Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Retesteth support #5909

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion libethcore/BlockHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ h256 BlockHeader::hash(IncludeSeal _i) const

void BlockHeader::streamRLPFields(RLPStream& _s) const
{
bigint nnn = m_number; // Fix rlp stream issue with uint65_t
Copy link
Member

@gumb0 gumb0 Jun 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it supposed to fix the case when block number doesn't in 64 bit?
But it doesn't fix it, because m_number is still uint64_t

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there are some proposals to require the limit for block nuumber and timestamp, so I'm not sure it makes sense to change it now.
https://eips.ethereum.org/EIPS/eip-1985

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fixes the test. Because RLPStream << was working incorrectly with u64int_t

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean exactly? Maybe we should fix operator<< for uint64_t or something

(Some tests currently fail anyway)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I had blockchain/invalidblocks/bcInvalidHeader/timestamp4 test failing without this change. I assume the issue is in << operation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find this test, what are header values there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I was out of laptop.
it is this test:
BlockchainTests/InvalidBlocks/bcUncleHeaderValidity/incorrectUncleTimestamp4

I set timestamp of the uncleheader to 500000000000 + previous block (~1000)
and the value I get rlp::85746a528800. but testeth gives me RLP encode of this argument rlp::846a528800
unless I explicitly say that it is a bigint in that function. the fix is dirty because I just try to make the tests pass

bigint ttt = m_timestamp; // Fix rlp stream issue with uint65_t
_s << m_parentHash << m_sha3Uncles << m_author << m_stateRoot << m_transactionsRoot << m_receiptsRoot << m_logBloom
<< m_difficulty << m_number << m_gasLimit << m_gasUsed << m_timestamp << m_extraData;
<< m_difficulty << nnn << m_gasLimit << m_gasUsed << ttt << m_extraData;
}

void BlockHeader::streamRLP(RLPStream& _s, IncludeSeal _i) const
Expand Down
2 changes: 1 addition & 1 deletion test/jsontests
Submodule jsontests updated 19329 files
6 changes: 2 additions & 4 deletions test/tools/jsontests/BlockChainTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,7 @@ void testBCTest(json_spirit::mObject const& _o)
BOOST_REQUIRE_MESSAGE(blObj.count("blockHeader"),
"blockHeader field is not found. "
"filename: " + TestOutputHelper::get().testFile().string() +
" testname: " + TestOutputHelper::get().testName()
);
" testname: " + TestOutputHelper::get().testName());

//Check Provided Header against block in RLP
TestBlock blockFromFields(blObj["blockHeader"].get_obj());
Expand All @@ -549,8 +548,7 @@ void testBCTest(json_spirit::mObject const& _o)
BOOST_REQUIRE_MESSAGE(blObj.count("transactions"),
"transactions field is not found. "
"filename: " + TestOutputHelper::get().testFile().string() +
" testname: " + TestOutputHelper::get().testName()
);
" testname: " + TestOutputHelper::get().testName());
for (auto const& txObj: blObj["transactions"].get_array())
{
TestTransaction transaction(txObj.get_obj());
Expand Down