mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallowed --metadata-literal, --model-checker-show-unproved, --model-checker-div-mod-no-slacks ----metadata-hash=swarm outside of compiler mode
This commit is contained in:
parent
035f6abb1b
commit
7aaab9a797
@ -13,6 +13,7 @@ Compiler Features:
|
||||
Bugfixes:
|
||||
* ABI Encoder: When encoding an empty string coming from storage do not add a superfluous empty slot for data.
|
||||
* Yul Optimizer: Do not remove ``returndatacopy`` in cases in which it might perform out-of-bounds reads that unconditionally revert as out-of-gas. Previously, any ``returndatacopy`` that wrote to memory that was never read from was removed without accounting for the out-of-bounds condition.
|
||||
* Commandline Interface: Disallow the following options outside of the compiler mode: ``--via-ir``,``--metadata-literal``, ``--metadata-hash``, ``--model-checker-show-unproved``, ``--model-checker-div-mod-no-slacks``.
|
||||
|
||||
|
||||
### 0.8.14 (2022-05-17)
|
||||
|
||||
@ -911,7 +911,12 @@ void CommandLineParser::processArgs()
|
||||
// TODO: This should eventually contain all options.
|
||||
{g_strErrorRecovery, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strExperimentalViaIR, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strViaIR, {InputMode::Compiler, InputMode::CompilerWithASTImport}}
|
||||
{g_strViaIR, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strMetadataLiteral, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strMetadataHash, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strModelCheckerShowUnproved, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strModelCheckerDivModNoSlacks, {InputMode::Compiler, InputMode::CompilerWithASTImport}},
|
||||
{g_strModelCheckerEngine, {InputMode::Compiler, InputMode::CompilerWithASTImport}}
|
||||
};
|
||||
vector<string> invalidOptionsForCurrentInputMode;
|
||||
for (auto const& [optionName, inputModes]: validOptionInputModeCombinations)
|
||||
|
||||
@ -281,15 +281,10 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options)
|
||||
"--libraries="
|
||||
"dir1/file1.sol:L=0x1234567890123456789012345678901234567890,"
|
||||
"dir2/file2.sol:L=0x1111122222333334444455555666667777788888",
|
||||
"--metadata-hash=swarm", // Ignored in assembly mode
|
||||
"--metadata-literal", // Ignored in assembly mode
|
||||
"--model-checker-contracts=" // Ignored in assembly mode
|
||||
"contract1.yul:A,"
|
||||
"contract2.yul:B",
|
||||
"--model-checker-div-mod-no-slacks", // Ignored in assembly mode
|
||||
"--model-checker-engine=bmc", // Ignored in assembly mode
|
||||
"--model-checker-invariants=contract,reentrancy", // Ignored in assembly mode
|
||||
"--model-checker-show-unproved", // Ignored in assembly mode
|
||||
"--model-checker-solvers=z3,smtlib2", // Ignored in assembly mode
|
||||
"--model-checker-targets=" // Ignored in assembly mode
|
||||
"underflow,"
|
||||
@ -378,15 +373,10 @@ BOOST_AUTO_TEST_CASE(standard_json_mode_options)
|
||||
"dir2/file2.sol:L=0x1111122222333334444455555666667777788888",
|
||||
"--gas", // Accepted but has no effect in Standard JSON mode
|
||||
"--combined-json=abi,bin", // Accepted but has no effect in Standard JSON mode
|
||||
"--metadata-hash=swarm", // Ignored in Standard JSON mode
|
||||
"--metadata-literal", // Ignored in Standard JSON mode
|
||||
"--model-checker-contracts=" // Ignored in Standard JSON mode
|
||||
"contract1.yul:A,"
|
||||
"contract2.yul:B",
|
||||
"--model-checker-div-mod-no-slacks", // Ignored in Standard JSON mode
|
||||
"--model-checker-engine=bmc", // Ignored in Standard JSON mode
|
||||
"--model-checker-invariants=contract,reentrancy", // Ignored in Standard JSON mode
|
||||
"--model-checker-show-unproved", // Ignored in Standard JSON mode
|
||||
"--model-checker-solvers=z3,smtlib2", // Ignored in Standard JSON mode
|
||||
"--model-checker-targets=" // Ignored in Standard JSON mode
|
||||
"underflow,"
|
||||
@ -424,16 +414,25 @@ BOOST_AUTO_TEST_CASE(invalid_options_input_modes_combinations)
|
||||
// TODO: This should eventually contain all options.
|
||||
{"--error-recovery", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}},
|
||||
{"--experimental-via-ir", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}},
|
||||
{"--via-ir", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}}
|
||||
{"--via-ir", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}},
|
||||
{"--metadata-literal", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}},
|
||||
{"--metadata-hash=swarm", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}},
|
||||
{"--model-checker-show-unproved", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}},
|
||||
{"--model-checker-div-mod-no-slacks", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}},
|
||||
{"--model-checker-engine=bmc", {"--assemble", "--yul", "--strict-assembly", "--standard-json", "--link"}}
|
||||
};
|
||||
|
||||
for (auto const& [optionName, inputModes]: invalidOptionInputModeCombinations)
|
||||
for (string const& inputMode: inputModes)
|
||||
{
|
||||
stringstream serr;
|
||||
vector<string> commandLine = {"solc", optionName, "file", inputMode};
|
||||
size_t separatorPosition = optionName.find("=");
|
||||
string optionNameWithoutValue = optionName.substr(0, separatorPosition);
|
||||
soltestAssert(!optionNameWithoutValue.empty());
|
||||
|
||||
string expectedMessage = "The following options are not supported in the current input mode: " + optionName;
|
||||
vector<string> commandLine = {"solc", optionNameWithoutValue, "file", inputMode};
|
||||
|
||||
string expectedMessage = "The following options are not supported in the current input mode: " + optionNameWithoutValue;
|
||||
auto hasCorrectMessage = [&](CommandLineValidationError const& _exception) { return _exception.what() == expectedMessage; };
|
||||
|
||||
BOOST_CHECK_EXCEPTION(parseCommandLine(commandLine), CommandLineValidationError, hasCorrectMessage);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user