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

Enforce contract verification #5122

Closed
rimrakhimov opened this issue Apr 15, 2024 · 1 comment
Closed

Enforce contract verification #5122

rimrakhimov opened this issue Apr 15, 2024 · 1 comment
Labels
status:ready This issue is ready to be worked on

Comments

@rimrakhimov
Copy link
Contributor

rimrakhimov commented Apr 15, 2024

Description

On contract verification, blockscout differentiates source codes on partial and full matches. In case of partially verified
contracts re-verification of such contracts is allowed. But it is not possible to re-verify such contracts via Hardhat rn, as it always returns "The contract {contract_address} has already been verified on Etherscan."

Suggestion

We suggest to add a new flag on verify:verify subtask - --skip-is-verified-check. That should disable the if(isVerified) condition to prevent verification attempt.

A kind of similar approach has been adopted by foundry - foundry-rs/foundry#6461.

I may try to create a PR with corresponding changes. Just would like to ensure that you are fine with suggested approach.

Minimal Reproducible Steps

  1. Create a new template project and update Lock.sol contract to have a contract named ModifiedMetadataHashLock.
  2. config hardhat network:
const config: HardhatUserConfig = {
  solidity: "0.8.24",
  networks: {
    sepolia: {
      url: 'https://endpoints.omniatech.io/v1/eth/sepolia/public',
      accounts: [PRIVATE_KEY],
    },
  },
  etherscan: {
    apiKey: 'ETHERSCAN_API_KEY',
    customChains: [
      {
        network: "sepolia",
        chainId: 11155111,
        urls: {
          apiURL: "https://eth-sepolia.blockscout.com/api",
          browserURL: "https://eth-sepolia.blockscout.com/",
          // apiURL: "https://api-sepolia.etherscan.io/api",
          // browserURL: "https://sepolia.etherscan.io/",
        }
      }
    ]
  }
};
  1. npx hardhat verify 0xcA30DBB0Cb79cef0194f6e212B49fa1EB7246b61 --network sepolia 123
  2. Output (even though the contract has been verified only partially and can be re-verified):
The contract 0xcA30DBB0Cb79cef0194f6e212B49fa1EB7246b61 has already been verified on Etherscan.
https://eth-sepolia.blockscout.com/address/0xcA30DBB0Cb79cef0194f6e212B49fa1EB7246b61#code

Search terms

No response

@github-project-automation github-project-automation bot moved this to Backlog in Hardhat Apr 15, 2024
@kanej kanej added status:needs-decision We need to make a decision about this and removed status:triaging labels Apr 16, 2024
@kanej kanej moved this from Backlog to To-do in Hardhat Apr 16, 2024
@kanej
Copy link
Member

kanej commented Apr 17, 2024

This is a feature we want to see, though we would suggest --force instead of --skip-is-verified-check as the flag.

@kanej kanej added status:ready This issue is ready to be worked on and removed status:needs-decision We need to make a decision about this labels Apr 17, 2024
@kanej kanej removed their assignment Apr 18, 2024
@schaable schaable closed this as completed May 8, 2024
@github-project-automation github-project-automation bot moved this from To-do to Done in Hardhat May 8, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready This issue is ready to be worked on
Projects
Archived in project
Development

No branches or pull requests

3 participants