diff options
author | chriseth <c@ethdev.com> | 2016-11-24 17:32:52 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-12-01 23:03:59 +0800 |
commit | 91ecc4533dffbe67fa27adfaff27780ddf69c21a (patch) | |
tree | 665bbbe1a0396e56ade492c1a544b1eb1fb4310b /libevmasm/Assembly.cpp | |
parent | 36c6fe2b698b1a05cae954dcee5d9e0fcea85d05 (diff) | |
download | dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.tar.gz dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.tar.zst dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.zip |
Add swarm hash to the end of the bytecode.
Diffstat (limited to 'libevmasm/Assembly.cpp')
-rw-r--r-- | libevmasm/Assembly.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index b040917d..fab63840 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -432,7 +432,7 @@ LinkerObject const& Assembly::assemble() const unsigned bytesPerTag = dev::bytesRequired(bytesRequiredForCode); byte tagPush = (byte)Instruction::PUSH1 - 1 + bytesPerTag; - unsigned bytesRequiredIncludingData = bytesRequiredForCode + 1; + unsigned bytesRequiredIncludingData = bytesRequiredForCode + 1 + m_auxiliaryData.size(); for (auto const& sub: m_subs) bytesRequiredIncludingData += sub->assemble().bytecode.size(); @@ -525,8 +525,9 @@ LinkerObject const& Assembly::assemble() const } } - if (!dataRef.empty() && !subRef.empty()) - ret.bytecode.push_back(0); + // Append a STOP just to be sure. + ret.bytecode.push_back(0); + for (size_t i = 0; i < m_subs.size(); ++i) { auto references = subRef.equal_range(i); @@ -568,6 +569,9 @@ LinkerObject const& Assembly::assemble() const } ret.bytecode += dataItem.second; } + + ret.bytecode += m_auxiliaryData; + for (unsigned pos: sizeRef) { bytesRef r(ret.bytecode.data() + pos, bytesPerDataRef); |