Skip to content

EIP-6780: SELFDESTRUCT only in same transaction #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 3 tasks
lorenzogentile404 opened this issue Jan 22, 2025 · 0 comments · Fixed by #147
Open
1 of 3 tasks

EIP-6780: SELFDESTRUCT only in same transaction #67

lorenzogentile404 opened this issue Jan 22, 2025 · 0 comments · Fixed by #147
Labels
hardfork cancun EIP's for the Cancun hardfork London to Prague London to Pectra will implement For those EIP's that will be implemented on Linea
Milestone

Comments

@lorenzogentile404
Copy link
Contributor

lorenzogentile404 commented Jan 22, 2025

EIP-6780: SELFDESTRUCT only in same transaction

Progress

Impact

This will impact deployments and SELFDESTRUCT:

  • TX_INIT (for deployment transactions)
  • any CREATE/CREATE2 will have to log its ABS_TX_NUM of the current moment
  • the account/ perspective (we need a new field "deployed in transaction X"
  • the processing of the SELFDESTRUCT opcode (in particular the final account wiping row will depend on whether or not the contract in question was deployed in the same transaction or not.)

Notes

Read through https://hackmd.io/@vbuterin/selfdestruct. The approach detailed below will likely require a new corset feature.

Approach

We can deal with this in the following way:

  • add a transaction-constant binary column account/HAS_CODE_FIRST_IN_TXN
  • the only constraints are that
    • this is binary
    • transaction-constancy in the permuted realm
If acp_FIRST_IN_TXN[i] ≡ 1 Then acp_HAS_CODE_FIRST_IN_TRANSACTION[i] = acp_HAS_CODE[i]
If acp_AGAIN_IN_TXN[i] ≡ 1 Then acp_HAS_CODE_FIRST_IN_TRANSACTION[i] = acp_HAS_CODE_FIRST_IN_TRANSACTION[i - 1]
  • when processing a SELFDESTRUCT we act upon it like so:
    • If account/HAS_CODE_FIRST_IN_TXN ≡ 0 Then
      • deleting the account at the end
        • raising the deployment number
        • erasing the balance
        • erasing the code
        • resetting the nonce
    • If account/HAS_CODE_FIRST_IN_TXN ≡ 1 Then we apply the modified way
      • maintain the balanace if recipient == accountAddress
      • not deleting account at the end, i.e. maintain as is
        • the deployment number
        • the balance
        • the code
        • the nonce

Question. Why only log the first recorded value of account/HAS_CODE ? I.e. why don't we care about the balance and the nonce or e.g. log the first recorded value of account/EXISTS ?

We cannot use account existence as a criterion since an account which gets deployed in a transaction may have nonzero balance prior to deployment, and would thus exist in the state. We also don't care about nonzero nonce. Indeed, for an account to be able to SELFDESTRUCT it must have nonempty code, which means that it was deployed at some stage and has nonzero nonce. In any case, the only criterion that matters is whether the account has code to begin with.

Test vectors

  • interaction with CREATE (there should be some tests already)
  • multitransaction test with DEPLOYMENT and CREATE
@lorenzogentile404 lorenzogentile404 added the hardfork cancun EIP's for the Cancun hardfork label Jan 22, 2025
@OlivierBBB OlivierBBB added the will implement For those EIP's that will be implemented on Linea label Jan 22, 2025
@OlivierBBB OlivierBBB added this to the London to Pectra milestone Mar 22, 2025
@OlivierBBB OlivierBBB linked a pull request Apr 7, 2025 that will close this issue
@OlivierBBB OlivierBBB changed the title EIP-6780: SELFDESTRUCT only in same transaction EIP-6780: SELFDESTRUCT only in same transaction Apr 8, 2025
@OlivierBBB OlivierBBB reopened this Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hardfork cancun EIP's for the Cancun hardfork London to Prague London to Pectra will implement For those EIP's that will be implemented on Linea
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants