Skip to content

Conversation

@ranchalp
Copy link

@ranchalp ranchalp commented Jun 9, 2025

1. Purpose or design rationale of this PR

See #1196 for more.

2. PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
  • ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
  • docs: Documentation-only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

3. Deployment tag versioning

Has the version in params/version.go been updated?

  • This PR doesn't involve a new deployment, git tag, docker image tag, and it doesn't affect traces
  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change
  • Yes

@coderabbitai
Copy link

coderabbitai bot commented Jun 9, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

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.

@ranchalp ranchalp force-pushed the rollupfee-estimate-compression branch from 9d4f5bc to 4c1dc4d Compare June 9, 2025 10:31
@ranchalp ranchalp requested review from Thegaram and jonastheis June 9, 2025 13:18
@ranchalp
Copy link
Author

Waiting for a decision on which zstd library to use (I am not sure I understand why not just going with our own?), otherwise comments resolved.

@ranchalp ranchalp marked this pull request as ready for review June 10, 2025 20:27
@ranchalp ranchalp force-pushed the l1data-to-rollupfee branch from d0e730b to ce2498e Compare June 11, 2025 16:00
@ranchalp ranchalp force-pushed the rollupfee-estimate-compression branch from b83f7dc to e3c5bd7 Compare June 12, 2025 13:38
@ranchalp
Copy link
Author

Following the discussion here, I reverted the use of a standard go zstd library in favour for the da-codec's version.

Copy link
Collaborator

@jonastheis jonastheis left a comment

Choose a reason for hiding this comment

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

Please revert all the whitespace changes. Next to being a pain when reviewing it also increases the diff.

Good common practice is to check files and their content before committing to avoid such whitespace changes from eg linter and to make sure what you're committing is actually sensible.

// Default compression ratio is 1.0 (no compression)
compressionRatio := big.NewInt(rcfg.Precision.Int64())

compressedBytes, err := zstd.CompressScrollBatchBytes(data)
Copy link
Collaborator

@jonastheis jonastheis Jun 19, 2025

Choose a reason for hiding this comment

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

might still be good to use the zstd version that comes with da-codec. maybe we need to introduce a new function there to get rid of the overhead

Choose a reason for hiding this comment

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

Updated the da-codec version to codecv8's zstd compression: f31326d.

Copy link

@colinlyguo colinlyguo Jun 24, 2025

Choose a reason for hiding this comment

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

might still be good to use the zstd version that comes with da-codec

The call stack would be a bit counter-intuitive here. calculateEncodedL1DataFeeFeynman is called based on IsCurie and IsFeynman checks.

I can think of two refactoring ways:

  • Passing blockNumber and blockTime as parameters of calculateEncodedL1DataFeeFeynman, or determining it outside and passing the compression function as a parameter. This will require remembering to update this util function in da-codec repo, which is the same as updating here in future upgrades.

  • Or another solution would be to expose a new interface based on the da-codec version, dedicated to compression ratio estimation here (determining the fees).

Do either of these approaches align with your thoughts, or do you have a different method in mind?

Choose a reason for hiding this comment

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

I don't understand your point about the counter-intuitive call stack.

But I agree we should:

  1. Pass compressionRatio as parameter for easier testing, and
  2. Expose an estimate tx compression ratio function in da-codec

Choose a reason for hiding this comment

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

Replied to the comment here: #1196 (comment).

@colinlyguo colinlyguo force-pushed the rollupfee-estimate-compression branch from 434dbf6 to 185d45e Compare June 24, 2025 19:23
@colinlyguo colinlyguo force-pushed the rollupfee-estimate-compression branch from 185d45e to bfcbb4b Compare June 24, 2025 19:24
@colinlyguo colinlyguo force-pushed the rollupfee-estimate-compression branch from b6e7b53 to 0346191 Compare June 24, 2025 21:59
@Thegaram Thegaram merged commit 872ccf5 into l1data-to-rollupfee Jun 25, 2025
10 checks passed
@Thegaram Thegaram deleted the rollupfee-estimate-compression branch June 25, 2025 10:17
colinlyguo added a commit that referenced this pull request Jun 26, 2025
* Change l1DataFee to rollupFee for Feynman

* Update CommitScalarSlot to ExecScalarSlot

* Rename l1DataFee to rollupFee

* Scale compression ratio to match scalars precision

* Use l1DataFee and commitScalar instead of rollupFee and execScalar

* Use blocktime not blocknumber

* Add unit test

* Clarify test comment

* feat(feynman): upgrade gas oracle predeploy

* address comments

* revert renaming CalculateL1DataFee to CalculateRollupFee

* simplify EstimateL1DataFeeForMessage

* address comments

* add a comment based on pr reviews

* update formula

* tweaks

* tweak comments

* Estimate compression ratio at rollupFee for Feynman  (#1197)

* Estimate compression ratio

* Update rollup/fees/rollup_fee.go

Co-authored-by: Péter Garamvölgyi <[email protected]>

* Check compressed size smaller and remove unnecessary checks/changes

* goimports locally run

* rollback format changes

* update da-codec's zstd function

* apply zstd

* tweaks

* tweak unit test

* make sure compression ratio >= 1

* nit

---------

Co-authored-by: Péter Garamvölgyi <[email protected]>
Co-authored-by: colinlyguo <[email protected]>
Co-authored-by: colin <[email protected]>

* refactoring

* remove incorrect merge artifact

* error handling

* update da-codec commit

* update da-codec commit

---------

Co-authored-by: Péter Garamvölgyi <[email protected]>
Co-authored-by: colin <[email protected]>
Co-authored-by: colinlyguo <[email protected]>
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.

6 participants