Skip to content

fix: create alias oracle once per block instead of per address#102

Merged
prestwich merged 2 commits intodevelopfrom
fix/alias-oracle-per-block
Mar 13, 2026
Merged

fix: create alias oracle once per block instead of per address#102
prestwich merged 2 commits intodevelopfrom
fix/alias-oracle-per-block

Conversation

@prestwich
Copy link
Member

@prestwich prestwich commented Mar 13, 2026

Summary

Performance fix: creates the alias oracle once per block instead of once per address lookup.

  • Moves AliasOracleFactory::create() before the address loop so all addresses in a block are checked against the same host state snapshot
  • Removes the now-unused should_alias helper method
  • Expands the code comment in RethAliasOracleFactory::create() with a full correctness analysis of why Latest is safe (EOA→contract transitions require a birthday attack, and even then the failure mode is benign over-aliasing)

Previously, each address in a block called create()state_by_block_number_or_tag(Latest), opening a new state snapshot per address. Now a single snapshot is shared across the block.

Linear: ENG-2037

Test plan

  • cargo clippy -p signet-block-processor --all-features --all-targets
  • cargo clippy -p signet-node --all-features --all-targets
  • cargo +nightly fmt
  • cargo t -p signet-block-processor
  • cargo t -p signet-node
  • cargo t -p signet-node-tests

🤖 Generated with Claude Code

AliasOracleFactory::create() was called for every address in the
transaction loop, causing each check to potentially see different host
state. Move the create() call before the loop so all addresses in a
block are checked against the same state snapshot.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@prestwich prestwich requested a review from a team as a code owner March 13, 2026 18:05
Explain why Latest is safe (EOAs can't become contracts without a
birthday attack), the only risk (computationally infeasible collision),
and why over-aliasing is benign compared to under-aliasing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@prestwich prestwich merged commit d7be452 into develop Mar 13, 2026
6 checks passed
prestwich added a commit that referenced this pull request Mar 13, 2026
- Remove `should_alias` helper that recreated the oracle per address,
  restoring the fix from #102 (create oracle once per block)
- Revert unrelated rpc/interest changes back to develop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants