diff --git a/Cargo.lock b/Cargo.lock index abdb309..65749dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1478,6 +1478,7 @@ name = "forge-testsuite" version = "0.1.0" dependencies = [ "ethers", + "ethers-solc", "forge", "foundry-common", "foundry-config", diff --git a/Cargo.toml b/Cargo.toml index 3345213..2cfcfb9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,5 @@ foundry-common = { git = "https://github.com/polytope-labs/foundry", rev = "acdf foundry-config = { git = "https://github.com/polytope-labs/foundry", rev = "acdfeeb24263903d5ab8135d67c42c8595f54192" } foundry-evm = { git = "https://github.com/polytope-labs/foundry", rev = "acdfeeb24263903d5ab8135d67c42c8595f54192" } ethers = { git = "https://github.com/gakonst/ethers-rs", rev = "594627dc1c3b490ba8f513f8f5e23d11448cbcf8", features = ["ethers-solc"] } +ethers-solc = { git = "https://github.com/gakonst/ethers-rs", rev = "594627dc1c3b490ba8f513f8f5e23d11448cbcf8", features = ["svm-solc"] } once_cell = "1.19.0" diff --git a/src/lib.rs b/src/lib.rs index fc4e951..c6b1ac7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,9 +19,9 @@ use ethers::{ abi::{Detokenize, Tokenize}, - solc::{remappings::Remapping, Project, ProjectPathsConfig}, types::{Log, U256}, }; +use ethers_solc::{remappings::Remapping, Project, ProjectPathsConfig, SolcConfig}; use forge::{ executor::{ inspector::CheatsConfig, @@ -82,7 +82,15 @@ fn runner_with_root(root: PathBuf) -> MultiContractRunner { paths.remappings.push(mapping) }); - let project = Project::builder().paths(paths).build().unwrap(); + let mut config = SolcConfig::builder().build(); + // enable the optimizer manually + config.settings.optimizer.enabled = Some(true); + let project = Project::builder() + .paths(paths) + .solc_config(config) + .set_auto_detect(true) + .build() + .unwrap(); let compiled = project.compile().unwrap(); if compiled.has_compiler_errors() {