fix: pre-warm Tempo precompile accounts in fork mode to prevent invariant hang #259
+92
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes invariant test runner hanging indefinitely when using
--fork-urlagainst a Tempo RPC.Closes #251
Motivation
Tempo precompile addresses (
0xDEc0...,0x20C0...) are Rust-native precompiles with no real EVM bytecode on-chain. The RPC returns empty code (0x) or sentinel bytecode (0xef) for these addresses.In fork mode, the
SharedBackendsends RPC requests for every uncached account/storage access usingtokio::task::block_in_place()+recv(). During invariant fuzzing — which involves many rapid executor clone + snapshot/revert cycles — the repeated cache misses for precompile addresses create a pathological RPC storm that effectively hangs the test runner.Simple fork tests work because they only touch precompile addresses a few times and the responses are fast enough. Invariant fuzzing amplifies the problem by orders of magnitude.
Changes
crates/evm/evm/src/tempo.rs: addwarm_tempo_precompile_accounts()which pre-populates sentinel bytecode (0xef) into the local fork cache for all known precompile (0xDEc0...) and TIP20 token (0x20C0...) addresses. Gated to known Tempo chain IDs only.crates/forge/src/runner.rs: call the warm function in fork mode (else branch of the existing precompile init guard).Testing
cargo check -p foundry-evm -p forge✓cargo clippy -p foundry-evm -p forge -- -D warnings✓eth_getCodereturns0xfor StablecoinDEX,0xeffor TIP20 tokensThread: https://tempoxyz.slack.com/archives/C0A87C21805/p1770734618130419