You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the x/authInitGenesis function, if the provided GenesisState.Accounts has a max AccountNumber that is greater than the number of Accounts, the account numbers of the created accounts are different from those provided.
For example, if GenesisState.Accounts has account numbers 0, 1, 3, 4, 5; then InitGenesis will change 3, 4, and 5 to 2, 3, and 4 (respectively).
Version
First noticed in 0.46.0, but it looks like it's always been this way.
Still exists in main as of commit 6af89d6ce3f43e8a67ea2ee93c5a49e395ebd09dWed Aug 24 23:13:11 2022 +0200.
Steps to Reproduce
Create an x/authGenesisState with a single Accounts entry that has account number 10.
Call InitGenesis.
Look up the account.
Expected result:
The account has account number 10.
Actual result:
The account has account number 0.
The reason I found this, though was in Provenance's import/export sim. Our sim created several accounts, and removed one. Then it exported the current state and imported it again (as a separate app). Then it compared the state of the two apps and found that the states were different because the 2nd app had reduced account numbers.
The text was updated successfully, but these errors were encountered:
I fixed this in our fork with this PR: provenance-io#228
That PR also contains the fix for #13028, but the rest is just for this.
That solution still fixes entries with duplicated account numbers (e.g. if they're all '0'), but only changes them when they're duplicates. It also updates the global account number to the largest one, so new accounts will go up from there.
Summary of Bug
In the
x/auth
InitGenesis
function, if the providedGenesisState.Accounts
has a maxAccountNumber
that is greater than the number ofAccounts
, the account numbers of the created accounts are different from those provided.For example, if
GenesisState.Accounts
has account numbers 0, 1, 3, 4, 5; thenInitGenesis
will change 3, 4, and 5 to 2, 3, and 4 (respectively).Version
First noticed in 0.46.0, but it looks like it's always been this way.
Still exists in
main
as of commit6af89d6ce3f43e8a67ea2ee93c5a49e395ebd09d
Wed Aug 24 23:13:11 2022 +0200
.Steps to Reproduce
x/auth
GenesisState
with a singleAccounts
entry that has account number 10.InitGenesis
.Expected result:
The account has account number 10.
Actual result:
The account has account number 0.
The reason I found this, though was in Provenance's import/export sim. Our sim created several accounts, and removed one. Then it exported the current state and imported it again (as a separate app). Then it compared the state of the two apps and found that the states were different because the 2nd app had reduced account numbers.
The text was updated successfully, but these errors were encountered: