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

Ecotone gas price #12584

Merged
merged 12 commits into from
Mar 26, 2024
Merged

Ecotone gas price #12584

merged 12 commits into from
Mar 26, 2024

Conversation

matYang
Copy link
Contributor

@matYang matYang commented Mar 26, 2024

After the Ecotone upgrade, OP stack l1 gas price is no longer simply a query of l1BaseFee: https://docs.optimism.io/stack/transactions/fees#ecotone

The new equations are:

l1_data_fee = tx_compressed_size * weighted_gas_price

weighted_gas_price ~= (16 * base_fee_scalar * base_fee + blob_base_fee_scalar * blob_base_fee) / 10^scalar_decimal / 16

We implement a simpler way to calculate weighted_gas_price:

weighted_gas_price ~= getL1Fee(0x1) / getL1GasUsed(0x1)

Experiments show this simpler approach gives a gas price within 1% of the value calculated from the formula.
Referencing GasOracle code: https://vscode.blockscan.com/optimism/0xb528d11cc114e026f138fe568744c6d45ce6da7a, this approach uses the same formula under the hood.

This PR implements an OP Stack data availability price reader (DAPriceReader) to abstract the logic out of l1GasOracle.

Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset.

@matYang matYang marked this pull request as ready for review March 26, 2024 06:03
@matYang matYang requested a review from a team as a code owner March 26, 2024 06:03
amit-momin
amit-momin previously approved these changes Mar 26, 2024
@matYang matYang requested a review from amit-momin March 26, 2024 20:20
@matYang matYang added this pull request to the merge queue Mar 26, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 26, 2024
@matYang matYang added this pull request to the merge queue Mar 26, 2024
Merged via the queue into develop with commit c7cacd0 Mar 26, 2024
104 checks passed
@matYang matYang deleted the ecotone-gas-price branch March 26, 2024 21:47
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.

2 participants