|
11 | 11 | import |
12 | 12 | std/[json, strutils, times, tables, os, math, streams], |
13 | 13 | eth/[rlp, trie, eip1559], |
14 | | - stint, stew/results, |
| 14 | + stint, stew/[results, byteutils], |
15 | 15 | "."/[config, types, helpers], |
16 | 16 | ../common/state_clearing, |
17 | 17 | ../../nimbus/[vm_types, vm_state, transaction], |
18 | 18 | ../../nimbus/common/common, |
19 | 19 | ../../nimbus/db/accounts_cache, |
20 | | - ../../nimbus/utils/utils, |
| 20 | + ../../nimbus/evm/validate, |
| 21 | + ../../nimbus/utils/[utils, eof], |
21 | 22 | ../../nimbus/core/pow/difficulty, |
22 | 23 | ../../nimbus/core/dao, |
23 | 24 | ../../nimbus/core/executor/[process_transaction, executor_helpers], |
24 | 25 | ../../nimbus/core/eip4844 |
25 | 26 |
|
26 | | -import stew/byteutils |
27 | 27 | const |
28 | 28 | wrapExceptionEnabled* {.booldefine.} = true |
29 | 29 | stdinSelector = "stdin" |
@@ -425,6 +425,20 @@ proc transitionAction*(ctx: var TransContext, conf: T8NConf) = |
425 | 425 | else: |
426 | 426 | raise newError(ErrorConfig, "EIP-1559 config but missing 'currentBaseFee' in env section") |
427 | 427 |
|
| 428 | + if com.forkGTE(EOFFork): |
| 429 | + for address, acc in ctx.alloc: |
| 430 | + if not hasEOFByte(acc.code): |
| 431 | + continue |
| 432 | + |
| 433 | + var c: Container |
| 434 | + var res = c.decode(acc.code) |
| 435 | + if res.isOk: |
| 436 | + res = c.validateCode() |
| 437 | + |
| 438 | + if res.isErr: |
| 439 | + raise newError(ErrorConfig, "code at $1 considered invalid: $2" % |
| 440 | + [address.toHex, res.error.toString]) |
| 441 | + |
428 | 442 | if com.isShanghaiOrLater(ctx.env.currentTimestamp) and ctx.env.withdrawals.isNone: |
429 | 443 | raise newError(ErrorConfig, "Shanghai config but missing 'withdrawals' in env section") |
430 | 444 |
|
|
0 commit comments