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

feat: support multilayer gas fee reporting in gas reports and deployment scripts #6253

Open
dghelm opened this issue Nov 8, 2023 · 3 comments
Labels
Cmd-forge-script Command: forge script P-low Priority: low T-feature Type: feature T-to-discuss Type: requires discussion

Comments

@dghelm
Copy link
Contributor

dghelm commented Nov 8, 2023

Component

Forge

Describe the feature you would like

For L2s that have "total transaction fees" that include both the L2 gas fee and an L1 Data Fee (also taken from L2 account, but depend on callData size and gas prices on L1), it'd be helpful for gas reports and deployment scripts to include L1 Data Fee context.

My own use case would be for helping developers understand the differences in optimizing for gas usage in an L2 environment, although I'm hopeful actual projects would be able to use it for better insight into how their contracts will perform on an L2.

For example:

Chain 534351

Estimated gas price: 7.6143807 gwei

Estimated total gas used for script: 510867

Estimated amount required: 0.0038899358250669 ETH

would include an additional Estimated L1 Data Fee that would also be added into the amount of Estimated amount required.

In a Gas Report, this might be complicated, as the L1 Data fee will only really be useful for developers if the contract will be called by an EOA.

Additional context

Not all L2s expose this fee to users. AFAIK, Linea and Arbitrum just adjust gas fees to account for this cost and abstract it from the user, maintaining gas_estimate as the full transaction cost.

Scroll and OpStack networks, however, do have this fee.

This is related to the bug at #4903 and feature request at #5733, but the solution there seems much more nuanced (and supportive of highly divergent gas schedules) than something more basic like what MetaMask implements for MultiLayer Gas Fee prediction (which essentially just calls the L1GasOracle if you're on a chain listed as "MultiLayer Gas Fee").

More context on L1 gas fees:
https://docs.scroll.io/en/developers/transaction-fees-on-scroll/
https://community.optimism.io/docs/developers/build/transaction-fees/#the-l1-data-fee

@dghelm dghelm added the T-feature Type: feature label Nov 8, 2023
@gakonst gakonst added this to Foundry Nov 8, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Nov 8, 2023
@dghelm
Copy link
Contributor Author

dghelm commented Nov 8, 2023

Also, although slightly intimidated as I'm new to Rust, I'm happy to take a stab at a PR if pointed in the right direction (or even just implementing the Scroll fee calculation code).

@ankurdubey521
Copy link

@dghelm I'm interesting in working on this as well! I could look into implementing the Optimism Fee Calculation Logic

@zerosnacks zerosnacks added the A-gas-snapshots Area: gas snapshotting/reporting label Jul 4, 2024
@zerosnacks
Copy link
Member

zerosnacks commented Jul 4, 2024

This is a great point: our tooling can no longer assume a base case of Ethereum mainnet but has to reflect the reality of a multi-chain / rollup-centric future.

@zerosnacks zerosnacks changed the title Support MutliLayer Gas Fee reporting in Gas Reports and Deployment Scripts feat: support multilayer gas fee reporting in gas reports and deployment scripts Jul 4, 2024
@zerosnacks zerosnacks added the Cmd-forge-script Command: forge script label Jul 4, 2024
@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@grandizzy grandizzy added P-low Priority: low and removed A-gas-snapshots Area: gas snapshotting/reporting labels Oct 3, 2024
@grandizzy grandizzy removed this from the v1.0.0 milestone Nov 5, 2024
@grandizzy grandizzy added the T-to-discuss Type: requires discussion label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cmd-forge-script Command: forge script P-low Priority: low T-feature Type: feature T-to-discuss Type: requires discussion
Projects
Archived in project
Development

No branches or pull requests

4 participants