Skip to content

Commit e7f916c

Browse files
authored
[SharovBot] fix(txpool): reduce P2P message batch flush interval from 1s to 250ms (#19377)
**[SharovBot]** > **Draft** — running hive `engine/cancun` test 100× before marking ready for review ## Problem The hive test **"Blob Transaction Ordering, Multiple Clients (Cancun)"** intermittently fails with: ``` FAIL: Error verifying blob bundle (payload 1/5): expected 6 blob, got 5 ``` Root cause: `fetch.go`'s `receiveMessage` batches ALL inbound P2P messages and flushes them via a ticker set to **1 second**. Combined with `processRemoteTxnsEvery = 100ms`, worst-case latency from P2P receipt to pool inclusion is **~1.1 seconds**. The hive test sends 1-blob transactions to Client B which must gossip to Client A before Client A builds the payload (`GetPayloadDelay: 2s` window). With 1.1s worst-case latency the margin is only 0.9s — sometimes not enough in the docker test environment. ## Fix Reduce the batch flush ticker from **1s → 250ms**. Worst-case latency drops to **~350ms**, giving ~1.65s margin within the 2-second payload window. ```diff -ticker := time.NewTicker(1 * time.Second) +ticker := time.NewTicker(250 * time.Millisecond) ``` ## Testing Running hive `engine/cancun` test 100 times on this branch. Will mark ready for review once all pass. Fixes: https://github.com/erigontech/erigon/actions/runs/22242447860/job/64349011577
1 parent 2c163e4 commit e7f916c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

txnprovider/txpool/fetch.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,12 @@ func (f *Fetch) receiveMessage(ctx context.Context, sentryClient sentryproto.Sen
229229
}
230230
}
231231

232-
// Start ticker goroutine to flush batch every second
233-
ticker := time.NewTicker(1 * time.Second)
232+
// Start ticker goroutine to flush batch.
233+
// Reduced from 1s to 250ms to lower worst-case latency between receiving
234+
// a POOLED_TRANSACTIONS_66 response and the transaction entering the pool.
235+
// This matters for block builders that need freshly-gossiped transactions
236+
// (e.g. multi-client blob tx ordering tests with a 2s payload window).
237+
ticker := time.NewTicker(250 * time.Millisecond)
234238
defer ticker.Stop()
235239
go func() {
236240
for {

0 commit comments

Comments
 (0)