From f29ab597ef53fcc72a806c3e28af8a8125d9b3bd Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 6 Aug 2024 15:19:40 -0600 Subject: [PATCH 1/2] cheats: fix assume not precompile After the cancun hardfork, the point evaluation precompile was added at `address(10)` which the `assumeNotPrecompile` implementation did not take into account. Pectra is scheduled to include BLS precompiles and likely more precompiles will be introduced in other future hardforks. We might as well reserve the least significant byte for Ethereum precompiles, as the address space is large and there is no need to make calls from these addresses, and in return code will not break on new EVM specs. This was causing test failures in the Optimism test suite when we updated the EVM version to cancun. --- src/StdCheats.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/StdCheats.sol b/src/StdCheats.sol index f2933139..d093c5e3 100644 --- a/src/StdCheats.sol +++ b/src/StdCheats.sol @@ -322,8 +322,8 @@ abstract contract StdCheatsSafe { // Note: For some chains like Optimism these are technically predeploys (i.e. bytecode placed at a specific // address), but the same rationale for excluding them applies so we include those too. - // These should be present on all EVM-compatible chains. - vm.assume(addr < address(0x1) || addr > address(0x9)); + // These are reserved by Ethereum and may be on all EVM-compatible chains. + vm.assume(addr < address(0x1) || addr > address(0x100)); // forgefmt: disable-start if (chainId == 10 || chainId == 420) { From dab1435989f46223db6f63e9ac9821c157bd74ed Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Tue, 6 Aug 2024 16:11:19 -0600 Subject: [PATCH 2/2] cheats: update typo Use the address range of precomiples that testnets use, see https://github.com/eth-clients/holesky/blob/main/metadata/genesis.json --- src/StdCheats.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StdCheats.sol b/src/StdCheats.sol index d093c5e3..9d4b2e02 100644 --- a/src/StdCheats.sol +++ b/src/StdCheats.sol @@ -323,7 +323,7 @@ abstract contract StdCheatsSafe { // address), but the same rationale for excluding them applies so we include those too. // These are reserved by Ethereum and may be on all EVM-compatible chains. - vm.assume(addr < address(0x1) || addr > address(0x100)); + vm.assume(addr < address(0x1) || addr > address(0xff)); // forgefmt: disable-start if (chainId == 10 || chainId == 420) {