refactor(x/accounts): Skip Importing Unregistered Genesis Account Types#20022
refactor(x/accounts): Skip Importing Unregistered Genesis Account Types#20022meetrick wants to merge 12 commits into
Conversation
Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
WalkthroughWalkthroughThe update in the Changes
Recent Review DetailsConfiguration used: .coderabbit.yml Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
Warning Following problems were encountered
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
|
@julienrbrt Could you review this PR? |
Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
This reverts commit 6deeed2.
Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
julienrbrt
left a comment
There was a problem hiding this comment.
lgtm! pending a test case.
| @@ -80,7 +80,13 @@ func (k Keeper) ImportState(ctx context.Context, genState *v1.GenesisState) erro | |||
| } | |||
|
|
|||
| func (k Keeper) importAccount(ctx context.Context, acc *v1.GenesisAccount) error { | |||
There was a problem hiding this comment.
can we add a test case for this?
There was a problem hiding this comment.
I think we can add the following test case code to genesis_test.go, and we need to think about it more.
func TestImportAccountError(t *testing.T) {
// Initialize the keeper and context for testing
k, ctx := newKeeper(t, func(deps implementation.Dependencies) (string, implementation.Account, error) {
acc, err := NewTestAccount(deps)
return "test", acc, err
})
// Set up a mock query router
k.queryRouter = mockQuery(func(ctx context.Context, req, resp implementation.ProtoMsg) error { return nil })
// Define a mock GenesisAccount with a non-existent account type
acc := &v1.GenesisAccount{
Address: "test-address",
AccountType: "non-existent-type",
AccountNumber: 1,
State: nil,
}
// Attempt to import the mock GenesisAccount into the state
err := k.importAccount(ctx, acc)
// Assert that an error is returned
require.Error(t, err)
// Assert that the error message contains the expected substring
require.Contains(t, err.Error(), "account type non-existent-type not found in the registered accounts")
}
There was a problem hiding this comment.
I updated test case
Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
|
@julienrbrt The test failure occurs due to the PR below. I need to modify the source code |
Signed-off-by: Hwangjae Lee <meetrick@gmail.com>
|
@julienrbrt The source code seems fine, but I'm experiencing failures in the test cases. Can you advise me? Should I create a new PR? |
|
FYI, you don't need to create each time a new PR. It gets very hard to review as context is missing in each new PR you make. |
Description
Skip Importing Unregistered Genesis Account Types in x/accounts/genesis.go
Replace: #19924
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...
!in the type prefix if API or client breaking changeCHANGELOG.mdReviewers 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...
Summary by CodeRabbit
Bug Fixes
Tests