test_initcode_selfdestruct_keeps_top_frame_state_charge()¶
Documentation for tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_top_frame_charges.py::test_initcode_selfdestruct_keeps_top_frame_state_charge@ffe48572.
Generate fixtures for these test cases for Bogota with:
A creation transaction whose init code SELFDESTRUCTs keeps the
top-frame NEW_ACCOUNT state charge consumed.
SELFDESTRUCT is a successful halt: the frame returns no
output (an empty deposit, so no deposit charges) and no rollback
runs, so the refill machinery that returns state gas on a revert or
exceptional halt never triggers — even though the created account
is destroyed at the end of the transaction (EIP-6780 same-tx
deletion) and its leaf never persists. Deletion itself carries no
state-gas credit: freeing state is not refunded.
Where the endowment ends up follows EIP-8246: destruction preserves
a nonzero balance, so a self beneficiary leaves a balance-only leaf
behind, while sweeping to an external beneficiary (or a zero
endowment) removes the account entirely. Sweeping value to a
not-yet-existing beneficiary additionally pays the opcode-level
NEW_ACCOUNT and ACCOUNT_WRITE for the beneficiary — both
the destroyed target's top-frame charge and the sweep's charge stay
paid.
The receipt pins the exact total; a regression refilling the
top-frame charge shows up as a 183,600 shortfall in
cumulative_gas_used and a matching sender refund.
Source code in tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_top_frame_charges.py
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | |
Parametrized Test Cases¶
This test generates 6 parametrized test cases across 2 forks.