Skip to content

Commit 9a10dcf

Browse files
authored
fix(contract-verifier): Fix version extraction in gh resolver (#3378)
## What ❔ GH resolver wasn't adding `v` for zksolc/zkvyper, while our API expects it.
1 parent 503956d commit 9a10dcf

File tree

1 file changed

+4
-1
lines changed
  • core/lib/contract_verifier/src/resolver/github

1 file changed

+4
-1
lines changed

core/lib/contract_verifier/src/resolver/github/gh_api.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ impl CompilerGitHubRelease {
8686
match self {
8787
Self::Solc | Self::Vyper => {
8888
// Solidity and Vyper releases are tagged with version numbers in form of `vX.Y.Z`.
89+
// Our API does not require the `v` prefix for solc/vyper, so we strip it.
8990
tag_name
9091
.strip_prefix('v')
9192
.filter(|v| semver::Version::parse(v).is_ok())
@@ -94,6 +95,7 @@ impl CompilerGitHubRelease {
9495
Self::ZkVmSolc => {
9596
// ZkVmSolc releases are tagged with version numbers in form of `X.Y.Z-A.B.C`, where
9697
// `X.Y.Z` is the version of the Solidity compiler, and `A.B.C` is the version of the ZkSync fork.
98+
// `v` prefix is not required.
9799
if let Some((main, fork)) = tag_name.split_once('-') {
98100
if semver::Version::parse(main).is_ok() && semver::Version::parse(fork).is_ok()
99101
{
@@ -105,8 +107,9 @@ impl CompilerGitHubRelease {
105107
}
106108
Self::ZkSolc | Self::ZkVyper => {
107109
// zksolc and zkvyper releases are tagged with version numbers in form of `X.Y.Z` (without 'v').
110+
// Our API expects versions to be prefixed with `v` for zksolc/zkvyper, so we add it.
108111
if semver::Version::parse(tag_name).is_ok() {
109-
Some(tag_name.to_string())
112+
Some(format!("v{tag_name}"))
110113
} else {
111114
None
112115
}

0 commit comments

Comments
 (0)