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

op-batcher: Add threshold for L1 blob base fee #11212

Conversation

ak-akiyama
Copy link

Description

Add the new flag to op-batcher to cancel tx sending if the L1 blob base fee exceeds the threshold. The threshold value can be set using the cli argument --max-l1-blob-base-fee=n or the environment variable OP_BATCHER_MAX_L1_BLOB_BASE_FEE=n. If the threshold is set to 0 (default), no action will be taken.

This will be useful for the test L2 networks rolling up to the Sepolia network, which tends to have high blob fee rates.

Since no JSON-RPC method was found to get the L1 blob base fee, this implementation get the fee from the L2 GasPriceOracle contract:

function blobBaseFee() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFee();
}

Tests

ak-akiyama@da79ba0#diff-6524d10e489e31223b0801a83152fb420341719ae1fb7deab8b74597b5c437e9R129-R156

@ak-akiyama ak-akiyama requested a review from a team as a code owner July 23, 2024 17:13
@ak-akiyama ak-akiyama requested a review from geoknee July 23, 2024 17:13
@tynes
Copy link
Contributor

tynes commented Jul 23, 2024

Thanks for this PR! You should be able to calculate the current blob base fee using the following function here. Its not best to grab it from the L2, you can grab the latest L1 block header and pull the inputs from the header to pass into the linked function. This will allow you to delete a bunch of code spanning outside of the batcher in this PR. It would also be useful to have a max basefee config option as well, but no need to bloat this PR with multiple features. That could be done in a follow up.

@tynes
Copy link
Contributor

tynes commented Jul 23, 2024

I would like to eventually introduce the idea of "strategies" where you could implement more complex logic behind a common interface for when batches should be submitted. Definitely out of scope here but you could imagine expressing "submit the cheaper of calldata or blobs, under the max configured basefee/blobbasefee unless 20 mins pass, then submit no matter what" as a strategy

@ak-akiyama
Copy link
Author

I'll close my PR since there is another excellent PR (#11219, #11059). Thank you for reviewing.

@ak-akiyama ak-akiyama closed this Jul 24, 2024
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.

3 participants