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

Issue with Verifying Contracts on zkSync When Deployed via External Library #519

Open
mshakeg opened this issue Nov 30, 2023 · 1 comment

Comments

@mshakeg
Copy link

mshakeg commented Nov 30, 2023

🐛 Bug Report for hardhat-zksync plugins

💥 Plugin name

@matterlabs/hardhat-zksync-verify@^0.2.1

📝 Description

I am experiencing a problem verifying contracts on the zkSync network when they are deployed through an external library. Specifically, the issue arises when a factory contract uses a library to deploy a child contract, instead of deploying it directly. This setup seems to cause verification failures despite following standard verification procedures.

🔄 Reproduction Steps

  1. Setup: I have set up a Hardhat zksync project using the zksync-cli template containing the contracts in question: a factory contract (DeployerFactory2WithConstructorAndLibrary), a deployment library (ChildDeployer), and a child contract (ChildWithConstructorAndLibrary).

  2. Deployment: The DeployerFactory2WithConstructorAndLibrary contract uses the ChildDeployer library to deploy instances of ChildWithConstructorAndLibrary using the CREATE2 opcode for deterministic address generation.

  3. Verification Attempt: After deploying the ChildWithConstructorAndLibrary contract using the factory and library, I attempted to verify it on zkSync using Hardhat's verification command with the appropriate constructor arguments in arguments.js

yarn hardhat verify <ChildWithConstructorAndLibrary> --contract contracts/ChildWithConstructorAndLibrary.sol:ChildWithConstructorAndLibrary --constructor-args arguments.js
  1. Failure: The verification process fails with the following error:
Error in plugin @matterlabs/hardhat-zksync-verify: The address provided as argument contains a contract, but its bytecode doesn't match any of your local contracts.

      Possible causes are:
        - Contract code changed after the deployment was executed. This includes code for seemingly unrelated contracts.
        - A solidity file was added, moved, deleted or renamed after the deployment was executed. This includes files for seemingly unrelated contracts.
        - Solidity compiler settings were modified after the deployment was executed (like the optimizer, target EVM, etc.).
        - The given address is wrong.
        - The selected network is wrong.

🤔 Expected Behavior

The ChildWithConstructorAndLibrary contract, deployed via the factory and library, should be verifiable on the zkSync network using standard verification procedures.

😯 Current Behavior

Verification fails, indicating a mismatch in bytecode or other related issues, despite the deployment process completing successfully.

NOTE: I have been able to verify child contracts created in numerous other ways by a factory contract as outlined here

🖥️ Environment

  • Node version: v20.9.0
  • Operating System & Version: macOS
@nikola-bozin-txfusion
Copy link
Contributor

Currently, our backend verification system does not allow verifying contracts that are deployed from another contract.
But we are working to support this feature and we will let you know once this is implemented.

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

2 participants