forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix auth genesis account number handling. #228
Merged
SpicyLemon
merged 7 commits into
release-pio/v0.46.x
from
prov/dwedul-0.46-fix-auth-sim-decoder
Aug 18, 2022
Merged
Fix auth genesis account number handling. #228
SpicyLemon
merged 7 commits into
release-pio/v0.46.x
from
prov/dwedul-0.46-fix-auth-sim-decoder
Aug 18, 2022
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
… state is missing one.
…ed when there's only 1 account with the number 0.
…ount numbers so that all account numbers are unique.
All unit tests passed locally (on the 3rd run). 1st run:
All of those are pretty usual on the first 2nd run:
3rd run:
|
arnabmitra
approved these changes
Aug 18, 2022
derekadams
approved these changes
Aug 18, 2022
SpicyLemon
added a commit
that referenced
this pull request
Aug 18, 2022
* Add a sim state decocoder for the auth account number entries. * Don't change account numbers during auth InitGenesis when the genesis state is missing one. * Tweak auth InitGenesis to make sure that GetNextAccountNumber is called when there's only 1 account with the number 0. * Update SanitizeGenesisAccounts to update accounts with duplicated account numbers so that all account numbers are unique. * Add some unit tests on the AccountKeeper's InitGenesis function. * Add some unit tests on the SanitizeGenesisAccounts changes. * add a comment about using a *uint64 (instead of just a uint64).
Merged
19 tasks
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
This fixes the account keeper's
InitGenesis
toa) Allow for missing account numbers.
b) Only change account numbers that are duplicated.
c) Accounts with duplicated account numbers get updated account numbers in a deterministic way (based on the order they were originally provided).
This also adds a simulation decoder for the newly added
AccountNumberStoreKeyPrefix
.Prior to this PR, all account numbers in the provided accounts were rewritten to be sequential starting with 0. The list was sorted by account number before doing that, but if there was a missing account number, all account numbers larger than the missing one were reduced by 1. Also, since
sort.Slice
isn't guaranteed to be stable, if there were accounts with duplicate account numbers, the final "sorted" list was nondeterministic.Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change