Skip to content

Commit

Permalink
Support optional storage field in input alloc.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Mar 30, 2023
1 parent f835186 commit 213793d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/statetest/statetest_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,14 @@ state::State from_json<state::State>(const json::json& j)
.balance = from_json<intx::uint256>(j_acc.at("balance")),
.code = from_json<bytes>(j_acc.at("code"))});

for (const auto& [j_key, j_value] : j_acc.at("storage").items())
if (const auto storage_it = j_acc.find("storage"); storage_it != j_acc.end())
{
const auto value = from_json<bytes32>(j_value);
acc.storage.insert({from_json<bytes32>(j_key), {.current = value, .original = value}});
for (const auto& [j_key, j_value] : storage_it->items())
{
const auto value = from_json<bytes32>(j_value);
acc.storage.insert(
{from_json<bytes32>(j_key), {.current = value, .original = value}});
}
}
}
return o;
Expand Down

0 comments on commit 213793d

Please sign in to comment.