hyperlane-xyz / hyperlane-monorepo

The home for Hyperlane core contracts, sdk packages, and other infrastructure
https://hyperlane.xyz
Other
243 stars 274 forks source link

Generic contract deployment middleware / Cross-chain create2 factory #2232

Open nambrot opened 1 year ago

nambrot commented 1 year ago

To deploy contracts on multiple chains today, developers need a funded EOA on all chain. For example the Router abstraction tooling as well as hyperlane-deploy itself require that as well. For applications building on top of Hyperlane, you could imagine a generic contract deployment middleware to be useful. Thus the scope of this issue is to create a simple Router application looking somewhat similar to this:

interface GenericContractDeploymentMiddleware {
  function deployContract(uint32 destination, bytes bytecode, bytes32 salt)
  function deployContractAndInit(uint32 destination, bytes bytecode, bytes32 salt, bytes initCode)
}

On the sending side, it would just dispatch a message to the remote router whose handle basically just deploys a contract via a Create2Factory like this one (The create2 part of it is not strictly necessary, tho also follow https://github.com/foundry-rs/foundry/issues/2638.) It would probably be secured by a RoutingISM similar to interchain accounts to allow senders to specify the ISM to be used (which allows them to not have attackers squat the address it wants if using Create2)

This allows developers to just have a balance on one chain but deploy contracts on multiple chains.

armanthepythonguy commented 1 year ago

I would like to work on this. I have experience in this. I worked on something very similar in ScalingETH hackathon for my custom solution. Can you please assign me?

nambrot commented 1 year ago

Go for it!

nambrot commented 1 year ago

Probably blocked by https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/2512

nambrot commented 4 months ago

Unblocked now