Skip to content

fix(lib-sourcify): normalize old Vyper beta versions from Etherscan#2748

Open
kuzdogan wants to merge 1 commit intostagingfrom
fix/vyper-etherscan-version-normalization
Open

fix(lib-sourcify): normalize old Vyper beta versions from Etherscan#2748
kuzdogan wants to merge 1 commit intostagingfrom
fix/vyper-etherscan-version-normalization

Conversation

@kuzdogan
Copy link
Copy Markdown
Member

@kuzdogan kuzdogan commented Apr 14, 2026

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) use v0.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.0bN0.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:

Count
Fixed by this PR (format mismatch, 0.1.0b16 + 0.1.0b17) 157
Not fixable (no binaries ever published for 0.1.0b40.1.0b15, 0.2.13, 0.3.5) 3,854

Changes

  • packages/lib-sourcify/src/utils/etherscan/etherscan-util.ts — add normalizeVyperVersion helper; update both find calls in getVyperCompilerVersion
  • packages/lib-sourcify/test/utils/etherscan-util.spec.ts — new describe('getVyperCompilerVersion') block with 5 test cases
  • services/server/test/helpers/etherscanResponseMocks.ts — add MALFORMED_VYPER_VERSION_RESPONSE fixture

Test plan

  • cd packages/lib-sourcify && npm test — all 28 etherscan-util tests pass, including 5 new cases
  • New tests cover: resolving b16, resolving b17, regression for well-formed 0.3.10, undefined returned for genuinely missing version (b4), and end-to-end via processVyperResultFromEtherscan

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>
@kuzdogan kuzdogan moved this from Triage to Sprint - Needs Review in Sourcify Public Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Sprint - Needs Review

Development

Successfully merging this pull request may close these issues.

1 participant