Skip to content

Commit

Permalink
Revert "blockchaintest: Only check state root for 5 first/last blocks"
Browse files Browse the repository at this point in the history
This reverts commit e7384ed.
  • Loading branch information
chfast committed Aug 20, 2024
1 parent d8a314b commit 5d5ed72
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions test/blockchaintest/blockchaintest_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ void run_blockchain_tests(std::span<const BlockchainTest> tests, evmc::VM& vm)
std::unordered_map<int64_t, hash256> known_block_hashes{
{c.genesis_block_header.block_number, c.genesis_block_header.hash}};

for (size_t i = 0; i != c.test_blocks.size(); ++i)
for (const auto& test_block : c.test_blocks)
{
const auto& test_block = c.test_blocks[i];
auto bi = test_block.block_info;
bi.known_block_hashes = known_block_hashes;

Expand All @@ -159,16 +158,8 @@ void run_blockchain_tests(std::span<const BlockchainTest> tests, evmc::VM& vm)
SCOPED_TRACE(std::string{evmc::to_string(rev)} + '/' + std::to_string(case_index) +
'/' + c.name + '/' + std::to_string(test_block.block_info.number));

if (i < 5 || i >= c.test_blocks.size() - 5)
{
// Only check state hashes for first (early problems)
// and last (final check of all blocks) 5 blocks.
// Otherwise, for very long blockchain test we spend a lot of time in MPT hashing
// because the implementation of it is very simplistic: the trie is not updated
// along the state changes but a new trie is build from scratch for every block.
EXPECT_EQ(
state::mpt_hash(TestState{state}), test_block.expected_block_header.state_root);
}
EXPECT_EQ(
state::mpt_hash(TestState{state}), test_block.expected_block_header.state_root);

if (rev >= EVMC_SHANGHAI)
{
Expand Down

0 comments on commit 5d5ed72

Please sign in to comment.