diff --git a/test/integration/export/CMakeLists.txt b/test/integration/export/CMakeLists.txt index d18eb7b807..6fe59a2437 100644 --- a/test/integration/export/CMakeLists.txt +++ b/test/integration/export/CMakeLists.txt @@ -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 diff --git a/test/unittests/state_transition.cpp b/test/unittests/state_transition.cpp index 804daa6d05..9bf00bbcfe 100644 --- a/test/unittests/state_transition.cpp +++ b/test/unittests/state_transition.cpp @@ -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); diff --git a/test/unittests/state_transition_block_test.cpp b/test/unittests/state_transition_block_test.cpp index 33d5194885..f4cd7588b2 100644 --- a/test/unittests/state_transition_block_test.cpp +++ b/test/unittests/state_transition_block_test.cpp @@ -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)