Emit warning when using the Yul optimiser

This commit is contained in:
Alex Beregszaszi
2019-03-25 18:38:06 +01:00
committed by chriseth
parent dce27bb452
commit 0432401e20
7 changed files with 48 additions and 0 deletions
@@ -1,3 +1,4 @@
Warning: The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.
gas_test_abiv2_optimize_yul/input.sol:2:1: Warning: Experimental features are turned on. Do not use experimental features on live deployments.
pragma experimental ABIEncoderV2;
^-------------------------------^
@@ -0,0 +1,17 @@
{
"language": "Solidity",
"sources":
{
"A":
{
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
}
},
"settings":
{
"optimizer": {
"enabled": true,
"details": { "yul": true }
}
}
}
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"Warning: The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.\n","message":"The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.","severity":"warning","type":"Warning"}],"sources":{"A":{"id":0}}}
@@ -0,0 +1,16 @@
{
"language": "Solidity",
"sources":
{
"A":
{
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
}
},
"settings":
{
"optimizer": {
"details": { "yul": true, "yulDetails": {} }
}
}
}
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"Warning: The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.\n","message":"The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.","severity":"warning","type":"Warning"}],"sources":{"A":{"id":0}}}
+6
View File
@@ -996,6 +996,12 @@ BOOST_AUTO_TEST_CASE(optimizer_settings_details_different)
)";
Json::Value result = compile(input);
BOOST_CHECK(containsAtMostWarnings(result));
BOOST_CHECK(containsError(
result,
"Warning",
"The Yul optimiser is still experimental. "
"Do not use it in production unless correctness of generated code is verified with extensive tests."
));
Json::Value contract = getContractResult(result, "fileA", "A");
BOOST_CHECK(contract.isObject());
BOOST_CHECK(contract["metadata"].isString());