rust-ethereum / evm

Pure Rust implementation of Ethereum Virtual Machine
Apache License 2.0
1.16k stars 355 forks source link

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

Closed RomarQ closed 3 months ago

RomarQ commented 4 months ago

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 https://github.com/rust-ethereum/evm/pull/280

ahmadkaouk commented 3 months ago

@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: https://github.com/rust-ethereum/evm/blob/f7a23df6c478ca6a151af5f60e62944800529a61/src/standard/gasometer/mod.rs#L413-L415

RomarQ commented 3 months ago

@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:

https://github.com/rust-ethereum/evm/blob/f7a23df6c478ca6a151af5f60e62944800529a61/src/standard/gasometer/mod.rs#L413-L415

Done, thanks for the remark 👍

koushiro commented 3 months ago

@RomarQ Please resolve the conflicts

RomarQ commented 3 months ago

@RomarQ Please resolve the conflicts

Done