From 5348b9df842daaab4612d3ce6fa7856e3e74c5fb Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Wed, 31 May 2023 23:22:23 +0200 Subject: [PATCH] Add support to import AST via Standard JSON. --- Changelog.md | 2 +- docs/using-the-compiler.rst | 7 +- libsolidity/interface/StandardCompiler.cpp | 95 ++- libsolidity/interface/StandardCompiler.h | 1 + .../standard_import_evmasm/input.json | 417 +++++++++++++ .../standard_import_evmasm/output.json | 575 ++++++++++++++++++ test/libsolidity/StandardCompiler.cpp | 2 +- 7 files changed, 1095 insertions(+), 4 deletions(-) create mode 100644 test/cmdlineTests/standard_import_evmasm/input.json create mode 100644 test/cmdlineTests/standard_import_evmasm/output.json diff --git a/Changelog.md b/Changelog.md index 3fd0f078c..73e67fb0c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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. diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 57f0fab6c..b92397df2 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -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": { diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 28a564a4c..fa7f52d12 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -30,6 +30,7 @@ #include #include +#include #include @@ -716,6 +717,11 @@ std::variant 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 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) { diff --git a/libsolidity/interface/StandardCompiler.h b/libsolidity/interface/StandardCompiler.h index 588813d76..c7a739e20 100644 --- a/libsolidity/interface/StandardCompiler.h +++ b/libsolidity/interface/StandardCompiler.h @@ -96,6 +96,7 @@ private: std::variant parseInput(Json::Value const& _input); std::map parseAstFromInput(StringMap const& _sources); + Json::Value importEvmAssembly(InputsAndSettings _inputsAndSettings); Json::Value compileSolidity(InputsAndSettings _inputsAndSettings); Json::Value compileYul(InputsAndSettings _inputsAndSettings); diff --git a/test/cmdlineTests/standard_import_evmasm/input.json b/test/cmdlineTests/standard_import_evmasm/input.json new file mode 100644 index 000000000..34b2f3ac5 --- /dev/null +++ b/test/cmdlineTests/standard_import_evmasm/input.json @@ -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": [ + "" + ] + } + }, + "settings": { + "outputSelection": { + "*": { + "": [ + "evm.assembly", + "evm.legacyAssembly", + "evm.bytecode", + "evm.deployedBytecode" + ] + } + } + } +} diff --git a/test/cmdlineTests/standard_import_evmasm/output.json b/test/cmdlineTests/standard_import_evmasm/output.json new file mode 100644 index 000000000..e7b932b2a --- /dev/null +++ b/test/cmdlineTests/standard_import_evmasm/output.json @@ -0,0 +1,575 @@ +{ + "contracts": + { + "A": + { + "": + { + "evm": + { + "assembly": " /* \"\":36:51 */ + 0x00 + /* \"\":33:34 */ + dup1 + /* \"\":26:52 */ + sstore + /* \"\":67:80 */ + bytecodeSize + /* \"\":64:65 */ + 0x01 + /* \"\":57:81 */ + sstore + /* \"\":96:111 */ + dataOffset(sub_0) + /* \"\":93:94 */ + 0x02 + /* \"\":86:112 */ + sstore + /* \"\":127:140 */ + dataSize(sub_0) + /* \"\":124:125 */ + 0x03 + /* \"\":117:141 */ + sstore + /* \"\":156:173 */ + dataOffset(sub_0.sub_0) + /* \"\":153:154 */ + 0x04 + /* \"\":146:174 */ + sstore + /* \"\":189:204 */ + dataSize(sub_0.sub_0) + /* \"\":186:187 */ + 0x05 + /* \"\":179:205 */ + sstore + /* \"\":220:237 */ + dataOffset(sub_0.sub_0.sub_0) + /* \"\":217:218 */ + 0x06 + /* \"\":210:238 */ + sstore + /* \"\":253:268 */ + dataSize(sub_0.sub_0.sub_0) + /* \"\":250:251 */ + 0x07 + /* \"\":243:269 */ + sstore + /* \"\":284:303 */ + dataOffset(sub_0.sub_1) + /* \"\":281:282 */ + 0x08 + /* \"\":274:304 */ + sstore + /* \"\":319:336 */ + dataSize(sub_0.sub_1) + /* \"\":316:317 */ + 0x09 + /* \"\":309:337 */ + sstore +stop +data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 + +sub_0: assembly { + /* \"\":418:433 */ + dataOffset(sub_0) + /* \"\":414:416 */ + 0x0a + /* \"\":407:434 */ + sstore + /* \"\":452:465 */ + dataSize(sub_0) + /* \"\":448:450 */ + 0x0b + /* \"\":441:466 */ + sstore + /* \"\":484:499 */ + dataOffset(sub_1) + /* \"\":480:482 */ + 0x0c + /* \"\":473:500 */ + sstore + /* \"\":518:531 */ + dataSize(sub_1) + /* \"\":514:516 */ + 0x0d + /* \"\":507:532 */ + sstore + /* \"\":550:567 */ + dataOffset(sub_0.sub_0) + /* \"\":546:548 */ + 0x0e + /* \"\":539:568 */ + sstore + /* \"\":586:601 */ + dataSize(sub_0.sub_0) + /* \"\":582:584 */ + 0x0f + /* \"\":575:602 */ + sstore + stop + + sub_0: assembly { + /* \"\":658:673 */ + dataOffset(sub_0) + /* \"\":654:656 */ + 0x10 + /* \"\":647:674 */ + sstore + /* \"\":694:707 */ + dataSize(sub_0) + /* \"\":690:692 */ + 0x11 + /* \"\":683:708 */ + sstore + stop + + sub_0: assembly { + /* \"\":761:770 */ + invalid + } + } + + sub_1: assembly { + /* \"\":833:842 */ + invalid + } +} +", + "bytecode": + { + "functionDebugData": {}, + "linkReferences": {}, + "object": "", + "opcodes":"", + "sourceMap":"" + }, + "deployedBytecode": + { + "functionDebugData": {}, + "immutableReferences": {}, + "linkReferences": {}, + "object": "", + "opcodes":"", + "sourceMap":"" + }, + "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": + [ + "", + "#utility.yul" + ] + } + } + } + } + } +} diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index 785f14284..a82472c72 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -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)