From d073930fa3ae216e65138011e92794affa9eab8b Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 13 Mar 2023 20:43:53 +0100 Subject: [PATCH] chore(solc): add more cache traces (#2248) * chore(solc): add more cache traces * simplify bools --- ethers-solc/src/cache.rs | 5 ++++- ethers-solc/src/compile/project.rs | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ethers-solc/src/cache.rs b/ethers-solc/src/cache.rs index 08fba251..b0586712 100644 --- a/ethers-solc/src/cache.rs +++ b/ethers-solc/src/cache.rs @@ -922,7 +922,10 @@ impl<'a, T: ArtifactOutput> ArtifactsCache<'a, T> { write_to_disk: bool, ) -> Result> { match self { - ArtifactsCache::Ephemeral(_, _) => Ok(Default::default()), + ArtifactsCache::Ephemeral(_, _) => { + tracing::trace!("no cache configured, ephemeral"); + Ok(Default::default()) + } ArtifactsCache::Cached(cache) => { let ArtifactsCacheInner { mut cache, diff --git a/ethers-solc/src/compile/project.rs b/ethers-solc/src/compile/project.rs index e5f503a4..7a792286 100644 --- a/ethers-solc/src/compile/project.rs +++ b/ethers-solc/src/compile/project.rs @@ -358,13 +358,14 @@ impl<'a, T: ArtifactOutput> ArtifactsState<'a, T> { /// /// this concludes the [`Project::compile()`] statemachine fn write_cache(self) -> Result> { - trace!("write cache"); let ArtifactsState { output, cache, compiled_artifacts } = self; let project = cache.project(); let ignored_error_codes = project.ignored_error_codes.clone(); let compiler_severity_filter = project.compiler_severity_filter.clone(); - let skip_write_to_disk = project.no_artifacts || - output.has_error(&ignored_error_codes, &compiler_severity_filter); + let has_error = output.has_error(&ignored_error_codes, &compiler_severity_filter); + let skip_write_to_disk = project.no_artifacts || has_error; + trace!(has_error, project.no_artifacts, skip_write_to_disk, cache_path=?project.cache_path(),"prepare writing cache file"); + let cached_artifacts = cache.consume(&compiled_artifacts, !skip_write_to_disk)?; Ok(ProjectCompileOutput { compiler_output: output,