-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor x/staking Unbonding Validator Queue #6844
Conversation
I think it is possible to use a single key like you have started to do here, just note that the iteration over safe-to-unbond validators must be non-linear, you have to check the second value in the key (since unbonding height is first in the key, and it's possible that a validator will be past their unbonding height but not past their unbonding time). |
Thanks for pointing that out @cwgoes. Do you believe the single key approach here is the ideal approach? I can swap the composite key s.t. the time comes first (which we'll have to length-prefix), so that'll make the iteration linear. If so, we'll still have to check the height too though, no? |
If the key is prefixed by time, you'll have to check the height; if the key is prefixed by height, you'll have to check the time. I can't immediately think of a way to avoid checking one of the two values without more control over the tree (e.g. a custom ordering function). In expectation, prefixing by time is probably better, since the height requirement is intended to only kick in under exceptional circumstances (where the validators are misbehaving & accelerating the timestamp). |
Codecov Report
@@ Coverage Diff @@
## master #6844 +/- ##
==========================================
+ Coverage 61.42% 61.46% +0.03%
==========================================
Files 517 517
Lines 32060 32077 +17
==========================================
+ Hits 19694 19716 +22
+ Misses 10799 10791 -8
- Partials 1567 1570 +3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
Description
closes: #6478
/cc @cwgoes
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes