axelarnetwork / axelar-gmp-sdk-solidity

Solidity libraries and utilities provided by Axelar.
27 stars 30 forks source link

Mismatched chain ID when trying to reuse ConstAddressDeployer deployment transaction bytecode #53

Closed tab00 closed 10 months ago

tab00 commented 1 year ago

It would've been good if it was possible to reuse the transaction bytecode (at https://etherscan.io/getRawTx?tx=0xb56d861ab7c8bd843113ff2fe8589bbaa225bbe76e054c9577dbbcbd17bac099) of ConstAddressDeployer creation so that anyone could deploy ConstAddressDeployer to 0x98b2920d53612483f91f12ed7754e51b4a77919e on any blockchain that does not yet have it.

Otherwise, in the current situation we'd have to beg/hope/wait for Axelar to deploy ConstAddressDeployer onto some new blockchain that we want to try. If I had already used ConstAddressDeployer to deploy my contract on other existing blockchains (all to the same address), then in order to deploy the contract onto the new blockchain to the same address as the others, I'd have to use ConstAddressDeployer which should be at 0x98b2920d53612483f91f12ed7754e51b4a77919e on the new blockchain, right? If, for whatever reason, Axelar doesn't deploy ConstAddressDeployer onto the new blockchain then I wouldn't be able to deploy my contract to the same address as my contract on the other blockchains.

With https://github.com/Arachnid/deterministic-deployment-proxy it is possible to reuse the deployment transaction bytecode to deploy their CREATE2 factory contract at the same address on any blockchain. You can see the same bytecode was used on different blockchains: https://etherscan.io/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26 https://goerli.etherscan.io/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26 https://sepolia.etherscan.io/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26 https://goerli.basescan.org/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26 https://optimistic.etherscan.io/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26 https://testnet.bobascan.com/getRawTx?tx=0xeddf9e61fb9d8f5111840daef55e5fde0041f5702856532cdbb5a02998033d26

I can use these existing CREATE2 factory contracts to deploy my contract to each blockchain and they'd all have the same address. When a new blockchain comes along I can deploy the CREATE2 factory contract onto it using the same deployment transaction bytecode, then use it to deploy my own contract.

Can there be a solution for Axelar's CREATE2 deployer?

SKYBITDev3 commented 1 year ago

The error occurs because normal transactions nowadays contains the chain ID of the blockchain, so you can't reuse that same transaction on a different blockchain (which would have a different chain ID) as a node would check whether the chain ID in a transaction equals the chain ID of the blockchain that it's being executed on.

However, transactions that don't have a chain ID or is 0 could be replayed on other blockchains if nodes don't enforce existence of chain ID in transactions.