Skip to content

feat(p2p): deduplicate on-demand TX validation#23377

Open
fcarreiro wants to merge 2 commits into
merge-train/spartanfrom
fc/deduplicate-tx-validation
Open

feat(p2p): deduplicate on-demand TX validation#23377
fcarreiro wants to merge 2 commits into
merge-train/spartanfrom
fc/deduplicate-tx-validation

Conversation

@fcarreiro
Copy link
Copy Markdown
Contributor

@fcarreiro fcarreiro commented May 18, 2026

Summary

  • Introduces a shared transaction validation cache (SharedTxValidationCache) used by tx collection sources to deduplicate concurrent validation by tx hash.
  • Validations for different claimed hashes are done in parallel.
  • Validations for the same hash are serialized, successful outcomes are cached and subsequent duplicates are skipped, while invalid outcomes are intentionally not cached to avoid poisoning by forged txs.
  • Wires the cache into BatchTxRequester (and injectable options) so batch tx handling uses shared deduped validation results before enqueueing fetched txs.
  • Updates requester behavior around peer handling and response processing to work with validation outcomes and preserve correct smart/dumb peer transitions.

Testing

  • Adds comprehensive unit tests for SharedTxValidationCache (accept/invalid/skip behavior, same-hash serialization, cross-source dedup, thrown validator handling).
  • Updates BatchTxRequester tests to exercise cache-driven validation outcomes and invalid-transaction peer penalization paths.
  • Updates integration coverage in p2p_client.integration_batch_txs.test.ts to inject/use the shared validation cache in batch requester flows.

NOTE: Cache is an LRU set.

Closes https://linear.app/aztec-labs/issue/A-934/dont-repeatedly-verify-retrieved-transactions .

Copy link
Copy Markdown
Contributor Author

fcarreiro commented May 18, 2026

@fcarreiro fcarreiro force-pushed the fc/deduplicate-tx-validation branch 2 times, most recently from 936aeb8 to 373777f Compare May 19, 2026 16:04
@fcarreiro fcarreiro force-pushed the fc/simplify-IBatchRequestTxValidator branch from 3f8f813 to 9939045 Compare May 19, 2026 16:04
@fcarreiro fcarreiro force-pushed the fc/deduplicate-tx-validation branch from 373777f to 5c42586 Compare May 19, 2026 16:04
@fcarreiro fcarreiro force-pushed the fc/deduplicate-tx-validation branch 4 times, most recently from 859f17d to c63a8c2 Compare May 20, 2026 17:12
@fcarreiro fcarreiro force-pushed the fc/simplify-IBatchRequestTxValidator branch from 9939045 to a059397 Compare May 20, 2026 17:12
Base automatically changed from fc/simplify-IBatchRequestTxValidator to merge-train/spartan May 20, 2026 17:16
@fcarreiro fcarreiro force-pushed the fc/deduplicate-tx-validation branch from c63a8c2 to 4674334 Compare May 20, 2026 17:16
@fcarreiro fcarreiro force-pushed the fc/deduplicate-tx-validation branch from 4674334 to 67ebb97 Compare May 21, 2026 13:51
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