Skip to content

Conversation

@nerolation
Copy link
Contributor

🗒️ Description

This PR adds three new BAL edge-case tests covering 7702 multi-authorization behavior and the two distinct post-Cancún SELFDESTRUCT outcomes:

  1. 7702 Double Authorization Reset:
    A single transaction includes two EIP-7702 authorizations for Alice—first setting delegation code, then clearing it.
    BAL must reflect the correct nonce increments (self-funded: 0→3; sponsored: 0→2) and must not include any code_changes, since the final code is empty.

  2. SELFDESTRUCT Sending Funds Back to Sender:
    A pre-existing contract C executes SELFDESTRUCT(Alice).
    Under EIP-6780, C remains intact (no code deletion) and all its balance is transferred to Alice.
    BAL must show C’s balance going to zero and Alice receiving the value.

  3. SELFDESTRUCT That Burns ETH (Created and Destroyed in Same Tx):
    A contract D is created and, in the same transaction, executes SELFDESTRUCT(D).
    Per EIP-6780, the ETH is burned rather than transferred.
    BAL must show D’s balance reduced to zero with no beneficiary receiving the value.

mirgee pushed a commit to mirgee/execution-specs that referenced this pull request Dec 5, 2025
…1815)

* chore(consume): add exponential retry logic for initial fcu in consume engine.

* chore(docs): changelog.
| `test_value_transfer_gas_calculation` | Ensure BAL correctly tracks OOG scenarios for CALL/CALLCODE/DELEGATECALL/STATICCALL (pre-Amsterdam test with BAL) | Nested calls with precise gas limits to test OOG behavior. For CALL with OOG: target account is read. For CALLCODE/DELEGATECALL/STATICCALL with OOG: target account **NOT** read (OOG before state access) | For CALL: target in BAL even with OOG. For CALLCODE/DELEGATECALL/STATICCALL: target **NOT** in BAL when OOG (state access deferred until after gas check) | ✅ Completed |
| `test_bal_7702_double_auth_reset_minimal` | Ensure BAL tracks multiple 7702 nonce increments but filters net-zero code change | Single transaction contains two EIP-7702 authorizations for `Alice`: (1) first auth sets delegation `0xef0100\|\|Oracle`, (2) second auth clears delegation back to empty. Transaction sends 10 wei to `Bob`. Two variants: (a) Self-funded: `Alice` is tx sender (one tx nonce bump + two auth bumps → nonce 0→3). (b) Sponsored: `Relayer` is tx sender (`Alice` only in auths → nonce 0→2 for `Alice`, plus one nonce bump for `Relayer`). | Variant (a): BAL **MUST** include `Alice` with `nonce_changes` 0→3. Variant (b): BAL **MUST** include `Alice` with `nonce_changes` 0→2 and `Relayer` with its own `nonce_changes`. For both variants, BAL **MUST NOT** include `code_changes` for `Alice` (net code is empty), **MUST** include `Bob` with `balance_changes` (receives 10 wei), and `Oracle` **MUST NOT** appear in BAL. | 🟡 Planned |
| `test_bal_selfdestruct_send_to_sender` | Ensure BAL tracks SELFDESTRUCT sending all funds back to the tx sender (no burn) | Pre-state: contract `C` exists from a prior transaction with non-empty code and balance = 100 wei. EOA `Alice` sends a transaction calling `C`. `C`’s code executes `SELFDESTRUCT(Alice)`. Under EIP-6780, because `C` was not created in this transaction, SELFDESTRUCT does not delete code or storage; it only transfers the entire 100 wei balance from `C` to `Alice`. Final post-state: `C` still exists with the same code and balance = 0; `Alice`’s balance increased by 100 wei (ignoring gas for this test). | BAL **MUST** include `Alice` with `nonce_changes` (tx sender) and `balance_changes` reflecting receipt of 100 wei, and **MUST** include `C` with `balance_changes` 100→0 and no `code_changes`. BAL **MUST NOT** include any other accounts. This test ensures SELFDESTRUCT-to-sender is modeled as a pure value transfer (no burn, no code deletion). | 🟡 Planned |
| `test_bal_selfdestruct_burn_balance` | Ensure BAL records ETH burn when a contract created in the same tx selfdestructs to itself | Pre-state: `Alice` sends a CREATE/CREATE2 transaction that deploys contract `D` with an initial endowment of 100 wei. In the same transaction, `D`’s runtime executes and calls `SELFDESTRUCT(D)` (beneficiary is its own address). Under EIP-6780, because `D` is created and selfdestructs in the same transaction and the target equals the caller, the 100 wei is **burned** (removed from total supply). Final post-state: `D` has balance = 0 and is considered destroyed per same-tx semantics. | BAL **MUST** include `D` with `balance_changes` 100→0 (burn) and may include `code_changes` indicating deletion if BAL models code removal; no other account **MUST** have `balance_changes` corresponding to this 100 wei, i.e. no recipient appears. `Alice` **MAY** appear only with `nonce_changes` and gas-related balance changes; the key assertion is that the 100 wei leaves `D` and is not credited to any other account. | 🟡 Planned |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just merged some more cases and I rebased here. I think that this test case covers this scenario here, what do you think?

Copy link
Contributor

@fselmo fselmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, took me a minute to review and merge some PRs ahead of this one... sorry for the wait here! I just merged those and rebased this one. We may have a duplicate case, can you make sure?

@fselmo fselmo force-pushed the eips/amsterdam/eip-7928 branch 2 times, most recently from ebc749e to 6044b67 Compare December 9, 2025 01:58
@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.85%. Comparing base (6044b67) to head (f866aa6).

Additional details and impacted files
@@                   Coverage Diff                    @@
##           eips/amsterdam/eip-7928    #1815   +/-   ##
========================================================
  Coverage                    83.85%   83.85%           
========================================================
  Files                          402      402           
  Lines                        25105    25105           
  Branches                      2287     2287           
========================================================
  Hits                         21051    21051           
  Misses                        3615     3615           
  Partials                       439      439           
Flag Coverage Δ
unittests 83.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants