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: re-add IntProto and DecProto and deprecate msg #22925

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Dec 17, 2024

Description

reverts half of: #16918
We shouldn't have removed the type, but only deprecated, as it was proto breaking and it is needed for migrating away from it.

catched by @damiannolan during IBC integration.


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

Summary by CodeRabbit

  • New Features

    • Introduced support for simulating nested messages and importing hex keys via standard input.
    • Added a new module for transaction validation.
  • Improvements

    • Upgraded RocksDB libraries and streamlined integration tests.
    • Enhanced performance and compatibility of various libraries.
  • Bug Fixes

    • Resolved issues with async pruning and improved error handling in gRPC query handlers.
  • API Breaking Changes

    • Deprecated certain methods and types, including IntProto and DecProto, and renamed SetProtocolVersion to SetAppVersion.
  • Documentation

    • Added comments to clarify fields in the GeneratorParams struct.
    • Updated the changelog to reflect the new version entry for the indexer project.

@julienrbrt julienrbrt added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Dec 17, 2024
Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces updates to the Cosmos SDK, focusing on enhancing the framework's functionality and addressing technical debt. The changes span multiple components, including the changelog, protobuf definitions, and type implementations. Key modifications involve adding new message types, deprecating certain methods, improving documentation, and standardizing code formatting. The updates aim to provide more clarity, improve type handling, and prepare the SDK for future developments.

Changes

File Change Summary
CHANGELOG.md - Added new features like nested message simulation and transaction validation module
- Upgraded RocksDB libraries
- Simplified integration tests
- Addressed various bug fixes
- Documented API breaking changes and deprecated features
api/cosmos/base/v1beta1/coin.pulsar.go - Added deprecated IntProto and DecProto message types
- Implemented protobuf reflection methods
api/cosmos/benchmark/module/v1/module.pulsar.go - Added descriptive comments for GeneratorParams struct fields
proto/cosmos/base/v1beta1/coin.proto - Introduced new IntProto and DecProto message types with deprecation notices
tools/benchmark/proto/cosmos/benchmark/module/v1/module.proto - Standardized formatting of field declarations
types/coin.go - Marked String() methods for IntProto and DecProto as deprecated
indexer/postgres/CHANGELOG.md - Added version entry for v0.1.0

📜 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 65bd417 and 8078493.

📒 Files selected for processing (1)
  • indexer/postgres/CHANGELOG.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • indexer/postgres/CHANGELOG.md

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>, 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. (Beta)
  • @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.

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 (3)
CHANGELOG.md (3)

Line range hint 1-2500: Improve version number formatting consistency

The version numbers in headers are formatted inconsistently throughout the document. Some use [vX.Y.Z] format while others use ## vX.Y.Z. Consider standardizing to one format across the entire changelog for better readability.

- # [v0.47.16]
+ ## [v0.47.16]

Line range hint 1-2500: Standardize changelog entry formatting

Some changelog entries start with PR references while others end with them. Consider standardizing the format to always have PR references at the end of entries for better readability.

For example:

- [#13891](https://github.com/cosmos/cosmos-sdk/pull/13891) Introduced a new `DenomOwnersByQuery` query method
+ Introduced a new `DenomOwnersByQuery` query method [#13891](https://github.com/cosmos/cosmos-sdk/pull/13891)

Line range hint 1-2500: Fix typos and formatting issues

There are several minor typos and formatting inconsistencies throughout the document:

  1. Line 167: Extra tilde character "~" should be removed
  2. Some bullet points use "*" while others use "-", should standardize
  3. Some code blocks are missing language identifiers
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5799c15 and 65bd417.

⛔ Files ignored due to path filters (2)
  • types/coin.pb.go is excluded by !**/*.pb.go
  • x/staking/types/staking.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (6)
  • CHANGELOG.md (1 hunks)
  • api/cosmos/base/v1beta1/coin.pulsar.go (5 hunks)
  • api/cosmos/benchmark/module/v1/module.pulsar.go (1 hunks)
  • proto/cosmos/base/v1beta1/coin.proto (1 hunks)
  • tools/benchmark/proto/cosmos/benchmark/module/v1/module.proto (2 hunks)
  • types/coin.go (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • tools/benchmark/proto/cosmos/benchmark/module/v1/module.proto
  • api/cosmos/benchmark/module/v1/module.pulsar.go
  • types/coin.go
🧰 Additional context used
📓 Path-based instructions (2)
api/cosmos/base/v1beta1/coin.pulsar.go (1)

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

CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

🔇 Additional comments (8)
api/cosmos/base/v1beta1/coin.pulsar.go (6)

986-995: Reintroduction of IntProto with proper deprecation

The IntProto type has been reintroduced and is correctly marked as deprecated with clear guidance to use math.Int directly. This ensures backward compatibility without encouraging new usage.


997-1003: Implementation of ProtoReflect for IntProto

The ProtoReflect method for IntProto is appropriately implemented, facilitating proper message reflection as required by the protobuf standards.


1933-1971: Deprecation comments for IntProto are clear and conform to style guidelines

The deprecation notice for IntProto is clearly stated in the comments, and the formatting aligns with the Go conventions, aiding developers in understanding the change.


2074-2080: Updated message types to include IntProto and DecProto

The file_cosmos_base_v1beta1_coin_proto_msgTypes array has been updated to include the new message types, ensuring they are registered correctly within the protobuf framework.


2119-2142: Exporter functions for IntProto and DecProto are correctly implemented

The exporter functions for both IntProto and DecProto are properly defined, which is necessary for accurate message state management in protobuf.


2150-2151: Message count updated appropriately

The NumMessages field is incremented to accommodate the new message types, maintaining consistency in the file descriptor.

proto/cosmos/base/v1beta1/coin.proto (2)

43-53: Reintroduction of IntProto with appropriate deprecation notice

The IntProto message has been reintroduced and properly marked as deprecated. The deprecation directive is clear, advising users to prefer using math.Int directly, which supports binary marshaling and unmarshaling.


55-65: Reintroduction of DecProto with appropriate deprecation notice

The DecProto message has been reintroduced and correctly marked as deprecated. Users are guided to use math.LegacyDec instead, aligning with the intended migration path.

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Thank you! 🙏🏻

x.Int = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.v1beta1.IntProto"))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.v1beta1.IntProto"))
}
panic(fmt.Errorf("message cosmos.base.v1beta1.IntProto does not contain field %s", fd.FullName()))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
x.Dec = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.v1beta1.DecProto"))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.base.v1beta1.DecProto"))
}
panic(fmt.Errorf("message cosmos.base.v1beta1.DecProto does not contain field %s", fd.FullName()))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@julienrbrt julienrbrt enabled auto-merge December 17, 2024 10:40
@julienrbrt julienrbrt added this pull request to the merge queue Dec 17, 2024
@@ -164,7 +164,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
### API Breaking Changes

* (baseapp) [#16244](https://github.com/cosmos/cosmos-sdk/pull/16244) `SetProtocolVersion` has been renamed to `SetAppVersion`. It now updates the consensus params in baseapp's `ParamStore`.
* (types) [#16918](https://github.com/cosmos/cosmos-sdk/pull/16918) Remove `IntProto` and `DecProto`. Instead, `math.Int` and `math.LegacyDec` should be used respectively. Both types support `Marshal` and `Unmarshal` which should be used for binary marshaling.
* (types) [#16918](https://github.com/cosmos/cosmos-sdk/pull/16918), [#22925](https://github.com/cosmos/cosmos-sdk/pull/22925) Deprecate `IntProto` and `DecProto`. Instead, `math.Int` and `math.LegacyDec` should be used respectively. Both types support `Marshal` and `Unmarshal` which should be used for binary marshaling.
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR link should be updated as well

Copy link
Member Author

Choose a reason for hiding this comment

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

?? What do you mean

@@ -16,16 +16,16 @@ message Module {
// GenesisParams defines the genesis parameters for the benchmark module.
message GeneratorParams {
// seed is the seed for the random number generator.
uint64 seed = 1;
uint64 seed = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't need to be committed

Copy link
Member Author

@julienrbrt julienrbrt Dec 17, 2024

Choose a reason for hiding this comment

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

It does. make proto-gen runs linting on proto files. This means when this file was committed linting wasn't run on it. The entirety of the result of make proto-gen should always be committed.

@@ -35,3 +35,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
# Changelog

## [Unreleased]

## [v0.1.0](https://github.com/cosmos/cosmos-sdk/releases/tag/indexer/postgres/v0.1.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need to be included?

Copy link
Member Author

@julienrbrt julienrbrt Dec 17, 2024

Choose a reason for hiding this comment

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

Theoretically it didn't but it saved me a PR to do it here directly.
I don't like to open PRs with one line change, especially when it is docs.

Merged via the queue into main with commit 0a89178 Dec 17, 2024
82 of 83 checks passed
@julienrbrt julienrbrt deleted the julien/readd-intproto branch December 17, 2024 15:05
mergify bot pushed a commit that referenced this pull request Dec 17, 2024
(cherry picked from commit 0a89178)

# Conflicts:
#	api/cosmos/base/v1beta1/coin.pulsar.go
#	api/cosmos/benchmark/module/v1/module.pulsar.go
#	indexer/postgres/CHANGELOG.md
#	x/staking/types/staking.pb.go
julienrbrt added a commit that referenced this pull request Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release C:indexer/postgres C:Simulations C:x/staking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants