std json: do not request EVM bytecode (#410)

These compiler outputs are irrelevant for the `resolc` compilation
pipeline. It can also break the compilation pipeline. For example, solc
may reject the code without via-ir or fail during the EVM codegen phase
with stack too deep errors - which is not relevant to us.

---------

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
xermicus authored and GitHub committed 2025-11-13 10:32:32 +01:00
1 parent 8ee1860f12
commit 79aaca1a85
9 files changed
+96 -2

No files matched your search

+12 -1
View File
@@ -1,8 +1,10 @@
//! The tests for running resolc with standard JSON option.
use revive_solc_json_interface::SolcStandardJsonOutput;
use crate::tests::cli::utils::{
assert_command_success, assert_equal_exit_codes, execute_resolc_with_stdin_input,
execute_solc_with_stdin_input, STANDARD_JSON_CONTRACTS_PATH,
execute_solc_with_stdin_input, STANDARD_JSON_CONTRACTS_PATH, STANDARD_JSON_NO_EVM_CODEGEN_PATH,
};
const JSON_OPTION: &str = "--standard-json";
@@ -21,3 +23,12 @@ fn runs_with_valid_input_file() {
let solc_result = execute_solc_with_stdin_input(arguments, STANDARD_JSON_CONTRACTS_PATH);
assert_equal_exit_codes(&solc_result, &resolc_result);
}
#[test]
fn no_evm_codegen_requested() {
let result = execute_resolc_with_stdin_input(&[JSON_OPTION], STANDARD_JSON_NO_EVM_CODEGEN_PATH);
assert_command_success(&result, "EVM codegen std json input fixture should build");
let output: SolcStandardJsonOutput = serde_json::from_str(&result.stdout).unwrap();
assert!(!output.errors.iter().any(|msg| msg.severity == "error"))
}
+7 -1
View File
@@ -18,9 +18,15 @@ pub const YUL_CONTRACT_PATH: &str = "src/tests/data/yul/contract.yul";
/// The memeset YUL contract test fixture path.
pub const YUL_MEMSET_CONTRACT_PATH: &str = "src/tests/data/yul/memset.yul";
/// The standard JSON contracts test fixture path.
///
pub const STANDARD_JSON_CONTRACTS_PATH: &str =
"src/tests/data/standard_json/solidity_contracts.json";
/// The standard JSON no EVM codegen test fixture path.
///
/// This contains EVM bytecode selection flags with provided code
/// that doesn't compile without `viaIr`. Because we remove those
/// selection flags, it should compile fine regardless.
pub const STANDARD_JSON_NO_EVM_CODEGEN_PATH: &str =
"src/tests/data/standard_json/no_evm_codegen.json";
/// The simple Solidity contract containing i256 divisions and remains that should be compiled
/// correctly