-
Notifications
You must be signed in to change notification settings - Fork 30
Sequencer Fee Pricing Part 2: Electric Boogaloo: Override EstimateGas to take data price into account #273
Conversation
e859f35 to
6c7971a
Compare
6c7971a to
8089d62
Compare
tynes
left a comment
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.
This approach generally looks good so far
karlfloersch
left a comment
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.
Awesome! This looks great to me so far! Structure seems pretty perfect. I'm curious what is going wrong with the unit tests though hmm
8089d62 to
2ebd400
Compare
da52ce3 to
5081b63
Compare
716f75f to
a5c0c86
Compare
tynes
left a comment
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.
Generally looks good to me, left a few comments
core/rollup_fee.go
Outdated
| /// ROLLUP_BASE_TX_SIZE is the encoded rollup transaction's compressed size excluding | ||
| /// the variable length data. | ||
| /// Ref: https://github.com/ethereum-optimism/contracts/blob/409f190518b90301db20d0d4f53760021bc203a8/contracts/optimistic-ethereum/OVM/precompiles/OVM_SequencerEntrypoint.sol#L47 | ||
| var ROLLUP_BASE_TX_SIZE int = 96 |
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.
This will likely need to change due to ethereum-optimism/contracts#300
Also what do you think about making this a const?
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.
👍 if that PR gets merged first, I'll adjust it. This means I'll have to serialize the transaction each time, instead of assuming that the data is constant size right?
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.
Yup, will need to rlp.EncodeToBytes and use the length of that -
Line 70 in 2e46827
| func EncodeToBytes(val interface{}) ([]byte, error) { |
5081b63 to
117494d
Compare
b236ab7 to
f6bf300
Compare
f6bf300 to
479d23c
Compare
ba71677 to
aaa0a34
Compare
* experimenting with gas fudge factor * fix formatting * try using 1m gas constant * Add log statement for the gas estimate * Add more detail to gas estimate log * one more log edit * Try new formula * Bump base gas * Even more base gas * even more * Just 1m? * one more time * Final cleanup * Minor fix * Update internal/ethapi/api.go * don't use cap-1 * Make sure data is not nil Co-authored-by: Karl Floersch <[email protected]>
…vice (#277) * feat: pull L1GasPrice from the data transport service * refactor: split out single-iteration of sequencer loop * test(sync-service): ensure L1GasPrice is set correctly * chore: gofmt * fix: parse json response as string and test
* do not cast gasUsed * adjust comment on GasPrice method * add nil check for args.Data * log gas price changes in the sync service
e99fba1 to
32a4e5d
Compare
Security Question: does this introduce a DoS vector?
| // whitelisted, preventing any associated transaction from being dropped out of the pool | ||
| // due to pricing constraints. | ||
| func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err error) { | ||
| log.Debug("received tx", "gas", tx.Gas(), "gasprice", tx.GasPrice().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.
Transactions are not added to the TxPool so this should never log
karlfloersch
left a comment
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.
LGTM
Description
Fixes https://github.com/ethereum-optimism/roadmap/issues/715:
rollupTxSize * dataPrice + executionPrice * gasUsed, whereexecutionPriceis fetched via the standardeth_gasPricerules that geth uses based on the current l2 congestion, anddataPriceis a value set by the sequencer based on the current l1 congestion.gasUsedis the standard result ofeth_estimateGasfor a transaction, androllupTxSizeis the size of the serialized rollup tx if it were published on L1rollup_personalnamespace via asetL1GasPricemethod. This approach is nice because the gasPrice is stored in memory, configurable via CLI/RPC and requires nothing else.