mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Do not use the precompile address 0x05 in the wallet tests (but a randomized address)
This commit is contained in:
parent
31318305f3
commit
dcbcd36be7
@ -559,24 +559,24 @@ BOOST_AUTO_TEST_CASE(multisig_value_transfer)
|
|||||||
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(3), h256::AlignRight)) == encodeArgs());
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(3), h256::AlignRight)) == encodeArgs());
|
||||||
// 4 owners, set required to 3
|
// 4 owners, set required to 3
|
||||||
BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs());
|
BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs());
|
||||||
// check that balance is and stays zero at destination address
|
Address destination = Address("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41");
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 0);
|
||||||
m_sender = account(0);
|
m_sender = account(0);
|
||||||
sendEther(account(1), 10 * ether);
|
sendEther(account(1), 10 * ether);
|
||||||
m_sender = account(1);
|
m_sender = account(1);
|
||||||
auto ophash = callContractFunction("execute(address,uint256,bytes)", h256(0x05), 100, 0x60, 0x00);
|
auto ophash = callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 100, 0x60, 0x00);
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 0);
|
||||||
m_sender = account(0);
|
m_sender = account(0);
|
||||||
sendEther(account(2), 10 * ether);
|
sendEther(account(2), 10 * ether);
|
||||||
m_sender = account(2);
|
m_sender = account(2);
|
||||||
callContractFunction("confirm(bytes32)", ophash);
|
callContractFunction("confirm(bytes32)", ophash);
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 0);
|
||||||
m_sender = account(0);
|
m_sender = account(0);
|
||||||
sendEther(account(3), 10 * ether);
|
sendEther(account(3), 10 * ether);
|
||||||
m_sender = account(3);
|
m_sender = account(3);
|
||||||
callContractFunction("confirm(bytes32)", ophash);
|
callContractFunction("confirm(bytes32)", ophash);
|
||||||
// now it should go through
|
// now it should go through
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 100);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(revoke_addOwner)
|
BOOST_AUTO_TEST_CASE(revoke_addOwner)
|
||||||
@ -622,30 +622,31 @@ BOOST_AUTO_TEST_CASE(revoke_transaction)
|
|||||||
BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs());
|
BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs());
|
||||||
// create a transaction
|
// create a transaction
|
||||||
Address deployer = m_sender;
|
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);
|
m_sender = account(0);
|
||||||
sendEther(account(1), 10 * ether);
|
sendEther(account(1), 10 * ether);
|
||||||
m_sender = account(1);
|
m_sender = account(1);
|
||||||
auto opHash = callContractFunction("execute(address,uint256,bytes)", h256(0x05), 100, 0x60, 0x00);
|
auto opHash = callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 100, 0x60, 0x00);
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 0);
|
||||||
m_sender = account(0);
|
m_sender = account(0);
|
||||||
sendEther(account(2), 10 * ether);
|
sendEther(account(2), 10 * ether);
|
||||||
m_sender = account(2);
|
m_sender = account(2);
|
||||||
callContractFunction("confirm(bytes32)", opHash);
|
callContractFunction("confirm(bytes32)", opHash);
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 0);
|
||||||
m_sender = account(0);
|
m_sender = account(0);
|
||||||
sendEther(account(1), 10 * ether);
|
sendEther(account(1), 10 * ether);
|
||||||
m_sender = account(1);
|
m_sender = account(1);
|
||||||
BOOST_REQUIRE(callContractFunction("revoke(bytes32)", opHash) == encodeArgs());
|
BOOST_REQUIRE(callContractFunction("revoke(bytes32)", opHash) == encodeArgs());
|
||||||
m_sender = deployer;
|
m_sender = deployer;
|
||||||
callContractFunction("confirm(bytes32)", opHash);
|
callContractFunction("confirm(bytes32)", opHash);
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 0);
|
||||||
m_sender = account(0);
|
m_sender = account(0);
|
||||||
sendEther(account(3), 10 * ether);
|
sendEther(account(3), 10 * ether);
|
||||||
m_sender = account(3);
|
m_sender = account(3);
|
||||||
callContractFunction("confirm(bytes32)", opHash);
|
callContractFunction("confirm(bytes32)", opHash);
|
||||||
// now it should go through
|
// now it should go through
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 100);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(daylimit)
|
BOOST_AUTO_TEST_CASE(daylimit)
|
||||||
@ -661,31 +662,32 @@ BOOST_AUTO_TEST_CASE(daylimit)
|
|||||||
BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs());
|
BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs());
|
||||||
|
|
||||||
// try to send tx over daylimit
|
// 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);
|
sendEther(account(1), 10 * ether);
|
||||||
m_sender = account(1);
|
m_sender = account(1);
|
||||||
BOOST_REQUIRE(
|
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))
|
encodeArgs(u256(0))
|
||||||
);
|
);
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 0);
|
||||||
// try to send tx under daylimit by stranger
|
// try to send tx under daylimit by stranger
|
||||||
m_sender = account(0);
|
m_sender = account(0);
|
||||||
sendEther(account(4), 10 * ether);
|
sendEther(account(4), 10 * ether);
|
||||||
m_sender = account(4);
|
m_sender = account(4);
|
||||||
BOOST_REQUIRE(
|
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))
|
encodeArgs(u256(0))
|
||||||
);
|
);
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 0);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 0);
|
||||||
// now send below limit by owner
|
// now send below limit by owner
|
||||||
m_sender = account(0);
|
m_sender = account(0);
|
||||||
sendEther(account(1), 10 * ether);
|
sendEther(account(1), 10 * ether);
|
||||||
BOOST_REQUIRE(
|
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))
|
encodeArgs(u256(0))
|
||||||
);
|
);
|
||||||
BOOST_CHECK_EQUAL(balanceAt(Address(0x05)), 90);
|
BOOST_CHECK_EQUAL(balanceAt(destination), 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(daylimit_constructor)
|
BOOST_AUTO_TEST_CASE(daylimit_constructor)
|
||||||
|
Loading…
Reference in New Issue
Block a user