From 7bd0c5a9d4d6db440db5e6cf81e2dd40d65ddd80 Mon Sep 17 00:00:00 2001 From: rodiazet Date: Tue, 21 Mar 2023 12:14:27 +0100 Subject: [PATCH] Add special case to handle "0" value for bytearray --- test/statetest/statetest_loader.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/statetest/statetest_loader.cpp b/test/statetest/statetest_loader.cpp index 6c21f89364..0e3d071e65 100644 --- a/test/statetest/statetest_loader.cpp +++ b/test/statetest/statetest_loader.cpp @@ -130,7 +130,14 @@ state::BlockInfo from_json(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(*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() == "0") + difficulty = 0x0000000000000000000000000000000000000000000000000000000000000000_bytes32; + else + difficulty = from_json(*prev_randao_it); + } else if (current_difficulty_it != j.end()) difficulty = from_json(*current_difficulty_it); else if (parent_difficulty_it != j.end())