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@26332146.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_top_frame_charges.py::test_initcode_selfdestruct_keeps_top_frame_state_charge --fork Amsterdam
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
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 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 | |
Parametrized Test Cases¶
This test generates 6 parametrized test cases across 1 fork.