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

CANCUN: EIP-1153 Transient Storage #916

Open
wants to merge 1 commit into
base: cancun
Choose a base branch
from

Conversation

pldespaigne
Copy link
Contributor

@pldespaigne pldespaigne commented Aug 26, 2024

EIP 1153 Transient Storage

This is the first PR aiming to bring the Yellow Paper up to date with Cancun update

This PR translate EIP-1553 into the Yellow Paper.
Here is the PDF version of those changes: Paper.pdf

Definition

We formally define the Transient Storage as $\boldsymbol{\theta}$ (symbol not already used in the paper), in section 6. Transaction Execution.

Screenshot

0_after

Updating functions $\Theta$, $\Lambda$ and $\Xi$

We updated every occurrence of the Message Call function $\boldsymbol{\Theta}$ to incorporate transient storage $\boldsymbol{\theta}$ as the second parameter and new resultant transient storage $\boldsymbol{\theta}'$ as the last returned parameter.

Screenshot

3_after

We updated every occurrence of the Create function $\boldsymbol{\Lambda}$ to incorporate transient storage $\boldsymbol{\theta}$ as the second parameter and new resultant transient storage $\boldsymbol{\theta}'$ as the last returned parameter.

Screenshot

2_after

We updated every occurrence of the Execution function $\boldsymbol{\Xi}$ to incorporate transient storage $\boldsymbol{\theta}$ as the second parameter and new resultant transient storage $\boldsymbol{\theta}'$ as the second returned parameter.

Screenshot

4_after

STATICCALL Exception

We added $\small{TSTORE}$ to the list of forbidden opocodes during a static execution.

Screenshot

5_after

Gas cost

We added $\small{TLOAD}$ and $\small{TSTORE}$ to gas opcode categories.

Screenshot

8_after

We added a new fee tier for that category.

Screenshot

6_after

Finally, we updated the gas cost function $C$ to handle those new opcodes.

Screenshot

7_after

Opcodes Definition

We added $\small{TLOAD}$ and $\small{TSTORE}$ to the list of opcodes.

Screenshot

9_after

@pldespaigne
Copy link
Contributor Author

@yperbasis could you create a cancun branch please, so that I can update the target branch of the PR and mark it as ready to review 🙏

@yperbasis
Copy link
Member

@yperbasis could you create a cancun branch please, so that I can update the target branch of the PR and mark it as ready to review 🙏

done

@pldespaigne pldespaigne changed the base branch from master to cancun August 27, 2024 08:03
@pldespaigne pldespaigne marked this pull request as ready for review August 27, 2024 08:03
@pldespaigne
Copy link
Contributor Author

Thanks!
PR is now ready to review!

@alexprut @benjaminion @RenanSouza2 @timbeiko @alexkroeger any feedback on that will be highly appreciated as well 🙏

@RenanSouza2
Copy link
Contributor

Hey, I‘m not sure why I was mentionend but I have two suggestions,

the first one is to simplify the section 6.2 to
'The transient storage (eip1153), fomrally ...‘

the second one is to use Gwarmaccess in the gas formula instead of creating a new category

@pldespaigne
Copy link
Contributor Author

pldespaigne commented Aug 29, 2024

Thanks for your feedback!

  • What needs to be simplified in section 6.2 for you? Would you avoid to formally define the transient storage and simply says that it behave almost as the regular storage, like the EIP-1153 does?

  • I did it this way so it's more future proof if one of those gas category change, but yeah it doesn't look clean, and I think I like it better using only $G_{warmaccess}$.

@RenanSouza2
Copy link
Contributor

I have one more suggestion, to move the definition from section 6 (transaction execution) to section 9 (Execution model),

this could be integrated in 9.1 (basics), or there could be a revamp and expand the explanation of memory, storage,

my previous suggestion was to remove the sentences 'introduced by eip 1153, during the cancun update' and start by 'the transient storage (eip1153)[authors], formally ...'

@pldespaigne
Copy link
Contributor Author

pldespaigne commented Aug 30, 2024

From what I understand, section 9 describe thing relative to a single execution context (such as memory, environment, etc...).

Structures used for the whole transaction (such as accrued sub-state) are defined in section 6.

Since transient storage is created at the beginning of the tx (and destroy at the end) and persist across contexts, I find it more logical to put it in section 6.
Again that's just my opinion, I'm happy to discuss this further and make that update if everybody agrees on it.

Thanks again for the feedbacks!

@RenanSouza2
Copy link
Contributor

makes sense, 6.1 is substate and 6.2 is transient storage

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.

3 participants