[SharovBot] fix(txpool): inject mined-tx senders into state diff to evict stale pending txns (AuRa/Gnosis)#19592
[SharovBot] fix(txpool): inject mined-tx senders into state diff to evict stale pending txns (AuRa/Gnosis)#19592Giulio2002 wants to merge 3 commits intomainfrom
Conversation
bf994fa to
5805d41
Compare
yperbasis
left a comment
There was a problem hiding this comment.
I'd prefer this to be fixed differently, namely for the the execution layer to emit state-diff UPSERT entries with the nonce changes for system transactions.
5805d41 to
91b8250
Compare
|
[SharovBot] Done, @yperbasis — updated to fix this at the execution layer as you suggested. Root cause: in stateWriter := state.NewWriter(se.doms.AsPutDel(se.applyTx), nil, txTask.TxNum)This meant that Fix: store the accumulator on The txpool workaround ( |
yperbasis
left a comment
There was a problem hiding this comment.
Did you check exec3_parallel?
… senders to evict stale pending txns
On AuRa/Gnosis Chain, block finalization (engine.Finalize) executes system
transactions (validator rewards, bridge calls, etc.) that advance sender
nonces. These state changes were NOT reaching the txpool state-diff batch
because the block-end stateWriter in exec3_serial.go was constructed with a
nil accumulator.
Fix: store the block's accumulator on serialExecutor (se.accumulator) and
pass it to the block-end stateWriter so that UpdateAccountData → ChangeAccount
calls during Finalize/FinalizeAndAssemble emit UPSERT entries into the batch.
The txpool then calls onSenderStateChange for those senders and evicts any
pending transactions whose nonces are now stale.
Changes:
- execution/stagedsync/exec3_serial.go:
- Add accumulator field to serialExecutor
- Set se.accumulator = accumulator alongside StartChange per block
- Pass se.accumulator to state.NewWriter in the block-end path
- txnprovider/txpool/pool.go:
- Remove txpool-level ensureMinedSendersInStateDiff workaround
- Restore original cache.OnNewBlock ordering
- txnprovider/txpool/pool_test.go:
- Update TestStalePendingEvictionViaMineNonce to test via correct
stateChanges from the EL (as now emitted after this fix)
This is the EL-level fix requested by @yperbasis on #19392/#19393.
91b8250 to
d4e35f9
Compare
|
[SharovBot] Yes, @yperbasis — applied the same fix to Added Also fixed the lint error: added |
[SharovBot]
This is the AuRa stale-pending fix (first half of the split requested by @yperbasis on #19393). The zombie-queued fix (second half) was addressed in #19449 (merged).
Implements the EL-level fix suggested by @yperbasis: make the execution layer emit state-diff UPSERT entries for system-transaction senders so the txpool evicts stale pending transactions naturally.
Root Cause
In
exec3_serial.go, the block-endstateWriteris constructed with a nil accumulator:This means that
engine.Finalize/engine.FinalizeAndAssemble— which execute AuRa system calls (validator rewards, bridge calls, etc.) — write account changes to the DB but do not emitUPSERTentries into the accumulator. The accumulator batch is what gets forwarded to the txpool asstateChanges, so the txpool never learns that those senders' nonces advanced.As a result:
stateChanges.ChangeBatchonSenderStateChangeis never called for themnonce too low, and produce empty or near-empty blocksObserved on Gnosis Chain validator nodes.
Fix
Store the block accumulator on
serialExecutorand pass it to the block-endstateWriter:Now
UpdateAccountData→ChangeAccountcalls duringFinalizeemit UPSERT entries into the batch. The txpool receives the correct stateChanges andonSenderStateChangefires for system-tx senders, evicting stale pending transactions.Changes
execution/stagedsync/exec3_serial.go: addaccumulatorfield toserialExecutor; set it per block; pass it to the block-endstateWritertxnprovider/txpool/pool.go: no txpool changes (previous workaround removed)txnprovider/txpool/pool_test.go:TestStalePendingEvictionViaMineNonceregression testTesting
Related
release/3.3will follow after merge