diff --git a/src/evm/contract_utils.rs b/src/evm/contract_utils.rs index 3a3358ba..42e01845 100644 --- a/src/evm/contract_utils.rs +++ b/src/evm/contract_utils.rs @@ -1246,18 +1246,14 @@ impl ContractLoader { } } - evm_executor.host.env.block.number = EVMU256::from( - u64::from_str_radix( - &onchain_middleware - .as_ref() - .unwrap() - .endpoint - .block_number - .trim_start_matches("0x"), - 16, - ) - .unwrap(), - ); + match &onchain_middleware { + Some(onchain) => { + evm_executor.host.env.block.number = EVMU256::from( + u64::from_str_radix(onchain.endpoint.block_number.trim_start_matches("0x"), 16).unwrap(), + ); + } + None => {} + } SetupData { evmstate: new_vm_state,