mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add support to import AST via Standard JSON.
This commit is contained in:
parent
11ac5a4efa
commit
5348b9df84
@ -7,7 +7,7 @@ Compiler Features:
|
||||
* Commandline Interface: Add new input mode ``--import-asm-json`` that can import EVM assembly in the format used by ``--asm-json``.
|
||||
* EWasm: Remove EWasm backend.
|
||||
* Parser: Introduce ``pragma experimental solidity``, which will enable an experimental language mode that in particular has no stability guarantees between non-breaking releases and is not suited for production use.
|
||||
|
||||
* Standard JSON Interface: Add experimental support for importing EVM Assembly JSON via Standard JSON.
|
||||
|
||||
Bugfixes:
|
||||
* SMTChecker: Fix encoding of side-effects inside ``if`` and ``ternary conditional``statements in the BMC engine.
|
||||
|
@ -203,7 +203,7 @@ Input Description
|
||||
.. code-block:: javascript
|
||||
|
||||
{
|
||||
// Required: Source code language. Currently supported are "Solidity", "Yul" and "SolidityAST" (experimental).
|
||||
// Required: Source code language. Currently supported are "Solidity", "Yul", "SolidityAST" (experimental), "EvmAssemblyJSON" (experimental).
|
||||
"language": "Solidity",
|
||||
// Required
|
||||
"sources":
|
||||
@ -238,6 +238,11 @@ Input Description
|
||||
// produced by the compiler in "stopAfter": "parsing" mode and then re-performs
|
||||
// analysis, so any analysis-based annotations of the AST are ignored upon import.
|
||||
"ast": { ... } // formatted as the json ast requested with the ``ast`` output selection.
|
||||
// If language is set to "EvmAssemblyJSON", an EVM Assembly JSON object needs to be supplied directly under the key of the source.
|
||||
// The format need to be the same as used by ``--asm-json``. Only one source can be defined.
|
||||
".code": [ ... ],
|
||||
".data": { ... }, // optional
|
||||
"sourceList": [ ... ], // optional (if no ``source`` node was defined in any ``.code`` element.)
|
||||
},
|
||||
"destructible":
|
||||
{
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <libyul/optimiser/Suite.h>
|
||||
|
||||
#include <libevmasm/Disassemble.h>
|
||||
#include <libevmasm/EVMAssemblyStack.h>
|
||||
|
||||
#include <libsmtutil/Exceptions.h>
|
||||
|
||||
@ -716,6 +717,11 @@ std::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompiler:
|
||||
for (auto const& sourceName: sources.getMemberNames())
|
||||
ret.sources[sourceName] = util::jsonCompactPrint(sources[sourceName]);
|
||||
}
|
||||
else if (ret.language == "EvmAssemblyJSON")
|
||||
{
|
||||
for (auto const& sourceName: sources.getMemberNames())
|
||||
ret.sources[sourceName] = util::jsonCompactPrint(sources[sourceName]);
|
||||
}
|
||||
|
||||
Json::Value const& auxInputs = _input["auxiliaryInput"];
|
||||
|
||||
@ -1129,6 +1135,91 @@ map<string, Json::Value> StandardCompiler::parseAstFromInput(StringMap const& _s
|
||||
return sourceJsons;
|
||||
}
|
||||
|
||||
Json::Value StandardCompiler::importEvmAssembly(StandardCompiler::InputsAndSettings _inputsAndSettings)
|
||||
{
|
||||
solAssert(_inputsAndSettings.language == "EvmAssemblyJSON");
|
||||
solAssert(1 == _inputsAndSettings.sources.size());
|
||||
|
||||
bool const binariesRequested = isBinaryRequested(_inputsAndSettings.outputSelection);
|
||||
bool const wildcardMatchesExperimental = false;
|
||||
Json::Value output = Json::objectValue;
|
||||
if (binariesRequested)
|
||||
{
|
||||
evmasm::EVMAssemblyStack stack(_inputsAndSettings.evmVersion);
|
||||
std::string const& sourceName = _inputsAndSettings.sources.begin()->first; // result of structured binding can only be used within lambda from C++20 on.
|
||||
std::string const& source = _inputsAndSettings.sources.begin()->second;
|
||||
stack.parseAndAnalyze(sourceName, source);
|
||||
stack.assemble();
|
||||
if (stack.compilationSuccessful())
|
||||
{
|
||||
// EVM
|
||||
Json::Value evmData(Json::objectValue);
|
||||
if (isArtifactRequested(_inputsAndSettings.outputSelection, sourceName, "", "evm.assembly", wildcardMatchesExperimental))
|
||||
evmData["assembly"] = stack.assemblyString(sourceName, {{sourceName, source}});
|
||||
if (isArtifactRequested(_inputsAndSettings.outputSelection, sourceName, "", "evm.legacyAssembly", wildcardMatchesExperimental))
|
||||
evmData["legacyAssembly"] = stack.assemblyJSON(sourceName);
|
||||
|
||||
if (isArtifactRequested(
|
||||
_inputsAndSettings.outputSelection,
|
||||
sourceName,
|
||||
"",
|
||||
evmObjectComponents("bytecode"),
|
||||
wildcardMatchesExperimental
|
||||
))
|
||||
{
|
||||
evmData["bytecode"] = collectEVMObject(
|
||||
_inputsAndSettings.evmVersion,
|
||||
stack.object(sourceName),
|
||||
stack.sourceMapping(sourceName),
|
||||
{},
|
||||
false,
|
||||
[&](string const& _element)
|
||||
{
|
||||
return isArtifactRequested(
|
||||
_inputsAndSettings.outputSelection,
|
||||
sourceName,
|
||||
"",
|
||||
"evm.bytecode." + _element,
|
||||
wildcardMatchesExperimental);
|
||||
});
|
||||
}
|
||||
|
||||
if (isArtifactRequested(
|
||||
_inputsAndSettings.outputSelection,
|
||||
sourceName,
|
||||
"",
|
||||
evmObjectComponents("deployedBytecode"),
|
||||
wildcardMatchesExperimental
|
||||
))
|
||||
evmData["deployedBytecode"] = collectEVMObject(
|
||||
_inputsAndSettings.evmVersion,
|
||||
stack.runtimeObject(sourceName),
|
||||
stack.runtimeSourceMapping(sourceName),
|
||||
{},
|
||||
true,
|
||||
[&](string const& _element)
|
||||
{
|
||||
return isArtifactRequested(
|
||||
_inputsAndSettings.outputSelection,
|
||||
sourceName,
|
||||
"",
|
||||
"evm.deployedBytecode." + _element,
|
||||
wildcardMatchesExperimental);
|
||||
});
|
||||
|
||||
Json::Value contractData(Json::objectValue);
|
||||
if (!evmData.empty())
|
||||
contractData["evm"] = evmData;
|
||||
|
||||
Json::Value contractsOutput = Json::objectValue;
|
||||
contractsOutput[sourceName][""] = contractData;
|
||||
if (!contractsOutput.empty())
|
||||
output["contracts"] = contractsOutput;
|
||||
}
|
||||
}
|
||||
return util::removeNullMembers(output);
|
||||
}
|
||||
|
||||
Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSettings _inputsAndSettings)
|
||||
{
|
||||
CompilerStack compilerStack(m_readFile);
|
||||
@ -1577,8 +1668,10 @@ Json::Value StandardCompiler::compile(Json::Value const& _input) noexcept
|
||||
return compileYul(std::move(settings));
|
||||
else if (settings.language == "SolidityAST")
|
||||
return compileSolidity(std::move(settings));
|
||||
else if (settings.language == "EvmAssemblyJSON")
|
||||
return importEvmAssembly(std::move(settings));
|
||||
else
|
||||
return formatFatalError(Error::Type::JSONError, "Only \"Solidity\", \"Yul\" or \"SolidityAST\" is supported as a language.");
|
||||
return formatFatalError(Error::Type::JSONError, "Only \"Solidity\", \"Yul\", \"SolidityAST\" or \"EvmAssemblyJSON\" is supported as a language.");
|
||||
}
|
||||
catch (Json::LogicError const& _exception)
|
||||
{
|
||||
|
@ -96,6 +96,7 @@ private:
|
||||
std::variant<InputsAndSettings, Json::Value> parseInput(Json::Value const& _input);
|
||||
|
||||
std::map<std::string, Json::Value> parseAstFromInput(StringMap const& _sources);
|
||||
Json::Value importEvmAssembly(InputsAndSettings _inputsAndSettings);
|
||||
Json::Value compileSolidity(InputsAndSettings _inputsAndSettings);
|
||||
Json::Value compileYul(InputsAndSettings _inputsAndSettings);
|
||||
|
||||
|
417
test/cmdlineTests/standard_import_evmasm/input.json
Normal file
417
test/cmdlineTests/standard_import_evmasm/input.json
Normal file
@ -0,0 +1,417 @@
|
||||
{
|
||||
"language": "EvmAssemblyJSON",
|
||||
"sources": {
|
||||
"A": {
|
||||
".code": [
|
||||
{
|
||||
"begin": 36,
|
||||
"end": 51,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"begin": 33,
|
||||
"end": 34,
|
||||
"name": "DUP1",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 26,
|
||||
"end": 52,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 67,
|
||||
"end": 80,
|
||||
"name": "PUSHSIZE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 64,
|
||||
"end": 65,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"begin": 57,
|
||||
"end": 81,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 96,
|
||||
"end": 111,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 93,
|
||||
"end": 94,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "2"
|
||||
},
|
||||
{
|
||||
"begin": 86,
|
||||
"end": 112,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 127,
|
||||
"end": 140,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 124,
|
||||
"end": 125,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "3"
|
||||
},
|
||||
{
|
||||
"begin": 117,
|
||||
"end": 141,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 156,
|
||||
"end": 173,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000ffffffffffffffff"
|
||||
},
|
||||
{
|
||||
"begin": 153,
|
||||
"end": 154,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "4"
|
||||
},
|
||||
{
|
||||
"begin": 146,
|
||||
"end": 174,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 189,
|
||||
"end": 204,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000ffffffffffffffff"
|
||||
},
|
||||
{
|
||||
"begin": 186,
|
||||
"end": 187,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "5"
|
||||
},
|
||||
{
|
||||
"begin": 179,
|
||||
"end": 205,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 220,
|
||||
"end": 237,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000fffffffffffffffe"
|
||||
},
|
||||
{
|
||||
"begin": 217,
|
||||
"end": 218,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "6"
|
||||
},
|
||||
{
|
||||
"begin": 210,
|
||||
"end": 238,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 253,
|
||||
"end": 268,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000fffffffffffffffe"
|
||||
},
|
||||
{
|
||||
"begin": 250,
|
||||
"end": 251,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "7"
|
||||
},
|
||||
{
|
||||
"begin": 243,
|
||||
"end": 269,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 284,
|
||||
"end": 303,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000fffffffffffffffd"
|
||||
},
|
||||
{
|
||||
"begin": 281,
|
||||
"end": 282,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "8"
|
||||
},
|
||||
{
|
||||
"begin": 274,
|
||||
"end": 304,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 319,
|
||||
"end": 336,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000fffffffffffffffd"
|
||||
},
|
||||
{
|
||||
"begin": 316,
|
||||
"end": 317,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "9"
|
||||
},
|
||||
{
|
||||
"begin": 309,
|
||||
"end": 337,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
}
|
||||
],
|
||||
".data": {
|
||||
"0": {
|
||||
".code": [
|
||||
{
|
||||
"begin": 418,
|
||||
"end": 433,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 414,
|
||||
"end": 416,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "A"
|
||||
},
|
||||
{
|
||||
"begin": 407,
|
||||
"end": 434,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 452,
|
||||
"end": 465,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 448,
|
||||
"end": 450,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "B"
|
||||
},
|
||||
{
|
||||
"begin": 441,
|
||||
"end": 466,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 484,
|
||||
"end": 499,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000001"
|
||||
},
|
||||
{
|
||||
"begin": 480,
|
||||
"end": 482,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "C"
|
||||
},
|
||||
{
|
||||
"begin": 473,
|
||||
"end": 500,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 518,
|
||||
"end": 531,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000001"
|
||||
},
|
||||
{
|
||||
"begin": 514,
|
||||
"end": 516,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "D"
|
||||
},
|
||||
{
|
||||
"begin": 507,
|
||||
"end": 532,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 550,
|
||||
"end": 567,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000ffffffffffffffff"
|
||||
},
|
||||
{
|
||||
"begin": 546,
|
||||
"end": 548,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "E"
|
||||
},
|
||||
{
|
||||
"begin": 539,
|
||||
"end": 568,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 586,
|
||||
"end": 601,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000ffffffffffffffff"
|
||||
},
|
||||
{
|
||||
"begin": 582,
|
||||
"end": 584,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "F"
|
||||
},
|
||||
{
|
||||
"begin": 575,
|
||||
"end": 602,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
}
|
||||
],
|
||||
".data": {
|
||||
"0": {
|
||||
".code": [
|
||||
{
|
||||
"begin": 658,
|
||||
"end": 673,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 654,
|
||||
"end": 656,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "10"
|
||||
},
|
||||
{
|
||||
"begin": 647,
|
||||
"end": 674,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 694,
|
||||
"end": 707,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 690,
|
||||
"end": 692,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "11"
|
||||
},
|
||||
{
|
||||
"begin": 683,
|
||||
"end": 708,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
}
|
||||
],
|
||||
".data": {
|
||||
"0": {
|
||||
".code": [
|
||||
{
|
||||
"begin": 761,
|
||||
"end": 770,
|
||||
"name": "INVALID",
|
||||
"source": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"1": {
|
||||
".code": [
|
||||
{
|
||||
"begin": 833,
|
||||
"end": 842,
|
||||
"name": "INVALID",
|
||||
"source": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"ACAF3289D7B601CBD114FB36C4D29C85BBFD5E133F14CB355C3FD8D99367964F": "48656c6c6f2c20576f726c6421"
|
||||
},
|
||||
"sourceList": [
|
||||
"<stdin>"
|
||||
]
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": {
|
||||
"*": {
|
||||
"": [
|
||||
"evm.assembly",
|
||||
"evm.legacyAssembly",
|
||||
"evm.bytecode",
|
||||
"evm.deployedBytecode"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
575
test/cmdlineTests/standard_import_evmasm/output.json
Normal file
575
test/cmdlineTests/standard_import_evmasm/output.json
Normal file
@ -0,0 +1,575 @@
|
||||
{
|
||||
"contracts":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"":
|
||||
{
|
||||
"evm":
|
||||
{
|
||||
"assembly": " /* \"<stdin>\":36:51 */
|
||||
0x00
|
||||
/* \"<stdin>\":33:34 */
|
||||
dup1
|
||||
/* \"<stdin>\":26:52 */
|
||||
sstore
|
||||
/* \"<stdin>\":67:80 */
|
||||
bytecodeSize
|
||||
/* \"<stdin>\":64:65 */
|
||||
0x01
|
||||
/* \"<stdin>\":57:81 */
|
||||
sstore
|
||||
/* \"<stdin>\":96:111 */
|
||||
dataOffset(sub_0)
|
||||
/* \"<stdin>\":93:94 */
|
||||
0x02
|
||||
/* \"<stdin>\":86:112 */
|
||||
sstore
|
||||
/* \"<stdin>\":127:140 */
|
||||
dataSize(sub_0)
|
||||
/* \"<stdin>\":124:125 */
|
||||
0x03
|
||||
/* \"<stdin>\":117:141 */
|
||||
sstore
|
||||
/* \"<stdin>\":156:173 */
|
||||
dataOffset(sub_0.sub_0)
|
||||
/* \"<stdin>\":153:154 */
|
||||
0x04
|
||||
/* \"<stdin>\":146:174 */
|
||||
sstore
|
||||
/* \"<stdin>\":189:204 */
|
||||
dataSize(sub_0.sub_0)
|
||||
/* \"<stdin>\":186:187 */
|
||||
0x05
|
||||
/* \"<stdin>\":179:205 */
|
||||
sstore
|
||||
/* \"<stdin>\":220:237 */
|
||||
dataOffset(sub_0.sub_0.sub_0)
|
||||
/* \"<stdin>\":217:218 */
|
||||
0x06
|
||||
/* \"<stdin>\":210:238 */
|
||||
sstore
|
||||
/* \"<stdin>\":253:268 */
|
||||
dataSize(sub_0.sub_0.sub_0)
|
||||
/* \"<stdin>\":250:251 */
|
||||
0x07
|
||||
/* \"<stdin>\":243:269 */
|
||||
sstore
|
||||
/* \"<stdin>\":284:303 */
|
||||
dataOffset(sub_0.sub_1)
|
||||
/* \"<stdin>\":281:282 */
|
||||
0x08
|
||||
/* \"<stdin>\":274:304 */
|
||||
sstore
|
||||
/* \"<stdin>\":319:336 */
|
||||
dataSize(sub_0.sub_1)
|
||||
/* \"<stdin>\":316:317 */
|
||||
0x09
|
||||
/* \"<stdin>\":309:337 */
|
||||
sstore
|
||||
stop
|
||||
data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421
|
||||
|
||||
sub_0: assembly {
|
||||
/* \"<stdin>\":418:433 */
|
||||
dataOffset(sub_0)
|
||||
/* \"<stdin>\":414:416 */
|
||||
0x0a
|
||||
/* \"<stdin>\":407:434 */
|
||||
sstore
|
||||
/* \"<stdin>\":452:465 */
|
||||
dataSize(sub_0)
|
||||
/* \"<stdin>\":448:450 */
|
||||
0x0b
|
||||
/* \"<stdin>\":441:466 */
|
||||
sstore
|
||||
/* \"<stdin>\":484:499 */
|
||||
dataOffset(sub_1)
|
||||
/* \"<stdin>\":480:482 */
|
||||
0x0c
|
||||
/* \"<stdin>\":473:500 */
|
||||
sstore
|
||||
/* \"<stdin>\":518:531 */
|
||||
dataSize(sub_1)
|
||||
/* \"<stdin>\":514:516 */
|
||||
0x0d
|
||||
/* \"<stdin>\":507:532 */
|
||||
sstore
|
||||
/* \"<stdin>\":550:567 */
|
||||
dataOffset(sub_0.sub_0)
|
||||
/* \"<stdin>\":546:548 */
|
||||
0x0e
|
||||
/* \"<stdin>\":539:568 */
|
||||
sstore
|
||||
/* \"<stdin>\":586:601 */
|
||||
dataSize(sub_0.sub_0)
|
||||
/* \"<stdin>\":582:584 */
|
||||
0x0f
|
||||
/* \"<stdin>\":575:602 */
|
||||
sstore
|
||||
stop
|
||||
|
||||
sub_0: assembly {
|
||||
/* \"<stdin>\":658:673 */
|
||||
dataOffset(sub_0)
|
||||
/* \"<stdin>\":654:656 */
|
||||
0x10
|
||||
/* \"<stdin>\":647:674 */
|
||||
sstore
|
||||
/* \"<stdin>\":694:707 */
|
||||
dataSize(sub_0)
|
||||
/* \"<stdin>\":690:692 */
|
||||
0x11
|
||||
/* \"<stdin>\":683:708 */
|
||||
sstore
|
||||
stop
|
||||
|
||||
sub_0: assembly {
|
||||
/* \"<stdin>\":761:770 */
|
||||
invalid
|
||||
}
|
||||
}
|
||||
|
||||
sub_1: assembly {
|
||||
/* \"<stdin>\":833:842 */
|
||||
invalid
|
||||
}
|
||||
}
|
||||
",
|
||||
"bytecode":
|
||||
{
|
||||
"functionDebugData": {},
|
||||
"linkReferences": {},
|
||||
"object": "<BYTECODE REMOVED>",
|
||||
"opcodes":"<OPCODES REMOVED>",
|
||||
"sourceMap":"<SOURCEMAP REMOVED>"
|
||||
},
|
||||
"deployedBytecode":
|
||||
{
|
||||
"functionDebugData": {},
|
||||
"immutableReferences": {},
|
||||
"linkReferences": {},
|
||||
"object": "<BYTECODE REMOVED>",
|
||||
"opcodes":"<OPCODES REMOVED>",
|
||||
"sourceMap":"<SOURCEMAP REMOVED>"
|
||||
},
|
||||
"legacyAssembly":
|
||||
{
|
||||
".code":
|
||||
[
|
||||
{
|
||||
"begin": 36,
|
||||
"end": 51,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"begin": 33,
|
||||
"end": 34,
|
||||
"name": "DUP1",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 26,
|
||||
"end": 52,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 67,
|
||||
"end": 80,
|
||||
"name": "PUSHSIZE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 64,
|
||||
"end": 65,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"begin": 57,
|
||||
"end": 81,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 96,
|
||||
"end": 111,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 93,
|
||||
"end": 94,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "2"
|
||||
},
|
||||
{
|
||||
"begin": 86,
|
||||
"end": 112,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 127,
|
||||
"end": 140,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 124,
|
||||
"end": 125,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "3"
|
||||
},
|
||||
{
|
||||
"begin": 117,
|
||||
"end": 141,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 156,
|
||||
"end": 173,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000ffffffffffffffff"
|
||||
},
|
||||
{
|
||||
"begin": 153,
|
||||
"end": 154,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "4"
|
||||
},
|
||||
{
|
||||
"begin": 146,
|
||||
"end": 174,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 189,
|
||||
"end": 204,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000ffffffffffffffff"
|
||||
},
|
||||
{
|
||||
"begin": 186,
|
||||
"end": 187,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "5"
|
||||
},
|
||||
{
|
||||
"begin": 179,
|
||||
"end": 205,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 220,
|
||||
"end": 237,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000fffffffffffffffe"
|
||||
},
|
||||
{
|
||||
"begin": 217,
|
||||
"end": 218,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "6"
|
||||
},
|
||||
{
|
||||
"begin": 210,
|
||||
"end": 238,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 253,
|
||||
"end": 268,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000fffffffffffffffe"
|
||||
},
|
||||
{
|
||||
"begin": 250,
|
||||
"end": 251,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "7"
|
||||
},
|
||||
{
|
||||
"begin": 243,
|
||||
"end": 269,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 284,
|
||||
"end": 303,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000fffffffffffffffd"
|
||||
},
|
||||
{
|
||||
"begin": 281,
|
||||
"end": 282,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "8"
|
||||
},
|
||||
{
|
||||
"begin": 274,
|
||||
"end": 304,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 319,
|
||||
"end": 336,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000fffffffffffffffd"
|
||||
},
|
||||
{
|
||||
"begin": 316,
|
||||
"end": 317,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "9"
|
||||
},
|
||||
{
|
||||
"begin": 309,
|
||||
"end": 337,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
}
|
||||
],
|
||||
".data":
|
||||
{
|
||||
"0":
|
||||
{
|
||||
".code":
|
||||
[
|
||||
{
|
||||
"begin": 418,
|
||||
"end": 433,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 414,
|
||||
"end": 416,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "A"
|
||||
},
|
||||
{
|
||||
"begin": 407,
|
||||
"end": 434,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 452,
|
||||
"end": 465,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 448,
|
||||
"end": 450,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "B"
|
||||
},
|
||||
{
|
||||
"begin": 441,
|
||||
"end": 466,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 484,
|
||||
"end": 499,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000001"
|
||||
},
|
||||
{
|
||||
"begin": 480,
|
||||
"end": 482,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "C"
|
||||
},
|
||||
{
|
||||
"begin": 473,
|
||||
"end": 500,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 518,
|
||||
"end": 531,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000001"
|
||||
},
|
||||
{
|
||||
"begin": 514,
|
||||
"end": 516,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "D"
|
||||
},
|
||||
{
|
||||
"begin": 507,
|
||||
"end": 532,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 550,
|
||||
"end": 567,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000ffffffffffffffff"
|
||||
},
|
||||
{
|
||||
"begin": 546,
|
||||
"end": 548,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "E"
|
||||
},
|
||||
{
|
||||
"begin": 539,
|
||||
"end": 568,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 586,
|
||||
"end": 601,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "000000000000000000000000000000000000000000000000ffffffffffffffff"
|
||||
},
|
||||
{
|
||||
"begin": 582,
|
||||
"end": 584,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "F"
|
||||
},
|
||||
{
|
||||
"begin": 575,
|
||||
"end": 602,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
}
|
||||
],
|
||||
".data":
|
||||
{
|
||||
"0":
|
||||
{
|
||||
".code":
|
||||
[
|
||||
{
|
||||
"begin": 658,
|
||||
"end": 673,
|
||||
"name": "PUSH [$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 654,
|
||||
"end": 656,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "10"
|
||||
},
|
||||
{
|
||||
"begin": 647,
|
||||
"end": 674,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"begin": 694,
|
||||
"end": 707,
|
||||
"name": "PUSH #[$]",
|
||||
"source": 0,
|
||||
"value": "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
},
|
||||
{
|
||||
"begin": 690,
|
||||
"end": 692,
|
||||
"name": "PUSH",
|
||||
"source": 0,
|
||||
"value": "11"
|
||||
},
|
||||
{
|
||||
"begin": 683,
|
||||
"end": 708,
|
||||
"name": "SSTORE",
|
||||
"source": 0
|
||||
}
|
||||
],
|
||||
".data":
|
||||
{
|
||||
"0":
|
||||
{
|
||||
".code":
|
||||
[
|
||||
{
|
||||
"begin": 761,
|
||||
"end": 770,
|
||||
"name": "INVALID",
|
||||
"source": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"1":
|
||||
{
|
||||
".code":
|
||||
[
|
||||
{
|
||||
"begin": 833,
|
||||
"end": 842,
|
||||
"name": "INVALID",
|
||||
"source": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"ACAF3289D7B601CBD114FB36C4D29C85BBFD5E133F14CB355C3FD8D99367964F": "48656c6c6f2c20576f726c6421"
|
||||
},
|
||||
"sourceList":
|
||||
[
|
||||
"<stdin>",
|
||||
"#utility.yul"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -187,7 +187,7 @@ BOOST_AUTO_TEST_CASE(invalid_language)
|
||||
}
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsError(result, "JSONError", "Only \"Solidity\", \"Yul\" or \"SolidityAST\" is supported as a language."));
|
||||
BOOST_CHECK(containsError(result, "JSONError", "Only \"Solidity\", \"Yul\", \"SolidityAST\" or \"EvmAssemblyJSON\" is supported as a language."));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(valid_language)
|
||||
|
Loading…
Reference in New Issue
Block a user