mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'upstream/develop' into evmjit_stack
This commit is contained in:
commit
bc00b64684
@ -75,7 +75,9 @@ target_link_libraries(testeth ${CURL_LIBRARIES})
|
|||||||
target_link_libraries(testeth ${CRYPTOPP_LIBRARIES})
|
target_link_libraries(testeth ${CRYPTOPP_LIBRARIES})
|
||||||
target_link_libraries(testeth ethereum)
|
target_link_libraries(testeth ethereum)
|
||||||
target_link_libraries(testeth ethcore)
|
target_link_libraries(testeth ethcore)
|
||||||
target_link_libraries(testeth secp256k1)
|
if (NOT WIN32)
|
||||||
|
target_link_libraries(testeth secp256k1)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (JSCONSOLE)
|
if (JSCONSOLE)
|
||||||
target_link_libraries(testeth jsengine)
|
target_link_libraries(testeth jsengine)
|
||||||
|
@ -69,6 +69,7 @@ void mine(State& s, BlockChain const& _bc)
|
|||||||
sealer->onSealGenerated([&](bytes const& sealedHeader){ sealed = sealedHeader; });
|
sealer->onSealGenerated([&](bytes const& sealedHeader){ sealed = sealedHeader; });
|
||||||
sealer->generateSeal(s.info());
|
sealer->generateSeal(s.info());
|
||||||
sealed.waitNot({});
|
sealed.waitNot({});
|
||||||
|
sealer.reset();
|
||||||
s.sealBlock(sealed);
|
s.sealBlock(sealed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +80,8 @@ void mine(Ethash::BlockHeader& _bi)
|
|||||||
sealer->onSealGenerated([&](bytes const& sealedHeader){ sealed = sealedHeader; });
|
sealer->onSealGenerated([&](bytes const& sealedHeader){ sealed = sealedHeader; });
|
||||||
sealer->generateSeal(_bi);
|
sealer->generateSeal(_bi);
|
||||||
sealed.waitNot({});
|
sealed.waitNot({});
|
||||||
_bi = Ethash::BlockHeader(sealed);
|
sealer.reset();
|
||||||
|
_bi = Ethash::BlockHeader(sealed, IgnoreSeal, h256{}, HeaderData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -841,7 +843,7 @@ dev::eth::Ethash::BlockHeader constructHeader(
|
|||||||
rlpStream << _parentHash << _sha3Uncles << _coinbaseAddress << _stateRoot << _transactionsRoot << _receiptsRoot << _logBloom
|
rlpStream << _parentHash << _sha3Uncles << _coinbaseAddress << _stateRoot << _transactionsRoot << _receiptsRoot << _logBloom
|
||||||
<< _difficulty << _number << _gasLimit << _gasUsed << _timestamp << _extraData << h256{} << Nonce{};
|
<< _difficulty << _number << _gasLimit << _gasUsed << _timestamp << _extraData << h256{} << Nonce{};
|
||||||
|
|
||||||
return Ethash::BlockHeader(rlpStream.out());
|
return Ethash::BlockHeader(rlpStream.out(), IgnoreSeal, h256{}, HeaderData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateEthashSeal(dev::eth::Ethash::BlockHeader& _header, h256 const& _mixHash, dev::eth::Nonce const& _nonce)
|
void updateEthashSeal(dev::eth::Ethash::BlockHeader& _header, h256 const& _mixHash, dev::eth::Nonce const& _nonce)
|
||||||
@ -855,7 +857,7 @@ void updateEthashSeal(dev::eth::Ethash::BlockHeader& _header, h256 const& _mixHa
|
|||||||
header << sourceRlp[i];
|
header << sourceRlp[i];
|
||||||
|
|
||||||
header << _mixHash << _nonce;
|
header << _mixHash << _nonce;
|
||||||
_header = Ethash::BlockHeader(header.out());
|
_header = Ethash::BlockHeader(header.out(), IgnoreSeal, h256{}, HeaderData);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -559,6 +559,62 @@ BOOST_AUTO_TEST_CASE(multisig_value_transfer)
|
|||||||
BOOST_CHECK_EQUAL(m_state.balance(Address(0x05)), 100);
|
BOOST_CHECK_EQUAL(m_state.balance(Address(0x05)), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(revoke_addOwner)
|
||||||
|
{
|
||||||
|
deployWallet();
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x12)) == encodeArgs());
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x13)) == encodeArgs());
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x14)) == encodeArgs());
|
||||||
|
// 4 owners, set required to 3
|
||||||
|
BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs());
|
||||||
|
// add a new owner
|
||||||
|
Address deployer = m_sender;
|
||||||
|
h256 opHash = sha3(FixedHash<4>(dev::sha3("addOwner(address)")).asBytes() + h256(0x33).asBytes());
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x33)) == encodeArgs());
|
||||||
|
BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x33)) == encodeArgs(false));
|
||||||
|
m_sender = Address(0x12);
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x33)) == encodeArgs());
|
||||||
|
BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x33)) == encodeArgs(false));
|
||||||
|
// revoke one confirmation
|
||||||
|
m_sender = deployer;
|
||||||
|
BOOST_REQUIRE(callContractFunction("revoke(bytes32)", opHash) == encodeArgs());
|
||||||
|
m_sender = Address(0x13);
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x33)) == encodeArgs());
|
||||||
|
BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x33)) == encodeArgs(false));
|
||||||
|
m_sender = Address(0x14);
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x33)) == encodeArgs());
|
||||||
|
BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x33)) == encodeArgs(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(revoke_transaction)
|
||||||
|
{
|
||||||
|
deployWallet(200);
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x12)) == encodeArgs());
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x13)) == encodeArgs());
|
||||||
|
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x14)) == encodeArgs());
|
||||||
|
// 4 owners, set required to 3
|
||||||
|
BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs());
|
||||||
|
// create a transaction
|
||||||
|
Address deployer = m_sender;
|
||||||
|
h256 opHash("8f27f478ebcfaf28b0c354f4809ace8087000d668b89c8bc3b1b608bfdbe6654");
|
||||||
|
BOOST_CHECK_EQUAL(m_state.balance(Address(0x05)), 0);
|
||||||
|
m_sender = Address(0x12);
|
||||||
|
BOOST_REQUIRE(callContractFunction("execute(address,uint256,bytes)", h256(0x05), 100, 0x60, 0x00) == encodeArgs(opHash));
|
||||||
|
BOOST_CHECK_EQUAL(m_state.balance(Address(0x05)), 0);
|
||||||
|
m_sender = Address(0x13);
|
||||||
|
BOOST_REQUIRE(callContractFunction("execute(address,uint256,bytes)", h256(0x05), 100, 0x60, 0x00) == encodeArgs(opHash));
|
||||||
|
BOOST_CHECK_EQUAL(m_state.balance(Address(0x05)), 0);
|
||||||
|
m_sender = Address(0x12);
|
||||||
|
BOOST_REQUIRE(callContractFunction("revoke(bytes32)", opHash) == encodeArgs());
|
||||||
|
m_sender = deployer;
|
||||||
|
BOOST_REQUIRE(callContractFunction("execute(address,uint256,bytes)", h256(0x05), 100, 0x60, 0x00) == encodeArgs(opHash));
|
||||||
|
BOOST_CHECK_EQUAL(m_state.balance(Address(0x05)), 0);
|
||||||
|
m_sender = Address(0x14);
|
||||||
|
BOOST_REQUIRE(callContractFunction("execute(address,uint256,bytes)", h256(0x05), 100, 0x60, 0x00) == encodeArgs(opHash));
|
||||||
|
// now it should go through
|
||||||
|
BOOST_CHECK_EQUAL(m_state.balance(Address(0x05)), 100);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(daylimit)
|
BOOST_AUTO_TEST_CASE(daylimit)
|
||||||
{
|
{
|
||||||
deployWallet(200);
|
deployWallet(200);
|
||||||
|
Loading…
Reference in New Issue
Block a user