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: revive max blob size decorator #3479

Merged
merged 7 commits into from
May 17, 2024

Conversation

rootulp
Copy link
Collaborator

@rootulp rootulp commented May 14, 2024

Closes #3468 by reviving the max blob size decorator and making both decorators version aware so that:

  • v1 uses max blob size decorator
  • v2 uses max blob share decorator

@rootulp rootulp self-assigned this May 14, 2024
@rootulp rootulp marked this pull request as ready for review May 14, 2024 18:44
@rootulp rootulp requested a review from a team as a code owner May 14, 2024 18:44
@rootulp rootulp requested review from ramin and cmwaters and removed request for a team May 14, 2024 18:44
Copy link
Contributor

coderabbitai bot commented May 14, 2024

Walkthrough

Walkthrough

The changes involve the introduction of a new MaxTotalBlobSizeDecorator to enforce transaction blob size limits for app version 1 in the ante handler. Additionally, adjustments are made to the existing BlobShareDecorator to apply conditionally based on the app version, ensuring compatibility across different versions.

Changes

File Path Change Summary
app/ante/ante.go Added MaxTotalBlobSizeDecorator and updated comments for BlobShareDecorator based on app version
x/blob/ante/blob_share_decorator.go Imported v1 from appconsts and added app version conditional check
x/blob/ante/blob_share_decorator_test.go Introduced appVersion field in testCase struct and added relevant imports
x/blob/ante/max_total_blob_size_ante.go Added MaxTotalBlobSizeDecorator struct, methods, and related functionality
x/blob/ante/max_total_blob_size_ante_test.go Added tests for MaxTotalBlobSizeDecorator with various scenarios

Assessment against linked issues

Objective Addressed Explanation
Differentiate blob share ante handler based on app version (#3468)
Ensure MaxTotalBlobSizeDecorator checks total blob size for app version 1 (#3468)
Modify tests to include app version scenarios (#3468)

Recent Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 5dcbae9 and 594c2c2.
Files selected for processing (3)
  • app/ante/ante.go (1 hunks)
  • x/blob/ante/max_total_blob_size_ante.go (1 hunks)
  • x/blob/ante/max_total_blob_size_ante_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • app/ante/ante.go
  • x/blob/ante/max_total_blob_size_ante.go
  • x/blob/ante/max_total_blob_size_ante_test.go

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:

Note: Auto-reply has been disabled for this repository by the repository owner. 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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: 6

Out of diff range and nitpick comments (3)
x/blob/ante/blob_share_decorator.go (1)

5-5: Remove unused import.

The import v1 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v1" is not used in the code. Consider removing it to keep the imports clean.

x/blob/ante/max_total_blob_size_ante.go (1)

1-10: Remove unused import.

The import v1 "github.com/celestiaorg/celestia-app/v2/pkg/appconsts/v1" is not used in the code. Consider removing it to keep the imports clean.

x/blob/ante/blob_share_decorator_test.go (1)

8-9: Unused imports should be removed.

The imports for v1 and v2 are used, but ensure that tmproto and version are necessary. If they are not used elsewhere in the code, consider removing them to keep the import list clean.

Also applies to: 16-17

Comment on lines +34 to +40
{
name: "want no error if appVersion v1 and 8 MiB blob",
pfb: &blob.MsgPayForBlobs{
BlobSizes: []uint32{8 * mebibyte},
},
appVersion: v1.Version,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Add assertions for wantErr in v1 test cases.

The test case for appVersion v1 does not include an assertion for wantErr. Even if no error is expected, it is good practice to explicitly assert that wantErr is nil.

{
	name: "want no error if appVersion v1 and 8 MiB blob",
	pfb: &blob.MsgPayForBlobs{
		BlobSizes: []uint32{8 * mebibyte},
	},
	appVersion: v1.Version,
+	wantErr:    nil,
},

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
{
name: "want no error if appVersion v1 and 8 MiB blob",
pfb: &blob.MsgPayForBlobs{
BlobSizes: []uint32{8 * mebibyte},
},
appVersion: v1.Version,
},
{
name: "want no error if appVersion v1 and 8 MiB blob",
pfb: &blob.MsgPayForBlobs{
BlobSizes: []uint32{8 * mebibyte},
},
appVersion: v1.Version,
wantErr: nil,
},

x/blob/ante/blob_share_decorator_test.go Show resolved Hide resolved
x/blob/ante/blob_share_decorator_test.go Show resolved Hide resolved
x/blob/ante/blob_share_decorator_test.go Show resolved Hide resolved
x/blob/ante/blob_share_decorator.go Show resolved Hide resolved
x/blob/ante/max_total_blob_size_ante.go Show resolved Hide resolved
@rootulp rootulp requested review from evan-forbes and ninabarbakadze and removed request for ramin and cmwaters May 16, 2024 15:32
rach-id
rach-id previously approved these changes May 17, 2024
Copy link
Member

@rach-id rach-id left a comment

Choose a reason for hiding this comment

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

LGTM utAck

left some optional nits

x/blob/ante/max_total_blob_size_ante.go Outdated Show resolved Hide resolved
x/blob/ante/max_total_blob_size_ante.go Show resolved Hide resolved
x/blob/ante/max_total_blob_size_ante.go Outdated Show resolved Hide resolved
x/blob/ante/max_total_blob_size_ante.go Show resolved Hide resolved
ninabarbakadze
ninabarbakadze previously approved these changes May 17, 2024
Copy link
Member

@ninabarbakadze ninabarbakadze left a comment

Choose a reason for hiding this comment

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

🚢

x/blob/ante/max_total_blob_size_ante.go Show resolved Hide resolved
evan-forbes
evan-forbes previously approved these changes May 17, 2024
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

lgtm and makes sense.

In this specific case, meaning when the antehandler is only ran during checktx, I think after all network are upgraded we will actually able to get rid of this one.

@rootulp rootulp dismissed stale reviews from evan-forbes, ninabarbakadze, and rach-id via 5dcbae9 May 17, 2024 17:49
@celestia-bot celestia-bot requested review from a team, staheri14 and evan-forbes and removed request for a team May 17, 2024 17:49
@celestia-bot celestia-bot requested a review from a team May 17, 2024 17:52
@rootulp rootulp enabled auto-merge (squash) May 17, 2024 18:07
@rootulp rootulp merged commit 33f818b into celestiaorg:main May 17, 2024
33 checks passed
@rootulp rootulp deleted the rp/version-blob-ante-handler branch May 17, 2024 19:48
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.

Differentiate blob share ante handler based on app version
4 participants