Universal CREATE2 wrapper

I have some use cases, including generalized state channels and verification challenges, where any of many users may want to create the contract to be verified, in the same spirit as Bitcoin MAST. CREATE2 almost gets us there, but annoyingly includes the creator address as part of the data getting hashes, which runs against the “the same contract binds everyone principle”. Lo and behold, this can be worked around by a contract that has this runtime code:

GETPC DUP1 CALLDATALOAD 32 CALLDATASIZE SUB DUP1 32 DUP5 CALLDATACOPY DUP3 CALLVALUE CREATE2 STOP

Now, I could create this contract on the Ethereum network, but wouldn’t it be nice if it had the very same address on every EVM network, so we could have universal MAST addresses? Well, that’s possible, thanks to presigned transactions: I generated an address, had it sign transactions to create the above contract with all possible values of gas on an geometric sequence of ratio sqrt(2), then threw the address away, so the same addresses can be used everywhere. It would be much nicer of course, if a precompiled contract did the same, but this is good enough for now.