-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
refactor(x/accounts)!: accounts and auth module use the same account number tracking #20405
Changes from 15 commits
df6ab84
8d84d4a
daf2b1c
6f9370e
61d223e
0181991
d140922
f697324
724cb22
142ced2
60c07e5
6f210de
631fd73
79ec18a
6d85cea
a8e711c
5b44990
8fdcd06
8feaaba
63f0f01
91cce64
cf8b56b
eb79394
db13681
b0ce6f9
effe701
5da3500
35c522e
b2cfa49
c09f833
cfac669
c2edaa6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -97,8 +97,10 @@ type AccountKeeper struct { | |||||||||||
authority string | ||||||||||||
|
||||||||||||
// State | ||||||||||||
Schema collections.Schema | ||||||||||||
Params collections.Item[types.Params] | ||||||||||||
Schema collections.Schema | ||||||||||||
Params collections.Item[types.Params] | ||||||||||||
|
||||||||||||
// Only use for migration | ||||||||||||
sontrinh16 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
AccountNumber collections.Sequence | ||||||||||||
// Accounts key: AccAddr | value: AccountI | index: AccountsIndex | ||||||||||||
Accounts *collections.IndexedMap[sdk.AccAddress, sdk.AccountI, AccountsIndexes] | ||||||||||||
|
@@ -182,7 +184,7 @@ func (ak AccountKeeper) GetSequence(ctx context.Context, addr sdk.AccAddress) (u | |||||||||||
// NextAccountNumber returns and increments the global account number counter. | ||||||||||||
// If the global account number is not set, it initializes it with value 0. | ||||||||||||
func (ak AccountKeeper) NextAccountNumber(ctx context.Context) uint64 { | ||||||||||||
n, err := ak.AccountNumber.Next(ctx) | ||||||||||||
n, err := ak.AccountsModKeeper.NextAccountNumber(ctx) | ||||||||||||
sontrinh16 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Address the error handling issue in - panic(err)
+ if err != nil {
+ return 0, err
+ } This change allows the caller to handle the error appropriately instead of causing a panic, enhancing the robustness of the service. Committable suggestion
Suggested change
|
||||||||||||
if err != nil { | ||||||||||||
panic(err) | ||||||||||||
} | ||||||||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
@julienrbrt @tac0turtle where should the migration live?
it needs to set x/accounts Account number to auth's account number.
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.
if accounts does not have a dependency on auth but auth has a dep on accounts then I think it would be good for auth to have the migration and set it in the other module
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.
added the migration in