mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2396 from ethereum/asm-aux
Display auxiliary data in assembly
This commit is contained in:
commit
71fea1e370
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Features:
|
Features:
|
||||||
* Assembly: renamed ``SHA3`` to ``KECCAK256``.
|
* Assembly: renamed ``SHA3`` to ``KECCAK256``.
|
||||||
|
* Assembly: Display auxiliary data in the assembly output.
|
||||||
* Assembly: Add ``CREATE2`` (EIP86), ``STATICCALL`` (EIP214), ``RETURNDATASIZE`` and ``RETURNDATACOPY`` (EIP211) instructions.
|
* Assembly: Add ``CREATE2`` (EIP86), ``STATICCALL`` (EIP214), ``RETURNDATASIZE`` and ``RETURNDATACOPY`` (EIP211) instructions.
|
||||||
* AST: export all attributes to JSON format.
|
* AST: export all attributes to JSON format.
|
||||||
* Inline Assembly: Present proper error message when not supplying enough arguments to a functional
|
* Inline Assembly: Present proper error message when not supplying enough arguments to a functional
|
||||||
|
@ -216,6 +216,9 @@ ostream& Assembly::streamAsm(ostream& _out, string const& _prefix, StringMap con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_auxiliaryData.size() > 0)
|
||||||
|
_out << endl << _prefix << "auxdata: 0x" << toHex(m_auxiliaryData) << endl;
|
||||||
|
|
||||||
return _out;
|
return _out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,8 +318,13 @@ Json::Value Assembly::streamAsmJson(ostream& _out, StringMap const& _sourceCodes
|
|||||||
data[hexStr.str()] = m_subs[i]->stream(_out, "", _sourceCodes, true);
|
data[hexStr.str()] = m_subs[i]->stream(_out, "", _sourceCodes, true);
|
||||||
}
|
}
|
||||||
root[".data"] = data;
|
root[".data"] = data;
|
||||||
_out << root;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_auxiliaryData.size() > 0)
|
||||||
|
root[".auxdata"] = toHex(m_auxiliaryData);
|
||||||
|
|
||||||
|
_out << root;
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,11 +201,12 @@ BOOST_AUTO_TEST_CASE(basic_compilation)
|
|||||||
BOOST_CHECK(dev::test::bytecodeSansMetadata(contract["evm"]["bytecode"]["object"].asString()) ==
|
BOOST_CHECK(dev::test::bytecodeSansMetadata(contract["evm"]["bytecode"]["object"].asString()) ==
|
||||||
"60606040523415600b57fe5b5b60338060196000396000f30060606040525bfe00");
|
"60606040523415600b57fe5b5b60338060196000396000f30060606040525bfe00");
|
||||||
BOOST_CHECK(contract["evm"]["assembly"].isString());
|
BOOST_CHECK(contract["evm"]["assembly"].isString());
|
||||||
BOOST_CHECK(contract["evm"]["assembly"].asString() ==
|
BOOST_CHECK(contract["evm"]["assembly"].asString().find(
|
||||||
" /* \"fileA\":0:14 contract A { } */\n mstore(0x40, 0x60)\n jumpi(tag_1, iszero(callvalue))\n"
|
" /* \"fileA\":0:14 contract A { } */\n mstore(0x40, 0x60)\n jumpi(tag_1, iszero(callvalue))\n"
|
||||||
" invalid\ntag_1:\ntag_2:\n dataSize(sub_0)\n dup1\n dataOffset(sub_0)\n 0x0\n codecopy\n 0x0\n"
|
" invalid\ntag_1:\ntag_2:\n dataSize(sub_0)\n dup1\n dataOffset(sub_0)\n 0x0\n codecopy\n 0x0\n"
|
||||||
" return\nstop\n\nsub_0: assembly {\n /* \"fileA\":0:14 contract A { } */\n"
|
" return\nstop\n\nsub_0: assembly {\n /* \"fileA\":0:14 contract A { } */\n"
|
||||||
" mstore(0x40, 0x60)\n tag_1:\n invalid\n}\n");
|
" mstore(0x40, 0x60)\n tag_1:\n invalid\n\n"
|
||||||
|
" auxdata: 0xa165627a7a72305820") != std::string::npos);
|
||||||
BOOST_CHECK(contract["evm"]["gasEstimates"].isObject());
|
BOOST_CHECK(contract["evm"]["gasEstimates"].isObject());
|
||||||
BOOST_CHECK(dev::jsonCompactPrint(contract["evm"]["gasEstimates"]) ==
|
BOOST_CHECK(dev::jsonCompactPrint(contract["evm"]["gasEstimates"]) ==
|
||||||
"{\"creation\":{\"codeDepositCost\":\"10200\",\"executionCost\":\"62\",\"totalCost\":\"10262\"}}");
|
"{\"creation\":{\"codeDepositCost\":\"10200\",\"executionCost\":\"62\",\"totalCost\":\"10262\"}}");
|
||||||
|
Loading…
Reference in New Issue
Block a user