Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions crates/compilers/src/artifact_output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,8 @@ pub trait ArtifactOutput {
) -> Result<Artifacts<Self::Artifact>> {
let mut artifacts =
self.output_to_artifacts(contracts, sources, ctx, layout, primary_profiles);
fs::create_dir_all(&layout.artifacts).map_err(|err| {
error!(dir=?layout.artifacts, "Failed to create artifacts folder");
SolcIoError::new(err, &layout.artifacts)
})?;
fs::create_dir_all(&layout.artifacts)
.map_err(|err| SolcIoError::new(err, &layout.artifacts))?;

artifacts.join_all(&layout.artifacts);
artifacts.write_all()?;
Expand Down Expand Up @@ -1140,16 +1138,17 @@ impl ArtifactOutput for MinimalCombinedArtifactsHardhatFallback {
}

fn read_cached_artifact(path: &Path) -> Result<Self::Artifact> {
let content = fs::read_to_string(path).map_err(|err| SolcError::io(err, path))?;
if let Ok(a) = serde_json::from_str(&content) {
Ok(a)
} else {
error!("Failed to deserialize compact artifact");
trace!("Fallback to hardhat artifact deserialization");
let artifact = serde_json::from_str::<HardhatArtifact>(&content)?;
trace!("successfully deserialized hardhat artifact");
Ok(artifact.into_contract_bytecode())
#[derive(Deserialize)]
#[serde(untagged)]
enum Artifact {
Compact(CompactContractBytecode),
Hardhat(HardhatArtifact),
}

Ok(match utils::read_json_file::<Artifact>(path)? {
Artifact::Compact(c) => c,
Artifact::Hardhat(h) => h.into_contract_bytecode(),
})
}

fn contract_to_artifact(
Expand Down
2 changes: 1 addition & 1 deletion crates/compilers/src/compilers/solc/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub static RELEASES: std::sync::LazyLock<(svm::Releases, Vec<Version>, bool)> =
(releases, sorted_versions, true)
}
Err(err) => {
error!("{:?}", err);
error!("failed to deserialize SVM static RELEASES JSON: {err}");
Default::default()
}
}
Expand Down
10 changes: 6 additions & 4 deletions crates/compilers/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,9 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
.collect(),
);
} else {
error!("failed to resolve versions");
return Err(SolcError::msg(errors.join("\n")));
let s = errors.join("\n");
debug!("failed to resolve versions: {s}");
return Err(SolcError::msg(s));
}
}

Expand Down Expand Up @@ -960,8 +961,9 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
if errors.is_empty() {
Ok(resulted_sources)
} else {
error!("failed to resolve settings");
Err(SolcError::msg(errors.join("\n")))
let s = errors.join("\n");
debug!("failed to resolve settings: {s}");
return Err(SolcError::msg(s));
}
}

Expand Down
Loading