feat: gaslimit encoding end to end#932
Conversation
|
| l2GasLimit: BigNumber, | ||
| l2GasPrice: BigNumber | ||
| ): BigNumber { | ||
| const l1GasLimit = calculateL1GasLimit(data) |
There was a problem hiding this comment.
This should throw an error if the values do not satisfy the correct equations, see #823 (comment)
| } | ||
| expect(estimate).to.be.deep.eq(expected) | ||
| const estimate = await l2Provider.estimateGas(tx) | ||
| const l2Gaslimit = await l2Provider.send('eth_estimateExecutionGas', [ |
There was a problem hiding this comment.
This new RPC endpoint was added to be exactly what the L1 eth_estimateGas is
Codecov Report
@@ Coverage Diff @@
## feat/gaslimit-encoding #932 +/- ##
=======================================================
Coverage 82.21% 82.21%
=======================================================
Files 48 48
Lines 1895 1895
Branches 303 303
=======================================================
Hits 1558 1558
Misses 337 337 Continue to review full report at Codecov.
|
| @@ -0,0 +1,19 @@ | |||
| import './setup' | |||
There was a problem hiding this comment.
This needs more tests but the e2e tests are passing using encode and decode
|
This implementation needs to use |
| return err | ||
| } | ||
|
|
||
| if !s.enforceFees && tx.GasPrice().Cmp(common.Big0) == 0 { |
There was a problem hiding this comment.
This should be able to be moved to the top
|
I have more commits coming for this branch soon |
| func RoundL2GasPrice(gasPrice uint64) uint64 { | ||
| if gasPrice == 0 { | ||
| return gasPrice | ||
| // VerifyL2GasPrice returns an error if the number is an invalid possible L2 gas |
There was a problem hiding this comment.
big.Ints are too verbose but we have to use them because we need the arbitrary precision
* l2geth: updated calculate rollup fee * l2geth: implement the gasprice serialization * lint: fix * rollup-test: fix * l2geth: gaslimit encoding state polling (#927) * l2geth: rollup gas price oracle state polling * l2geth: read l2 gasprice from the tip * l2geth: add config options for L2 gas price * l2geth: comment to remove code in future * l2geth: handle 0 and 1 fees * l2geth: enable 0 and 1 fee tests * feat: gaslimit encoding end to end (#932) * core-utils: add fees package * integration-tests: refactor for new fees * l2geth: end to end fee spec * l2geth: use new env var * deps: regenerate * lint: fix * l2geth: fee verification * tests: update gas prices * tests: update gas prices * tests: cleanup * l2geth: small cleanup * l2geth: fix max * feat: fix fee calculations with bigints * tests: fix * tests: lint * core-utils: rename fees to L2GasLimit * l2geth: fix comment * l2geth: fix name of env var * l2geth: delete extra print statement * l2geth: fix logline * tests: fix typo * l2geth: improve readability * chore: add changeset * l2geth: fix compiler error * feat: clean up and fix fees * lint: fix * core-utils: refactor api to be more friendly * lint: fix * comments: fix * refactor: clean up style and common language Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
Description
This PR included end to end testing of the gasLimit encoding scheme described in #823 (comment)
A JS fees library was written that implements the scheme and is added to
core-utils. It could use some more tests but currently passes the end to end tests. Will follow up with more tests as well as #823 (comment)It has some additional implementation details, for example handling gasPrices set to 0