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
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).
Deployment: The DeployerFactory2WithConstructorAndLibrary contract uses the ChildDeployer library to deploy instances of ChildWithConstructorAndLibrary using the CREATE2 opcode for deterministic address generation.
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
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
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.
🐛 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
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
).Deployment: The
DeployerFactory2WithConstructorAndLibrary
contract uses theChildDeployer
library to deploy instances ofChildWithConstructorAndLibrary
using theCREATE2
opcode for deterministic address generation.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 inarguments.js
🤔 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