diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-10-20 23:23:53 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-10-24 03:20:32 +0800 |
commit | dcbcd36be79df439d08c7ed3441eb498225dd68d (patch) | |
tree | 8f2cf75c6410aed0cb72316ac637c85ad92f30a0 /test/contracts | |
parent | 31318305f3da0296cd31fedfe0512037a4b901c2 (diff) | |
download | dexon-solidity-dcbcd36be79df439d08c7ed3441eb498225dd68d.tar.gz dexon-solidity-dcbcd36be79df439d08c7ed3441eb498225dd68d.tar.zst dexon-solidity-dcbcd36be79df439d08c7ed3441eb498225dd68d.zip |
Do not use the precompile address 0x05 in the wallet tests (but a randomized address)
Diffstat (limited to 'test/contracts')
-rw-r--r-- | test/contracts/Wallet.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index bbe603d4..90334ad6 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -559,24 +559,24 @@ BOOST_AUTO_TEST_CASE(multisig_value_transfer) BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(3), h256::AlignRight)) == encodeArgs()); // 4 owners, set required to 3 BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs()); - // check that balance is and stays zero at destination address - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + Address destination = Address("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41"); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(1), 10 * ether); m_sender = account(1); - auto ophash = callContractFunction("execute(address,uint256,bytes)", h256(0x05), 100, 0x60, 0x00); - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + auto ophash = callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 100, 0x60, 0x00); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(2), 10 * ether); m_sender = account(2); callContractFunction("confirm(bytes32)", ophash); - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(3), 10 * ether); m_sender = account(3); callContractFunction("confirm(bytes32)", ophash); // now it should go through - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 100); + BOOST_CHECK_EQUAL(balanceAt(destination), 100); } BOOST_AUTO_TEST_CASE(revoke_addOwner) @@ -622,30 +622,31 @@ BOOST_AUTO_TEST_CASE(revoke_transaction) BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs()); // create a transaction Address deployer = m_sender; - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + Address destination = Address("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41"); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(1), 10 * ether); m_sender = account(1); - auto opHash = callContractFunction("execute(address,uint256,bytes)", h256(0x05), 100, 0x60, 0x00); - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + auto opHash = callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 100, 0x60, 0x00); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(2), 10 * ether); m_sender = account(2); callContractFunction("confirm(bytes32)", opHash); - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(1), 10 * ether); m_sender = account(1); BOOST_REQUIRE(callContractFunction("revoke(bytes32)", opHash) == encodeArgs()); m_sender = deployer; callContractFunction("confirm(bytes32)", opHash); - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(3), 10 * ether); m_sender = account(3); callContractFunction("confirm(bytes32)", opHash); // now it should go through - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 100); + BOOST_CHECK_EQUAL(balanceAt(destination), 100); } BOOST_AUTO_TEST_CASE(daylimit) @@ -661,31 +662,32 @@ BOOST_AUTO_TEST_CASE(daylimit) BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs()); // try to send tx over daylimit - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + Address destination = Address("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41"); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); sendEther(account(1), 10 * ether); m_sender = account(1); BOOST_REQUIRE( - callContractFunction("execute(address,uint256,bytes)", h256(0x05), 150, 0x60, 0x00) != + callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 150, 0x60, 0x00) != encodeArgs(u256(0)) ); - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); // try to send tx under daylimit by stranger m_sender = account(0); sendEther(account(4), 10 * ether); m_sender = account(4); BOOST_REQUIRE( - callContractFunction("execute(address,uint256,bytes)", h256(0x05), 90, 0x60, 0x00) == + callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 90, 0x60, 0x00) == encodeArgs(u256(0)) ); - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0); + BOOST_CHECK_EQUAL(balanceAt(destination), 0); // now send below limit by owner m_sender = account(0); sendEther(account(1), 10 * ether); BOOST_REQUIRE( - callContractFunction("execute(address,uint256,bytes)", h256(0x05), 90, 0x60, 0x00) == + callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 90, 0x60, 0x00) == encodeArgs(u256(0)) ); - BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 90); + BOOST_CHECK_EQUAL(balanceAt(destination), 90); } BOOST_AUTO_TEST_CASE(daylimit_constructor) |