-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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: TestAccountsMigration systemtest with simdv2 #22673
Conversation
📝 WalkthroughWalkthroughThe changes in this pull request involve the addition of two new methods to the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
📒 Files selected for processing (1)
x/accounts/module.go
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
x/accounts/module.go (1)
Pattern **/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
🔇 Additional comments (3)
x/accounts/module.go (3)
11-11
: LGTM: Import statement is correctly aliased
The import statement for appmodulev2
is properly aliased and follows the Uber Go style guide.
75-82
: LGTM: Message handlers are correctly registered
The implementation properly registers all necessary message handlers using the correct registration method.
65-82
: Verify complete handler registration
Let's ensure all query and message handlers from the server interfaces are registered.
✅ Verification successful
All handlers are correctly registered
The code correctly registers all query and message handlers from the accounts module:
Query handlers registered:
- AccountQuery
- Schema
- AccountType
- AccountNumber
Message handlers registered:
- Init
- Execute
- ExecuteBundle
The implementation matches the interfaces defined in the protobuf files, with all methods properly registered in the RegisterQueryHandlers and RegisterMsgHandlers functions.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any unregistered handlers from the query and message servers
# Find all methods in the query and message server interfaces
echo "Checking for query and message handlers..."
ast-grep --pattern 'type QueryServer interface {
$$$
}'
ast-grep --pattern 'type MsgServer interface {
$$$
}'
Length of output: 100524
Script:
#!/bin/bash
# Let's search for the QueryServer and MsgServer interfaces specifically in the accounts module
echo "Searching for QueryServer interface in accounts module..."
rg -A 10 "type QueryServer interface" x/accounts/v1/query.pb.go
echo "Searching for MsgServer interface in accounts module..."
rg -A 10 "type MsgServer interface" x/accounts/v1/tx.pb.go
Length of output: 1515
// RegisterQueryHandlers registers the query handlers for the accounts module. | ||
func (am AppModule) RegisterQueryHandlers(router appmodulev2.QueryRouter) { | ||
queryServer := NewQueryServer(am.k) | ||
|
||
appmodulev2.RegisterMsgHandler(router, queryServer.AccountNumber) | ||
appmodulev2.RegisterMsgHandler(router, queryServer.AccountQuery) | ||
appmodulev2.RegisterMsgHandler(router, queryServer.AccountType) | ||
appmodulev2.RegisterMsgHandler(router, queryServer.Schema) | ||
} |
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.
Critical: Incorrect handler registration for queries
The implementation is using RegisterMsgHandler
for registering query handlers, which is incorrect. This explains the system test failures mentioned in issue #22651 where query handlers couldn't be found.
Apply this fix:
func (am AppModule) RegisterQueryHandlers(router appmodulev2.QueryRouter) {
queryServer := NewQueryServer(am.k)
- appmodulev2.RegisterMsgHandler(router, queryServer.AccountNumber)
- appmodulev2.RegisterMsgHandler(router, queryServer.AccountQuery)
- appmodulev2.RegisterMsgHandler(router, queryServer.AccountType)
- appmodulev2.RegisterMsgHandler(router, queryServer.Schema)
+ appmodulev2.RegisterQueryHandler(router, queryServer.AccountNumber)
+ appmodulev2.RegisterQueryHandler(router, queryServer.AccountQuery)
+ appmodulev2.RegisterQueryHandler(router, queryServer.AccountType)
+ appmodulev2.RegisterQueryHandler(router, queryServer.Schema)
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
// RegisterQueryHandlers registers the query handlers for the accounts module. | |
func (am AppModule) RegisterQueryHandlers(router appmodulev2.QueryRouter) { | |
queryServer := NewQueryServer(am.k) | |
appmodulev2.RegisterMsgHandler(router, queryServer.AccountNumber) | |
appmodulev2.RegisterMsgHandler(router, queryServer.AccountQuery) | |
appmodulev2.RegisterMsgHandler(router, queryServer.AccountType) | |
appmodulev2.RegisterMsgHandler(router, queryServer.Schema) | |
} | |
// RegisterQueryHandlers registers the query handlers for the accounts module. | |
func (am AppModule) RegisterQueryHandlers(router appmodulev2.QueryRouter) { | |
queryServer := NewQueryServer(am.k) | |
appmodulev2.RegisterQueryHandler(router, queryServer.AccountNumber) | |
appmodulev2.RegisterQueryHandler(router, queryServer.AccountQuery) | |
appmodulev2.RegisterQueryHandler(router, queryServer.AccountType) | |
appmodulev2.RegisterQueryHandler(router, queryServer.Schema) | |
} |
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.
This fixes the TestAccountsMigration
👍
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.
Looks like what looked like a double registration RegisterServices + RegisterMsg/QueryHandler can work together. In v2 it looks like RegisterMsg/QueryHandler will override RegisterServices, which is good
(cherry picked from commit 18dcdb8)
…22674) Co-authored-by: Hieu Vu <[email protected]>
Description
Closes: #22651
x/accounts
msg server & queries for appmodule v2Author 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.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.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit