-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
l2geth: updated calculate rollup fee #906
Conversation
🦋 Changeset detectedLatest commit: 81e32b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report
@@ Coverage Diff @@
## develop #906 +/- ##
==========================================
Coverage ? 82.21%
==========================================
Files ? 48
Lines ? 1895
Branches ? 303
==========================================
Hits ? 1558
Misses ? 337
Partials ? 0 Continue to review full report at Codecov.
|
8e1cf35
to
6636805
Compare
I'd like to improve the testing of this, it will build on #912 |
This has been fixed and is no longer an issue. Passing in the L2 gasprice of 0 is a special case that is handled |
* 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
* 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
@@ -45,13 +45,13 @@ describe('Native ETH Integration Tests', async () => { | |||
const amount = utils.parseEther('0.5') | |||
const addr = '0x' + '1234'.repeat(10) | |||
const gas = await env.ovmEth.estimateGas.transfer(addr, amount) | |||
expect(gas).to.be.deep.eq(BigNumber.from(21000)) | |||
expect(gas).to.be.deep.eq(BigNumber.from(0x35008e17cb6d)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decode and assert against the gas limit to decouple actual value being hardcoded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to leave this out of scope for this PR and we should address the fact that the integration tests are coupled such that they all cannot run against kovan/goerli in an additional PR
27800da
to
a76fd99
Compare
Attempting to game the system by handcrafting an RLP transaction. I created a transaction and then updated the gasLimit (see Trying to deserialize this resulted in an error
Users that send transactions with too large of a fee will fail to have their transaction accepted by the sequencer. Currently, the $ python
Python 3.8.4 (default, Jul 15 2020, 10:38:22)
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> max_u64 = 0xFFFFFFFFFFFFFFFF
>>> max_u64 * 10**-18
18.446744073709553 |
return nil | ||
} | ||
// Make sure that the fee is paid | ||
if tx.Gas() < fee.Uint64() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analyze volatile fees on L1 causing this to fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these like reminders you set to yourself?
Description
PR that implements the transaction fee scheme describe in: #823 (comment)
This scheme encodes the L2 Gas Price inside of the L1 Gas Limit which also encodes the full fee because the gas price is set to 1 wei. The L2 gas price is encoded in the lower order bits of the
tx.gasLimit
using a scheme by which allows the L2 gas limit to be human readable as well as easily recoverable. The gas limits must follow the form:It also adds new functionality to the L2 GasPrice Oracle where it polls the L2 state for a particular storage slot for the current L2 gasprice. It is held in memory and is used to reject transactions coming in via RPC that have too low of a gas price. It is also used in the calculation of the fee for
eth_estimateGas
. (The fee is returned here becauseeth_gasPrice
returns 1). This gasprice can be updated via a transaction sent to theOVM_GasPriceOracle
contract, see #936It adds new config options:
"ROLLUP_GAS_PRICE_ORACLE_ADDRESS"
- address of theOVM_GasPriceOracle
"ROLLUP_ENABLE_L2_GAS_POLLING"
- allows for backwards compatibility by turning off the gas price polling"ROLLUP_ENFORCE_FEES"
- turns off accepting 0 gasprice transactionsA new RPC endpoint is added called
eth_estimateExecutionGas
that mimics the L1eth_estimateGas
. This will allow users to know how much gas a transaction will use without needing to decode the value from the L2eth_estimateGas
Some of the files got changed due to a
yarn lint
Metadata
eth_estimateGas
#823