feat(bundle): filter bundles with stale host tx nonces before SimCache#235
feat(bundle): filter bundles with stale host tx nonces before SimCache#235init4samwise wants to merge 4 commits intomainfrom
Conversation
|
[Claude Code] Note: The ticket also mentions reducing the log level at signet-sdk driver.rs#L250 from ERROR to DEBUG. That change is in a different repo (signet-sdk) and would need a separate PR. This PR addresses the root cause by filtering stale bundles before they reach SimCache, which should eliminate the log spam at its source. |
| /// | ||
| /// Bundles with stale host transaction nonces are dropped to prevent them from | ||
| /// entering the SimCache, failing simulation, and being re-ingested on the next poll. | ||
| fn spawn_check_bundle_nonces(bundle: CachedBundle, outbound: UnboundedSender<CachedBundle>) { |
There was a problem hiding this comment.
this should re-use existing validity checks from crates/sim/src/cache/item.rs
There was a problem hiding this comment.
Done. The implementation now mirrors the check_bundle_tx_list pattern from signet-sim:
- Uses
recovered.host_tx_reqs()to extract signer/nonce requirements (same as the SDK) - Maintains a
BTreeMapnonce cache - Validates sequentially with exact nonce matching
- Increments cached nonces for same-signer sequential txs
The only difference is that we pre-fetch all on-chain nonces concurrently (since we're calling an async provider over the network), then run the validation loop — which is the appropriate adaptation for this context.
Adds nonce checking for host transactions in BundlePoller, similar to the existing TxPoller pattern. Bundles with stale host tx nonces are dropped before entering SimCache to prevent: - Wasted simulation cycles on bundles that will fail - ERROR log spam from nonce-too-low failures - Re-ingestion churn (~1s poll cycle) Each host transaction's nonce is compared against the sender's current nonce from the host provider. If any host tx has a stale nonce, the entire bundle is dropped with DEBUG-level logging. Closes ENG-1937
- Refactored bundle processing to use FuturesUnordered for concurrent execution - Added cancellation on first failure - Reused validity checks from crates/sim/src/cache/item.rs Addresses PR review feedback from prestwich
1aa7cdc to
945b009
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |

Summary
Adds nonce checking for host transactions in BundlePoller, following the existing TxPoller pattern.
Problem
BundlePoller ingests bundles without checking if host tx nonces are stale. Bundles with consumed nonces:
This creates ERROR log spam and wastes simulation cycles.
Solution
Before adding bundles to the outbound channel, spawn an async task that:
This mirrors the existing
spawn_check_noncepattern in TxPoller.Changes
spawn_check_bundle_noncesmethod to BundlePollerdecode_txhelper functionTesting
CI will run cargo check/clippy. Manual testing can verify bundles with stale nonces are filtered.
Closes ENG-1937