mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4968 from ethereum/alethUpdateCompatible
Fix tests for newer versions of aleth.
This commit is contained in:
commit
5cf570e100
@ -122,9 +122,9 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
|
|||||||
if (!_isCreation)
|
if (!_isCreation)
|
||||||
{
|
{
|
||||||
d.to = dev::toString(m_contractAddress);
|
d.to = dev::toString(m_contractAddress);
|
||||||
BOOST_REQUIRE(m_rpc.eth_getCode(d.to, "latest").size() > 2);
|
BOOST_REQUIRE(m_rpc.eth_getCode(d.to, "pending").size() > 2);
|
||||||
// Use eth_call to get the output
|
// Use eth_call to get the output
|
||||||
m_output = fromHex(m_rpc.eth_call(d, "latest"), WhenError::Throw);
|
m_output = fromHex(m_rpc.eth_call(d, "pending"), WhenError::Throw);
|
||||||
}
|
}
|
||||||
|
|
||||||
string txHash = m_rpc.eth_sendTransaction(d);
|
string txHash = m_rpc.eth_sendTransaction(d);
|
||||||
|
@ -3038,6 +3038,9 @@ BOOST_AUTO_TEST_CASE(gasprice)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(blockhash)
|
BOOST_AUTO_TEST_CASE(blockhash)
|
||||||
|
{
|
||||||
|
// depending on the aleth version, this test only works for pre-constantinople
|
||||||
|
if (Options::get().evmVersion() < EVMVersion::constantinople())
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
contract C {
|
contract C {
|
||||||
@ -3056,9 +3059,6 @@ BOOST_AUTO_TEST_CASE(blockhash)
|
|||||||
ABI_CHECK(callContractFunction("g()"), encodeArgs(true));
|
ABI_CHECK(callContractFunction("g()"), encodeArgs(true));
|
||||||
|
|
||||||
vector<u256> hashes;
|
vector<u256> hashes;
|
||||||
// currently the test only works for pre-constantinople
|
|
||||||
if (Options::get().evmVersion() < EVMVersion::constantinople())
|
|
||||||
{
|
|
||||||
// ``blockhash()`` is only valid for the last 256 blocks, otherwise zero
|
// ``blockhash()`` is only valid for the last 256 blocks, otherwise zero
|
||||||
hashes.emplace_back(0);
|
hashes.emplace_back(0);
|
||||||
for (u256 i = blockNumber() - u256(255); i <= blockNumber(); i++)
|
for (u256 i = blockNumber() - u256(255); i <= blockNumber(); i++)
|
||||||
@ -3067,19 +3067,10 @@ BOOST_AUTO_TEST_CASE(blockhash)
|
|||||||
hashes.emplace_back(0);
|
hashes.emplace_back(0);
|
||||||
// future block hashes are zero
|
// future block hashes are zero
|
||||||
hashes.emplace_back(0);
|
hashes.emplace_back(0);
|
||||||
}
|
|
||||||
else
|
|
||||||
// TODO: Starting from constantinople blockhash always seems to return zero.
|
|
||||||
// The blockhash contract introduced in EIP96 seems to break in our setup of
|
|
||||||
// aleth (setting the constantinople fork block to zero and resetting the chain
|
|
||||||
// to block zero before each test run). Pre-deploying the blockchain contract
|
|
||||||
// during genesis seems to help, but currently causes problems with other tests.
|
|
||||||
// Set the expectation to zero for now, so that this test tracks changes in this
|
|
||||||
// behavior.
|
|
||||||
hashes.assign(259, 0);
|
|
||||||
|
|
||||||
ABI_CHECK(callContractFunction("f()"), encodeDyn(hashes));
|
ABI_CHECK(callContractFunction("f()"), encodeDyn(hashes));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(value_complex)
|
BOOST_AUTO_TEST_CASE(value_complex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user