Skip to content

Commit

Permalink
EIP-1153 spec update: change opcode value
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed Jun 25, 2023
1 parent 26a8759 commit ab4a1a1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
11 changes: 4 additions & 7 deletions nimbus/evm/interpreter/gas_costs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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`,
Expand Down
14 changes: 5 additions & 9 deletions nimbus/evm/interpreter/op_codes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions nimbus/evm/interpreter/op_handlers/oph_memory.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -511,15 +511,15 @@ 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",
exec: (prep: vm2OpIgnore,
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",
Expand Down

0 comments on commit ab4a1a1

Please sign in to comment.