From 7435364f06e07f82f12fc7d2cb15ac5b03ad7cc0 Mon Sep 17 00:00:00 2001 From: 3commascapital <90629478+3commascapital@users.noreply.github.com> Date: Tue, 9 Jul 2024 15:33:49 -0500 Subject: [PATCH 1/4] Adds logic for forcing through verification when is verified check fails in backend --- .../hardhat-verify/src/internal/tasks/etherscan.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/hardhat-verify/src/internal/tasks/etherscan.ts b/packages/hardhat-verify/src/internal/tasks/etherscan.ts index e238896ebf..f3b93e5589 100644 --- a/packages/hardhat-verify/src/internal/tasks/etherscan.ts +++ b/packages/hardhat-verify/src/internal/tasks/etherscan.ts @@ -27,6 +27,7 @@ import { UnexpectedNumberOfFilesError, VerificationAPIUnexpectedMessageError, ContractAlreadyVerifiedError, + NetworkRequestError, } from "../errors"; import { Etherscan } from "../etherscan"; import { Bytecode } from "../solc/bytecode"; @@ -102,7 +103,15 @@ subtask(TASK_VERIFY_ETHERSCAN) chainConfig ); - const isVerified = await etherscan.isVerified(address); + let isVerified = false + try { + isVerified = await etherscan.isVerified(address); + } catch (err) { + if (!force || err instanceof NetworkRequestError) { + throw err + } + // https://github.com/blockscout/blockscout/issues/9001 + } if (!force && isVerified) { const contractURL = etherscan.getContractUrl(address); console.log(`The contract ${address} has already been verified on the block explorer. If you're trying to verify a partially verified contract, please use the --force flag. From 88e57fa3870aff726d8d6d536c03155f685acf63 Mon Sep 17 00:00:00 2001 From: push <90629478+3commascapital@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:02:38 -0500 Subject: [PATCH 2/4] Adds changeset --- .changeset/fuzzy-eyes-collect.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fuzzy-eyes-collect.md diff --git a/.changeset/fuzzy-eyes-collect.md b/.changeset/fuzzy-eyes-collect.md new file mode 100644 index 0000000000..deb79573b6 --- /dev/null +++ b/.changeset/fuzzy-eyes-collect.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/hardhat-verify": patch +--- + +Makes force flag comprehensive enough to cover failing optional calls From 3084ec6cdf0665f5be2c9c191421732ab937ee4e Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Tue, 9 Jul 2024 19:06:37 -0300 Subject: [PATCH 3/4] Update .changeset/fuzzy-eyes-collect.md --- .changeset/fuzzy-eyes-collect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/fuzzy-eyes-collect.md b/.changeset/fuzzy-eyes-collect.md index deb79573b6..dc057aca7f 100644 --- a/.changeset/fuzzy-eyes-collect.md +++ b/.changeset/fuzzy-eyes-collect.md @@ -2,4 +2,4 @@ "@nomicfoundation/hardhat-verify": patch --- -Makes force flag comprehensive enough to cover failing optional calls +Make the `--force` flag override the check of any existing verification, even in the presence of errors. From 2f8ec7b9d8b15c1868b82d971138804c22ab614a Mon Sep 17 00:00:00 2001 From: Patricio Palladino Date: Tue, 9 Jul 2024 22:07:33 +0000 Subject: [PATCH 4/4] Fix linter errors --- packages/hardhat-verify/src/internal/tasks/etherscan.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hardhat-verify/src/internal/tasks/etherscan.ts b/packages/hardhat-verify/src/internal/tasks/etherscan.ts index f3b93e5589..1154f8abf7 100644 --- a/packages/hardhat-verify/src/internal/tasks/etherscan.ts +++ b/packages/hardhat-verify/src/internal/tasks/etherscan.ts @@ -103,12 +103,12 @@ subtask(TASK_VERIFY_ETHERSCAN) chainConfig ); - let isVerified = false + let isVerified = false; try { isVerified = await etherscan.isVerified(address); } catch (err) { if (!force || err instanceof NetworkRequestError) { - throw err + throw err; } // https://github.com/blockscout/blockscout/issues/9001 }