Skip to content

Commit

Permalink
Merge branch 'master' into cargo-update
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Dec 9, 2024
2 parents 5d951a4 + 2e56b8f commit c0f004c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions crates/verify/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use foundry_config::{figment, impl_figment_convert, impl_figment_convert_cast, C
use itertools::Itertools;
use reqwest::Url;
use revm_primitives::HashSet;
use semver::BuildMetadata;
use std::path::PathBuf;

use crate::provider::VerificationContext;
Expand Down Expand Up @@ -275,7 +276,7 @@ impl VerifyArgs {

let cache = project.read_cache_file().ok();

let version = if let Some(ref version) = self.compiler_version {
let mut version = if let Some(ref version) = self.compiler_version {
version.trim_start_matches('v').parse()?
} else if let Some(ref solc) = config.solc {
match solc {
Expand Down Expand Up @@ -321,7 +322,21 @@ impl VerifyArgs {
let profiles = entry
.artifacts
.get(&contract.name)
.and_then(|artifacts| artifacts.get(&version))
.and_then(|artifacts| {
let mut cached_artifacts = artifacts.get(&version);
// If we try to verify with specific build version and no cached artifacts
// found, then check if we have artifacts cached for same version but
// without any build metadata.
// This could happen when artifacts are built / cached
// with a version like `0.8.20` but verify is using a compiler-version arg
// as `0.8.20+commit.a1b79de6`.
// See <https://github.com/foundry-rs/foundry/issues/9510>.
if cached_artifacts.is_none() && version.build != BuildMetadata::EMPTY {
version.build = BuildMetadata::EMPTY;
cached_artifacts = artifacts.get(&version);
}
cached_artifacts
})
.map(|artifacts| artifacts.keys().collect::<HashSet<_>>())
.unwrap_or_default();

Expand Down

0 comments on commit c0f004c

Please sign in to comment.