Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8aa8dff
Rework BatchTxPool functionality to a legitimate Ethereum tx mempool
m-Peter Aug 7, 2026
3e51723
Address review comments
m-Peter Aug 10, 2026
a843102
Log transaction submissions from BatchTxPool
m-Peter Aug 10, 2026
60450e7
Close the window between batch detachment and the lastSubmittedAt update
m-Peter Aug 10, 2026
1a08967
Deprecate --eoa-activity-cache-ttl CLI flag as it is no longer applic…
m-Peter Aug 11, 2026
427224b
Reject transactions with in-flight nonces
m-Peter Aug 11, 2026
8c8cd85
Solidify BatchTxPool rework: fix log tag, race, sizing, and add unit …
vishalchangrani Aug 10, 2026
d8b5af7
Revert logic change on staleEntry()
m-Peter Aug 11, 2026
1c5e411
Merge pull request #987 from onflow/vishal/mpeter/solidify-tx-mempool
m-Peter Aug 11, 2026
f9c164b
Move state index nonce read after the duplication, in-flight checks
m-Peter Aug 12, 2026
298b60e
Update comments on the new logic of BatchTxPool
m-Peter Aug 12, 2026
8941811
Remove unused from field from batchSubmission type
m-Peter Aug 12, 2026
686ae8f
Re-use eoaQueueEntry() in eoaEnqueueTxs()
m-Peter Aug 12, 2026
bf4c366
Move the cap check to just before the enqueue, so fast-path-eligible …
m-Peter Aug 12, 2026
01bfc16
Prune transactions that exceed the queue TTL
m-Peter Aug 12, 2026
aafa055
Cap retries per tx and drop with a WARN + TransactionsDropped after N…
m-Peter Aug 13, 2026
6f1b87e
Add unit tests for ErrTxPoolFull and the flush failure/success merge …
m-Peter Aug 13, 2026
a6844f1
Reset txQueue retries on submission success
m-Peter Aug 14, 2026
8529e5c
Update stalenessFactor so that it's about 10 seconds with the current…
m-Peter Aug 14, 2026
c21529e
Fix comment on eoaEnqueueTxs boolean value
m-Peter Aug 18, 2026
8ebe992
Move rollback of nonce range reservation to eoaEnqueueTxs()
m-Peter Aug 18, 2026
1e2b22e
Add comments on the fields of batchSubmission type
m-Peter Aug 18, 2026
dca6f94
Distinguish the 2 cases for fast-path submission for logging
m-Peter Aug 19, 2026
250bfaf
Guard elapsed spacing in processPooledTransactions() and add an E2E test
m-Peter Aug 19, 2026
cb4995e
test(requester): add BatchTxPool wedge -> recovery e2e test (#988)
vishalchangrani Aug 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ func (b *Bootstrap) StartAPIServer(ctx context.Context) error {
nonceProvider,
)
} else if b.config.TxBatchMode {
nonceProvider := requester.NewLocalNonceProvider(
b.config.FlowNetworkID,
b.storages.Registers,
b.storages.Blocks,
b.collector,
)
txPool, err = requester.NewBatchTxPool(
ctx,
b.client,
Expand All @@ -295,6 +301,7 @@ func (b *Bootstrap) StartAPIServer(ctx context.Context) error {
b.config,
b.collector,
b.keystore,
nonceProvider,
)
} else {
txPool, err = requester.NewSingleTxPool(
Expand Down
8 changes: 7 additions & 1 deletion cmd/run/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ var (
txStateValidation string
initHeight,
forceStartHeight uint64
eoaActivityCacheTTL time.Duration
)

func init() {
Expand Down Expand Up @@ -321,7 +322,7 @@ func init() {
Cmd.Flags().DurationVar(&cfg.TxRequestLimitDuration, "tx-request-limit-duration", time.Second*3, "Time interval upon which to enforce transaction submission rate limiting.")
Cmd.Flags().BoolVar(&cfg.TxBatchMode, "tx-batch-mode", false, "Enable batch transaction submission, to avoid nonce mismatch issues for high-volume EOAs.")
Cmd.Flags().DurationVar(&cfg.TxBatchInterval, "tx-batch-interval", time.Millisecond*1200, "Time interval upon which to submit the transaction batches to the Flow network.")
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.")
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.")
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.")
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.")
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.")
Expand All @@ -336,4 +337,9 @@ func init() {
if err != nil {
panic(err)
}

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.")
if err != nil {
panic(err)
}
}
4 changes: 0 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ type Config struct {
// TxBatchInterval is the time interval upon which to submit the transaction batches to the
// Flow network.
TxBatchInterval time.Duration
// EOAActivityCacheTTL is the 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.
EOAActivityCacheTTL time.Duration
// ExperimentalSoftFinalityEnabled enables the experimental soft finality feature which syncs
// EVM block and transaction data from the upstream Access node before the block is sealed.
// CAUTION: This feature is experimental and may return incorrect data in certain circumstances.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/ethereum/go-ethereum v1.17.4
github.com/goccy/go-json v0.10.4
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/holiman/uint256 v1.3.2
github.com/onflow/atree v0.16.1
github.com/onflow/cadence v1.10.5
Expand Down Expand Up @@ -98,6 +97,7 @@ require (
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/huandu/go-clone v1.6.0 // indirect
Expand Down
3 changes: 3 additions & 0 deletions models/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ var (
// configured maximum gap ahead of the EOA's on-chain nonce. Such a tx cannot
// execute until the gap fills, so it is rejected up front for fast feedback.
ErrNonceTooHigh = fmt.Errorf("%w: %s", ErrInvalid, "nonce too high")
// ErrTxPoolFull is returned when the per-EOA pool has reached its size cap
// and cannot accept another transaction until existing ones drain.
ErrTxPoolFull = fmt.Errorf("%w: %s", ErrInvalid, "transaction pool is full for this account")

// Storage errors

Expand Down
Loading
Loading