-
Notifications
You must be signed in to change notification settings - Fork 18
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
Problem: migrate function does not reset properly validator nonce #154
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.
lgtm
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.
I'm not familiar with that logic in detail -- is it all right as it is with setting nonces to zero (as the previous msgs with the same nonce can't be relayed due to a different height/bridge address), or will this also need some global or per validator revision number?
module/x/gravity/keeper/keeper.go
Outdated
// Reset all validators ethereum event nonce to zero | ||
delegateKeys := k.getDelegateKeys(ctx) | ||
for _, delegateKey := range delegateKeys { | ||
if len(delegateKey.ValidatorAddress) != 0 { |
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.
when would there be 0-len addresses?
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.
should technically not happen.
After thinking, I decided to remove the safeguard because it the len is nil, then the function will panic allowing us to detect corrupted state during the upgrade
Should be alright setting nonce to 0 because the new ethereum's gravity address will have the nonce set to 1 Validators will have to report nonce from 1 onward as the nonce need to be reported in in a sequential order |
Problem: To reset the state of each orchestrator (nonce), the current code loop over all the attestations voters and set their nonce to 0
Before #75 we are keeping ALL the attestations in the state, but with the new improvement, we are keeping only the most recent one’s.
Validator that miss to vote on the most recent attestation will be miss by the migrate function and their state will remains.
The solution is to change the code to get the list of validators and set their nonce to zero for each of them