From ab4a1a141b5ce7f48821d5d1f75ac444d9b5928b Mon Sep 17 00:00:00 2001 From: jangko Date: Sun, 25 Jun 2023 08:24:45 +0700 Subject: [PATCH] EIP-1153 spec update: change opcode value --- nimbus/evm/interpreter/gas_costs.nim | 11 ++++------- nimbus/evm/interpreter/op_codes.nim | 14 +++++--------- nimbus/evm/interpreter/op_handlers/oph_memory.nim | 8 ++++---- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/nimbus/evm/interpreter/gas_costs.nim b/nimbus/evm/interpreter/gas_costs.nim index 3aec92443..a145c4916 100644 --- a/nimbus/evm/interpreter/gas_costs.nim +++ b/nimbus/evm/interpreter/gas_costs.nim @@ -626,9 +626,10 @@ template gasCosts(fork: EVMFork, prefix, ResultGasCostsName: untyped) = Msize: fixed GasBase, Gas: fixed GasBase, JumpDest: fixed GasJumpDest, - BeginSub: fixed GasBase, - ReturnSub: fixed GasLow, - JumpSub: fixed GasHigh, + + # 5c & 5d: Transient storage operations + Tload: fixed GasWarmStorageRead, + Tstore: fixed GasWarmStorageRead, # 5f, 60s & 70s: Push Operations Push0: fixed GasBase, @@ -708,10 +709,6 @@ template gasCosts(fork: EVMFork, prefix, ResultGasCostsName: untyped) = Log3: memExpansion `prefix gasLog3`, Log4: memExpansion `prefix gasLog4`, - # b0s: Transient storage operations - Tload: fixed GasWarmStorageRead, - Tstore: fixed GasWarmStorageRead, - # f0s: System operations Create: complex `prefix gasCreate`, Call: complex `prefix gasCall`, diff --git a/nimbus/evm/interpreter/op_codes.nim b/nimbus/evm/interpreter/op_codes.nim index 0a22e9e93..c11f4890a 100644 --- a/nimbus/evm/interpreter/op_codes.nim +++ b/nimbus/evm/interpreter/op_codes.nim @@ -127,9 +127,10 @@ type JumpDest = 0x5b, ## Mark a valid destination for jumps. This ## operation has no effect on machine state during ## execution. - BeginSub = 0x5c, ## Marks the entry point to a subroutine - ReturnSub = 0x5d, ## Returns control to the caller of a subroutine. - JumpSub = 0x5e, ## Transfers control to a subroutine. + Tload = 0x5c, ## Load word from transient storage. + Tstore = 0x5d, ## Save word to transient storage. + + Nop0x5E = 0x5e, ## Transfers control to a subroutine. # 5f, 60s & 70s: Push Operations. Push0 = 0x5f, ## Place 0 on stack. EIP-3855 @@ -174,12 +175,7 @@ type Nop0xA5, Nop0xA6, Nop0xA7, Nop0xA8, Nop0xA9, Nop0xAA, Nop0xAB, Nop0xAC, Nop0xAD, Nop0xAE, Nop0xAF, Nop0xB0, - Nop0xB1, Nop0xB2, - - Tload = 0xb3, ## Load word from transient storage. - Tstore = 0xb4, ## Save word to transient storage. - - Nop0xB5, Nop0xB6, + Nop0xB1, Nop0xB2, Nop0xB3, Nop0xB4, Nop0xB5, Nop0xB6, Nop0xB7, Nop0xB8, Nop0xB9, Nop0xBA, Nop0xBB, Nop0xBC, Nop0xBD, Nop0xBE, Nop0xBF, Nop0xC0, Nop0xC1, Nop0xC2, Nop0xC3, Nop0xC4, Nop0xC5, Nop0xC6, Nop0xC7, Nop0xC8, diff --git a/nimbus/evm/interpreter/op_handlers/oph_memory.nim b/nimbus/evm/interpreter/op_handlers/oph_memory.nim index 3a3ef9c41..d3d0d0665 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_memory.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_memory.nim @@ -306,14 +306,14 @@ const discard tloadOp: Vm2OpFn = proc (k: var Vm2Ctx) = - ## 0xb3, Load word from transient storage. + ## 0x5c, Load word from transient storage. let slot = k.cpt.stack.peek() val = k.cpt.getTransientStorage(slot) k.cpt.stack.top(val) tstoreOp: Vm2OpFn = proc (k: var Vm2Ctx) = - ## 0xb4, Save word to transient storage. + ## 0x5d, Save word to transient storage. checkInStaticContext(k.cpt) let @@ -511,7 +511,7 @@ const run: jumpDestOp, post: vm2OpIgnore)), - (opCode: Tload, ## 0xb3, Load word from transient storage. + (opCode: Tload, ## 0x5c, Load word from transient storage. forks: Vm2OpCancunAndLater, name: "tLoad", info: "Load word from transient storage", @@ -519,7 +519,7 @@ const run: tloadOp, post: vm2OpIgnore)), - (opCode: Tstore, ## 0xb4, Save word to transient storage. + (opCode: Tstore, ## 0x5d, Save word to transient storage. forks: Vm2OpCancunAndLater, name: "tStore", info: "Save word to transient storage",