primev / mev-commit

establishes a p2p network, allowing mev actors to issue bids and commitments for execution in real time
https://docs.primev.xyz/
Other
26 stars 1 forks source link

ENS + create3 #45

Open shaspitz opened 5 months ago

shaspitz commented 5 months ago

Background

Contract address management has been a pain point. Create2 first helped by making contract addresses be predetermined by deploying address + contract bytecode + salt. However create2 has a weakness in that if we change any .sol file, a contract address will change. To improve on this, we should introduce an address management system that prevents the need to change hardcoded contract addresses in client code.

Solution

ENS is the standard for Mainnet ethereum. Docs recommend that name resolving on other chains, still go through L1. However it's more desirable to have the ENS contracts be native to the mev-commit chain.

A problem arises that if we don't use existing mainnet deployments, the address for the ENS registry is not necessarily predetermined. But by using create3, we could make the registry address predetermined by only a salt.

In production/testnet we will deploy all contracts via a secure account. While in a private devnet environment we will deploy ENS + other contracts from the default genesis account 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266. But each should correspond to a single registry address

shaspitz commented 5 months ago

Note the most common create3 implementation hashes msg.sender into the salt https://github.com/ZeframLou/create3-factory, so we'll opt for using something like this directly