Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
This repository was archived by the owner on Apr 12, 2021. It is now read-only.

L1 <> L2 Create2 Address Mismatch #306

@gakonst

Description

@gakonst

Is your feature request related to a problem? Please describe.

@dmihal mentioned on twitter that due to how OVM bytecode is different from EVM bytecode, Create2 addresses on Optimism would be different from Create2 addresses in Ethereum. This can be problematic for UX e.g. when somebody sends ETH to a user on L2 and accidentally sends it on L1 to an address that does not exist. Normally, you could Create2 to claim that address, but here that's not possible due to this mismatch.

Describe the solution you'd like

  1. Add a mapping(address => address) ovmToEVMBytecodeHash to the ExecutionManager
  2. Allow passing the bytecode hash directly to the create2 address function
  3. In the Create2 code, replace _bytecode with ovmToEVMBytecodeHash[keccak256(_bytecode)]. If the mapping at that key is empty, default to using keccak256(_bytecode).
  4. Add a function for populating that mapping. It can be gated with a trusted admin key. The mapping could also be populated in the constructor of the execution manager.

The overhead from this is pretty small, just an extra lookup in the mapping, and I believe it fully addresses the issue. It'd also be nice if we had a list of "popular" bytecode hashes, to populate most of the needed keys in the mapping in the constructor.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions