From d7407fe138fe97dd301e81d3f1ade5874b7cc4cc Mon Sep 17 00:00:00 2001 From: xermicus Date: Thu, 18 Jun 2026 19:12:27 +0200 Subject: [PATCH] remove ambiguous ny opt configuration (#550) Otherwise the std json input settings aren't succint. Signed-off-by: xermicus --- crates/resolc/src/resolc/arguments.rs | 13 ++++-- crates/resolc/src/tests/cli/standard_json.rs | 45 +++----------------- 2 files changed, 15 insertions(+), 43 deletions(-) diff --git a/crates/resolc/src/resolc/arguments.rs b/crates/resolc/src/resolc/arguments.rs index 88a8615..215fee8 100644 --- a/crates/resolc/src/resolc/arguments.rs +++ b/crates/resolc/src/resolc/arguments.rs @@ -66,9 +66,9 @@ pub struct Arguments { /// Route Yul lowering through the experimental newyork IR pipeline. /// - /// Orthogonal to the input mode: composes with `--yul`, `--standard-json`, - /// `--combined-json`, and the default Solidity mode. Equivalent to setting the - /// `settings.polkavm.newyork` field in standard JSON input. Off by default. + /// Composes with `--yul`, `--combined-json`, and the default Solidity mode. In + /// standard JSON mode this flag is rejected; enable the pipeline via the + /// `settings.polkavm.newyork` input field instead. Off by default. #[arg(long = "newyork")] pub newyork: bool, @@ -410,6 +410,13 @@ impl Arguments { None, )); } + if self.newyork { + messages.push(SolcStandardJsonOutputError::new_error( + "The newyork IR pipeline must be enabled in standard JSON input polkavm settings.", + None, + None, + )); + } if !self.llvm_arguments.is_empty() { messages.push(SolcStandardJsonOutputError::new_error( "LLVM arguments must be configured in standard JSON input polkavm settings.", diff --git a/crates/resolc/src/tests/cli/standard_json.rs b/crates/resolc/src/tests/cli/standard_json.rs index a315800..c553424 100644 --- a/crates/resolc/src/tests/cli/standard_json.rs +++ b/crates/resolc/src/tests/cli/standard_json.rs @@ -557,6 +557,11 @@ fn invalid_extra_arguments() { error_message: "LLVM arguments must be configured in standard JSON input polkavm settings", }, + TestCase { + arguments: vec![JSON_OPTION, "--newyork"], + error_message: + "The newyork IR pipeline must be enabled in standard JSON input polkavm settings", + }, ]; for case in cases { @@ -610,46 +615,6 @@ fn pvm_codegen_newyork_input_setting() { ); } -/// The `--newyork` CLI flag selects the newyork pipeline for standard JSON input -/// and produces the same bytecode as the `settings.polkavm.newyork` input field. -#[test] -fn pvm_codegen_newyork_cli_flag() { - let stock = - execute_resolc_with_stdin_input(&[JSON_OPTION], STANDARD_JSON_NEWYORK_DISABLED_PATH); - assert_command_success(&stock, "the stock standard JSON input should build"); - let flagged = execute_resolc_with_stdin_input( - &[JSON_OPTION, "--newyork"], - STANDARD_JSON_NEWYORK_DISABLED_PATH, - ); - assert_command_success(&flagged, "the --newyork flag should build the stock input"); - - let stock_output = to_solc_standard_json_output(&stock.stdout); - let flagged_output = to_solc_standard_json_output(&flagged.stdout); - assert_no_errors(&stock_output); - assert_no_errors(&flagged_output); - - let stock_bytecode = bytecode_object(&stock_output, "C.sol", "C"); - let flagged_bytecode = bytecode_object(&flagged_output, "C.sol", "C"); - assert_ne!( - stock_bytecode, flagged_bytecode, - "--newyork should select a different pipeline than the default" - ); - - let via_field = - execute_resolc_with_stdin_input(&[JSON_OPTION], STANDARD_JSON_NEWYORK_ENABLED_PATH); - assert_command_success( - &via_field, - "the newyork-enabled standard JSON input should build", - ); - let via_field_output = to_solc_standard_json_output(&via_field.stdout); - assert_no_errors(&via_field_output); - assert_eq!( - flagged_bytecode, - bytecode_object(&via_field_output, "C.sol", "C"), - "--newyork and settings.polkavm.newyork should select the same pipeline" - ); -} - /// `settings.polkavm.newyork` also selects the newyork pipeline for `"language": "Yul"` /// standard JSON input: the same Yul source yields different bytecode than the stock pipeline. #[test]