Skip to content

Commit 0028d4d

Browse files
authored
Support optional storage field in input alloc. (#606)
1 parent f835186 commit 0028d4d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/statetest/statetest_loader.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,14 @@ state::State from_json<state::State>(const json::json& j)
184184
.balance = from_json<intx::uint256>(j_acc.at("balance")),
185185
.code = from_json<bytes>(j_acc.at("code"))});
186186

187-
for (const auto& [j_key, j_value] : j_acc.at("storage").items())
187+
if (const auto storage_it = j_acc.find("storage"); storage_it != j_acc.end())
188188
{
189-
const auto value = from_json<bytes32>(j_value);
190-
acc.storage.insert({from_json<bytes32>(j_key), {.current = value, .original = value}});
189+
for (const auto& [j_key, j_value] : storage_it->items())
190+
{
191+
const auto value = from_json<bytes32>(j_value);
192+
acc.storage.insert(
193+
{from_json<bytes32>(j_key), {.current = value, .original = value}});
194+
}
191195
}
192196
}
193197
return o;

0 commit comments

Comments
 (0)