Skip to content

feat(query): mark x/distribution and x/gov queries with module_query_safe #24672

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

crStiv
Copy link
Contributor

@crStiv crStiv commented May 4, 2025

Added the module_query_safe tag to all query RPC methods in the x/distribution and x/gov modules. It should allow these queries to be executed across chains via interchain accounts.

Fixes #20219

Summary by CodeRabbit

  • New Features
    • Enhanced query services in the distribution and governance modules to improve safety for all RPC methods.
  • Chores
    • Updated service definitions to align with the latest query safety standards.

Copy link

ironbird-prod bot commented May 4, 2025

Ironbird - launch a network To use Ironbird, you can use the following commands:
  • /ironbird start OR /ironbird start --load-test-config= - Launch a testnet with the specified chain and load test configuration.
  • /ironbird chains - List of chain images that ironbird can use to spin-up testnet
  • /ironbird loadtests - List of load test modes that ironbird can run against testnet
Custom Load Test Configuration You can provide a custom load test configuration using the `--load-test-config=` flag:
/ironbird start cosmos --load-test-config={
  "block_gas_limit_target": 0.75,
  "num_of_blocks": 50,
  "msgs": [
    {"weight": 0.3, "type": "MsgSend"},
    {"weight": 0.3, "type": "MsgMultiSend"},
	{"weight": 0.4, "type": "MsgArr", "ContainedType": "MsgSend", "NumMsgs": 3300}
  ]
}

Use /ironbird loadtests to see more examples.

Copy link
Contributor

coderabbitai bot commented May 4, 2025

📝 Walkthrough

Walkthrough

The changes update the protobuf service definitions for the distribution and governance modules in the Cosmos SDK. Specifically, the cosmos/query/v1/query.proto file is imported into the relevant .proto files, and the (cosmos.query.v1.module_query_safe) = true option is added to every RPC method in the Query services for distribution, gov/v1, and gov/v1beta1. No changes are made to the RPC signatures, request/response messages, or HTTP annotations.

Changes

File(s) Change Summary
proto/cosmos/distribution/v1beta1/query.proto Imported cosmos/query/v1/query.proto and added (cosmos.query.v1.module_query_safe) = true to all RPC methods in the Query service.
proto/cosmos/gov/v1/query.proto
proto/cosmos/gov/v1beta1/query.proto
Imported cosmos/query/v1/query.proto and added (cosmos.query.v1.module_query_safe) = true to all RPC methods in the Query service.

Assessment against linked issues

Objective Addressed Explanation
Mark all x/distribution and x/gov queries with module_query_safe (#20219)

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83e38dc and 45291b9.

📒 Files selected for processing (3)
  • proto/cosmos/distribution/v1beta1/query.proto (2 hunks)
  • proto/cosmos/gov/v1/query.proto (1 hunks)
  • proto/cosmos/gov/v1beta1/query.proto (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: Check up to date mocks
  • GitHub Check: build (arm64)
  • GitHub Check: build (amd64)
  • GitHub Check: dependency-review
  • GitHub Check: Summary
🔇 Additional comments (6)
proto/cosmos/distribution/v1beta1/query.proto (2)

11-11: Added import for module_query_safe option
Imported cosmos/query/v1/query.proto to enable the (cosmos.query.v1.module_query_safe) option. Verify that the path is correct and that this file is present in the repository.


19-19: Marked all Distribution Query RPC methods as module_query_safe
Every RPC in the Query service now includes option (cosmos.query.v1.module_query_safe) = true. This aligns with the PR objective to make distribution queries safe for interchain accounts. No RPC appears to be missing the tag.

Also applies to: 26-26, 33-33, 40-40, 47-47, 53-53, 61-61, 67-67, 74-74, 83-83

proto/cosmos/gov/v1beta1/query.proto (2)

10-10: Imported module_query_safe definitions
The import of cosmos/query/v1/query.proto is required to use the module_query_safe option. Ensure the file path matches the repository layout.


18-18: Tagged all Gov v1beta1 Query RPCs with module_query_safe
Each RPC method in the Query service now has option (cosmos.query.v1.module_query_safe) = true. This fully covers Proposal, Proposals, Vote, Votes, Params, Deposit, Deposits, and TallyResult.

Also applies to: 24-24, 30-30, 36-36, 42-42, 48-48, 54-54, 60-60

proto/cosmos/gov/v1/query.proto (2)

8-8: Added import for module_query_safe option
Importing cosmos/query/v1/query.proto enables usage of the (cosmos.query.v1.module_query_safe) option. Confirm the import path is accurate.


16-16: Applied module_query_safe tag to all Gov v1 Query RPCs
All RPC methods in this Query service are now marked with (cosmos.query.v1.module_query_safe) = true, covering Constitution, Proposal, Proposals, Vote, Votes, Params, Deposit, Deposits, and TallyResult as intended.

Also applies to: 22-22, 28-28, 34-34, 40-40, 46-46, 52-52, 58-58, 64-64


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@aljo242
Copy link
Contributor

aljo242 commented May 5, 2025

What is your reasoning / justification for marking them as safe?

@crStiv
Copy link
Contributor Author

crStiv commented May 5, 2025

@aljo242 Marked them because they're read-only, deterministic operations that track gas properly, just like the bank module queries, which enables them to work through interchain accounts.

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.

Mark more queries with module_query_safe
2 participants