NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7.31k stars 1.41k forks source link

hardhat-verify not working for some contracts on chains Fantom, Blast and Mantle #5392

Closed blockchainguyy closed 4 months ago

blockchainguyy commented 5 months ago

Version of Hardhat

2.19.5

What happened?

I'm encountering issues with contract verification using Etherscan APIs through Hardhat verify for Fantom, Blast, and Mantle chains. The error message I receive is Compiled contract deployment bytecode does NOT match the transaction deployment bytecode. However, I can successfully verify the same contract using the explorer's UI.

Minimal reproduction steps

Steps for failed verification using Hardhat verify:

  1. Checkout the main branch of the repository https://github.com/axelarnetwork/axelar-contract-deployments and install dependencies using npm ci.
  2. Checkout tag v6.3.1 of the repository https://github.com/axelarnetwork/axelar-cgp-solidity and install dependencies using npm ci. Then create artifacts using npm run build.
  3. Create a keys.json file in this repository with the following content: {"chains": {"fantom": {"api": "apiKey"}}}.
  4. From the repository https://github.com/axelarnetwork/axelar-contract-deployments, run the command: node evm/verify-contract.js -e testnet -n fantom -c AxelarGasService --dir ../axelar-cgp-solidity/.

Note The same script used above is able to verify the deployed contracts on other chains supported by etherscan.

Steps to generate flattened files:

  1. Checkout tag v6.3.1 of the repository https://github.com/axelarnetwork/axelar-cgp-solidity and install dependencies using npm ci. Then, create artifacts using npm run build and generate a flattened file using npm run flatten.
  2. Edit the pragma statement in the flattened file artifacts/flattened/gas-service/AxelarGasService.sol from pragma solidity 0.8.9 0.8.23; to pragma solidity 0.8.23.
  3. Use this file to verify using a single solidity file on testnet.ftmscan.com.

Search terms

No response

blockchainguyy commented 5 months ago

@schaable any update?

schaable commented 4 months ago

Hi @blockchainguyy! Sorry for taking so long to review this. Unfortunately, reproducing the issue with your setup will not help us in this scenario, as there's too much going on. However, I've tested deploying and verifying the Lock contract to the Fantom testnet and did not encounter that error. To triage this correctly, I'd need an isolated minimal reproducible example.

schaable commented 4 months ago

I'm closing this issue as there has been no further response. However, I'll be happy to investigate further if a minimal example can be provided.