From 5137ec3525d2b797f414ac4a1b5f5afe1597f388 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Fri, 22 Nov 2024 05:54:30 +0400 Subject: [PATCH 1/2] fix(forge test): install missing dependencies before instantiating the project --- crates/forge/bin/cmd/test/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/forge/bin/cmd/test/mod.rs b/crates/forge/bin/cmd/test/mod.rs index 4e811bcbfbf9..79b12f582d38 100644 --- a/crates/forge/bin/cmd/test/mod.rs +++ b/crates/forge/bin/cmd/test/mod.rs @@ -291,16 +291,15 @@ impl TestArgs { config.invariant.gas_report_samples = 0; } - // Set up the project. - let mut project = config.project()?; - // Install missing dependencies. if install::install_missing_dependencies(&mut config) && config.auto_detect_remappings { // need to re-configure here to also catch additional remappings config = self.load_config(); - project = config.project()?; } + // Set up the project. + let project = config.project()?; + let mut filter = self.filter(&config); trace!(target: "forge::test", ?filter, "using filter"); From d14c002d2f64ac5ae04318fa399339d646fecad6 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Fri, 22 Nov 2024 05:56:28 +0400 Subject: [PATCH 2/2] optimization --- crates/config/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 6444802e3bc9..5a159c3925b8 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -904,6 +904,9 @@ impl Config { ) -> Result>, SolcError> { let mut map = BTreeMap::new(); + if self.compilation_restrictions.is_empty() { + return Ok(BTreeMap::new()); + } let graph = Graph::::resolve(paths)?; let (sources, _) = graph.into_sources();