Add utils to estimate Scroll L1 gas #34
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
F
s which signify1111
s in binary.