Print auxiliary data in the assembly

This commit is contained in:
Alex Beregszaszi 2017-06-14 13:31:04 +01:00
parent 3273e865ec
commit 585b3ea3e3
3 changed files with 10 additions and 2 deletions

View File

@ -1,8 +1,9 @@
### 0.4.12 (unreleased)
Features:
* Assembly: renamed ``SHA3`` to ``KECCAK256``.
* Assembly: Add ``CREATE2`` (EIP86), ``RETURNDATASIZE`` and ``RETURNDATACOPY`` (EIP211) instructions.
* Assembly: Display auxiliary data in the assembly output.
* Assembly: Renamed ``SHA3`` to ``KECCAK256``.
* AST: export all attributes to JSON format.
* Inline Assembly: Present proper error message when not supplying enough arguments to a functional
instruction.

View File

@ -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;
}
@ -317,6 +320,9 @@ Json::Value Assembly::streamAsmJson(ostream& _out, StringMap const& _sourceCodes
root[".data"] = data;
}
if (m_auxiliaryData.size() > 0)
root[".auxdata"] = toHex(m_auxiliaryData);
_out << root;
return root;

View File

@ -205,7 +205,8 @@ BOOST_AUTO_TEST_CASE(basic_compilation)
" /* \"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"
" 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: 0xa165627a7a72305820e4855da8c6a5e8a35933acba62e02f4842146bb9655b81cb06547caf8ea743b40029\n}\n");
BOOST_CHECK(contract["evm"]["gasEstimates"].isObject());
BOOST_CHECK(dev::jsonCompactPrint(contract["evm"]["gasEstimates"]) ==
"{\"creation\":{\"codeDepositCost\":\"10200\",\"executionCost\":\"62\",\"totalCost\":\"10262\"}}");