axelarnetwork / axelar-gmp-sdk-solidity

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

deployCreate3Upgradable - "too many arguments: in Contract constructor" #25

Open tab00 opened 1 year ago

tab00 commented 1 year ago

I replaced deployUpgradable with deployCreate3Upgradable in the cross-chain-token example (and deployed Create3Deployer and passed its address in place of ConstAddressDeployer address): https://github.com/axelarnetwork/axelar-examples/blob/main/examples/evm/cross-chain-token/index.js#L21

Deployment using npm run deploy evm/cross-chain-token local causes this error output:

Error: too many arguments: in Contract constructor (count=3, expectedCount=0, code=UNEXPECTED_ARGUMENT, version=contracts/5.7.0) at Logger.makeError (/root/projects/axelar-examples/node_modules/@ethersproject/logger/lib/index.js:238:21) at Logger.throwError (/root/projects/axelar-examples/node_modules/@ethersproject/logger/lib/index.js:247:20) at Logger.checkArgumentCount (/root/projects/axelar-examples/node_modules/@ethersproject/logger/lib/index.js:313:18) at ContractFactory.getDeployTransaction (/root/projects/axelar-examples/node_modules/@ethersproject/contracts/lib/index.js:1125:16) at deployCreate3Contract (/root/projects/axelar-examples/node_modules/@axelar-network/axelar-gmp-sdk-solidity/scripts/create3Deployer.js:89:28) at deployCreate3Upgradable (/root/projects/axelar-examples/node_modules/@axelar-network/axelar-gmp-sdk-solidity/scripts/upgradable.js:70:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.deploy (/root/projects/axelar-examples/examples/evm/cross-chain-token/index.js:21:22) at async Promise.all (index 4) at async deploy (/root/projects/axelar-examples/scripts/libs/deploy.js:17:5) { reason: 'too many arguments: in Contract constructor', code: 'UNEXPECTED_ARGUMENT', count: 3, expectedCount: 0

Please fix this so that we can deploy using CREATE3. Thank you.

tab00 commented 1 year ago

deployCreate3Upgradable calls deployCreate3Contract: https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/main/scripts/upgradable.js#L70

However the proxy should be inited, so it should instead call deployCreate3AndInitContract maybe like this:

  const proxy = await deployCreate3AndInitContract(
    create3DeployerAddress,
    wallet,
    proxyJson,
    key,
    additionalProxyConstructorArgs,
    [
      implementation.address,
      wallet.address,
      setupParams,      
    ],
    gasLimit,
  );
tab00 commented 1 year ago

@re1ro what do you think?

tab00 commented 1 year ago

There seems to be a problem with init in Create3Deployer: https://github.com/axelarnetwork/axelar-gmp-sdk-solidity/blob/main/contracts/deploy/Create3Deployer.sol#L53

I get "processing response error" when I attempt deployment, and then transaction reverts. Deployment works if I comment out that (and next) line, but it's not usable because it hasn't been inited.

There is no such problem when deploying with CREATE2 - init works.