-
Notifications
You must be signed in to change notification settings - Fork 580
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
Adding router v2 #7392
base: feat/ibc-eureka
Are you sure you want to change the base?
Adding router v2 #7392
Conversation
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.
LGTM
} | ||
|
||
if rtr.HasRoute(module) { | ||
panic(errors.New(fmt.Sprintf("route %s has already been registered", 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.
(just curious: why do we panic with errors.New
here rather than just fmt.Sprintf
, as we do at line 41?)
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.
most panics (I think all) use errors rather than strings, so this was just to be consistent.
modules/core/api/router.go
Outdated
|
||
// it's possible that some routes have been dynamically added e.g. with interchain accounts. | ||
// in this case, we need to check if the module has the specified prefix. | ||
for prefix := range rtr.routes { |
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.
[nit] since rtr.routes
is a map, can't we loop like this?
for prefix, value := range rtr.routes {
if strings.HasPrefix(module, prefix) {
return value, true
}
}
?
modules/core/api/router_test.go
Outdated
mockv2 "github.com/cosmos/ibc-go/v9/testing/mock/v2" | ||
) | ||
|
||
func (suite *ApiTestSuite) TestRouteer() { |
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.
func (suite *ApiTestSuite) TestRouteer() { | |
func (suite *ApiTestSuite) TestRouter() { |
Quality Gate passed for 'ibc-go'Issues Measures |
Description
Also adding barebones mock module to have an implementation of the interface to register.
closes: #7384
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
).godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.