mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-11-10 20:57:10 +00:00
remove ambiguous ny opt configuration (#550)
Otherwise the std json input settings aren't succint. Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
1 parent
6e0dfdcbb1
commit
d7407fe138
2 files changed
+15
-43
No files matched your search
@@ -66,9 +66,9 @@ pub struct Arguments {
|
|||||||
|
|
||||||
/// Route Yul lowering through the experimental newyork IR pipeline.
|
/// Route Yul lowering through the experimental newyork IR pipeline.
|
||||||
///
|
///
|
||||||
/// Orthogonal to the input mode: composes with `--yul`, `--standard-json`,
|
/// Composes with `--yul`, `--combined-json`, and the default Solidity mode. In
|
||||||
/// `--combined-json`, and the default Solidity mode. Equivalent to setting the
|
/// standard JSON mode this flag is rejected; enable the pipeline via the
|
||||||
/// `settings.polkavm.newyork` field in standard JSON input. Off by default.
|
/// `settings.polkavm.newyork` input field instead. Off by default.
|
||||||
#[arg(long = "newyork")]
|
#[arg(long = "newyork")]
|
||||||
pub newyork: bool,
|
pub newyork: bool,
|
||||||
|
|
||||||
@@ -410,6 +410,13 @@ impl Arguments {
|
|||||||
None,
|
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() {
|
if !self.llvm_arguments.is_empty() {
|
||||||
messages.push(SolcStandardJsonOutputError::new_error(
|
messages.push(SolcStandardJsonOutputError::new_error(
|
||||||
"LLVM arguments must be configured in standard JSON input polkavm settings.",
|
"LLVM arguments must be configured in standard JSON input polkavm settings.",
|
||||||
|
|||||||
@@ -557,6 +557,11 @@ fn invalid_extra_arguments() {
|
|||||||
error_message:
|
error_message:
|
||||||
"LLVM arguments must be configured in standard JSON input polkavm settings",
|
"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 {
|
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"`
|
/// `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.
|
/// standard JSON input: the same Yul source yields different bytecode than the stock pipeline.
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in new issue
Block a user