-
Notifications
You must be signed in to change notification settings - Fork 376
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
Make updateMembershipHistory in Validators.sol correct if epoch number is 0 #8060
Merged
Conversation
This file contains 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
…r is 0. Celo-blockchain has a tool called mycelo which applies the core contract migrations as part of genesis generation. This means that the epoch number when they are run is zero. However, the updateMembershipHistory() method in Validators.sol did not expect that to be possible. As a result, when mycelo adds a validator to a validator group, the method does not add a new entry to the member's history (specifically, it does not increase numEntries from 0 to 1 as it should). This commit fixes that by adding a condition to the check for whether to replace an existing entry, namely that the number of entries isn't zero.
oneeman
pushed a commit
that referenced
this pull request
Jun 10, 2021
This was referenced Jun 10, 2021
codyborn
approved these changes
Jun 11, 2021
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!
eelanagaraj
pushed a commit
that referenced
this pull request
Jun 17, 2021
…r is 0 (#8060) ### Description Celo-blockchain has a tool called mycelo which applies the core contract migrations as part of genesis generation. This means that the epoch number when they are run is zero. However, the updateMembershipHistory() method in Validators.sol did not expect that to be possible. As a result, when mycelo adds a validator to a validator group, the method does not add a new entry to the member's history (specifically, it does not increase numEntries from 0 to 1 as it should). This commit fixes that by adding a condition to the check for whether to replace an existing entry, namely that the number of entries isn't zero. This will allow the e2e slashing tests to use mycelo instead of running the migrations against the live network. ### Other changes * Updated the contract to use `InitializableV2` as required by CI. ### Tested * Verified that, before this fix, validators' membership history is empty when they are added to the group using mycelo * Verified that, after this fix, validators' membership history is correct when they are added to the group using mycelo * Protocol package's automated tests pass * Logically speaking, the change makes sense ### Backwards compatibility Backwards compatible, as this only fixes a bug in an edge case the contract wasn't originally designed to handle.
tkporter
pushed a commit
that referenced
this pull request
Jul 8, 2021
…r is 0 (#8060) ### Description Celo-blockchain has a tool called mycelo which applies the core contract migrations as part of genesis generation. This means that the epoch number when they are run is zero. However, the updateMembershipHistory() method in Validators.sol did not expect that to be possible. As a result, when mycelo adds a validator to a validator group, the method does not add a new entry to the member's history (specifically, it does not increase numEntries from 0 to 1 as it should). This commit fixes that by adding a condition to the check for whether to replace an existing entry, namely that the number of entries isn't zero. This will allow the e2e slashing tests to use mycelo instead of running the migrations against the live network. ### Other changes * Updated the contract to use `InitializableV2` as required by CI. ### Tested * Verified that, before this fix, validators' membership history is empty when they are added to the group using mycelo * Verified that, after this fix, validators' membership history is correct when they are added to the group using mycelo * Protocol package's automated tests pass * Logically speaking, the change makes sense ### Backwards compatibility Backwards compatible, as this only fixes a bug in an edge case the contract wasn't originally designed to handle.
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.
Description
Celo-blockchain has a tool called mycelo which applies the core contract migrations as part of genesis generation. This means that the epoch number when they are run is zero. However, the updateMembershipHistory() method in Validators.sol did not expect that to be possible. As a result, when mycelo adds a validator to a validator group, the method does not add a new entry to the member's history (specifically, it does not increase numEntries from 0 to 1 as it should). This commit fixes that by adding a condition to the check for whether to replace an existing entry, namely that the number of entries isn't zero.
This will allow the e2e slashing tests to use mycelo instead of running the migrations against the live network.
Other changes
InitializableV2
as required by CI.Tested
Backwards compatibility
Backwards compatible, as this only fixes a bug in an edge case the contract wasn't originally designed to handle.