Skip to content

feat(bundle): filter bundles with stale host tx nonces before SimCache#235

Open
init4samwise wants to merge 1 commit intomainfrom
samwise/eng-1937-bundle-nonce-filter
Open

feat(bundle): filter bundles with stale host tx nonces before SimCache#235
init4samwise wants to merge 1 commit intomainfrom
samwise/eng-1937-bundle-nonce-filter

Conversation

@init4samwise
Copy link
Contributor

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:

  1. Get added to SimCache
  2. Fail simulation with "nonce too low"
  3. Get removed
  4. Re-ingested on next poll (~1s)

This creates ERROR log spam and wastes simulation cycles.

Solution

Before adding bundles to the outbound channel, spawn an async task that:

  1. Decodes each host transaction
  2. Recovers the sender address
  3. Fetches current nonce from host provider
  4. Drops bundle if any host tx has stale nonce (tx_nonce < provider_nonce)

This mirrors the existing spawn_check_nonce pattern in TxPoller.

Changes

  • Added spawn_check_bundle_nonces method to BundlePoller
  • Added decode_tx helper function
  • Updated task loop to use nonce checking before forwarding bundles
  • Uses DEBUG-level logging for dropped bundles (not ERROR)

Testing

CI will run cargo check/clippy. Manual testing can verify bundles with stale nonces are filtered.


Closes ENG-1937

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
@init4samwise
Copy link
Contributor Author

[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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant