fix validator state when trying to update the max-rate #4647
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.
During the previous hardfork we mad sure to update the max-rate to be at least the
min-rate
+max-rate-change
to comply with the the minimum 7% rate imposed in HIP30, for validators running under that threshold. However, with that we introduced a subtle bug under the assumption thatmax-rate-change
was a small value but in practice is not, it can go up to a 100% which will sum to a number higher than a 100% when adding the min-rate.For a handful of validators that caused the sanity checks fails when persisting the state in the hard-drive. A issue that is hard to catch as it'll only happen once per epoch, this bug explains issues like the buggy validator or the validator with undelegated funds issues.
As this is a change in the way the data is stored in the state this will have to go with a hardfork, I guess we can inlcude it with the leader rotation.