use Nim 2.0.6 (#2384)

* use Nim 2.0.6

* Fixes for nim 2.0.6

* Workaround nim 2.0 array indexing issue

* Remove excess gcsafe pragma

* Oops, fix recursive template

* Fix imports

* Fluffy nph linting

---------

Co-authored-by: jangko <jangko128@gmail.com>
Co-authored-by: tersec <tersec@users.noreply.github.com>
This commit is contained in:
Miran 2024-06-19 03:27:54 +02:00 committed by GitHub
parent 8727307ef4
commit ea0d18424a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 20 additions and 12 deletions

View File

@ -7,7 +7,7 @@
{.push raises: [].}
import std/streams, yaml, results
import std/streams, yaml, results, yaml/parser, yaml/presenter
export yaml

View File

@ -101,6 +101,14 @@ func getHistoricalRootsIndex*(slot: Slot): uint64 =
func getHistoricalRootsIndex*(blockHeader: BeaconBlockHeader): uint64 =
getHistoricalRootsIndex(blockHeader.slot)
template `[]`(x: openArray[Eth2Digest], chunk: Limit): Eth2Digest =
# Nim 2.0 requires arrays to be indexed by the same type they're declared with.
# Both HistoricalBatch.block_roots and HistoricalBatch.state_roots
# are declared with uint64. But `Limit = int64`.
# Looks like this template can be used as a workaround.
# See https://github.com/status-im/nimbus-eth1/pull/2384
x[chunk.uint64]
# Builds proof to be able to verify that a BeaconBlock root is part of the
# HistoricalBatch for given root.
func buildProof*(

View File

@ -14,7 +14,7 @@ import
eth/p2p/discoveryv5/protocol as discv5_protocol,
eth/p2p/discoveryv5/routing_table,
../../network/wire/[portal_protocol, portal_stream, portal_protocol_config],
../../nimbus/common/chain_config,
../../../nimbus/common/chain_config,
../../network/history/[history_content, history_network],
../../network/state/[state_content, state_utils, state_network],
../../eth_data/yaml_utils,

View File

@ -61,7 +61,7 @@ proc updateTotal(t: AristoDbProfListRef; fnInx: uint) =
# ---------------------
func ppUs(elapsed: Duration): string {.gcsafe, raises: [ValueError].} =
func ppUs(elapsed: Duration): string {.gcsafe, raises: [].} =
result = $elapsed.inMicroseconds
let ns = elapsed.inNanoseconds mod 1_000 # fraction of a micro second
if ns != 0:
@ -70,7 +70,7 @@ func ppUs(elapsed: Duration): string {.gcsafe, raises: [ValueError].} =
result &= &".{du:02}"
result &= "us"
func ppMs(elapsed: Duration): string {.gcsafe, raises: [ValueError].} =
func ppMs(elapsed: Duration): string {.gcsafe, raises: [].} =
result = $elapsed.inMilliseconds
let ns = elapsed.inNanoseconds mod 1_000_000 # fraction of a milli second
if ns != 0:
@ -79,7 +79,7 @@ func ppMs(elapsed: Duration): string {.gcsafe, raises: [ValueError].} =
result &= &".{dm:02}"
result &= "ms"
func ppSecs(elapsed: Duration): string {.gcsafe, raises: [ValueError].} =
func ppSecs(elapsed: Duration): string {.gcsafe, raises: [].} =
result = $elapsed.inSeconds
let ns = elapsed.inNanoseconds mod 1_000_000_000 # fraction of a second
if ns != 0:
@ -88,7 +88,7 @@ func ppSecs(elapsed: Duration): string {.gcsafe, raises: [ValueError].} =
result &= &".{ds:02}"
result &= "s"
func ppMins(elapsed: Duration): string {.gcsafe, raises: [ValueError].} =
func ppMins(elapsed: Duration): string {.gcsafe, raises: [].} =
result = $elapsed.inMinutes
let ns = elapsed.inNanoseconds mod 60_000_000_000 # fraction of a minute
if ns != 0:

View File

@ -139,7 +139,7 @@ template getBlobBaseFee*(c: Computation): UInt256 =
else:
c.vmState.txCtx.blobBaseFee
proc getBlockHash*(c: Computation, number: BlockNumber): Hash256 =
proc getBlockHash*(c: Computation, number: BlockNumber): Hash256 {.gcsafe, raises:[].} =
when evmc_enabled:
let
blockNumber = BlockNumber c.host.getTxContext().block_number

View File

@ -52,7 +52,7 @@ func blockCtx(com: CommonRef, header: BlockHeader):
# --------------
proc `$`*(vmState: BaseVMState): string
{.gcsafe, raises: [ValueError].} =
{.gcsafe, raises: [].} =
if vmState.isNil:
result = "nil"
else:
@ -235,7 +235,7 @@ proc baseFeePerGas*(vmState: BaseVMState): UInt256 =
vmState.blockCtx.baseFeePerGas.get(0.u256)
method getAncestorHash*(
vmState: BaseVMState, blockNumber: BlockNumber): Hash256 {.base.} =
vmState: BaseVMState, blockNumber: BlockNumber): Hash256 {.gcsafe, base.} =
let db = vmState.com.db
try:
var blockHash: Hash256

View File

@ -78,7 +78,7 @@ type
{.push gcsafe, raises: [].}
{.pragma: apiRaises, raises: [].}
{.pragma: apiPragma, cdecl, gcsafe, apiRaises, locks:0.}
{.pragma: apiPragma, cdecl, gcsafe, apiRaises.}
proc toHash(n: Node): common.Hash256 {.gcsafe, raises: [ValueError].} =
result.data = hexToByteArray[32](n.stringVal)

View File

@ -25,7 +25,7 @@ proc setEthHandlerNewBlocksAndHashes*(
blockHandler: NewBlockHandler;
hashesHandler: NewBlockHashesHandler;
arg: pointer;
) {.gcsafe, raises: [CatchableError].} =
) {.gcsafe, raises: [].} =
let w = EthWireRef(node.protocolState protocol.eth)
w.setNewBlockHandler(blockHandler, arg)
w.setNewBlockHashesHandler(hashesHandler, arg)

@ -1 +1 @@
Subproject commit 8cdaec502b5a48f2514e11209f0d81a001d2a2b1
Subproject commit 03bfa4c6acaf67e1e2e7c855ddd95b52de5a6cad