OpenZeppelin / openzeppelin-sdk

OpenZeppelin SDK repository for CLI and upgrades.js. No longer actively developed.
MIT License
433 stars 200 forks source link

oz verify fails when using binary solc (instead of solc.js) #1551

Open shark0der opened 4 years ago

shark0der commented 4 years ago

When oz verify sends the post request to etherscan, it sends the compiler version as well. In oz source code there's this line:

const compiler = `v${compilerVersion.replace('.Emscripten.clang', '')}`;

https://github.com/OpenZeppelin/openzeppelin-sdk/blob/11352d7ee54cbbee8234f418cd0ffc0bac30e749/packages/cli/src/models/Verifier.ts#L87

What it tries to do is to remove the suffix from the version, but it wrongly assumes that we're using solc.js. In my case, the version is 0.5.17+commit.d19bba13.Linux.g++ and it was sending that verbatim to etherscan.

Dropping .Linux.g++ solved the issue and the verification went through succesfully:

const compiler = `v${compilerVersion.replace('.Emscripten.clang', '')}`.replace('.Linux.g++', '');

As a side note, oz verify shows up a false warning:

A regular instance of TokenMock was found. Verification of regular instances is not yet supported.

The verification went through despite the warning.

abcoathup commented 4 years ago

Hi @shark0der! I’m sorry that you had this issue.

Thanks so much for reporting it! The project owner will review and triage this issue during the next week.