Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/integration/export/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set_tests_properties(
add_test(
NAME ${PREFIX}/execute_exported_state_tests
# TODO: Broken exported tests are filtered out.
COMMAND evmone-statetest ${EXPORT_DIR}/state_tests --gtest_filter=-*block.*
COMMAND evmone-statetest ${EXPORT_DIR}/state_tests --gtest_filter=*block.block_apply_withdrawal
)
set_tests_properties(
${PREFIX}/execute_exported_state_tests PROPERTIES
Expand Down
12 changes: 12 additions & 0 deletions test/unittests/state_transition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,18 @@ void state_transition::export_state_test(
jenv["currentCoinbase"] = hex0x(block.coinbase);
jenv["currentBaseFee"] = hex0x(block.base_fee);
jenv["currentRandom"] = hex0x(block.prev_randao);
if (!block.withdrawals.empty())
{
auto& jwithdrawals = jenv["withdrawals"] = json::json::array();
for (const auto& withdrawal : block.withdrawals)
{
auto& jwithdrawal = jwithdrawals.emplace_back(json::json::object());
jwithdrawal["index"] = hex0x(withdrawal.index);
jwithdrawal["validatorIndex"] = hex0x(withdrawal.validator_index);
jwithdrawal["address"] = hex0x(withdrawal.recipient);
jwithdrawal["amount"] = hex0x(withdrawal.amount_in_gwei);
}
}

jt["pre"] = to_json(pre);

Expand Down
6 changes: 3 additions & 3 deletions test/unittests/state_transition_block_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ using namespace evmone::test;

TEST_F(state_transition, block_apply_withdrawal)
{
static constexpr auto withdrawal_address = 0x8888_address;
static constexpr auto WITHDRAWAL_ADDRESS = 0x8888_address;

block.withdrawals = {{0, 0, withdrawal_address, 3}};
block.withdrawals = {{0, 0, WITHDRAWAL_ADDRESS, 3}};
tx.to = To;
expect.post[withdrawal_address].balance = intx::uint256{3} * 1'000'000'000;
expect.post[WITHDRAWAL_ADDRESS].balance = uint256{3} * 1'000'000'000;
}

TEST_F(state_transition, known_block_hash)
Expand Down