Skip to content

Commit

Permalink
Support set code transaction in state test loader
Browse files Browse the repository at this point in the history
Co-authored-by: pdobacz <[email protected]>
  • Loading branch information
gumb0 and pdobacz committed Jan 17, 2025
1 parent 2ab115b commit 35e354b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/statetest/statetest_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,26 @@ state::AccessList from_json<state::AccessList>(const json::json& j)
return o;
}

template <>
state::AuthorizationList from_json<state::AuthorizationList>(const json::json& j)
{
state::AuthorizationList o;
for (const auto& a : j)
{
state::Authorization authorization{};
authorization.chain_id = from_json<intx::uint256>(a.at("chainId"));
authorization.addr = from_json<address>(a.at("address"));
authorization.nonce = from_json<uint64_t>(a.at("nonce"));
if (a.contains("signer"))
authorization.signer = from_json<address>(a.at("signer"));
authorization.r = from_json<intx::uint256>(a.at("r"));
authorization.s = from_json<intx::uint256>(a.at("s"));
authorization.v = from_json<intx::uint256>(a.at("v"));
o.emplace_back(authorization);
}
return o;
}

// Based on calculateEIP1559BaseFee from ethereum/retesteth
static uint64_t calculate_current_base_fee_eip1559(
uint64_t parent_gas_used, uint64_t parent_gas_limit, uint64_t parent_base_fee)
Expand Down Expand Up @@ -343,6 +363,7 @@ static void from_json_tx_common(const json::json& j, state::Transaction& o)
else if (const auto au_it = j.find("authorizationList"); au_it != j.end())
{
o.type = state::Transaction::Type::set_code;
o.authorization_list = from_json<state::AuthorizationList>(*au_it);
}
}

Expand Down

0 comments on commit 35e354b

Please sign in to comment.