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

feat: allow module safe queries in ICA (backport #5785) #6123

Merged
merged 13 commits into from
May 2, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 9, 2024

Description

closes: #5784

Commit Message / Changelog Entry

feat: allow module safe queries in ICA

see the guidelines for commit messages. (view raw markdown for examples)


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 the 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 and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

Summary by CodeRabbit

  • New Features

    • Implemented a mechanism for whitelisting safe queries to enhance module query safety.
    • Added a new message structure for defining query requests by interchain accounts.
    • Introduced an RPC handler for safe queries with payload and response message definitions.
  • Tests

    • Expanded test coverage to validate module query safety and successful execution of specific queries.
    • Introduced test functions to ensure the correct functioning of query safelisting and transaction handling.
  • Documentation

    • Updated the codec setup function to include interface registration for improved transaction handling.

This is an automatic backport of pull request #5785 done by [Mergify](https://mergify.com).

* imp: initial modification of tx.proto

* imp: ran 'make proto-all'

* fix: compiler errors

* imp: added query router interface

* imp: added queryRouter to icahost keeper

* imp: improved proto definitions

* imp: ran 'make proto-all'

* imp: added sdk.Msg helpers

* feat: basic implementation

* style: improved field names

* imp: ran 'make proto-all'

* fix: compiler errors

* imp: ran gofumpt

* feat: tests passing

* feat: tests improved

* test: removed unneeded code

* imp: improved 'IsModuleSafe' function

* imp: added IsModuleQuerySafe to msg_server

* imp: added more test cases

* fix: callbacks compiler

* fix: non determinancy issues

* fix: added query msg to codec

* imp: whitelist logic added

* e2e: new test added

* fix: new test

* fix: test

* fix: e2e

* fix: e2e

* imp(e2e): added the QueryTxsByEvents function

* fix: e2e

* e2e: lint fix

* fix: e2e

* e2e: debug

* fix: e2e

* test: debug helpers

* debug

* test: added codec_test case

* imp: additional test case

* imp: added important unit test

* r4r

* e2e: debug

* imp: added logs

* fix: e2e

* fix: e2e

* fix: e2e

* imp: added height to proto response

* imp: ran 'make proto-all'

* imp: added height

* e2e: updated e2e to test height

* imp: review suggestions

* e2e: remove unneeded log

* refactor: refactored 'ExtractValueFromEvents'

* e2e: review item

* imp: review item

* nit: review item

* docs: added godocs

* test: unit test for mqsWhitelist added

* imp: added logging

* style: rename to allow list

* add changelog

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
(cherry picked from commit eecfa5c)

# Conflicts:
#	e2e/testsuite/codec.go
#	e2e/testsuite/tx.go
#	modules/apps/27-interchain-accounts/host/keeper/keeper.go
#	modules/apps/27-interchain-accounts/host/keeper/keeper_test.go
#	modules/apps/27-interchain-accounts/host/keeper/msg_server.go
#	modules/apps/27-interchain-accounts/host/keeper/msg_server_test.go
#	modules/apps/27-interchain-accounts/host/types/codec.go
#	modules/apps/27-interchain-accounts/host/types/codec_test.go
#	modules/apps/27-interchain-accounts/host/types/host.pb.go
#	modules/apps/27-interchain-accounts/host/types/msgs.go
#	modules/apps/27-interchain-accounts/host/types/tx.pb.go
#	modules/apps/callbacks/testing/simapp/app.go
#	modules/light-clients/08-wasm/testing/simapp/app.go
#	proto/ibc/applications/interchain_accounts/host/v1/tx.proto
#	testing/simapp/app.go
@mergify mergify bot requested a review from colin-axner as a code owner April 9, 2024 08:25
@mergify mergify bot added the conflicts label Apr 9, 2024
@mergify mergify bot requested a review from AdityaSripal as a code owner April 9, 2024 08:25
Copy link
Contributor Author

mergify bot commented Apr 9, 2024

Cherry-pick of eecfa5c has failed:

On branch mergify/bp/release/v7.5.x/pr-5785
Your branch is up to date with 'origin/release/v7.5.x'.

You are currently cherry-picking commit eecfa5c0.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   CHANGELOG.md
	new file:   e2e/tests/interchain_accounts/query_test.go
	modified:   modules/apps/27-interchain-accounts/host/keeper/export_test.go
	modified:   modules/apps/27-interchain-accounts/host/keeper/relay_test.go
	modified:   modules/apps/27-interchain-accounts/types/router.go
	modified:   proto/ibc/applications/interchain_accounts/host/v1/host.proto

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   e2e/testsuite/codec.go
	deleted by us:   e2e/testsuite/tx.go
	both modified:   modules/apps/27-interchain-accounts/host/keeper/keeper.go
	both modified:   modules/apps/27-interchain-accounts/host/keeper/keeper_test.go
	deleted by us:   modules/apps/27-interchain-accounts/host/keeper/msg_server.go
	deleted by us:   modules/apps/27-interchain-accounts/host/keeper/msg_server_test.go
	deleted by us:   modules/apps/27-interchain-accounts/host/types/codec.go
	deleted by us:   modules/apps/27-interchain-accounts/host/types/codec_test.go
	both modified:   modules/apps/27-interchain-accounts/host/types/host.pb.go
	deleted by us:   modules/apps/27-interchain-accounts/host/types/msgs.go
	deleted by us:   modules/apps/27-interchain-accounts/host/types/tx.pb.go
	both modified:   modules/apps/callbacks/testing/simapp/app.go
	deleted by us:   modules/light-clients/08-wasm/testing/simapp/app.go
	deleted by us:   proto/ibc/applications/interchain_accounts/host/v1/tx.proto
	both modified:   testing/simapp/app.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Copy link
Contributor

coderabbitai bot commented Apr 9, 2024

Important

Auto Review Skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@crodriguezvega crodriguezvega self-assigned this Apr 9, 2024
@damiannolan
Copy link
Member

Strange that the unit test is failing, looks like Query/Validator is module query safe on sdk v0.47.x. I haven't looked at this in any more detail yet.

@DimitrisJim
Copy link
Contributor

Strange that the unit test is failing,

I cant repro locally for some reason. Query/Validator is module safe in sdk 0.47.8 https://github.com/cosmos/cosmos-sdk/blob/4912bef7fb14ebe5da96ed96e8c47b609506cf49/proto/cosmos/staking/v1beta1/query.proto#L27 can't see why it isn't included in the allow list

@DimitrisJim
Copy link
Contributor

lol, what a silly thing to lose 2 hours on

@damiannolan
Copy link
Member

lol, what a silly thing to lose 2 hours on

Ahhh RIP! 🪦 Thanks for diving into it @DimitrisJim

Interesting how that fixed the test failures. The go.mod of ibc-go on the release branch still uses go 1.19, but with the test workflow runner on go 1.21 its now passing 🤔

@DimitrisJim
Copy link
Contributor

yea, god knows what kind of nightmarish rabbit whole it would be to decipher. Thankfully went the route of repro-ing by getting the action to run locally and then working my way from there. It runs on main, it runs locally if I don't go through the workflows so appeared like the workflow definition was the plausible culprit 🔍

This could very well be some obscure bug someplace that was fixed with more recent releases of go. We might want to bump these across the board considering go offers backwards compat.

@crodriguezvega
Copy link
Contributor

Thanks for the fix, @DimitrisJim. In a follow up PR I will bump the go version in the go.mod then.

This PR is then ready for review. cc: @damiannolan @srdtrk

@crodriguezvega crodriguezvega added priority PRs that need prompt reviews and removed conflicts labels Apr 16, 2024
Copy link
Member

@srdtrk srdtrk left a comment

Choose a reason for hiding this comment

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

Looks good. I've added one suggestion. Thanks @crodriguezvega, @damiannolan, and @DimitrisJim for this clean backport.

@crodriguezvega crodriguezvega added this to the v7.5.0 milestone Apr 22, 2024
@crodriguezvega crodriguezvega removed the priority PRs that need prompt reviews label Apr 25, 2024
@crodriguezvega crodriguezvega merged commit b78afb0 into release/v7.5.x May 2, 2024
14 checks passed
@crodriguezvega crodriguezvega deleted the mergify/bp/release/v7.5.x/pr-5785 branch May 2, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants