Skip to content

Commit f56c8ce

Browse files
committed
EOF suite: rebase master branch
1 parent 255ebad commit f56c8ce

File tree

7 files changed

+33
-10
lines changed

7 files changed

+33
-10
lines changed

nimbus/evm/code_stream.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import
1010
chronicles,
1111
eth/common,
1212
stew/[results, endians2],
13-
stew/ranges/ptr_arith,
13+
stew/ptrops,
1414
../utils/eof,
1515
./interpreter/op_codes
1616

nimbus/evm/interpreter/op_handlers/oph_envinfo.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const
169169
cpt.gasCosts[CodeCopy].m_handler(cpt.memory.len, memPos, len),
170170
reason = "CodeCopy fee")
171171

172-
cpt.memory.writePaddedResult(k.cpt.code.legacyCode, memPos, copyPos, len)
172+
cpt.memory.writePaddedResult(cpt.code.legacyCode, memPos, copyPos, len)
173173

174174
gasPriceOp: Vm2OpFn = proc (k: var Vm2Ctx) =
175175
## 0x3A, Get price of gas in current environment.

nimbus/evm/interpreter_dispatch.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ else:
330330
# to write the async version of the iterative one, but this one is
331331
# a bit shorter and feels cleaner, so if it works just as well I'd
332332
# rather use this one. --Adam
333+
import
334+
async/operations
335+
333336
proc asyncExecCallOrCreate*(c: Computation): Future[void] {.async.} =
334337
defer: c.dispose()
335338

nimbus/evm/stack_table.nim

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,21 +187,36 @@ proc mergeStackTable(): StackTable {.compileTime.} =
187187
result = londonStackTable()
188188
result[PrevRandao] = sp(0, 1)
189189

190-
proc cancunStackTable(): StackTable {.compileTime.} =
190+
proc shanghaiStackTable(): StackTable {.compileTime.} =
191191
result = mergeStackTable()
192+
# new opcodes EIP-3855
193+
result[Push0] = sp(0, 1)
194+
195+
proc cancunStackTable(): StackTable {.compileTime.} =
196+
result = shanghaiStackTable()
197+
# new opcodes EIP-4844
198+
result[BlobHash] = sp(1, 1)
199+
200+
# new opcodes EIP-1153
201+
result[TLoad] = sp(1, 1)
202+
result[TStore] = sp(2, 0)
203+
204+
# new opcodes EIP-5656
205+
result[Mcopy] = sp(3, 0)
206+
192207
# new opcodes EIP-4200
193208
result[Rjump] = sp(0, 0)
194209
result[RJumpI] = sp(1, 0)
195210
result[RJumpV] = sp(1, 0)
211+
196212
# new opcodes EIP-4750
197213
result[CallF] = sp(0, 0)
198214
result[RetF] = sp(0, 0)
199-
# new opcodes EIP-3855
200-
result[Push0] = sp(0, 1)
201215

202216
# disable opcodes EIP-3670
203217
result[CallCode] = StackDesc()
204218
result[SelfDestruct] = StackDesc()
219+
205220
# disable opcodes EIP-5450
206221
result[Jump] = StackDesc()
207222
result[JumpI] = StackDesc()
@@ -220,6 +235,6 @@ const
220235
istanbulStackTable(),
221236
londonStackTable(),
222237
mergeStackTable(),
223-
mergeStackTable(),
238+
shanghaiStackTable(),
224239
cancunStackTable(),
225240
]

tests/customgenesis/eof.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"berlinBlock": 0,
1515
"londonBlock": 0,
1616
"mergeForkBlock": 0,
17-
"shanghaiBlock": 0,
18-
"cancunBlock": 0,
17+
"shanghaiTime": "0x0",
18+
"cancunTime": "0x0",
1919
"terminalTotalDifficulty": 0
2020
},
2121
"genesis": {

tests/test_eof.nim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ proc eofMain*() =
278278
txs.add env.makeTx(some(cc), 0.u256, initCode)
279279

280280
suite "Test EOF code deployment":
281+
test "is EOF fork?":
282+
check com.forkGTE(EOFFork)
283+
281284
test "add txs to txpool":
282285
for tx in txs:
283286
let res = xp.addLocal(tx, force = true)
@@ -299,7 +302,8 @@ proc eofMain*() =
299302

300303
let body = BlockBody(
301304
transactions: blk.txs,
302-
uncles: blk.uncles
305+
uncles: blk.uncles,
306+
withdrawals: some[seq[Withdrawal]](@[])
303307
)
304308
check blk.txs.len == 4
305309

tools/t8n/testdata/28/env.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"parentGasUsed": "0x0",
88
"parentGasLimit": "0x750a163df65e8a",
99
"currentNumber": "1",
10-
"currentTimestamp": "1000"
10+
"currentTimestamp": "1000",
11+
"withdrawals": []
1112
}

0 commit comments

Comments
 (0)