Skip to content

feat: sample one tx per type and guard against reorgs - #39

Merged
mattsse merged 1 commit into
mainfrom
matt/tx-sampling-reorg-guard
Aug 24, 2026
Merged

feat: sample one tx per type and guard against reorgs#39
mattsse merged 1 commit into
mainfrom
matt/tx-sampling-reorg-guard

Conversation

@mattsse

@mattsse mattsse commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Two structural improvements from #29. Default transaction sampling previously took the first transaction of each block, which on busy chains is disproportionately the same kind of searcher activity; it now samples the first transaction of each distinct type present in the block, so rarer types (legacy, blob, 7702) get coverage of their serialization and execution paths at a fraction of the cost of --use-all-txes, whose behavior is unchanged.

fetch_block previously trusted rpc2's view of the chain without checking that rpc1 agrees, so a reorg mid-run made every downstream comparison diff at once with no indication of the cause. It now compares the canonical hash on both nodes, retries a few times to let transient tip reorgs settle, and fails with an explicit divergence error naming both hashes if the nodes never converge.

Stacked on #38. Part of #29

@mattsse
mattsse force-pushed the matt/tx-sampling-reorg-guard branch from f930a3c to 5815eef Compare August 13, 2026 16:17
@mattsse
mattsse force-pushed the matt/tx-sampling-reorg-guard branch from 5815eef to b6f138c Compare August 13, 2026 22:43
@mattsse
mattsse force-pushed the matt/tx-sampling-reorg-guard branch from b6f138c to 1133b37 Compare August 14, 2026 00:08
@mattsse
mattsse changed the base branch from matt/block-tags to main August 24, 2026 09:17
Default sampling now picks the first transaction of each distinct type
in a block instead of just the first transaction, which is often the
same kind of searcher activity. fetch_block now verifies both nodes
agree on the canonical block hash, retrying transient reorgs and
failing with a clear error on persistent divergence instead of
producing confusing diffs on every downstream call.
@mattsse
mattsse force-pushed the matt/tx-sampling-reorg-guard branch from 1133b37 to 82dff7f Compare August 24, 2026 09:19
@mattsse
mattsse merged commit dc9f923 into main Aug 24, 2026
6 checks passed
@mattsse
mattsse deleted the matt/tx-sampling-reorg-guard branch August 24, 2026 09:20
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