Skip to content

fix: remove unnecessary protobuf field option #24161

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 3 commits into
base: main
Choose a base branch
from

Conversation

hallazzang
Copy link
Contributor

@hallazzang hallazzang commented Mar 27, 2025

Description

This PR removes unnecessary gogoproto.castrepeated field options from various protobuf files.

Closes: #24144


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

  • New Features

    • Introduced new fields for enhanced transaction data, including additional withdraw parameters.
  • Refactor

    • Streamlined existing field definitions by adjusting value lengths and simplifying data specifications in transaction and staking messages, ensuring clearer and more reliable data handling.

Copy link
Contributor

coderabbitai bot commented Mar 27, 2025

📝 Walkthrough

Walkthrough

This pull request updates protocol buffer definitions and raw descriptor byte arrays for Cosmos modules. In the protocol pool files, field lengths for account and recipient have been adjusted and new fields (withdraw_account, withdraw_height, withdraw_time) have been added. In the staking files, the raw descriptor for the StakeAuthorization message is modified, and the field options for max_tokens have been simplified by removing an unnecessary casting option. Additionally, the handling of the amount field in the protocol pool message has been simplified by removing an extra option.

Changes

Files Change Summary
api/cosmos/protocolpool/v1/tx.pulsar.go Modified protocol buffer field representations; updated lengths for account and recipient; added withdraw_account, withdraw_height, withdraw_time; removed certain fields.
api/cosmos/staking/v1beta1/authz.pulsar.go Altered raw descriptor bytes for StakeAuthorization message; updated field descriptors for max_tokens, allow_list, deny_list, and adjusted authorization_type.
x/protocolpool/proto/cosmos/protocolpool/v1/tx.proto Simplified MsgClaimBudgetResponse by removing the gogoproto.castrepeated option from the amount field.
x/staking/proto/cosmos/staking/v1beta1/authz.proto Removed the unnecessary gogoproto.castrepeated option from the max_tokens field in StakeAuthorization.

Assessment against linked issues

Objective Addressed Explanation
Remove unnecessary gogoproto field option in staking/v1beta1/authz.proto (#24144)

Suggested labels

C:x/auth, backport/v0.52.x

Suggested reviewers

  • julienrbrt
  • tac0turtle
  • testinginprod
  • sontrinh16

📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b2861f and 1892ca6.

⛔ Files ignored due to path filters (2)
  • x/protocolpool/types/tx.pb.go is excluded by !**/*.pb.go
  • x/staking/types/authz.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (4)
  • api/cosmos/protocolpool/v1/tx.pulsar.go (1 hunks)
  • api/cosmos/staking/v1beta1/authz.pulsar.go (1 hunks)
  • x/protocolpool/proto/cosmos/protocolpool/v1/tx.proto (1 hunks)
  • x/staking/proto/cosmos/staking/v1beta1/authz.proto (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.go`: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

**/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

  • api/cosmos/staking/v1beta1/authz.pulsar.go
  • api/cosmos/protocolpool/v1/tx.pulsar.go
⏰ Context from checks skipped due to timeout of 90000ms (60)
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: tests (03)
  • GitHub Check: tests (02)
  • GitHub Check: tests (01)
  • GitHub Check: tests (00)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
🔇 Additional comments (4)
x/staking/proto/cosmos/staking/v1beta1/authz.proto (1)

19-19: Simplification of field option - looks good!

The gogoproto.castrepeated option has been removed from the max_tokens field. This change aligns with the PR's objective of removing unnecessary protobuf field options, while maintaining the field's core functionality.

x/protocolpool/proto/cosmos/protocolpool/v1/tx.proto (1)

116-116: Good removal of unnecessary casting option

The gogoproto.castrepeated option has been removed while preserving the gogoproto.nullable = false setting. This simplification maintains the non-nullable property of the field while eliminating redundant type casting.

api/cosmos/staking/v1beta1/authz.pulsar.go (1)

1423-1488: Auto-generated changes reflecting the proto updates

These changes to the raw descriptor bytes are automatically generated to reflect the removal of the gogoproto.castrepeated option from the Protobuf definitions. The updates include adjustments to the size and structure of the descriptor encoding, particularly for the max_tokens, allow_list, and deny_list fields.

api/cosmos/protocolpool/v1/tx.pulsar.go (1)

8606-8771:

❓ Verification inconclusive

Confirm backward compatibility after removing “gogoproto.castrepeated”.
These lines represent updates to the generated protobuf descriptor bytes, presumably removing the gogoproto.castrepeated option. While it appears structurally consistent, removing field options can potentially introduce backward compatibility issues if older clients rely on them. Please ensure that:

  1. No dependencies or client code still expect the old field options.
  2. The resulting wire format remains stable for existing consumers (no changes to field IDs or repeated field usage).

Below is a script to confirm no occurrences of gogoproto.castrepeated remain in the repository, which helps verify consistency:


🏁 Script executed:

#!/bin/bash
# Searches for any remaining references to gogoproto.castrepeated
rg 'gogoproto\.castrepeated'

Length of output: 14989


Ensure backward compatibility for tx.pulsar.go generated descriptor

The updated file (lines 8606–8771 in api/cosmos/protocolpool/v1/tx.pulsar.go) now omits the “gogoproto.castrepeated” option from the protobuf descriptor bytes. A repository‐wide search confirms that no such encoded option exists in this generated file—even though several proto source files still include the option in their comments. Please verify that:

  • No client or dependency explicitly relies on the removed field option.
  • The wire format (field IDs and repeated field semantics) remains unchanged for existing consumers.
✨ Finishing Touches
  • 📝 Generate Docstrings

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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • 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 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.

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.

@hallazzang hallazzang force-pushed the hallazzang/24144-unnecessary-protobuf-field-option branch from 66075a4 to 1892ca6 Compare March 28, 2025 06:12
@aljo242 aljo242 closed this Mar 28, 2025
@hallazzang
Copy link
Contributor Author

@aljo242 Can you please explain why this PR is closed?

@aljo242 aljo242 reopened this Apr 1, 2025
@aljo242 aljo242 marked this pull request as ready for review April 1, 2025 15:54
@aljo242 aljo242 requested a review from a team April 1, 2025 15:54
if the field is not `repeated`, remove `gogoproto.castrepeated` field
option
@hallazzang hallazzang force-pushed the hallazzang/24144-unnecessary-protobuf-field-option branch from 1892ca6 to 4a2d9ba Compare April 7, 2025 11:14
@aljo242 aljo242 added the v54 label Apr 17, 2025
@aljo242
Copy link
Contributor

aljo242 commented Apr 17, 2025

@hallazzang we will merge this once we release v53

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.

Unnecessary field option in staking/v1beta1/authz.proto
2 participants