Skip to content
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

chore: ics27 middleware callback routing #2157

Merged
merged 13 commits into from
Aug 31, 2022
Merged

Conversation

damiannolan
Copy link
Member

@damiannolan damiannolan commented Aug 31, 2022

Description

  • Adding IsMiddlewareEnabled keeper functions, key prefix and functions.
  • Call SetMiddlewareEnabled when ICS27 account is registered via the legacy go API - RegisterInterchainAccount
    • Calls routed through the new Msg service do not invoke the underlying application callbacks
  • Adding and updating tests

closes: #2145


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.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

Comment on lines 20 to 30
channelID, err := k.registerInterchainAccount(ctx, connectionID, owner, version)
if err != nil {
return err
}

portID, err := icatypes.NewControllerPortID(owner)
if err != nil {
return err
}

k.SetMiddlewareEnabled(ctx, portID, channelID)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about change the signature of the private func registerInterchainAccount and having this func and the msg server func generate the port ID.

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a preference. Whatever you think is best

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up and doing it so fast ❤️ , we will need to export this state in genesis and update the simulation directory in followup prs

Copy link
Contributor

@seantking seantking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤝

Am I correct in saying we don't need to do anything with SendTx? Whether or not middleware is enabled is dependent entirely on the use of RegisterInterchainAccount as the entry point?

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye! Wonderful! I opened #2166 and #2165 as followup issues

@damiannolan damiannolan enabled auto-merge (squash) August 31, 2022 15:57
@damiannolan damiannolan merged commit dda9f98 into main Aug 31, 2022
@damiannolan damiannolan deleted the damian/2145-ics27-cb-routing branch August 31, 2022 16:29
mergify bot pushed a commit that referenced this pull request Aug 31, 2022
* [WIP] add middleware enabled flags and conditional logic

* adapting private registerInterchainAccount func to accept portID in favour of owner

* updating tests

* cleaning up tests

* adding changelog

* updating tests: adding cbs with unreachable error returns for safety

* Update modules/apps/27-interchain-accounts/controller/keeper/keeper.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
(cherry picked from commit dda9f98)

# Conflicts:
#	CHANGELOG.md
#	modules/apps/27-interchain-accounts/controller/ibc_middleware.go
damiannolan added a commit that referenced this pull request Sep 6, 2022
* chore: ics27 middleware callback routing (#2157)

* [WIP] add middleware enabled flags and conditional logic

* adapting private registerInterchainAccount func to accept portID in favour of owner

* updating tests

* cleaning up tests

* adding changelog

* updating tests: adding cbs with unreachable error returns for safety

* Update modules/apps/27-interchain-accounts/controller/keeper/keeper.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
(cherry picked from commit dda9f98)

# Conflicts:
#	CHANGELOG.md
#	modules/apps/27-interchain-accounts/controller/ibc_middleware.go

* resolvning conflicts

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enforce calls to ics27 message server to not route through underlying app callbacks in ics27 controller
3 participants