Skip to content

Commit

Permalink
Add special case to handle "0" value for bytearray
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Mar 21, 2023
1 parent f4ba943 commit 7bd0c5a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/statetest/statetest_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ state::BlockInfo from_json<state::BlockInfo>(const json::json& j)
const auto current_difficulty_it = j.find("currentDifficulty");
const auto parent_difficulty_it = j.find("parentDifficulty");
if (prev_randao_it != j.end())
difficulty = from_json<evmc::bytes32>(*prev_randao_it);
{
// Special case to handle "0". Required by exec-spec-tests.
// TODO: Get rid of it.
if (prev_randao_it->is_string() && prev_randao_it->get<std::string>() == "0")
difficulty = 0x0000000000000000000000000000000000000000000000000000000000000000_bytes32;
else
difficulty = from_json<evmc::bytes32>(*prev_randao_it);
}
else if (current_difficulty_it != j.end())
difficulty = from_json<evmc::bytes32>(*current_difficulty_it);
else if (parent_difficulty_it != j.end())
Expand Down

0 comments on commit 7bd0c5a

Please sign in to comment.