lurch icon indicating copy to clipboard operation
lurch copied to clipboard

Can rooted be extended to use a salt in address creation?

Open thegostep opened this issue 5 years ago • 4 comments

thegostep avatar Jun 26 '20 18:06 thegostep

No, the way rooted works there is no “place” to put a salt. It uses the normal initcode, not a Solidity selector.

It would be easy to build a version which does, but then it would require a contract function call, instead of just changing the to address from null to “v0.rooted.eth”.

Does that make sense?

ricmoo avatar Jun 26 '20 19:06 ricmoo

That does make sense. What would a contract call version look like?

It could be neat to couple rooted with minimal proxies if there was a way to clear the storage of the proxy.

thegostep avatar Jun 26 '20 20:06 thegostep

It would prolly have a solidity signature like function deploy(bytes32 salt, bytes bytecode) payable. I only put the salt first because the code would be in EVM assembly and plucking items out after a dynamic object is trickier than before. :)

Then in ethers, you could use contract.deploy(salt, initcode).

It would be a fairly simple change to make if you wanted to dip your toes into the wonderful world of EVM assembly. :)

ricmoo avatar Jun 26 '20 20:06 ricmoo

Feels a bit like diving in the deep end for an assembly noob like me....

Is it possible to call v0.rooted.eth from a smart contract?

function create(bytes bytecode) payable {
  (bool success, bytes memory returnData) = address(v0.rooted.eth).call{value: msg.value}(bytecode);
  require(success);
}

If so then I would probably spin up a different contract every time instead of using a salt

thegostep avatar Jun 26 '20 21:06 thegostep