Skip to content

Disallow some cheatcodes for precompiles #1159

@onbjerg

Description

@onbjerg

I think we should disallow vm.etch for addresses 0 < n < 10, and throw an error about using an address >10.

I prefer breaking these early and getting "correct" behavior vs hacking something on Revm.

(This should be fine for transfers etc on the <10 addresses and seems only a vm.etch issue?)

Originally posted by @gakonst in #1146 (comment)

Worth considering disallowing other cheatcodes for those addresses. It's not realistic to prank that address or mockCall with it, and you also don't want to save or load slots from there, for example.

As for what addresses to block off, to be safe we might also want to:

  • Disallow a larger range, such as 0 < n < 99 to account for precompiles being added or other EVM chains that have additional precompiles
  • Prevent etching at addresses that other chains have predeployed contracts at. For example Optimism has predeployed contracts at 0x420...000 < n < 0x420...013, not sure about other networks offhand

Originally posted by @mds1 in #1146 (comment)

This is a breaking change

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions