You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Rework BatchTxPool functionality to a legitimate Ethereum tx mempool (#986)
* Rework BatchTxPool functionality to a legitimate Ethereum tx mempool
* Address review comments
* Log transaction submissions from BatchTxPool
* Close the window between batch detachment and the lastSubmittedAt update
* Deprecate --eoa-activity-cache-ttl CLI flag as it is no longer applicable
* Reject transactions with in-flight nonces
* Solidify BatchTxPool rework: fix log tag, race, sizing, and add unit tests
- flush success log tagged as flushReasonPrefix (metric already correct)
- flush success/failure paths merge lastSubmittedNonce/At with max() so a
concurrent Add() fast-path is never regressed by a stale ack or rollback
- eoaEnqueueTxs preserves an existing same-nonce entry: last-write-wins
keeps a client's fresher payload over a re-queued failed batch
- rename maxEOAPoolSize -> maxNonceLookahead (that's what it enforces and
add a real per-EOA size cap at admission time via maxEOAQueueSize +
ErrTxPoolFull
- staleEntry no longer marks a freshly-created queue (zero lastSubmittedAt)
as stale
- selectSequentialNonces walks the nonce-keyed map directly (O(k)) instead
of sorting the full queue every tick
- add batch_tx_pool_test.go: txQueue primitives + rollback preserve-fresh
* Revert logic change on staleEntry()
* Move state index nonce read after the duplication, in-flight checks
* Update comments on the new logic of BatchTxPool
* Remove unused from field from batchSubmission type
* Re-use eoaQueueEntry() in eoaEnqueueTxs()
* Move the cap check to just before the enqueue, so fast-path-eligible txs bypass it
* Prune transactions that exceed the queue TTL
* Cap retries per tx and drop with a WARN + TransactionsDropped after N attempts
* Add unit tests for ErrTxPoolFull and the flush failure/success merge branches
* Reset txQueue retries on submission success
* Update stalenessFactor so that it's about 10 seconds with the current tx-batch-interval
* Fix comment on eoaEnqueueTxs boolean value
Co-authored-by: Leo Zhang <zhangchiqing@gmail.com>
* Move rollback of nonce range reservation to eoaEnqueueTxs()
* Add comments on the fields of batchSubmission type
* Distinguish the 2 cases for fast-path submission for logging
* Guard elapsed spacing in processPooledTransactions() and add an E2E test
* test(requester): add BatchTxPool wedge -> recovery e2e test (#988)
Reproduces the wedge state from #983 (Cadence wrapper reverts before
advancing state, leaving the pool's in-flight marker ahead of the
on-chain frontier) and asserts BatchTxPool clears it within
TxBatchInterval*stalenessFactor. Auto-mine is disabled so the pool's
staleEntry timing is exposed - otherwise validateTransactionWithState
preempts once state catches up, masking the pool's recovery.
This is the counterpart to Test_BatchTxPool_InFlightNonceRejection,
which only verifies the wedge state is entered, not that it recovers.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: vishal <1117327+vishalchangrani@users.noreply.github.com>
Co-authored-by: Leo Zhang <zhangchiqing@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: cmd/run/cmd.go
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -281,6 +281,7 @@ var (
281
281
txStateValidationstring
282
282
initHeight,
283
283
forceStartHeightuint64
284
+
eoaActivityCacheTTL time.Duration
284
285
)
285
286
286
287
funcinit() {
@@ -321,7 +322,7 @@ func init() {
321
322
Cmd.Flags().DurationVar(&cfg.TxRequestLimitDuration, "tx-request-limit-duration", time.Second*3, "Time interval upon which to enforce transaction submission rate limiting.")
322
323
Cmd.Flags().BoolVar(&cfg.TxBatchMode, "tx-batch-mode", false, "Enable batch transaction submission, to avoid nonce mismatch issues for high-volume EOAs.")
323
324
Cmd.Flags().DurationVar(&cfg.TxBatchInterval, "tx-batch-interval", time.Millisecond*1200, "Time interval upon which to submit the transaction batches to the Flow network.")
324
-
Cmd.Flags().DurationVar(&cfg.EOAActivityCacheTTL, "eoa-activity-cache-ttl", time.Second*10, "Time interval used to track EOA activity. Tx send more frequently than this interval will be batched. Useful only when batch transaction submission is enabled.")
325
+
Cmd.Flags().DurationVar(&eoaActivityCacheTTL, "eoa-activity-cache-ttl", time.Second*10, "Time interval used to track EOA activity. Tx send more frequently than this interval will be batched. Useful only when batch transaction submission is enabled.")
325
326
Cmd.Flags().BoolVar(&cfg.ExperimentalSoftFinalityEnabled, "experimental-soft-finality-enabled", false, "Sets whether the gateway should use the experimental soft finality feature. This results in faster indexing time, because EVM state is fetched from finalized, instead of sealed Flow blocks.")
326
327
Cmd.Flags().BoolVar(&cfg.ExperimentalSealingVerificationEnabled, "experimental-sealing-verification-enabled", false, "Sets whether the gateway should use the experimental soft finality sealing verification feature. This is an extra safety check for --experimental-soft-finality-enabled=true, which verifies that all finalized Flow blocks that were indexed, have eventually been sealed. The ingestion will halt, even if a single Flow block was not found to be sealed.")
327
328
Cmd.Flags().BoolVar(&cfg.TxMemPoolMode, "tx-mempool-mode", false, "Enable the transaction mempool: expected-nonce transactions are submitted immediately, out-of-order transactions are held until their nonce gap fills. Mutually exclusive with --tx-batch-mode and requires --tx-state-validation=local-index.")
@@ -336,4 +337,9 @@ func init() {
336
337
iferr!=nil {
337
338
panic(err)
338
339
}
340
+
341
+
err=Cmd.Flags().MarkDeprecated("eoa-activity-cache-ttl", "This flag is no longer applicable and will be removed in future version. EOA activity is now preserved in a dedicated per-EOA queue, and not in a cache.")
0 commit comments