From 6f2cc074ab64a81e5f3082801f7131ff02947568 Mon Sep 17 00:00:00 2001 From: sprites0 <199826320+sprites0@users.noreply.github.com> Date: Sat, 12 Jul 2025 17:11:46 +0000 Subject: [PATCH] fix: Explicitly mark all known address to be warm (node-builder) Will be reverted after #17 is resolved. --- src/node/evm/executor.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/node/evm/executor.rs b/src/node/evm/executor.rs index 52c8abfdb..19fa4d6da 100644 --- a/src/node/evm/executor.rs +++ b/src/node/evm/executor.rs @@ -10,7 +10,7 @@ use crate::{ use alloy_consensus::{Transaction, TxReceipt}; use alloy_eips::{eip7685::Requests, Encodable2718}; use alloy_evm::{block::ExecutableTx, eth::receipt_builder::ReceiptBuilderCtx}; -use alloy_primitives::{address, hex, Address, Bytes, U256}; +use alloy_primitives::{address, hex, Address, Bytes, U160, U256}; use reth_chainspec::{EthChainSpec, EthereumHardforks, Hardforks}; use reth_evm::{ block::{BlockValidationError, CommitChanges}, @@ -244,6 +244,7 @@ where EVM: Evm, Precompiles = PrecompilesMap>, DB: Database + 'a, { + let block_number = evm.block().number; let precompiles_mut = evm.precompiles_mut(); // For all precompile addresses just in case it's populated and not cleared // Clear 0x00...08xx addresses @@ -261,4 +262,22 @@ where })) }); } + + // NOTE: Hotfix for the precompile issue (#17). Remove this once the issue is fixed. + if block_number >= U256::from(7000000) { + fill_all_precompiles(ctx, precompiles_mut); + } +} + +fn fill_all_precompiles<'a>(ctx: &HlBlockExecutionCtx<'a>, precompiles_mut: &mut PrecompilesMap) { + for address in 0x800..=0x80D { + let address = Address::from(U160::from(address)); + if !ctx.read_precompile_calls.contains_key(&address) { + precompiles_mut.apply_precompile(&address, |_| { + Some(DynPrecompile::from(move |_: PrecompileInput| -> PrecompileResult { + Err(PrecompileError::OutOfGas) + })) + }); + } + } }