Skip to content

Conversation

Amxx
Copy link
Contributor

@Amxx Amxx commented May 8, 2024

Rational for this change is explained in the PR, but might deserve some discussion. All these are a transposition of a discussion that already happened on EIP-5806 (alghouth without all the attention/participation that EIP-7702 is getting today)

Restricting nonce-changing operation

  • Lets say Alice has an EOA, and gave a signature so that Bob (or anyone) can temporarily place code at Alice's EOA's address.
  • Lets say Alice submits a "normal" transaction, with the correct nonce
  • Lets say before Alice transaction is mined, Bob (or anyone) uses Alice signature, invokes the code at under Alice's EOA's address, and execute any of these opcodes

Then Alice's nonce would increase, and the "normal" transaction would no longer be valid. This could DoS Alice's ability to use her EOA. It would also mess up with the mempool. Therefore, I strongly believe that these opcode MUST be restrited.

Restricting SSTORE

EDIT: The SSTORE part is the subject of #8539, no longer in this PR.

I understand people want to use SSTORE. I'm one of them, and I was very reluctant to add this restriction to EIP-5806. However, there is an invariant formulated somewhere (maybe @gballet can find the refenrence) that accounts without code SHOULD NOT have storage slot set. I believe this has to do with the transition to Verkle, or with safety assumption if permanent code is ever placed at this address. This restriction was recognised during the AA breakout session n°2.

I guess the proposed behavior is similar to what happens today if you use SSTORE in a contract that is selfdestructed within its construction transaction.

If you need persistent storage, you can use a third party contract that holds it for you

@Amxx Amxx requested a review from eth-bot as a code owner May 8, 2024 23:54
@github-actions github-actions bot added c-update Modifies an existing proposal s-draft This EIP is a Draft t-core labels May 8, 2024
@eth-bot
Copy link
Collaborator

eth-bot commented May 8, 2024

File EIPS/eip-7702.md

Requires 1 more reviewers from @adietrichs, @lightclient, @SamWilsn, @vbuterin

@eth-bot eth-bot added the a-review Waiting on author to review label May 8, 2024
@eth-bot eth-bot changed the title EIP-7702: Add opcode restrictions Update EIP-7702: Add opcode restrictions May 8, 2024
@@ -57,7 +57,7 @@ At the start of executing the transaction, for each `[contract_code, y_parity, r
2. Verify that the contract code of `signer` is empty.
3. Set the contract code of `signer` to `contract_code`.

At the end of the transaction, set the `contract_code` of each `signer` back to empty.
At the end of the transaction, set the `contract_code` of each `signer` back to empty. Any storage set for the `signer` must also be cleared.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say not cleared, but prevent SSTORE in the first place. Otherwise it might have unintended consequences to code that assumes the SSTORE was not implicitly a TSTORE. See my Safe example in the EM thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what I originally proposed, both in EIP-5806 and here.

I see that #8539 is specifying that part, so I'll change this PR to be only about create/create2/selfdestruct

@Amxx Amxx changed the title Update EIP-7702: Add opcode restrictions Update EIP-7702: Prohibit nonce-changing opcodes May 9, 2024
@AmadiMichael
Copy link

Resharing my comment from the 7702 eip...

Not so sure about the invariant because a contract that sets storage at initialization but also returns 0 bytes at initialization has no bytecode but has > 0 storage slots set.

E.g

PUSH1 0x01
PUSH0
SSTORE

PUSH0
PUSH0
RETURN

Returns no runtime code but definitely has something at storage slot 0 which if read via an rpc returns 0x01

Copy link

github-actions bot commented Aug 4, 2024

There has been no activity on this pull request for 2 weeks. It will be closed after 3 months of inactivity. If you would like to move this PR forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review.

Copy link

This pull request was closed due to inactivity. If you are still pursuing it, feel free to reopen it and respond to any feedback or request a review in a comment.

@github-actions github-actions bot closed this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-review Waiting on author to review c-update Modifies an existing proposal s-draft This EIP is a Draft t-core w-stale Waiting on activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants