Skip to content

miner: restore GasUsed assignment in applyTransaction#34082

Merged
MariusVanDerWijden merged 2 commits into
ethereum:bal-devnet-3from
qu0b:qu0b/fix/miner-gasused
Mar 24, 2026
Merged

miner: restore GasUsed assignment in applyTransaction#34082
MariusVanDerWijden merged 2 commits into
ethereum:bal-devnet-3from
qu0b:qu0b/fix/miner-gasused

Conversation

@qu0b
Copy link
Copy Markdown
Contributor

@qu0b qu0b commented Mar 24, 2026

Summary

  • The BAL refactoring in 5808d21 removed the line env.header.GasUsed = env.gasPool.Used() from applyTransaction(), causing all geth-proposed blocks to have GasUsed=0 in the header
  • Every other client rejects these blocks during validation, so geth can never successfully propose on the network
  • Restores the single line that was present in upstream master

Test plan

  • Verified line exists in upstream/master at miner/worker.go:409
  • Confirmed all 34 geth-proposed blocks on a 4-client devnet had GasUsed=0 via debug_getBadBlocks on besu
  • Build local image and verify geth proposals are accepted in a multi-client Kurtosis network

The BAL refactoring in 5808d21 removed the line that sets
header.GasUsed = gasPool.Used() after each transaction in the
miner's applyTransaction. This caused all geth-proposed blocks
to have GasUsed=0 in the header, which every other client
rejects during validation.
The WithReader() call creates a deep copy (Copy()) of the StateDB
per-tx. Mutations are captured from the copy, but the copy is
discarded — so env.state never accumulates state changes across txs.
This causes coinbase balance in BAL entries to not reflect priority
fee accumulation from prior transactions.

Fix: remove the stateCopy/WithReader path. Execute directly on
env.state (which already has a tracked reader from makeEnv), matching
the sequential state processor's approach.
@MariusVanDerWijden MariusVanDerWijden merged commit 974844c into ethereum:bal-devnet-3 Mar 24, 2026
2 of 3 checks passed
jwasinger pushed a commit to jwasinger/go-ethereum that referenced this pull request Mar 31, 2026
## Summary

- The BAL refactoring in 5808d21 removed the line `env.header.GasUsed
= env.gasPool.Used()` from `applyTransaction()`, causing all
geth-proposed blocks to have `GasUsed=0` in the header
- Every other client rejects these blocks during validation, so geth can
never successfully propose on the network
- Restores the single line that was present in upstream master

## Test plan

- [x] Verified line exists in upstream/master at miner/worker.go:409
- [x] Confirmed all 34 geth-proposed blocks on a 4-client devnet had
`GasUsed=0` via `debug_getBadBlocks` on besu
- [ ] Build local image and verify geth proposals are accepted in a
multi-client Kurtosis network
jwasinger pushed a commit to jwasinger/go-ethereum that referenced this pull request Mar 31, 2026
## Summary

- The BAL refactoring in 5808d21 removed the line `env.header.GasUsed
= env.gasPool.Used()` from `applyTransaction()`, causing all
geth-proposed blocks to have `GasUsed=0` in the header
- Every other client rejects these blocks during validation, so geth can
never successfully propose on the network
- Restores the single line that was present in upstream master

## Test plan

- [x] Verified line exists in upstream/master at miner/worker.go:409
- [x] Confirmed all 34 geth-proposed blocks on a 4-client devnet had
`GasUsed=0` via `debug_getBadBlocks` on besu
- [ ] Build local image and verify geth proposals are accepted in a
multi-client Kurtosis network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants