diff options
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/SolidityEndToEndTest.cpp | 12 | ||||
-rw-r--r-- | libsolidity/solidityExecutionFramework.h | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index a10b4767..ae2fc6dc 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -1151,8 +1151,10 @@ BOOST_AUTO_TEST_CASE(blockchain) " blockNumber = block.number;\n" " }\n" "}\n"; + m_envInfo.setBeneficiary(Address(0x123)); + m_envInfo.setNumber(7); compileAndRun(sourceCode, 27); - BOOST_CHECK(callContractFunctionWithValue("someInfo()", 28) == encodeArgs(28, 0, 1)); + BOOST_CHECK(callContractFunctionWithValue("someInfo()", 28) == encodeArgs(28, 0x123, 7)); } BOOST_AUTO_TEST_CASE(msg_sig) @@ -1187,12 +1189,14 @@ BOOST_AUTO_TEST_CASE(msg_sig_after_internal_call_is_same) BOOST_AUTO_TEST_CASE(now) { char const* sourceCode = "contract test {\n" - " function someInfo() returns (bool success) {\n" - " return block.timestamp == now && now > 0;\n" + " function someInfo() returns (bool equal, uint val) {\n" + " equal = block.timestamp == now;\n" + " val = now;\n" " }\n" "}\n"; + m_envInfo.setTimestamp(9); compileAndRun(sourceCode); - BOOST_CHECK(callContractFunction("someInfo()") == encodeArgs(true)); + BOOST_CHECK(callContractFunction("someInfo()") == encodeArgs(true, 9)); } BOOST_AUTO_TEST_CASE(type_conversions_cleanup) diff --git a/libsolidity/solidityExecutionFramework.h b/libsolidity/solidityExecutionFramework.h index 6a62c445..3f443720 100644 --- a/libsolidity/solidityExecutionFramework.h +++ b/libsolidity/solidityExecutionFramework.h @@ -45,7 +45,6 @@ public: ExecutionFramework() { g_logVerbosity = 0; - m_state.resetCurrent(); } bytes const& compileAndRunWithoutCheck( @@ -249,7 +248,7 @@ protected: void sendMessage(bytes const& _data, bool _isCreation, u256 const& _value = 0) { m_state.addBalance(m_sender, _value); // just in case - eth::Executive executive(m_state, eth::LastHashes(), 0); + eth::Executive executive(m_state, m_envInfo, 0); eth::ExecutionResult res; executive.setResultRecipient(res); eth::Transaction t = @@ -290,6 +289,7 @@ protected: dev::solidity::CompilerStack m_compiler; Address m_sender; Address m_contractAddress; + eth::EnvInfo m_envInfo; eth::State m_state; u256 const m_gasPrice = 100 * eth::szabo; u256 const m_gas = 100000000; |