fix: Explicitly mark all known address to be warm

Will be reverted after #17 is resolved.
This commit is contained in:
sprites0
2025-07-12 16:01:09 +00:00
parent 88a58a5c81
commit 716215d8b1

View File

@ -22,6 +22,7 @@ use alloy_consensus::{BlockHeader, Header};
use alloy_evm::eth::EthEvmContext; use alloy_evm::eth::EthEvmContext;
pub use alloy_evm::EthEvm; pub use alloy_evm::EthEvm;
use alloy_primitives::Address; use alloy_primitives::Address;
use alloy_primitives::U160;
use alloy_primitives::U256; use alloy_primitives::U256;
use core::{convert::Infallible, fmt::Debug}; use core::{convert::Infallible, fmt::Debug};
use parking_lot::RwLock; use parking_lot::RwLock;
@ -265,7 +266,18 @@ impl EvmFactory<EvmEnv> for HyperliquidEvmFactory {
input.block_env.number, input.block_env.number,
) )
.expect("Failed to collect a submitted block. If sourcing locally, make sure your local hl-node is producing blocks."); .expect("Failed to collect a submitted block. If sourcing locally, make sure your local hl-node is producing blocks.");
let cache = block.read_precompile_calls; let mut cache: HashMap<_, _> = block
.read_precompile_calls
.into_iter()
.map(|(address, calls)| (address, HashMap::from_iter(calls.into_iter())))
.collect();
// NOTE: Hotfix but semantically correct. Will be removed once hl-node pipeline is updated (#17)
if input.block_env.number >= 7000000 {
for i in 0x800..=0x80D {
cache.entry(Address::from(U160::from(i))).or_insert(HashMap::new());
}
}
let evm = Context::mainnet() let evm = Context::mainnet()
.with_db(db) .with_db(db)
@ -274,12 +286,7 @@ impl EvmFactory<EvmEnv> for HyperliquidEvmFactory {
.build_mainnet_with_inspector(NoOpInspector {}) .build_mainnet_with_inspector(NoOpInspector {})
.with_precompiles(ReplayPrecompile::new( .with_precompiles(ReplayPrecompile::new(
EthPrecompiles::default(), EthPrecompiles::default(),
Arc::new(RwLock::new( Arc::new(RwLock::new(cache)),
cache
.into_iter()
.map(|(address, calls)| (address, HashMap::from_iter(calls.into_iter())))
.collect(),
)),
)); ));
EthEvm::new(evm, false) EthEvm::new(evm, false)