Skip to content

Conversation

gumb0
Copy link
Member

@gumb0 gumb0 commented Jan 17, 2025

Clarify that CODE* operate on the code being executed, and not on the delegation designator.

(Tests' expectations agree with this.)

This clarification is motivated by confusion observed in this document: https://hackmd.io/5kcrdKgaQHSjrQ9MtAlBfg?comment=37baf7a2-fd97-4e3a-9972-e4a86c92ce8b

@gumb0 gumb0 requested a review from eth-bot as a code owner January 17, 2025 17:44
@github-actions github-actions bot added c-update Modifies an existing proposal s-review This EIP is in Review t-core labels Jan 17, 2025
@eth-bot
Copy link
Collaborator

eth-bot commented Jan 17, 2025

✅ All reviewers have approved.

@eth-bot eth-bot added the a-review Waiting on author to review label Jan 17, 2025
@gumb0 gumb0 marked this pull request as draft January 17, 2025 18:05
@gumb0 gumb0 force-pushed the eip-7702-code-ops branch 5 times, most recently from fc19724 to 817f1e6 Compare January 17, 2025 18:35
@@ -90,6 +90,8 @@ The delegation designation uses the banned opcode `0xef` from [EIP-3541](./eip-3

For example, `EXTCODESIZE` would return `2` (the size of `0xef01`) instead of `23` which would represent the delegation designation, `EXTCODEHASH` would return `0xeadcdba66a79ab5dce91622d1d75c8cff5cff0b96944c3bf1072cd08ce018329` (`keccak256(0xef01)`), and `CALL` would load the code from `address` and execute it in the context of `authority`.

`CODESIZE` and `CODECOPY` instructions operate on executable code, as before. *Note that in a delegated execution `CODESIZE` and `CODECOPY` produce different result comparing to `EXTCODESIZE` and `EXTCODECOPY` of execution target.*
Copy link
Member

Choose a reason for hiding this comment

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

I did not realize this before, but this is the first time we have a case where CODECOPY/CODESIZE vs EXTCODECOPY/EXTCODESIZE on itself (ADDRESS) returns something different, right? (Except in the context of a contract creation frame)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but it also answers the question "Am I being run as a delegate" - which is a useful security feature.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is true. CODECOPY copies the code that is dynamically running whereas EXTCODECOPY on ADDRESS copies the account code, these can already differ prior to EIP-7702 due to DELEGATECALL or CALLCODE.

@gumb0 gumb0 marked this pull request as ready for review January 20, 2025 09:18
Copy link
Member

@lightclient lightclient left a comment

Choose a reason for hiding this comment

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

sgtm

@gumb0
Copy link
Member Author

gumb0 commented Feb 4, 2025

@lightclient Not sure what's the CI failure about

@jochem-brouwer
Copy link
Member

Can we retrigger? (Maybe this comment does it?)

@gumb0 gumb0 force-pushed the eip-7702-code-ops branch from 817f1e6 to 8454802 Compare February 13, 2025 13:18
@github-actions github-actions bot removed the s-review This EIP is in Review label Feb 13, 2025
@eth-bot eth-bot enabled auto-merge (squash) February 13, 2025 13:18
Copy link
Collaborator

@eth-bot eth-bot left a comment

Choose a reason for hiding this comment

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

All Reviewers Have Approved; Performing Automatic Merge...

@eth-bot eth-bot merged commit 85e2e7a into ethereum:master Feb 13, 2025
10 checks passed
@gumb0 gumb0 deleted the eip-7702-code-ops branch February 13, 2025 13:34
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 t-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants