Skip to content

feat(l2): configure hard cap on L2 commit transactions #2532

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

Merged
merged 14 commits into from
Apr 29, 2025

Conversation

tomip01
Copy link
Contributor

@tomip01 tomip01 commented Apr 22, 2025

Motivation

Here we want to limit the price we are willing to pay for a commitment transaction from the L2 to the L1

Description

  • Add two values to the EthClient, (max_fee_per_gas and max_fee_per_blob_gas), so we can limit if the fees are two high
  • Add checks in the commitment if any of the fees exceeds the limits and, if this happens, return an error

Closes #2498

Copy link

github-actions bot commented Apr 22, 2025

Lines of code report

Total lines added: 59
Total lines removed: 0
Total lines changed: 59

Detailed view
+-------------------------------------------------+-------+------+
| File                                            | Lines | Diff |
+-------------------------------------------------+-------+------+
| ethrex/crates/l2/contracts/deployer.rs          | 804   | +6   |
+-------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_committer.rs      | 427   | +4   |
+-------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/proof_coordinator.rs | 268   | +4   |
+-------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/config/eth.rs            | 18    | +2   |
+-------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/config/toml_parser.rs    | 269   | +6   |
+-------------------------------------------------+-------+------+
| ethrex/crates/networking/rpc/clients/eth/mod.rs | 1030  | +37  |
+-------------------------------------------------+-------+------+

@tomip01 tomip01 self-assigned this Apr 23, 2025
@tomip01 tomip01 added the L2 Rollup client label Apr 23, 2025
@tomip01 tomip01 changed the title first approach feat(l2): configure hard cap on L2 commit transactions Apr 23, 2025
@tomip01 tomip01 marked this pull request as ready for review April 23, 2025 13:10
@tomip01 tomip01 requested a review from a team as a code owner April 23, 2025 13:10
Copy link
Contributor

@avilagaston9 avilagaston9 left a comment

Choose a reason for hiding this comment

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

The only doubt I have is that if we are only going to use max_fee_per_gas and max_fee_per_blob_gas for send_tx_bump_gas_exponential_backoff, shouldn't they be parameters of the function instead of the hole struct?

Copy link
Member

@jrchatruc jrchatruc left a comment

Choose a reason for hiding this comment

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

Left some comments

@tomip01 tomip01 requested a review from jrchatruc April 29, 2025 13:25

- `rpc_url`: The URL for interacting with the RPC endpoint from the client.
- `maximum_allowed_max_fee_per_gas`: Sets a hard cap on the maximum fee per gas you are willing to pay for a single transaction.
`maximum_allowed_max_fee_per_blob_gas`: Sets a hard cap on the maximum fee per blob gas you are willing to pay for a single transaction.
Copy link
Member

Choose a reason for hiding this comment

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

Small typo here: missing the - for maximum_allowed_max_fee_per_blob_gas

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice, edc1e92

Copy link
Contributor

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

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

LGTM. Left a refactor suggestion.

@tomip01 tomip01 requested a review from jrchatruc April 29, 2025 14:29
@ilitteri ilitteri added this pull request to the merge queue Apr 29, 2025
Merged via the queue into main with commit 240886b Apr 29, 2025
27 checks passed
@ilitteri ilitteri deleted the l2/add-max-gas-fee-tx branch April 29, 2025 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L2 Rollup client
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add a configurable hard cap on the max gas fee L2->L1 transactions can pay
4 participants