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 @@
jenv["currentCoinbase"] = hex0x(block.coinbase);
jenv["currentBaseFee"] = hex0x(block.base_fee);
jenv["currentRandom"] = hex0x(block.prev_randao);
if (!block.withdrawals.empty())

Check warning on line 184 in test/unittests/state_transition.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition.cpp#L184

Added line #L184 was not covered by tests
{
auto& jwithdrawals = jenv["withdrawals"] = json::json::array();
for (const auto& withdrawal : block.withdrawals)

Check warning on line 187 in test/unittests/state_transition.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition.cpp#L186-L187

Added lines #L186 - L187 were not covered by tests
{
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);

Check warning on line 193 in test/unittests/state_transition.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition.cpp#L189-L193

Added lines #L189 - L193 were not covered by tests
}
}

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 @@

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}};

Check warning on line 15 in test/unittests/state_transition_block_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition_block_test.cpp#L15

Added line #L15 was not covered by tests
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;

Check warning on line 17 in test/unittests/state_transition_block_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition_block_test.cpp#L17

Added line #L17 was not covered by tests
}

TEST_F(state_transition, known_block_hash)
Expand Down