-
Notifications
You must be signed in to change notification settings - Fork 118
L1 <> L2 Create2 Address Mismatch #306
Comments
Why would the mapping need to be populated in the constructor? you mean the constructor of the ExecutionManager? If there is an admin key that can update the mapping it could lead to a security vulnerability, this admin could break any counter-factual contract that hasn't been deployed yet. Imagine you have a smart contract wallet, the wallet is not deployed but it assumes the default Another possible solution would be to create a new opcode, this new opcode would need to exist on both L1 and L2, let's call it |
Yes the constructor of the EM.
We can make this configurable to initially be a trusted key that transitions to something community owned. I agree with the implications if it were to be misused, but I am OK with underwriting that risk given that it cannot result in theft and is at worst a grief. The new opcode approach could make sense but seems like a lot of effort, comparatively to just having a OVM->EVM bytecodehash map. |
I think something like this would work, but it would be hard develop and also to maintain, requiring community governance for something this primitive is complicated, because that governance can hold much more powers of what initially seems. If the primary concern is loss of funds, maybe Optimism can add a new transaction type, this transaction type could take the context (msg.sender) from whoever is sending the transaction on the L1 (without any kind of signature), it wouldn't be very efficient for day-to-day transactions, but it would allow almost any smart contract wallet to retrieve funds sent to the L2. The only downside I see with this approach is that it would break the "only account abstraction" paradigm that Optimism is having, since these kind of transactions would look more like EOAs than AA |
I think that this is a very interesting mechanism and is worth strongly considering. After mulling it over a bit, I think there could even be a further improvement: it seems very notable that the L1 code we are trying to make work with is unsafe code. It feels like it might not violate much existing semantics to add a way to deploy something to the Also, a short note on the possible implementation structure: |
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
mapping(address => address) ovmToEVMBytecodeHash
to the ExecutionManager_bytecode
withovmToEVMBytecodeHash[keccak256(_bytecode)]
. If the mapping at that key is empty, default to usingkeccak256(_bytecode)
.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.
The text was updated successfully, but these errors were encountered: