Repository navigation
fix: min floor when height > 0 - #5654
Merged
Merged
Conversation
akrem-chabchoub
approved these changes
Oct 8, 2026
aloknerurkar
reviewed
Oct 8, 2026
|
|
||
| var minErr *staking.MinDepositError | ||
| if errors.As(err, &minErr) { | ||
| return // correct: deposit refused below the height floor |
Contributor
There was a problem hiding this comment.
This branch can't be reached: the test deposits exactly what GetMinDeposit returned, which DepositStake always accepts. And if no manageStake is sent at all, sentHeight stays nil and the test passes without checking anything.
Something tighter could be: GetMinDeposit returns MIN*2^h - potential; depositing one PLUR less returns *MinDepositError; depositing the reported minimum sends manageStake with height h and potential + deposit >= MIN*2^h. Also t.Fatal if sentHeight == nil.
aloknerurkar
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Description
On the contract side, the MIN × 2^height floor applies only to the first stake (lastUpdatedBlockNumber == 0). If the price drops by half, 1 PLUR does not decrease the commitment, and the contract records height 1 with a stake of 10^17. A new node at that height must deposit 2×10^17.
#5571 removed the client-side check potential + deposit >= MIN × 2^height. This PR restores it when height > 0
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):
AI Disclosure