Skip to content

Commit bd4a899

Browse files
committed
Add special case to handle "0" value for bytearray
1 parent 635dfe2 commit bd4a899

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/statetest/statetest_loader.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,14 @@ state::BlockInfo from_json<state::BlockInfo>(const json::json& j)
130130
const auto current_difficulty_it = j.find("currentDifficulty");
131131
const auto parent_difficulty_it = j.find("parentDifficulty");
132132
if (prev_randao_it != j.end())
133-
difficulty = from_json<evmc::bytes32>(*prev_randao_it);
133+
{
134+
// Special case to handle "0". Required by exec-spec-tests.
135+
// TODO: Get rid of it.
136+
if (prev_randao_it->is_string() && prev_randao_it->get<std::string>() == "0")
137+
difficulty = 0x0000000000000000000000000000000000000000000000000000000000000000_bytes32;
138+
else
139+
difficulty = from_json<evmc::bytes32>(*prev_randao_it);
140+
}
134141
else if (current_difficulty_it != j.end())
135142
difficulty = from_json<evmc::bytes32>(*current_difficulty_it);
136143
else if (parent_difficulty_it != j.end())

0 commit comments

Comments
 (0)