Skip to content

Commit 6dc76a5

Browse files
authored
Merge pull request #4529 from NomicFoundation/sourcify-is-verified-bug
Normalize input addresses to lowercase for comparison
2 parents c006208 + c7d87c4 commit 6dc76a5

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.changeset/real-coins-tease.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nomicfoundation/hardhat-verify": patch
3+
---
4+
5+
Fixed case-sensitive address comparison for detecting verified contracts

packages/hardhat-verify/src/internal/solc/artifacts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ function mergeLibraries(
368368
) {
369369
const detectedAddress = detectedLibraries[sourceName][libraryName];
370370
// Our detection logic encodes bytes into lowercase hex.
371-
if (libraryAddress.toLowerCase() !== detectedAddress) {
371+
if (libraryAddress.toLowerCase() !== detectedAddress.toLowerCase()) {
372372
conflicts.push({
373373
library: `${sourceName}:${libraryName}`,
374374
detectedAddress,

packages/hardhat-verify/src/internal/sourcify.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ export class Sourcify {
4343
throw new Error(`Unexpected response body: ${JSON.stringify(json)}`);
4444
}
4545

46-
const contract = json.find((match) => match.address === address);
46+
const contract = json.find(
47+
(match) => match.address.toLowerCase() === address.toLowerCase()
48+
);
4749
if (contract === undefined) {
4850
return false;
4951
}

0 commit comments

Comments
 (0)