diff options
author | Dimitry <winsvega@mail.ru> | 2016-06-14 23:01:57 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-06-29 05:18:55 +0800 |
commit | 763faf7b0e56cde9845772de5226c9b6f1a5d80a (patch) | |
tree | 14660008fc89ee655fd51563c268d45da43b5596 /test/libsolidity | |
parent | ce2258b71e632e01b3f50d47704352065cb01b5d (diff) | |
download | dexon-solidity-763faf7b0e56cde9845772de5226c9b6f1a5d80a.tar.gz dexon-solidity-763faf7b0e56cde9845772de5226c9b6f1a5d80a.tar.zst dexon-solidity-763faf7b0e56cde9845772de5226c9b6f1a5d80a.zip |
replace BalanceAt
add addressHasCode
remove m_state and sealengine
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 6 | ||||
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.cpp | 12 | ||||
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.h | 3 |
3 files changed, 12 insertions, 9 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 7ab49248..8689d61e 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -1653,7 +1653,7 @@ BOOST_AUTO_TEST_CASE(suicide) compileAndRun(sourceCode, amount); u160 address(23); BOOST_CHECK(callContractFunction("a(address)", address) == bytes()); - BOOST_CHECK(!m_state.addressHasCode(m_contractAddress)); + BOOST_CHECK(!addressHasCode(m_contractAddress)); BOOST_CHECK_EQUAL(balanceAt(address), amount); } @@ -1669,7 +1669,7 @@ BOOST_AUTO_TEST_CASE(selfdestruct) compileAndRun(sourceCode, amount); u160 address(23); BOOST_CHECK(callContractFunction("a(address)", address) == bytes()); - BOOST_CHECK(!m_state.addressHasCode(m_contractAddress)); + BOOST_CHECK(!addressHasCode(m_contractAddress)); BOOST_CHECK_EQUAL(balanceAt(address), amount); } @@ -2467,7 +2467,7 @@ BOOST_AUTO_TEST_CASE(use_std_lib) compileAndRun(sourceCode, amount, "Icarus"); u256 balanceBefore = balanceAt(m_sender); BOOST_CHECK(callContractFunction("kill()") == bytes()); - BOOST_CHECK(!m_state.addressHasCode(m_contractAddress)); + BOOST_CHECK(!addressHasCode(m_contractAddress)); BOOST_CHECK(balanceAt(m_sender) > balanceBefore); } diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index db48c3a1..43d36f38 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -30,12 +30,10 @@ using namespace dev::solidity::test; ExecutionFramework::ExecutionFramework(): - m_rpc(RPCSession::instance("/tmp/test/geth.ipc")), - m_sender(m_rpc.account(0)), - m_state(0) + m_rpc(RPCSession::instance("/home/wins/Ethereum/testnet/ethnode1/geth.ipc")), + m_sender(m_rpc.account(0)) { eth::NoProof::init(); - m_sealEngine.reset(eth::ChainParams().createSealEngine()); if (g_logVerbosity != -1) g_logVerbosity = 0; @@ -84,6 +82,12 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 } } +bool ExecutionFramework::addressHasCode(Address const& _addr) +{ + string code = m_rpc.eth_getCode(toString(_addr), "latest"); + return !code.empty() && code != "0x"; +} + u256 ExecutionFramework::balanceAt(Address const& _addr) { return u256(m_rpc.eth_getBalance(toString(_addr), "latest")); diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index f2366d50..42b22c82 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -253,6 +253,7 @@ protected: u256 balanceAt(Address const& _addr); bool storageEmpty(Address const& _addr); + bool addressHasCode(Address const& _addr); RPCSession& m_rpc; @@ -263,7 +264,6 @@ protected: bytes data; }; - std::unique_ptr<eth::SealEngineFace> m_sealEngine; size_t m_optimizeRuns = 200; bool m_optimize = false; bool m_addStandardSources = false; @@ -271,7 +271,6 @@ protected: 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; bytes m_output; |