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

Have creation transactions run in runtime mode #118

Closed
wants to merge 1 commit into from

Conversation

pdobacz
Copy link
Member

@pdobacz pdobacz commented May 22, 2024

Formalization of the idea tossed on discord and discussed briefly during the EOF implementers call.

Opening the PR just to assess the fresh idea in writing, does not mean yet we're changing the spec.

Another PR with the version to relax the RETURN/STOP validation instead: #119

Copy link
Member Author

@pdobacz pdobacz left a comment

Choose a reason for hiding this comment

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

Added some first thoughts which occurred to me during writing this down


1. intrinsic gas cost rules and limits defined in EIP-3860 for legacy creation transaction apply. The entire `data` of the transaction is used for these calculations
2. Find the split of `data` into `initcontainer` and `calldata`:
1. intrinsic gas cost rules and limits defined in EIP-3860 for legacy creation transaction apply. The entire `data` of the transaction is used for these calculations, as if it were the initcode
Copy link
Member Author

Choose a reason for hiding this comment

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

Potential Problem 1: applying initcode-specific rules (eip-3860) to something which is not initcode


**NOTE** No code is ever set to `tx_address` but storage may be set and receives transaction value.
Copy link
Member Author

Choose a reason for hiding this comment

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

Potential Problem 2: this smells to me. I even consider adding a magic to the tx_address keccak256 for good measure. Decided not to, but I don't like this.

Copy link
Member

Choose a reason for hiding this comment

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

This is commonly discussed thing: should the storage persist in such account. In this context this address is used only once so this is not very practical.

The first version of 7702 actually sets code for the duration of the transaction. I think this may be fine too.

@@ -128,27 +128,21 @@ Code executing within an EOF environment will behave differently than legacy cod

#### Creation transactions

Creation transactions (tranactions with empty `to`), with `data` containing EOF code (starting with `EF00` magic) are interpreted as having a concatenation of EOF `initcontainer` and `calldata` in the `data` and:
Creation transactions (tranactions with empty `to`), with `data` containing EOF code (starting with `EF00` magic) are interpreted as having a concatenation of an EOF `txcontainer` and `calldata` in the `data` and:
Copy link
Member Author

@pdobacz pdobacz May 22, 2024

Choose a reason for hiding this comment

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

I invented a new name for this. Calling it "an EOF runtime container" seemed somewhat off (?) not sure why

@pdobacz
Copy link
Member Author

pdobacz commented May 29, 2024

Idea dropped on the EOF impls call (reasons in comments here and #119 also and here: ethereum/pm#1051 (comment) )

@pdobacz pdobacz closed this May 29, 2024
@pdobacz pdobacz deleted the runtime-mode-creation-tx branch May 29, 2024 15:41
@pdobacz
Copy link
Member Author

pdobacz commented Jun 4, 2024

Taking the liberty to duplicate @shemnon 's feedback on this here for completeness, and also to reply to it:

Danno's take on #118 - It causes problems with (a) storage and (b) nonce-based addresses.

For storage, the runtime could read/write storage from an EOA, which is an ongoing issue with EIP-7702. We don't want to be mis-alighed with their decisions.

For nonce-based addresses, the returned contract address from the create tx call will not have a contract at it, as the EOFCREATE call would create a different contract ad a salt based address. This for sure broke older dev tooling that assumed the contract address was nonce based from the account and never checked the transaction receipt, some may still do that when polling the address for info from RPC. It also makes repeated deployements difficult as we would have to chagne the salt on each call.

We would either introduce inconsistencies with legacy without need or we would need to re-work some assumptions, such as allowing EOFCREATE to inherit the calling address if it is a create transactions, which feels just as hacky as it sounds.

@pdobacz
Copy link
Member Author

pdobacz commented Jun 4, 2024

@shemnon

It also makes repeated deployements difficult as we would have to chagne the salt on each call.

All valid points, I just want to throw in here I'm not sure about the part quoted above - the "sender" address for the top-level frame changes every time (it is keccak(sender | sender_nonce), so every creation tx changes it). Unless you've meant calling a couple of EOFCREATE in a single creation tx, which is no different from how CREATE/2 would work in such context.


But nevertheless, I think the storage (and value!) are problems for this #118 here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants