Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot verify a contract with construct args and created within another contract #350

Open
zkbenny opened this issue Jul 27, 2023 · 9 comments

Comments

@zkbenny
Copy link

zkbenny commented Jul 27, 2023

I create a verify example project follow the guide Verify Contracts with Hardhat. Deploy and verify of the Greeter contract are ok, but verify a contract with construct args and created within another contract failed with message:

Error in plugin @matterlabs/hardhat-zksync-verify: Constructor arguments are not correct

Here are two contracts: DeployFactory and Proxy, when deploy a DeployFactory, a Proxy with a default input 100 will be created within.

// SPDX-License-Identifier: MIT OR Apache-2.0

pragma solidity ^0.8.0;

import "./Proxy.sol";

contract DeployFactory {
    Proxy public proxy;

    constructor() {
        proxy = new Proxy(100);
    }
}
// SPDX-License-Identifier: MIT OR Apache-2.0

pragma solidity ^0.8.0;

contract Proxy {
    uint256 public count;

    constructor(uint256 _count) {
        count = _count;
    }
}

Here is the details of running deploy script to testnet:

yarn hardhat deploy-zksync --script deploy-proxy.ts

Running deploy script for the Proxy contract
The deployment is estimated to cost 0.000785932 ETH
Constructor args:0x
DeployFactory was deployed to 0x8c03eC86967347dEDB5f1614b0AB23e48F6a215D
Proxy was deployed to 0x22EA9D66eA20D0826444B9716Af4261Ce98b51Ba
Compiling contracts for zkSync Era with zksolc v1.3.13 and solc v0.8.17
Compiling 2 Solidity files
Your verification ID is: 34368
Contract successfully verified on zkSync block explorer!
Compiling contracts for zkSync Era with zksolc v1.3.13 and solc v0.8.17
Compiling 1 Solidity file
Your verification ID is: 34369
Error in plugin @matterlabs/hardhat-zksync-verify: Constructor arguments are not correct

For more info run Hardhat with --show-stack-traces
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The DeployFactory contract 0x8c03eC86967347dEDB5f1614b0AB23e48F6a215D verify succeed, but the Proxy contract 0x22EA9D66eA20D0826444B9716Af4261Ce98b51Ba verify failed.

@zkbenny
Copy link
Author

zkbenny commented Jul 27, 2023

I'm sure the constructorArguments to verify Proxy contract is correct. I also tried verify command:

yarn hardhat verify --network zkSyncTestnet 0x22EA9D66eA20D0826444B9716Af4261Ce98b51Ba 100

Still not work.

Your verification ID is: 34388
Error in plugin @matterlabs/hardhat-zksync-verify: Constructor arguments are not correct

@zkbenny
Copy link
Author

zkbenny commented Jul 27, 2023

I also tried to verify in the explorer ui

image

but still not work
image

@zkbenny
Copy link
Author

zkbenny commented Jul 27, 2023

I tried looking for a solution from discord, and found a similar question

image

@FilipTxFusion
Copy link
Contributor

Hi @zkbenny, this is a known bug where the verification of the smart contract deployed from another contract expects parent's constructor args.
I will leave the issue open until the problem is resolved, and we will let you know once the new release is ready.

@zkbenny
Copy link
Author

zkbenny commented Jul 31, 2023

@FilipTxFusion Thanks, could you please fix this issue as soon as possible, if the contract cannot be open source and we cannot gain the trust of users

@statskiy-sovetnik
Copy link

@FilipTxFusion bumping this issue as we are also trying to verify a BeaconProxy, deployed from within a different contract. Getting an out-of-bound error, because I think it tries to decode tx params as constructor arguments, but they are different.

image

@FilipTxFusion
Copy link
Contributor

I understand, thanks for reporting it.
This task is added to our backlog and we will get to work on it as soon as other priorities are solved.

@novaknole
Copy link

Hi.. Is this issue resolved ? still getting the: Backend verification error: Constructor arguments are not correct when contract is deployed from another contract.

@zkcarter
Copy link

zkcarter commented May 29, 2024

Hi @FilipTxFusion Does this problem solved? I see the official contract of zkSync L2StandardERC20 has been verified.
I want to know how can our developers verify our contracts like zkSync L2StandardERC20. Thank you and waiting for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants