From f16dd7e07f365d335890ec10c03e6eaac353e1b2 Mon Sep 17 00:00:00 2001 From: qu0b Date: Tue, 24 Mar 2026 11:40:59 +0000 Subject: [PATCH] miner: fix BAL mutation tracking in applyTransaction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- miner/worker.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index 1a6e933edc..9f466ebfd6 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -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 {