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

Add utils to estimate Scroll L1 gas #34

Merged
merged 8 commits into from
Feb 27, 2024
Merged

Add utils to estimate Scroll L1 gas #34

merged 8 commits into from
Feb 27, 2024

Conversation

0xStrobe
Copy link
Contributor

@0xStrobe 0xStrobe commented Feb 25, 2024

Fixes #33 (only Scroll at the moment)

Scroll has a L1 gas estimation util which has a method getL1Fee to estimate the additional L1 gas needed to also be accounted for when a tx is submitted.

That method accepts the signed raw tx, which is kinda counterintuitive since the gas limit and gas price are also part of the tx, so it's not possible to accurately know the L1 gas before the tx is prepared.

This PR implements a workaround to find the upper bound of the L1 gas by preparing an unsigned transaction, then pads it with a lot of hex Fs which signify 1111s in binary.

Copy link
Contributor

@Mister-Meeseeks Mister-Meeseeks left a comment

Choose a reason for hiding this comment

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

Nice L1 gas estimation. Very based

@Mister-Meeseeks Mister-Meeseeks merged commit d58b264 into main Feb 27, 2024
0 of 6 checks passed
balu6914 added a commit to balu6914/Tempest-sdk that referenced this pull request Mar 15, 2024
Add utils to estimate Scroll L1 gas
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.

Add gas cost estimate calculation functions
3 participants