Merge pull request #5838 from maxsam4/useLiteralContent-patch

useLiteralContent data validation
This commit is contained in:
chriseth 2019-01-23 10:35:32 +01:00 committed by GitHub
commit ea292393a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 0 deletions

View File

@ -298,6 +298,8 @@ boost::optional<Json::Value> checkOptimizerKeys(Json::Value const& _input)
boost::optional<Json::Value> checkMetadataKeys(Json::Value const& _input)
{
if (_input.isObject() && _input.isMember("useLiteralContent") && !_input["useLiteralContent"].isBool())
return formatFatalError("JSONError", "\"settings.metadata.useLiteralContent\" must be Boolean");
static set<string> keys{"useLiteralContent"};
return checkKeys(_input, keys, "settings.metadata");
}

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1,19 @@
{
"language": "Solidity",
"sources":
{
"A":
{
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
}
},
"settings":
{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "byzantium",
"metadata": {}
}
}

View File

@ -0,0 +1 @@
{"sources":{"A":{"id":0}}}

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1,21 @@
{
"language": "Solidity",
"sources":
{
"A":
{
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
}
},
"settings":
{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "byzantium",
"metadata": {
"useLiteralContent": "literalContent"
}
}
}

View File

@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.metadata.useLiteralContent\" must be Boolean","message":"\"settings.metadata.useLiteralContent\" must be Boolean","severity":"error","type":"JSONError"}]}