-
Notifications
You must be signed in to change notification settings - Fork 9
Adding leader ban registry module in supra framework #290
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
base: dev
Are you sure you want to change the base?
Conversation
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.
A good start, the config pattern is nice. There's still quite a bit to do in the registry itself though. If you haven't already read the Rust code thoroughly then please do so.
aptos-move/framework/supra-framework/sources/configs/leader_ban_registry_config.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/configs/leader_ban_registry_config.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
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.
Looking good! A few more things to adjust though.
aptos-move/framework/supra-framework/sources/configs/leader_ban_registry_config.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
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.
A few things need to be fixed.
aptos-move/framework/supra-framework/sources/configs/leader_ban_registry_config.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/configs/leader_ban_registry_config.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
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.
Looks good, but please extend the e2e test. It should cover more functionality.
aptos-move/framework/supra-framework/tests/test_leader_ban_registry.move
Outdated
Show resolved
Hide resolved
…eat/leader_ban_registry
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.
Nice work! Just a couple more things to address.
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
aptos-move/framework/supra-framework/sources/leader_ban_registry.move
Outdated
Show resolved
Hide resolved
| }); | ||
| if (is_banned) { | ||
| let bans = vector::borrow_mut(&mut ban_registry.bans, index); | ||
| bans.consecutive_bans = bans.consecutive_bans + 1; |
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.
We need to reset all fields of bans.active here as well. The ban duration should reset each time the validator is banned.
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.
Then the test cases that I have written will not work
is it intended?
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.
Your test cases should test ban expiry by incrementing the current view without re-banning the validator that should be re-admitted to the validator set. Each time a validator is banned, its ban period should reset, so a validator can only be reinstated if it does not earn any new bans until its current ban period ends.
No description provided.