@@ -12,7 +12,7 @@ use foundry_cli::utils::{LoadConfig, STATIC_FUZZ_SEED};
12
12
use foundry_common:: { compile:: ProjectCompiler , errors:: convert_solar_errors} ;
13
13
use foundry_compilers:: {
14
14
Artifact , ArtifactId , Project , ProjectCompileOutput , ProjectPathsConfig , VYPER_EXTENSIONS ,
15
- artifacts:: { CompactBytecode , CompactDeployedBytecode , SolcLanguage , sourcemap:: SourceMap } ,
15
+ artifacts:: { CompactBytecode , CompactDeployedBytecode , sourcemap:: SourceMap } ,
16
16
} ;
17
17
use foundry_config:: Config ;
18
18
use foundry_evm:: { core:: ic:: IcPcMap , opts:: EvmOpts } ;
@@ -131,39 +131,23 @@ impl CoverageArgs {
131
131
let mut project = config. ephemeral_project ( ) ?;
132
132
133
133
if self . ir_minimum {
134
- // print warning message
135
134
sh_warn ! (
136
135
"`--ir-minimum` enables `viaIR` with minimum optimization, \
137
136
which can result in inaccurate source mappings.\n \
138
137
Only use this flag as a workaround if you are experiencing \" stack too deep\" errors.\n \
139
138
Note that `viaIR` is production ready since Solidity 0.8.13 and above.\n \
140
139
See more: https://github.com/foundry-rs/foundry/issues/3357"
141
140
) ?;
142
-
143
- // Enable viaIR with minimum optimization: https://github.com/ethereum/solidity/issues/12533#issuecomment-1013073350
144
- // And also in new releases of Solidity: https://github.com/ethereum/solidity/issues/13972#issuecomment-1628632202
145
- project. settings . solc . settings =
146
- project. settings . solc . settings . with_via_ir_minimum_optimization ( ) ;
147
-
148
- // Sanitize settings for solc 0.8.4 if version cannot be detected: https://github.com/foundry-rs/foundry/issues/9322
149
- // But keep the EVM version: https://github.com/ethereum/solidity/issues/15775
150
- let evm_version = project. settings . solc . evm_version ;
151
- let version = config. solc_version ( ) . unwrap_or_else ( || Version :: new ( 0 , 8 , 4 ) ) ;
152
- project. settings . solc . settings . sanitize ( & version, SolcLanguage :: Solidity ) ;
153
- project. settings . solc . evm_version = evm_version;
154
141
} else {
155
142
sh_warn ! (
156
143
"optimizer settings and `viaIR` have been disabled for accurate coverage reports.\n \
157
144
If you encounter \" stack too deep\" errors, consider using `--ir-minimum` which \
158
145
enables `viaIR` with minimum optimization resolving most of the errors"
159
146
) ?;
160
-
161
- project. settings . solc . optimizer . disable ( ) ;
162
- project. settings . solc . optimizer . runs = None ;
163
- project. settings . solc . optimizer . details = None ;
164
- project. settings . solc . via_ir = None ;
165
147
}
166
148
149
+ config. disable_optimizations ( & mut project, self . ir_minimum ) ;
150
+
167
151
let output = ProjectCompiler :: default ( )
168
152
. compile ( & project) ?
169
153
. with_stripped_file_prefixes ( project. root ( ) ) ;
0 commit comments