miner: restore GasUsed assignment in applyTransaction (#34082)

## Summary

- The BAL refactoring in 5808d212b 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
This commit is contained in:
Stefan 2026-03-24 14:05:50 +01:00 committed by GitHub
parent b3113baec8
commit 974844c8d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -442,12 +442,6 @@ func (miner *Miner) applyTransaction(env *environment, tx *types.Transaction) (*
snap = env.state.Snapshot()
gp = env.gasPool.Snapshot()
)
var stateCopy *state.StateDB
if env.accessList != nil {
stateCopy = env.state.WithReader(state.NewReaderWithTracker(env.state.Reader()))
env.evm.StateDB = stateCopy
}
mutations, receipt, err := core.ApplyTransaction(env.evm, env.gasPool, env.state, env.header, tx)
if err != nil {
if env.accessList != nil {
@ -461,6 +455,7 @@ func (miner *Miner) applyTransaction(env *environment, tx *types.Transaction) (*
env.accessList.AccumulateMutations(mutations, uint16(env.tcount)+1)
env.accessList.AccumulateReads(env.state.Reader().(state.StateReaderTracker).GetStateAccessList())
}
env.header.GasUsed = env.gasPool.Used()
return receipt, err
}