fix(lib-sourcify): normalize old Vyper beta versions from Etherscan#2748
Open
fix(lib-sourcify): normalize old Vyper beta versions from Etherscan#2748
Conversation
Etherscan encodes early Vyper beta releases as e.g. "vyper:0.1.0b17" while the GitHub release tag (and the Hardhat Vyper releases mirror) uses "v0.1.0-beta.17". The strict equality check in getVyperCompilerVersion therefore fails even though binaries exist for these versions. Fix by normalising the version number extracted from the Etherscan compiler string before the lookup: 0.1.0b17 → 0.1.0-beta.17 Applied to both the initial find and the one-time-refresh retry path. This unblocks 157 contracts (0.1.0b16 and 0.1.0b17) from the set of 4,011 failed Vyper Etherscan imports investigated in sourcifyeth/private-issues#58. The remaining 3,854 failures are unfixable because no upstream binaries were ever published for those versions. Same class of issue as #2716, fixed for Solidity in #2732. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 157 failed Vyper Etherscan imports caused by a format mismatch in
getVyperCompilerVersion(packages/lib-sourcify/src/utils/etherscan/etherscan-util.ts).Etherscan encodes early Vyper beta releases as
vyper:0.1.0b16/vyper:0.1.0b17, but the GitHub release tags (and the Hardhat Vyper releases mirror) usev0.1.0-beta.16/v0.1.0-beta.17. The strict equality lookup therefore always failed, even though binaries exist for these versions.Fix: normalize the version string before lookup —
0.1.0bN→0.1.0-beta.N— applied to both the initial find and the one-time-refresh retry path.This is the Vyper equivalent of the Solidity version-resolution issue #2716 fixed in #2732.
Context
Out of 4,011 failed Vyper Etherscan imports:
0.1.0b16+0.1.0b17)0.1.0b4–0.1.0b15,0.2.13,0.3.5)Changes
packages/lib-sourcify/src/utils/etherscan/etherscan-util.ts— addnormalizeVyperVersionhelper; update bothfindcalls ingetVyperCompilerVersionpackages/lib-sourcify/test/utils/etherscan-util.spec.ts— newdescribe('getVyperCompilerVersion')block with 5 test casesservices/server/test/helpers/etherscanResponseMocks.ts— addMALFORMED_VYPER_VERSION_RESPONSEfixtureTest plan
cd packages/lib-sourcify && npm test— all 28 etherscan-util tests pass, including 5 new casesb16, resolvingb17, regression for well-formed0.3.10,undefinedreturned for genuinely missing version (b4), and end-to-end viaprocessVyperResultFromEtherscan