Skip to content

fix(proto): set added_in annotations #24358

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

Merged
merged 4 commits into from
Apr 3, 2025
Merged

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Apr 2, 2025

Description

Noticed when checking #24335 (comment).
Not all annotations where backported in #24105.
This rewrite the // Since`` comments as added_in` annotations.
Should be backported to 0.53.


Author 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...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

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

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • Chores

    • Removed outdated version comments from protocol definitions to streamline metadata.
  • New Features

    • Updated several API endpoints and message fields with explicit version annotations, providing enhanced version tracking for newly introduced methods and parameters.

Copy link
Contributor

coderabbitai bot commented Apr 2, 2025

📝 Walkthrough

Walkthrough

This pull request updates numerous protocol buffer files. Most changes remove comment lines that specify the associated cosmos‑sdk version, which does not alter functionality. A subset of files has been updated to include an import statement for the cosmos_proto package and to add option annotations on RPC methods and message fields. These annotations document in which cosmos‑sdk version the method or field was introduced, thereby enhancing version metadata without affecting behavior.

Changes

File(s) Change Summary
proto/cosmos/authz/v1beta1/{authz.proto, event.proto, genesis.proto, query.proto, tx.proto}
proto/cosmos/base/reflection/v2alpha1/reflection.proto
proto/cosmos/consensus/v1/tx.proto
proto/cosmos/crypto/{hd/v1/hd.proto, keyring/v1/record.proto, secp256r1/keys.proto}
proto/cosmos/epochs/{module/v1/module.proto, v1beta1/{events.proto, genesis.proto}}
proto/cosmos/feegrant/v1beta1/{feegrant.proto, genesis.proto, query.proto}
proto/cosmos/gov/v1/{genesis.proto, gov.proto, query.proto}
proto/cosmos/group/v1/{events.proto, genesis.proto, query.proto, tx.proto, types.proto}
proto/cosmos/staking/v1beta1/authz.proto
proto/cosmos/upgrade/v1beta1/tx.proto
Removed comment lines (e.g. // Since: cosmos-sdk 0.43, // Since: cosmos-sdk 0.46, etc.) that provided versioning documentation. No modifications were made to functionality or structure.
proto/cosmos/consensus/v1/query.proto
proto/cosmos/epochs/v1beta1/query.proto
proto/cosmos/feegrant/v1beta1/tx.proto
proto/cosmos/gov/v1/tx.proto
proto/cosmos/tx/v1beta1/service.proto
x/tx/signing/aminojson/internal/aminojsonpb/aminojson.proto
Added an import (import "cosmos_proto/cosmos.proto";) and introduced option annotations on RPC methods and message fields (using (cosmos_proto.method_added_in) or (cosmos_proto.field_added_in)) to indicate the cosmos‑sdk version when the features were added.

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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
proto/cosmos/feegrant/v1beta1/tx.proto (2)

24-27: RPC Method PruneAllowances Annotation:
The PruneAllowances RPC method now includes a version annotation:
option (cosmos_proto.method_added_in) = "cosmos-sdk v0.50.0";
Consider verifying that the version string format is consistent with other annotations (for example, using "cosmos-sdk 0.50" instead of "v0.50.0") unless the additional precision is intentional.


63-75: Message Annotations for MsgPruneAllowances and Response:
The new annotations on the MsgPruneAllowances message (option (cosmos_proto.message_added_in) = "cosmos-sdk v0.50") and on MsgPruneAllowancesResponse are well placed. Again, please verify that the version string format is consistent across the codebase to avoid any potential confusion.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 41e3e9d and d77046c.

📒 Files selected for processing (32)
  • proto/cosmos/authz/v1beta1/authz.proto (0 hunks)
  • proto/cosmos/authz/v1beta1/event.proto (0 hunks)
  • proto/cosmos/authz/v1beta1/genesis.proto (0 hunks)
  • proto/cosmos/authz/v1beta1/query.proto (0 hunks)
  • proto/cosmos/authz/v1beta1/tx.proto (0 hunks)
  • proto/cosmos/base/reflection/v2alpha1/reflection.proto (0 hunks)
  • proto/cosmos/consensus/v1/query.proto (2 hunks)
  • proto/cosmos/consensus/v1/tx.proto (0 hunks)
  • proto/cosmos/crypto/hd/v1/hd.proto (0 hunks)
  • proto/cosmos/crypto/keyring/v1/record.proto (0 hunks)
  • proto/cosmos/crypto/secp256r1/keys.proto (0 hunks)
  • proto/cosmos/epochs/module/v1/module.proto (0 hunks)
  • proto/cosmos/epochs/v1beta1/events.proto (0 hunks)
  • proto/cosmos/epochs/v1beta1/genesis.proto (0 hunks)
  • proto/cosmos/epochs/v1beta1/query.proto (2 hunks)
  • proto/cosmos/feegrant/v1beta1/feegrant.proto (0 hunks)
  • proto/cosmos/feegrant/v1beta1/genesis.proto (0 hunks)
  • proto/cosmos/feegrant/v1beta1/query.proto (0 hunks)
  • proto/cosmos/feegrant/v1beta1/tx.proto (2 hunks)
  • proto/cosmos/gov/v1/genesis.proto (0 hunks)
  • proto/cosmos/gov/v1/gov.proto (0 hunks)
  • proto/cosmos/gov/v1/query.proto (0 hunks)
  • proto/cosmos/gov/v1/tx.proto (1 hunks)
  • proto/cosmos/group/v1/events.proto (0 hunks)
  • proto/cosmos/group/v1/genesis.proto (0 hunks)
  • proto/cosmos/group/v1/query.proto (0 hunks)
  • proto/cosmos/group/v1/tx.proto (0 hunks)
  • proto/cosmos/group/v1/types.proto (0 hunks)
  • proto/cosmos/staking/v1beta1/authz.proto (0 hunks)
  • proto/cosmos/tx/v1beta1/service.proto (1 hunks)
  • proto/cosmos/upgrade/v1beta1/tx.proto (0 hunks)
  • x/tx/signing/aminojson/internal/aminojsonpb/aminojson.proto (2 hunks)
💤 Files with no reviewable changes (26)
  • proto/cosmos/epochs/module/v1/module.proto
  • proto/cosmos/upgrade/v1beta1/tx.proto
  • proto/cosmos/group/v1/types.proto
  • proto/cosmos/authz/v1beta1/tx.proto
  • proto/cosmos/group/v1/tx.proto
  • proto/cosmos/group/v1/events.proto
  • proto/cosmos/consensus/v1/tx.proto
  • proto/cosmos/gov/v1/query.proto
  • proto/cosmos/feegrant/v1beta1/genesis.proto
  • proto/cosmos/authz/v1beta1/query.proto
  • proto/cosmos/crypto/hd/v1/hd.proto
  • proto/cosmos/epochs/v1beta1/genesis.proto
  • proto/cosmos/group/v1/query.proto
  • proto/cosmos/crypto/secp256r1/keys.proto
  • proto/cosmos/authz/v1beta1/genesis.proto
  • proto/cosmos/staking/v1beta1/authz.proto
  • proto/cosmos/base/reflection/v2alpha1/reflection.proto
  • proto/cosmos/gov/v1/gov.proto
  • proto/cosmos/crypto/keyring/v1/record.proto
  • proto/cosmos/feegrant/v1beta1/feegrant.proto
  • proto/cosmos/group/v1/genesis.proto
  • proto/cosmos/feegrant/v1beta1/query.proto
  • proto/cosmos/epochs/v1beta1/events.proto
  • proto/cosmos/authz/v1beta1/event.proto
  • proto/cosmos/gov/v1/genesis.proto
  • proto/cosmos/authz/v1beta1/authz.proto
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: tests (03)
  • GitHub Check: build (arm64)
  • GitHub Check: build (amd64)
  • GitHub Check: dependency-review
  • GitHub Check: Summary
🔇 Additional comments (12)
proto/cosmos/consensus/v1/query.proto (2)

6-6: Import Addition for Versioning Support

The new import statement for "cosmos_proto/cosmos.proto" properly enables the usage of the new versioning annotations. This change is consistent with similar updates in other parts of the codebase.


13-16: RPC Method Annotation Added

The addition of the option
option (cosmos_proto.method_added_in) = "cosmos-sdk 0.47";
within the Params RPC method correctly documents the introduction version for the method. Ensure that "cosmos-sdk 0.47" is indeed the intended version for this consensus module change.

proto/cosmos/epochs/v1beta1/query.proto (3)

7-7: Import Addition for Consistent Annotation

The inclusion of the import statement for "cosmos_proto/cosmos.proto" ensures that annotation options are available in this proto file. This is consistent with similar changes in other modules.


14-17: EpochInfos RPC Annotation

The RPC method EpochInfos now includes the option
option (cosmos_proto.method_added_in) = "cosmos-sdk 0.53";
which clearly indicates its introduction in cosmos-sdk v0.53. This change aligns with the PR objectives and provides improved version metadata.


19-22: CurrentEpoch RPC Annotation

Similarly, the CurrentEpoch RPC method now has the annotation
option (cosmos_proto.method_added_in) = "cosmos-sdk 0.53";
to denote its added version. This update is consistent and enhances clarity regarding API versioning.

x/tx/signing/aminojson/internal/aminojsonpb/aminojson.proto (3)

7-7: Import Addition in AminoJSON Proto

Adding the import for "cosmos_proto/cosmos.proto" makes the new field options available in this proto file. This change helps standardize version annotations across modules.


30-30: Field Annotation for 'unordered'

The field unordered now includes the option
(cosmos_proto.field_added_in) = "cosmos-sdk 0.53"
which documents the version in which this field was introduced. This addition improves maintainability and traceability.


31-31: Field Annotation for 'timeout_timestamp'

The update for the timeout_timestamp field, adding
(cosmos_proto.field_added_in) = "cosmos-sdk 0.53",
is clear and consistent with the versioning approach. This helps in tracking changes across versions.

proto/cosmos/tx/v1beta1/service.proto (1)

101-101: Field Version Annotation for query:
The updated query field now includes the added_in annotation
[(cosmos_proto.field_added_in) = "cosmos-sdk 0.50"], which enhances clarity on when this field was introduced. Please verify that this version designation aligns with the official release notes.

proto/cosmos/gov/v1/tx.proto (3)

20-43: RPC Methods Version Annotations (Part 1):
The RPC methods (SubmitProposal, ExecLegacyContent, Vote, VoteWeighted, and Deposit) now have the cosmos_proto.method_added_in annotation set to "cosmos-sdk 0.46". This addition improves API version transparency. Please ensure that these version designations match the documented API evolution in the release notes.


47-54: RPC Methods Version Annotations (Part 2):
The UpdateParams and CancelProposal methods now feature annotations "cosmos-sdk 0.47" and "cosmos-sdk 0.50" respectively. These annotations seem consistent with their introduction timing. Kindly double-check that these version numbers accurately reflect the intended changes as per the release history.


81-87: Field Annotations in MsgSubmitProposal:
The title and summary fields are now annotated with [(cosmos_proto.field_added_in) = "cosmos-sdk 0.47"] and the expedited field with [(cosmos_proto.field_added_in) = "cosmos-sdk 0.50"]. This clearly documents the versioning of field additions. Please confirm that these annotations are correct according to the module’s evolution.

Copy link
Contributor

github-actions bot commented Apr 2, 2025

@julienrbrt your pull request is missing a changelog!

@julienrbrt
Copy link
Member Author

@julienrbrt your pull request is missing a changelog!

I do not think we need a changelog, but after this we do need a new cosmossdk.io/api tag

Copy link
Contributor

Choose a reason for hiding this comment

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

im still not up to speed on how this works - but are there any problems with not annotating all the RPC below?

Copy link
Member Author

@julienrbrt julienrbrt Apr 2, 2025

Choose a reason for hiding this comment

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

given there was no client/v2 in 0.46, this is fine. It really matters for client/v2 actually.
we could annotate it tho if wanted.

Copy link
Contributor

Choose a reason for hiding this comment

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

ahhh that makes sense. thanks!

@aljo242 aljo242 merged commit 28c50a4 into main Apr 3, 2025
10 of 13 checks passed
@aljo242 aljo242 deleted the julien/correct-annotation branch April 3, 2025 18:34
mergify bot pushed a commit that referenced this pull request Apr 3, 2025
Co-authored-by: Alex | Interchain Labs <[email protected]>
(cherry picked from commit 28c50a4)
github-merge-queue bot pushed a commit that referenced this pull request Apr 3, 2025
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.

3 participants