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

refactor!: remove duplicate block #23437

Merged
merged 7 commits into from
Jan 17, 2025
Merged

refactor!: remove duplicate block #23437

merged 7 commits into from
Jan 17, 2025

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Jan 17, 2025

Description

Closes: #23364

This pr removed the comet block as it is duplicated with the sdk representation. If the user would like the comet block they should query comet.


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

Release Notes

  • Deprecations

    • Deprecated Block field in GetBlockByHeightResponse and GetLatestBlockResponse
    • Introduced new sdk_block field as a replacement
  • API Changes

    • Modified GetBlockByHeight method to return an empty Comet block
    • Removed input validation in NewLegacyAminoPubKey function for multisig keys
  • Versioning

    • Added version annotations for new fields and methods in Cosmos SDK 0.46 and 0.47

These changes aim to improve API clarity and streamline block data handling in the Cosmos SDK.

Copy link
Contributor

coderabbitai bot commented Jan 17, 2025

Caution

Review failed

The head commit changed during the review from c227215 to 3e29cc7.

📝 Walkthrough

Walkthrough

This pull request introduces changes to the Cosmos SDK's block data handling, focusing on deprecating and removing the Block field from GetBlockByHeightResponse and GetLatestBlockResponse. The modifications span multiple files, including the CHANGELOG.md, proto definitions, and service implementation. The primary goal is to streamline the API by removing redundant block data and reducing response payload size.

Changes

File Change Summary
CHANGELOG.md Added entry for block field deprecation
proto/cosmos/base/tendermint/v1beta1/query.proto - Deprecated block field in responses
- Added sdk_block field
- Added version annotations
client/grpc/cmtservice/service.go Modified GetBlockByHeight to return empty block
crypto/keys/multisig/multisig.go Removed input validation check in NewLegacyAminoPubKey

Assessment against linked issues

Objective Addressed Explanation
Remove deprecated block field
Reduce response payload size
Breaking API change

Possibly related PRs

Suggested labels

C:server/v2, C:server/v2 cometbft, C:x/auth, C:x/tx, C:schema

Suggested reviewers

  • julienrbrt
  • aaronc
  • kocubinski
  • facundomedica
  • testinginprod
  • alpe
  • sontrinh16
  • hieuvubk

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.

@tac0turtle tac0turtle added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Jan 17, 2025
@github-actions github-actions bot added the C:CLI label Jan 17, 2025
@tac0turtle tac0turtle marked this pull request as ready for review January 17, 2025 10:48
@julienrbrt julienrbrt changed the title chore: remove duplicate block refactor!: remove duplicate block Jan 17, 2025
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 (4)
client/grpc/cmtservice/service.go (1)

113-114: LGTM! Good optimization.

Returning an empty block instead of the full block data reduces response size while maintaining backward compatibility. This change aligns with the PR objective to eliminate duplicate block data.

However, consider adding a comment explaining why we're returning an empty block to help future maintainers understand the design decision.

-    Block:    &v1.Block{}, // fill with empty block to reduce response size
+    Block:    &v1.Block{}, // Return empty block as this field is deprecated. Users should query Comet directly or use SdkBlock
CHANGELOG.md (3)

56-56: Fix typo in API Breaking Changes entry

The entry has a typo in "x/distinction" - should be "x/distribution".

- (x/distinction) [#8918](https://github.com/cosmos/cosmos-sdk/pull/8918) Fix module's parameters validation.
+ (x/distribution) [#8918](https://github.com/cosmos/cosmos-sdk/pull/8918) Fix module's parameters validation.

Line range hint 1-1000: Improve changelog formatting consistency

The changelog has some inconsistent formatting:

  • Some PR links use full URLs while others use relative paths
  • Some bullet points use * while others use -
  • Indentation is inconsistent in some sections

Consider standardizing the formatting:

  • Use consistent bullet point style (prefer -)
  • Use consistent PR link format (prefer relative paths)
  • Maintain consistent indentation throughout

Line range hint 1-1000: Add missing PR links

Some changelog entries are missing links to their corresponding PRs/issues. For example:

  • "Fix negative index accesses in CompactUnmarshal,GetIndex,SetIndex"
  • Several entries in the API Breaking Changes section

Add the missing PR/issue links to improve traceability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b5dada3 and f82c370.

⛔ Files ignored due to path filters (1)
  • client/grpc/cmtservice/query.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (5)
  • CHANGELOG.md (1 hunks)
  • api/cosmos/base/tendermint/v1beta1/query.pulsar.go (3 hunks)
  • client/grpc/cmtservice/service.go (2 hunks)
  • crypto/keys/multisig/multisig.go (0 hunks)
  • proto/cosmos/base/tendermint/v1beta1/query.proto (1 hunks)
🔥 Files not summarized due to errors (1)
  • api/cosmos/base/tendermint/v1beta1/query.pulsar.go: Error: Server error: no LLM provider could handle the message
💤 Files with no reviewable changes (1)
  • crypto/keys/multisig/multisig.go
🧰 Additional context used
📓 Path-based instructions (3)
api/cosmos/base/tendermint/v1beta1/query.pulsar.go (1)

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

client/grpc/cmtservice/service.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"

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: test-system-v2
  • GitHub Check: Analyze
  • GitHub Check: Summary
🔇 Additional comments (5)
client/grpc/cmtservice/service.go (1)

7-7: LGTM!

The new import is required for creating empty v1.Block objects and follows Go import conventions.

proto/cosmos/base/tendermint/v1beta1/query.proto (1)

109-112: LGTM! Well-structured proto changes.

The changes follow protobuf best practices:

  1. Proper deprecation marking with clear message
  2. New field addition with correct version tracking
  3. Maintains backward compatibility while encouraging migration to sdk_block
api/cosmos/base/tendermint/v1beta1/query.pulsar.go (3)

10888-10889: Well-documented deprecation notice!

The deprecation notice clearly indicates that users should migrate to sdk_block instead of using the deprecated Block field.


10921-10921: Properly marked deprecated getter method

The getter method is correctly marked as deprecated, maintaining API consistency with the deprecated field.


11668-11886: Verify API version compatibility

The protobuf definitions include version information for cosmos-sdk. Please ensure that the version numbers are compatible with the current release.

✅ Verification successful

Version compatibility is correctly maintained

The cosmos-sdk version 0.47 used in the protobuf definitions is consistent with the module's scope and follows the established versioning patterns. Different versions across the codebase represent feature introduction points as per ADR-044 guidelines.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for version compatibility in other proto files
# Look for any version mismatches in proto files

rg -A 1 "cosmos-sdk [0-9]+" | grep -v "0.47\|0.46\|0.43\|0.52"

Length of output: 30178

@julienrbrt julienrbrt added this pull request to the merge queue Jan 17, 2025
Merged via the queue into main with commit 7f827c5 Jan 17, 2025
73 of 74 checks passed
@julienrbrt julienrbrt deleted the marko/23364 branch January 17, 2025 22:04
mergify bot pushed a commit that referenced this pull request Jan 17, 2025
Co-authored-by: Alex | Interchain Labs <[email protected]>
(cherry picked from commit 7f827c5)

# Conflicts:
#	CHANGELOG.md
#	api/cosmos/base/tendermint/v1beta1/query.pulsar.go
julienrbrt added a commit that referenced this pull request Jan 18, 2025
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:CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove deprecated block field from BlockByHeightResponse and LatestBlockResponse
5 participants