Update Nimbus EVM code to use the latest nim-evmc which supports EVMC v12.1.0 (#3065)

* Update Nimbus EVM code to use the latest nim-evmc which is now on EVMC v12.1.0

* Fix copyright.

* Fix tests.

* Update to use FkLatest.

* Fix copyright and update test helper.
This commit is contained in:
bhartnett 2025-02-14 09:06:54 +08:00 committed by GitHub
parent 67dbe817a9
commit f513e1dc53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 12 additions and 11 deletions

View File

@ -359,7 +359,7 @@ txparse: | build deps
# builds the nimbus evmc shared library
libnimbusevm: | build deps
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:evmc_enabled --app:lib --noMain -o:build/libnimbusevm/$@.$(SHAREDLIBEXT) nimbus/transaction/evmc_vm_glue.nim
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:evmc_enabled --app:lib --noMain -o:build/libnimbusevm/$@.$(SHAREDLIBEXT) execution_chain/transaction/evmc_vm_glue.nim
# usual cleaning
clean: | clean-common

View File

@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Copyright (c) 2018-2025 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
@ -30,3 +30,4 @@ const
FkCancun* = EVMC_CANCUN
FkPrague* = EVMC_PRAGUE
FkOsaka* = EVMC_OSAKA
FkLatest* = EVMFork(EVMFork.high.int - 1)

View File

@ -25,10 +25,10 @@ func getTargetBlobGasPerBlock*(electra: bool): uint64 =
else: TARGET_BLOB_GAS_PER_BLOCK.uint64
const
EVMForkToFork: array[FkCancun..EVMFork.high, HardFork] = [
EVMForkToFork: array[FkCancun..FkLatest, HardFork] = [
Cancun,
Prague,
Osaka
Osaka,
]
func getMaxBlobsPerBlock*(com: CommonRef, fork: EVMFork): uint64 =

View File

@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Copyright (c) 2018-2025 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
@ -31,7 +31,7 @@ const
eth2 = 2.eth
eth0 = 0.u256
BlockRewards: array[EVMFork, UInt256] = [
BlockRewards: array[FkFrontier..FkLatest, UInt256] = [
eth5, # Frontier
eth5, # Homestead
eth5, # Tangerine

View File

@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Copyright (c) 2018-2025 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
@ -774,7 +774,7 @@ const
LondonGasFees = BerlinGasFees.londonGasFees
ShanghaiGasFees = LondonGasFees.shanghaiGasFees
gasFees*: array[EVMFork, GasFeeSchedule] = [
gasFees*: array[FkFrontier..FkLatest, GasFeeSchedule] = [
FkFrontier: BaseGasFees,
FkHomestead: HomesteadGasFees,
FkTangerine: TangerineGasFees,

View File

@ -13,13 +13,13 @@ import
../execution_chain/db/ledger,
../execution_chain/common/[context, common]
func revTable(list: array[EVMFork, string]): Table[string, EVMFork] =
func revTable(list: array[FkFrontier..FkLatest, string]): Table[string, EVMFork] =
for k, v in list:
result[v] = k
const
# from https://ethereum-tests.readthedocs.io/en/latest/test_types/state_tests.html
ForkToName: array[EVMFork, string] = [
ForkToName: array[FkFrontier..FkLatest, string] = [
"Frontier", # FkFrontier
"Homestead", # FkHomestead
"EIP150", # FkTangerine

2
vendor/nim-evmc vendored

@ -1 +1 @@
Subproject commit 730d35d8572e1b3957b0c6c986ecd86413976da0
Subproject commit 0b758ff7a59dd6b3728309fa7ffeeea3d46454e0