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

feat: support transient storage opcodes (EIP-1153) #278

Merged
merged 7 commits into from
Jun 4, 2024

Conversation

RomarQ
Copy link
Contributor

@RomarQ RomarQ commented May 1, 2024

This PR adds 2 new opcodes (TLOAD and TSTORE) for manipulating state that behaves almost identically to storage but is discarded after every transaction.

These new instructions were introduced by EIP-1153 and included in Cancun fork.

Running the tests located at ethtests/GeneralStateTests/Cancun/stEIP1153-transientStorage will require the changes present in #280

Copy link

@librelois librelois left a comment

Choose a reason for hiding this comment

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

Some remarks to improve perf but overall it's good

jsontests/src/in_memory.rs Show resolved Hide resolved
@ahmadkaouk
Copy link
Contributor

@RomarQ I think it's important that the new opcodes should only be enabled when the Cancun fork is used and not for previous forks. We should add a flag that is set to true when the Cancun fork is chosen that enable or disable the new opcodes. Something similar to what was done for CREATE2 for example:

Opcode::CREATE2 if !is_static && config.has_create2 => GasCost::Create2 {
len: U256::from_big_endian(&stack.peek(2)?[..]),
},

@RomarQ
Copy link
Contributor Author

RomarQ commented May 13, 2024

@RomarQ I think it's important that the new opcodes should only be enabled when the Cancun fork is used and not for previous forks. We should add a flag that is set to true when the Cancun fork is chosen that enable or disable the new opcodes. Something similar to what was done for CREATE2 for example:

Opcode::CREATE2 if !is_static && config.has_create2 => GasCost::Create2 {
len: U256::from_big_endian(&stack.peek(2)?[..]),
},

Done, thanks for the remark 👍

@koushiro koushiro requested a review from sorpaas May 19, 2024 08:32
@koushiro
Copy link
Contributor

koushiro commented Jun 3, 2024

@RomarQ Please resolve the conflicts

@RomarQ
Copy link
Contributor Author

RomarQ commented Jun 3, 2024

@RomarQ Please resolve the conflicts

Done

@koushiro koushiro merged commit 63b19f7 into rust-ethereum:master Jun 4, 2024
3 checks passed
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.

4 participants