Skip to content
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

Update EIP-6800: EOFv1 tweaks #8713

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

gballet
Copy link
Member

@gballet gballet commented Jul 2, 2024

This is a proposal to modify how EOFv1 accounts are stored. A single bit is used to mark an account as an EOFv1 contract. The values returned by EXTCODECOPY, EXTCODEHASH and EXTCODESIZE are known by just reading this bit, which removes the needs to read the first code chunk.

The bit is stored in the version field of the basic account data leaf, effectively creating a new account version.

@github-actions github-actions bot added c-update Modifies an existing proposal s-draft This EIP is a Draft t-core labels Jul 2, 2024
@eth-bot
Copy link
Collaborator

eth-bot commented Jul 2, 2024

✅ All reviewers have approved.

@gballet gballet changed the title eip6800: EOFv1 tweaks eip6800: EOFv1 as a new account type Jul 2, 2024
@eth-bot eth-bot changed the title eip6800: EOFv1 as a new account type Update EIP-6800: EOFv1 tweaks Jul 2, 2024
`version` can have two values:

* `0`, in which case this is a legacy contract. `code_hash` and `code_size` have the meaning they do in legacy contract;
* `1`, in which case this is an EOFv1 contract. The `code_size` field isn't set, and the `code_hash` leaf isn't created, as these values are known by the client.
Copy link
Member Author

Choose a reason for hiding this comment

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

This has two consequences:

  • A new account version is created - if this is a problem, the bit can be set somewhere else
  • Values for code hash and size are not set. This is nice because it reduces the amount of computation required, as well as the costs. The drawback is that charging the gas costs for EXTCODEHASH for legacy contracts would become even more expensive: one would need to read the basic account data leaf in order to figure out if the code hash leaf should be read.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should encode in the spec how we differentiate EOFv1 contracts. Specifically saying it is a contract starting with the two bytes 0xEF00 should be sufficient, and will keep design space open for EIP-7702's redirect markers.

Copy link
Contributor

Choose a reason for hiding this comment

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

The drawback is that charging the gas costs for EXTCODEHASH for legacy contracts would become even more expensive: one would need to read the basic account data leaf in order to figure out if the code hash leaf should be read.

@gballet, despite charging more gas, I think the current EXTCODEHASH might be violating a principle we decided to hold in the last interop discussion, reg always reading version to be future-proof. As you mentioned, EXTCODEHASH doesn't do that today, and I think it might not be right.

If we end up having to read basic_data, this might indirectly resolve another pending discussion reg gballet/go-ethereum#420 (cc @g11tech)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-update Modifies an existing proposal s-draft This EIP is a Draft t-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants