Ensure correct flags are passed to solc in std json mode (#440)

This tests the marketplace contracts to compile fine. In prior versions
this fails to compile, hitting the solc "Stack too deep" error.

Closes #409

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
xermicus authored and GitHub committed 2026-01-06 11:16:59 +01:00
1 parent cfcd2ff77c
commit 13070a4bdf
4 files changed
+89 -2

No files matched your search

+21 -1
View File
@@ -4,7 +4,8 @@ use revive_solc_json_interface::SolcStandardJsonOutput;
use crate::cli_utils::{
assert_command_success, assert_equal_exit_codes, execute_resolc_with_stdin_input,
execute_solc_with_stdin_input, STANDARD_JSON_CONTRACTS_PATH, STANDARD_JSON_NO_EVM_CODEGEN_PATH,
execute_solc_with_stdin_input, STANDARD_JSON_CONTRACTS_PATH,
STANDARD_JSON_NO_EVM_CODEGEN_COMPLEX_PATH, STANDARD_JSON_NO_EVM_CODEGEN_PATH,
};
const JSON_OPTION: &str = "--standard-json";
@@ -32,3 +33,22 @@ fn no_evm_codegen_requested() {
let output: SolcStandardJsonOutput = serde_json::from_str(&result.stdout).unwrap();
assert!(!output.errors.iter().any(|msg| msg.severity == "error"))
}
/// A variant with more complex contracts.
///
/// The fixture is from a real project known to trigger the "Stack too deep" error.
///
/// The test ensures we set the right flags when requesting the Yul IR from solc:
/// no EVM codegen should be involved.
#[test]
fn no_evm_codegen_requested_complex() {
let result =
execute_resolc_with_stdin_input(&[JSON_OPTION], STANDARD_JSON_NO_EVM_CODEGEN_COMPLEX_PATH);
assert_command_success(
&result,
"the EVM codegen std json complext input fixture should build fine",
);
let output: SolcStandardJsonOutput = serde_json::from_str(&result.stdout).unwrap();
assert!(!output.errors.iter().any(|msg| msg.severity == "error"))
}