Skip to content

Commit

Permalink
cheats: fix assume not precompile (#594)
Browse files Browse the repository at this point in the history
* 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.

* cheats: update typo

Use the address range of precomiples that testnets use,
see https://github.com/eth-clients/holesky/blob/main/metadata/genesis.json
  • Loading branch information
tynes authored Aug 6, 2024
1 parent 1714bee commit bf66061
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/StdCheats.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(0xff));

// forgefmt: disable-start
if (chainId == 10 || chainId == 420) {
Expand Down

0 comments on commit bf66061

Please sign in to comment.