Consensys/linea-tracer

SELFDESTRUCT test vectors

Opened this issue · 2 comments

We want to test

Exceptional SELFDESTRUCT's:

  • STATICCALL into an account that will attempt to SELFDESTRUCT (STATICX case)
A static calls B [cold/warm]
B attempts to SELFDESTRUCT [and fails]

// alternatively
A static calls B [cold/warm]
B calls C
C attempts to SELFDESTRUCT [and fails]
B returns
A calls C
C attempts to SELFDESTRUCT [and succeeds]
  • various ways of pricing the instruction and being out of gas (OOGX case):
    • the heir is warm / heir is cold
    • the selfdestructor.balance().isZero() either true or false
    • the heir is $\texttt{DEAD}$ i.e. zero balance, zero nonce, empty code

We want also to play with the following

  • the heir == selfdestructor either true or false
  • multiple SELFDESTRUCT's being done at an address
  • CALLing into the account after SELFDESTRUCT (with or without value) and
  • SELFDESTRUCT'ing
    • while executing initcode
    • after deployment (same transaction)
    • after deployment (next transaction in the same block)
    • and have it REVERTED and (same tx) CALL into that same account again
A calls B [cold]
    // optionally
    // B invokes BALANCE on C's address, as well as EXTCODESIZE / EXTCODEHASH / EXTCODECOPY (nothing should have changed from before the SELFDESTRUCT
    B calls C [cold] // [warm]
        C interacts with its storage
        C selfdestructs
    B invokes BALANCE on C's address, as well as EXTCODESIZE / EXTCODEHASH / EXTCODECOPY (nothing should have changed from before the SELFDESTRUCT
    B calls C
        C interacts with its storage
        C selfdestructs [again]
    B invokes BALANCE on C's address, as well as EXTCODESIZE / EXTCODEHASH / EXTCODECOPY (nothing should have changed from before the SELFDESTRUCT
    B returns to A
// optionally
// A reverts

The above could also play out at an extra level of dept, REVERT and then Z (the parent of A) calls C again normally.

This will be useful to debug

  • deployment numbers / status
  • storage
  • marked for selfdestruct ...

To warm an account A can ask for the balance of B (invoke BALANCE), EXTCODESIZE or do pre-warming in transaction access list or do some CALL to B and send some founds (or see the suggestions above). CALL is the most complex. It is fine to always use the same approach to warm an account.

It's part of the big HUB PR #746