feat(op-reth/txpool): reserve the Isthmus operator fee in pool balance check#21609
Open
asdv23 wants to merge 1 commit into
Open
feat(op-reth/txpool): reserve the Isthmus operator fee in pool balance check#21609asdv23 wants to merge 1 commit into
asdv23 wants to merge 1 commit into
Conversation
…e check `OpTransactionValidator::apply_op_checks` reserved only the L1 data fee (`l1_tx_data_fee`) when checking that a sender can afford a transaction, not the Isthmus operator fee. On a post-Isthmus OP chain a sender covering `L2 gas + value + L1 data fee` — but not the operator fee — was admitted to the pool and then failed at execution. op-geth already charges the operator fee in its txpool balance check (`NewOperatorCostFunc`/`NewTotalRollupCostFunc`, `core/types/rollup_cost.go`), so op-reth was behind op-geth here. Add `operator_fee_addition()` and fold it into `cost_addition`. It is guarded on Isthmus activation (via the spec resolved from chain spec + timestamp) AND the presence of both operator fee params — `L1BlockInfo::operator_fee_charge` `.expect()`s the scalar and constant, so it would panic when they are unset — so it returns zero (no panic) before Isthmus. Uses the tx gas limit (worst-case spend), matching op-geth's `tx.Gas()`. Pool-admission only: no block-validation / state-root / execution change. Sibling of the L1-info gas-limit reservation (ethereum-optimism#21546 / ethereum-optimism#21548).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Closes #21608.
OpTransactionValidator::apply_op_checks(rust/op-reth/crates/txpool/src/validator.rs) reserves only the L1 data fee (l1_tx_data_fee) when checking that a sender can afford a transaction, not the Isthmus operator fee. On a post-Isthmus OP chain a sender whose balance coversL2 gas + value + L1 data fee— but not the operator fee — is admitted to the pool and then fails at execution.operator_feedid not appear anywhere inrust/op-reth/crates/txpoolbefore this change.op-geth already charges the operator fee in its txpool balance check (
NewOperatorCostFunc/NewTotalRollupCostFunc,core/types/rollup_cost.go, combined viaTotalTxCostand used inValidateTransactionWithState), so op-reth was behind op-geth here.Change
operator_fee_addition()and fold its result intocost_additioninapply_op_checks.revm_spec_by_timestamp_after_bedrock) and the presence of both operator fee params.L1BlockInfo::operator_fee_charge.expect()s the scalar and constant, so it panics when they are unset (pre-Isthmus); the guard returns zero without calling it.gas_limit(worst-case spend), matching op-geth'stx.Gas().cost()is left untouched — the operator fee stays an overlay applied at the check site, exactly like the existing L1 data fee.Scope / safety
Pool-admission only — no block-validation / state-root / execution change, so no consensus impact. Sequencer-only concern (verifiers do not admit from the mempool). Returns to op-geth parity.
Not in scope
The cumulative pending-balance path (
PoolInternalTransaction::next_cumulative_costsums the intrinsiccost(), which omits both the L1 fee and the operator fee) is a separate concern and is not addressed here.Sibling of the L1-info gas-limit reservation: #21546 / #21548.
Tests
Unit tests for
operator_fee_addition:operator_fee_charge) when Isthmus active + params present;0x7E) input.cargo test -p reth-optimism-txpool(operator_fee tests) andcargo clippy -p reth-optimism-txpool --all-targetspass;cargo +nightly fmt --checkclean.