Repository navigation
Description
Migrated from SergioDemianLerner/rustock#340 (pull request by @SDL-A1, 2026-11-01).
Merged: yes. The commits are already in this repository's history.
Original: SergioDemianLerner/rustock#340
Two findings reported by an rskj developer. One is a consensus bug; the other is what fed it. Work done by another agent and reviewed here — what I verified is at the bottom.
1. The miner did not apply RSKIP252
BlockTxsMaxGasPriceRule rejects any block carrying a transaction priced above 100× the block's minimumGasPrice. Rustock enforced it on import but never on the blocks it sealed itself — select_transactions dropped transactions below the minimum and nothing else.
That is the worst shape a miner bug takes: the node seals a block, spends the work, and every validator refuses it. The reported run produced 138 such blocks.
The fix computes a ceiling alongside the existing floor, reproducing both of TxGasPriceCap.isSurpassed's short-circuits — no cap before RSKIP252 activates, and no cap when the block's minimum is zero, which is what keeps regtest from having its whole pool dropped. The multiplier comes from BlockTxsMaxGasPriceRule::FOR_BLOCK_MULTIPLIER rather than a literal, so miner and validator cannot drift.
2. eth_gasPrice ignored the fee-market gate
rskj's EthereumImpl.getGasPrice answers with the tracker's percentile only when isFeeMarketWorking() — last 50 blocks averaging 90% full — and otherwise with the head's minimum × 1.1. Rustock returned the tracker unconditionally.
The tracker's window is 512 transactions with no age limit, so it outlives the conditions that filled it. Seeded from mainnet and then run on a quiet chain:
rskj 645 wei
rustock 26,065,600 wei 44,000x the block minimum
Which is how k6 came to price transactions over the cap the miner then failed to reject. The two findings are one story.
GasPriceSource gains is_fee_market_working(); eth_gas_price consults it. The no-tracker fallback also gains the 1.1 multiplier rskj applies on every non-tracker branch, which changes one existing expectation from 0x387ee40 to 0x3e252e0.
What I verified rather than took on trust
- rskj's miner really does filter both ends —
MinerUtils.filterTransactions→isHighGasPriced→TxGasPriceCap.FOR_BLOCK.isSurpassed, gated onisRskip252Enabled. TxGasPriceCap:FOR_BLOCK(100), REMASC short-circuit, zero-minimum short-circuit, strict>. Our import rule matches all four, and the new miner filter mirrors it.EthereumImpl.getGasPrice: both branches are as described.- The two activation-height sources agree —
activation_heights.fingerroot500andBlockProcessor::rskip252_height()are 5,468,000 / 4,015,800 / 0 on mainnet, testnet and regtest. The miner cannot disagree with the local validator today. Two sources for one height is still a latent trap; left alone deliberately, since collapsing them inside a consensus fix is the wrong place for it. - Mutation-checked the consensus test myself. Removing the ceiling fails
transactions_over_the_cap_are_not_minedwiththe one a wei over the cap is not: [100001, 50000, 100000, 0], exactly as the handoff reported. The test asserts the sealed block passesBlockTxsMaxGasPriceRuleandprocess_block, which is the right oracle — not a hand-written list. - 2,471 workspace tests pass, clippy clean.
One thing I changed
The fallback's constants cited GasPriceTracker.BLOCK_PRICE_MULTIPLIER, which does not exist in rskj. Two constants hold 1.1 and this branch uses the other: EthereumImpl.minGasPriceMultiplier, from the gasPriceMultiplier config key. Value unaffected — both are 1.1 — but in a file that exists to mirror rskj the citation is the load-bearing part.
The corrected comment also records that an rskj operator can retune gasPriceMultiplier and this node cannot, a divergence reachable only by changing that setting.
Not done
- The 138 already-sealed blocks are not cleaned up. This stops more being produced; a datadir holding that chain should be discarded, not re-synced from.
- The two-sources-of-truth activation height is untouched.
- No audit of whether other import rules lack a miner-side counterpart. The gap here was structural — the miner applied one half of a two-sided rule — and that question is worth asking of the rest.
🤖 Generated with Claude Code
Activity