aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog.md3
-rw-r--r--appveyor.yml3
-rw-r--r--docs/assembly.rst9
-rw-r--r--libevmasm/Assembly.cpp19
-rw-r--r--libevmasm/Assembly.h11
-rw-r--r--libevmasm/GasMeter.cpp7
-rw-r--r--libevmasm/Instruction.cpp2
-rw-r--r--libevmasm/Instruction.h7
-rw-r--r--libevmasm/SemanticInformation.cpp2
-rw-r--r--liblll/CodeFragment.cpp7
-rw-r--r--liblll/Compiler.cpp5
-rw-r--r--libsolidity/codegen/CompilerContext.h8
-rw-r--r--libsolidity/inlineasm/AsmAnalysis.cpp28
-rw-r--r--libsolidity/interface/CompilerStack.cpp8
-rw-r--r--libsolidity/interface/CompilerStack.h3
-rw-r--r--scripts/bytecodecompare/storebytecode.bat6
-rw-r--r--solc/CommandLineInterface.cpp3
-rw-r--r--solc/jsonCompiler.cpp10
-rw-r--r--test/libsolidity/InlineAssembly.cpp10
-rw-r--r--test/libsolidity/StandardCompiler.cpp5
20 files changed, 94 insertions, 62 deletions
diff --git a/Changelog.md b/Changelog.md
index 5315dc59..b2e080a0 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,7 +2,8 @@
Features:
* Assembly: renamed ``SHA3`` to ``KECCAK256``.
- * Assembly: Add ``CREATE2`` (EIP86), ``RETURNDATASIZE`` and ``RETURNDATACOPY`` (EIP211) instructions.
+ * Assembly: Display auxiliary data in the assembly output.
+ * Assembly: Add ``CREATE2`` (EIP86), ``STATICCALL`` (EIP214), ``RETURNDATASIZE`` and ``RETURNDATACOPY`` (EIP211) instructions.
* AST: export all attributes to JSON format.
* Inline Assembly: Present proper error message when not supplying enough arguments to a functional
instruction.
diff --git a/appveyor.yml b/appveyor.yml
index 22ec30a0..55c80a21 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -65,7 +65,8 @@ build_script:
- msbuild solidity.sln /p:Configuration=%CONFIGURATION% /m:%NUMBER_OF_PROCESSORS% /v:minimal
- cd %APPVEYOR_BUILD_FOLDER%
- scripts\release.bat %CONFIGURATION%
- - scripts\bytecodecompare\storebytecode.bat %CONFIGURATION% %APPVEYOR_REPO_COMMIT%
+ - ps: $bytecodedir = git show -s --format="%cd-%H" --date=short
+ - ps: scripts\bytecodecompare\storebytecode.bat $Env:CONFIGURATION $bytecodedir
test_script:
- cd %APPVEYOR_BUILD_FOLDER%
diff --git a/docs/assembly.rst b/docs/assembly.rst
index 9455dfb3..394fc9f5 100644
--- a/docs/assembly.rst
+++ b/docs/assembly.rst
@@ -236,11 +236,15 @@ In the grammar, opcodes are represented as pre-defined identifiers.
+-------------------------+------+-----------------------------------------------------------------+
| returndatasize | | size of the last returndata |
+-------------------------+------+-----------------------------------------------------------------+
-| returndatacopy(t, f, s) | `*` | copy s bytes from returndata at position f to mem at position t |
+| returndatacopy(t, f, s) | `-` | copy s bytes from returndata at position f to mem at position t |
+-------------------------+------+-----------------------------------------------------------------+
| create(v, p, s) | | create new contract with code mem[p..(p+s)) and send v wei |
| | | and return the new address |
+-------------------------+------+-----------------------------------------------------------------+
+| create2(v, n, p, s) | | create new contract with code mem[p..(p+s)) at address |
+| | | keccak256(<address> . n . keccak256(mem[p..(p+s))) and send v |
+| | | wei and return the new address |
++-------------------------+------+-----------------------------------------------------------------+
| call(g, a, v, in, | | call contract at address a with input mem[in..(in+insize)) |
| insize, out, outsize) | | providing g gas and v wei and output area |
| | | mem[out..(out+outsize)) returning 0 on error (eg. out of gas) |
@@ -252,6 +256,9 @@ In the grammar, opcodes are represented as pre-defined identifiers.
| delegatecall(g, a, in, | | identical to `callcode` but also keep ``caller`` |
| insize, out, outsize) | | and ``callvalue`` |
+-------------------------+------+-----------------------------------------------------------------+
+| staticcall(g, a, in, | | identical to `call(g, a, 0, in, insize, out, outsize)` but do |
+| insize, out, outsize) | | not allow state modifications |
++-------------------------+------+-----------------------------------------------------------------+
| return(p, s) | `-` | end execution, return data mem[p..(p+s)) |
+-------------------------+------+-----------------------------------------------------------------+
| revert(p, s) | `-` | end execution, revert state changes, return data mem[p..(p+s)) |
diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp
index ea061a30..92a4c2a4 100644
--- a/libevmasm/Assembly.cpp
+++ b/libevmasm/Assembly.cpp
@@ -40,7 +40,7 @@ void Assembly::append(Assembly const& _a)
auto newDeposit = m_deposit + _a.deposit();
for (AssemblyItem i: _a.m_items)
{
- if (i.type() == Tag || (i.type() == PushTag && i != errorTag()))
+ if (i.type() == Tag || i.type() == PushTag)
i.setData(i.data() + m_usedTags);
else if (i.type() == PushSub || i.type() == PushSubSize)
i.setData(i.data() + m_subs.size());
@@ -72,13 +72,6 @@ void Assembly::append(Assembly const& _a, int _deposit)
}
}
-string Assembly::out() const
-{
- stringstream ret;
- stream(ret);
- return ret.str();
-}
-
unsigned Assembly::bytesRequired(unsigned subTagSize) const
{
for (unsigned tagSize = subTagSize; true; ++tagSize)
@@ -216,6 +209,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;
}
@@ -315,8 +311,13 @@ Json::Value Assembly::streamAsmJson(ostream& _out, StringMap const& _sourceCodes
data[hexStr.str()] = m_subs[i]->stream(_out, "", _sourceCodes, true);
}
root[".data"] = data;
- _out << root;
}
+
+ if (m_auxiliaryData.size() > 0)
+ root[".auxdata"] = toHex(m_auxiliaryData);
+
+ _out << root;
+
return root;
}
diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h
index 528c9e74..13d82e1a 100644
--- a/libevmasm/Assembly.h
+++ b/libevmasm/Assembly.h
@@ -69,7 +69,13 @@ public:
AssemblyItem appendJumpI() { auto ret = append(newPushTag()); append(solidity::Instruction::JUMPI); return ret; }
AssemblyItem appendJump(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(solidity::Instruction::JUMP); return ret; }
AssemblyItem appendJumpI(AssemblyItem const& _tag) { auto ret = append(_tag.pushTag()); append(solidity::Instruction::JUMPI); return ret; }
- AssemblyItem errorTag() { return AssemblyItem(PushTag, 0); }
+
+ /// Adds a subroutine to the code (in the data section) and pushes its size (via a tag)
+ /// on the stack. @returns the pushsub assembly item.
+ AssemblyItem appendSubroutine(AssemblyPointer const& _assembly) { auto sub = newSub(_assembly); append(newPushSubSize(size_t(sub.data()))); return sub; }
+ void pushSubroutineSize(size_t _subRoutine) { append(newPushSubSize(_subRoutine)); }
+ /// Pushes the offset of the subroutine.
+ void pushSubroutineOffset(size_t _subRoutine) { append(AssemblyItem(PushSub, _subRoutine)); }
/// Appends @a _data literally to the very end of the bytecode.
void appendAuxiliaryDataToEnd(bytes const& _data) { m_auxiliaryData += _data; }
@@ -85,10 +91,7 @@ public:
void ignored() { m_baseDeposit = m_deposit; }
void endIgnored() { m_deposit = m_baseDeposit; m_baseDeposit = 0; }
- void popTo(int _deposit) { while (m_deposit > _deposit) append(solidity::Instruction::POP); }
-
void injectStart(AssemblyItem const& _i);
- std::string out() const;
int deposit() const { return m_deposit; }
void adjustDeposit(int _adjustment) { m_deposit += _adjustment; if (asserts(m_deposit >= 0)) BOOST_THROW_EXCEPTION(InvalidDeposit()); }
void setDeposit(int _deposit) { m_deposit = _deposit; if (asserts(m_deposit >= 0)) BOOST_THROW_EXCEPTION(InvalidDeposit()); }
diff --git a/libevmasm/GasMeter.cpp b/libevmasm/GasMeter.cpp
index c2e4f01d..c96c6ca5 100644
--- a/libevmasm/GasMeter.cpp
+++ b/libevmasm/GasMeter.cpp
@@ -129,6 +129,7 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item, bool _
case Instruction::CALL:
case Instruction::CALLCODE:
case Instruction::DELEGATECALL:
+ case Instruction::STATICCALL:
{
if (_includeExternalCosts)
// We assume that we do not know the target contract and thus, the consumption is infinite.
@@ -142,8 +143,10 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item, bool _
gas = GasConsumption::infinite();
if (_item.instruction() == Instruction::CALL)
gas += GasCosts::callNewAccountGas; // We very rarely know whether the address exists.
- int valueSize = _item.instruction() == Instruction::DELEGATECALL ? 0 : 1;
- if (!classes.knownZero(m_state->relativeStackElement(-1 - valueSize)))
+ int valueSize = 1;
+ if (_item.instruction() == Instruction::DELEGATECALL || _item.instruction() == Instruction::STATICCALL)
+ valueSize = 0;
+ else if (!classes.knownZero(m_state->relativeStackElement(-1 - valueSize)))
gas += GasCosts::callValueTransferGas;
gas += memoryGas(-2 - valueSize, -3 - valueSize);
gas += memoryGas(-4 - valueSize, -5 - valueSize);
diff --git a/libevmasm/Instruction.cpp b/libevmasm/Instruction.cpp
index d58a47a0..8feb733a 100644
--- a/libevmasm/Instruction.cpp
+++ b/libevmasm/Instruction.cpp
@@ -159,6 +159,7 @@ const std::map<std::string, Instruction> dev::solidity::c_instructions =
{ "CREATE", Instruction::CREATE },
{ "CALL", Instruction::CALL },
{ "CALLCODE", Instruction::CALLCODE },
+ { "STATICCALL", Instruction::STATICCALL },
{ "RETURN", Instruction::RETURN },
{ "DELEGATECALL", Instruction::DELEGATECALL },
{ "CREATE2", Instruction::CREATE2 },
@@ -300,6 +301,7 @@ static const std::map<Instruction, InstructionInfo> c_instructionInfo =
{ Instruction::CALLCODE, { "CALLCODE", 0, 7, 1, true, Tier::Special } },
{ Instruction::RETURN, { "RETURN", 0, 2, 0, true, Tier::Zero } },
{ Instruction::DELEGATECALL, { "DELEGATECALL", 0, 6, 1, true, Tier::Special } },
+ { Instruction::STATICCALL, { "STATICCALL", 0, 6, 1, true, Tier::Special } },
{ Instruction::CREATE2, { "CREATE2", 0, 4, 1, true, Tier::Special } },
{ Instruction::REVERT, { "REVERT", 0, 2, 0, true, Tier::Zero } },
{ Instruction::INVALID, { "INVALID", 0, 0, 0, true, Tier::Zero } },
diff --git a/libevmasm/Instruction.h b/libevmasm/Instruction.h
index 37cdccdb..89a25fb7 100644
--- a/libevmasm/Instruction.h
+++ b/libevmasm/Instruction.h
@@ -77,8 +77,8 @@ enum class Instruction: uint8_t
GASPRICE, ///< get price of gas in current environment
EXTCODESIZE, ///< get external code size (from another contract)
EXTCODECOPY, ///< copy external code (from another contract)
- RETURNDATASIZE, ///< get size of the last return data
- RETURNDATACOPY, ///< copy last return data to memory
+ RETURNDATASIZE = 0x3d, ///< get size of return data buffer
+ RETURNDATACOPY = 0x3e, ///< copy return data in current environment to memory
BLOCKHASH = 0x40, ///< get hash of most recent complete block
COINBASE, ///< get the block's coinbase address
@@ -187,7 +187,8 @@ enum class Instruction: uint8_t
CALLCODE, ///< message-call with another account's code only
RETURN, ///< halt execution returning output data
DELEGATECALL, ///< like CALLCODE but keeps caller's value and sender
- CREATE2 = 0xfb, ///< create new account with associated code
+ STATICCALL = 0xfa, ///< like CALL but disallow state modifications
+ CREATE2 = 0xfb, ///< create new account with associated code at address `sha3(sender + salt + sha3(init code)) % 2**160`
REVERT = 0xfd, ///< halt execution, revert state and return output data
INVALID = 0xfe, ///< invalid instruction for expressing runtime errors (e.g., division-by-zero)
diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp
index db4ee867..f63f0c61 100644
--- a/libevmasm/SemanticInformation.cpp
+++ b/libevmasm/SemanticInformation.cpp
@@ -137,6 +137,7 @@ bool SemanticInformation::isDeterministic(AssemblyItem const& _item)
case Instruction::CALL:
case Instruction::CALLCODE:
case Instruction::DELEGATECALL:
+ case Instruction::STATICCALL:
case Instruction::CREATE:
case Instruction::CREATE2:
case Instruction::GAS:
@@ -165,6 +166,7 @@ bool SemanticInformation::invalidatesMemory(Instruction _instruction)
case Instruction::CALL:
case Instruction::CALLCODE:
case Instruction::DELEGATECALL:
+ case Instruction::STATICCALL:
return true;
default:
return false;
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp
index 0f7f48ba..9f37bc65 100644
--- a/liblll/CodeFragment.cpp
+++ b/liblll/CodeFragment.cpp
@@ -515,8 +515,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
requireMaxSize(3);
requireDeposit(1, 1);
- auto subPush = m_asm.newSub(make_shared<Assembly>(code[0].assembly(ns)));
- m_asm.append(m_asm.newPushSubSize(subPush.data()));
+ auto subPush = m_asm.appendSubroutine(make_shared<Assembly>(code[0].assembly(ns)));
m_asm.append(Instruction::DUP1);
if (code.size() == 3)
{
@@ -571,7 +570,9 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
{
for (auto const& i: code)
m_asm.append(i.m_asm);
- m_asm.popTo(1);
+ // Leave only the last item on stack.
+ while (m_asm.deposit() > 1)
+ m_asm.append(Instruction::POP);
}
else if (us == "BYTECODESIZE")
{
diff --git a/liblll/Compiler.cpp b/liblll/Compiler.cpp
index ea8b27af..05376cd5 100644
--- a/liblll/Compiler.cpp
+++ b/liblll/Compiler.cpp
@@ -69,10 +69,11 @@ std::string dev::eth::compileLLLToAsm(std::string const& _src, bool _opt, std::v
{
CompilerState cs;
cs.populateStandard();
- string ret = CodeFragment::compile(_src, cs).assembly(cs).optimise(_opt).out();
+ stringstream ret;
+ CodeFragment::compile(_src, cs).assembly(cs).optimise(_opt).stream(ret);
for (auto i: cs.treesToKill)
killBigints(i);
- return ret;
+ return ret.str();
}
catch (Exception const& _e)
{
diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h
index c37142c9..030b35a6 100644
--- a/libsolidity/codegen/CompilerContext.h
+++ b/libsolidity/codegen/CompilerContext.h
@@ -141,8 +141,6 @@ public:
CompilerContext& appendInvalid();
/// Appends a conditional INVALID instruction
CompilerContext& appendConditionalInvalid();
- /// Returns an "ErrorTag"
- eth::AssemblyItem errorTag() { return m_asm->errorTag(); }
/// Appends a JUMP to a specific tag
CompilerContext& appendJumpTo(eth::AssemblyItem const& _tag) { m_asm->appendJump(_tag); return *this; }
/// Appends pushing of a new tag and @returns the new tag.
@@ -151,10 +149,10 @@ public:
eth::AssemblyItem newTag() { return m_asm->newTag(); }
/// Adds a subroutine to the code (in the data section) and pushes its size (via a tag)
/// on the stack. @returns the pushsub assembly item.
- eth::AssemblyItem addSubroutine(eth::AssemblyPointer const& _assembly) { auto sub = m_asm->newSub(_assembly); m_asm->append(m_asm->newPushSubSize(size_t(sub.data()))); return sub; }
- void pushSubroutineSize(size_t _subRoutine) { m_asm->append(m_asm->newPushSubSize(_subRoutine)); }
+ eth::AssemblyItem addSubroutine(eth::AssemblyPointer const& _assembly) { return m_asm->appendSubroutine(_assembly); }
+ void pushSubroutineSize(size_t _subRoutine) { m_asm->pushSubroutineSize(_subRoutine); }
/// Pushes the offset of the subroutine.
- void pushSubroutineOffset(size_t _subRoutine) { m_asm->append(eth::AssemblyItem(eth::PushSub, _subRoutine)); }
+ void pushSubroutineOffset(size_t _subRoutine) { m_asm->pushSubroutineOffset(_subRoutine); }
/// Pushes the size of the final program
void appendProgramSize() { m_asm->appendProgramSize(); }
/// Adds data to the data section, pushes a reference to the stack
diff --git a/libsolidity/inlineasm/AsmAnalysis.cpp b/libsolidity/inlineasm/AsmAnalysis.cpp
index 630e0abf..1a529118 100644
--- a/libsolidity/inlineasm/AsmAnalysis.cpp
+++ b/libsolidity/inlineasm/AsmAnalysis.cpp
@@ -29,6 +29,7 @@
#include <libsolidity/interface/Utils.h>
#include <boost/range/adaptor/reversed.hpp>
+#include <boost/algorithm/string.hpp>
#include <memory>
#include <functional>
@@ -447,25 +448,18 @@ void AsmAnalyzer::expectValidType(string const& type, SourceLocation const& _loc
void AsmAnalyzer::warnOnFutureInstruction(solidity::Instruction _instr, SourceLocation const& _location)
{
- string instr;
- switch (_instr)
- {
- case solidity::Instruction::CREATE2:
- instr = "create2";
- break;
- case solidity::Instruction::RETURNDATASIZE:
- instr = "returndatasize";
- break;
- case solidity::Instruction::RETURNDATACOPY:
- instr = "returndatacopy";
- break;
- default:
- break;
- }
- if (!instr.empty())
+ static set<solidity::Instruction> futureInstructions{
+ solidity::Instruction::CREATE2,
+ solidity::Instruction::RETURNDATACOPY,
+ solidity::Instruction::RETURNDATASIZE,
+ solidity::Instruction::STATICCALL
+ };
+ if (futureInstructions.count(_instr))
m_errorReporter.warning(
_location,
- "The \"" + instr + "\" instruction is only available after " +
+ "The \"" +
+ boost::to_lower_copy(instructionInfo(_instr).name)
+ + "\" instruction is only available after " +
"the Metropolis hard fork. Before that it acts as an invalid instruction."
);
}
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index aca9ce39..b09108b0 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -481,6 +481,14 @@ Json::Value const& CompilerStack::natspec(Contract const& _contract, Documentati
return *(*doc);
}
+Json::Value CompilerStack::functionHashes(ContractDefinition const& _contract)
+{
+ Json::Value functionHashes(Json::objectValue);
+ for (auto const& it: _contract.interfaceFunctions())
+ functionHashes[it.second->externalSignature()] = toHex(it.first.ref());
+ return functionHashes;
+}
+
string const& CompilerStack::onChainMetadata(string const& _contractName) const
{
if (m_stackState != CompilationSuccessful)
diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h
index bffdeabd..3250429b 100644
--- a/libsolidity/interface/CompilerStack.h
+++ b/libsolidity/interface/CompilerStack.h
@@ -177,6 +177,9 @@ public:
/// @param type The type of the documentation to get.
/// Can be one of 4 types defined at @c DocumentationType
Json::Value const& natspec(std::string const& _contractName, DocumentationType _type) const;
+
+ Json::Value functionHashes(ContractDefinition const& _contract);
+
std::string const& onChainMetadata(std::string const& _contractName) const;
void useMetadataLiteralSources(bool _metadataLiteralSources) { m_metadataLiteralSources = _metadataLiteralSources; }
diff --git a/scripts/bytecodecompare/storebytecode.bat b/scripts/bytecodecompare/storebytecode.bat
index 969a42a4..aa829d20 100644
--- a/scripts/bytecodecompare/storebytecode.bat
+++ b/scripts/bytecodecompare/storebytecode.bat
@@ -20,7 +20,7 @@ REM Copyright (c) 2017 solidity contributors.
REM ---------------------------------------------------------------------------
set CONFIGURATION=%1
-set COMMIT=%2
+set DIRECTORY=%2
mkdir bytecode
cd bytecode
@@ -33,8 +33,8 @@ git config user.name "travis"
git config user.email "chris@ethereum.org"
git clean -f -d -x
-mkdir %COMMIT%
-set REPORT=%COMMIT%/windows.txt
+if not exist %DIRECTORY% mkdir %DIRECTORY%
+set REPORT=%DIRECTORY%/windows.txt
cp ../report.txt %REPORT%
git add %REPORT%
git commit -a -m "Added report."
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 58c8bf73..e37922c6 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -165,6 +165,7 @@ static set<string> const g_combinedJsonArgs
g_strNatspecUser,
g_strNatspecDev,
g_strOpcodes,
+ g_strSignatureHashes,
g_strSrcMap,
g_strSrcMapRuntime
};
@@ -887,6 +888,8 @@ void CommandLineInterface::handleCombinedJSON()
auto map = m_compiler->runtimeSourceMapping(contractName);
contractData[g_strSrcMapRuntime] = map ? *map : "";
}
+ if (requests.count(g_strSignatureHashes))
+ contractData[g_strSignatureHashes] = m_compiler->functionHashes(m_compiler->contractDefinition(contractName));
if (requests.count(g_strNatspecDev))
contractData[g_strNatspecDev] = dev::jsonCompactPrint(m_compiler->natspec(contractName, DocumentationType::NatspecDev));
if (requests.count(g_strNatspecUser))
diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp
index 353258a6..c01c8061 100644
--- a/solc/jsonCompiler.cpp
+++ b/solc/jsonCompiler.cpp
@@ -88,14 +88,6 @@ ReadFile::Callback wrapReadCallback(CStyleReadFileCallback _readCallback = nullp
return readCallback;
}
-Json::Value functionHashes(ContractDefinition const& _contract)
-{
- Json::Value functionHashes(Json::objectValue);
- for (auto const& it: _contract.interfaceFunctions())
- functionHashes[it.second->externalSignature()] = toHex(it.first.ref());
- return functionHashes;
-}
-
/// Translates a gas value as a string to a JSON number or null
Json::Value gasToJson(Json::Value const& _value)
{
@@ -200,7 +192,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
contractData["runtimeBytecode"] = compiler.runtimeObject(contractName).toHex();
contractData["opcodes"] = solidity::disassemble(compiler.object(contractName).bytecode);
contractData["metadata"] = compiler.onChainMetadata(contractName);
- contractData["functionHashes"] = functionHashes(compiler.contractDefinition(contractName));
+ contractData["functionHashes"] = compiler.functionHashes(compiler.contractDefinition(contractName));
contractData["gasEstimates"] = estimateGas(compiler, contractName);
auto sourceMap = compiler.sourceMapping(contractName);
contractData["srcmap"] = sourceMap ? *sourceMap : "";
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp
index 7876b7ee..aae6dacd 100644
--- a/test/libsolidity/InlineAssembly.cpp
+++ b/test/libsolidity/InlineAssembly.cpp
@@ -572,6 +572,16 @@ BOOST_AUTO_TEST_CASE(returndatacopy_functional)
BOOST_CHECK(successAssemble("{ returndatacopy(0, 32, 64) }"));
}
+BOOST_AUTO_TEST_CASE(staticcall)
+{
+ BOOST_CHECK(successAssemble("{ pop(staticcall(10000, 0x123, 64, 0x10, 128, 0x10)) }"));
+}
+
+BOOST_AUTO_TEST_CASE(create2)
+{
+ BOOST_CHECK(successAssemble("{ pop(create2(10, 0x123, 32, 64)) }"));
+}
+
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp
index 92bb471b..35644a4d 100644
--- a/test/libsolidity/StandardCompiler.cpp
+++ b/test/libsolidity/StandardCompiler.cpp
@@ -201,11 +201,12 @@ BOOST_AUTO_TEST_CASE(basic_compilation)
BOOST_CHECK(dev::test::bytecodeSansMetadata(contract["evm"]["bytecode"]["object"].asString()) ==
"60606040523415600b57fe5b5b60338060196000396000f30060606040525bfe00");
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"
" 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: 0xa165627a7a72305820") != std::string::npos);
BOOST_CHECK(contract["evm"]["gasEstimates"].isObject());
BOOST_CHECK(dev::jsonCompactPrint(contract["evm"]["gasEstimates"]) ==
"{\"creation\":{\"codeDepositCost\":\"10200\",\"executionCost\":\"62\",\"totalCost\":\"10262\"}}");