From 845f3276e32e069fc14f83e5f29b38b5dfa3d42a Mon Sep 17 00:00:00 2001 From: tersec Date: Sun, 6 Oct 2024 12:15:54 +0000 Subject: [PATCH] bump nimbus-build-system to use Nim v2.0.10 (#2684) * bump nimbus-build-system to use Nim v2.0.10 * 2.0.10 fixes * fluffy linting * make trivial change which should trigger whole-nimbus+fluffy rebuild/ci * Nim v2.0.10 chronicles.error/macros.error ambiguity workaround * another contentType enum specifier * fluffy linting --- fluffy/eth_data/history_data_json_store.nim | 3 ++- fluffy/eth_data/history_data_seeding.nim | 4 ++-- fluffy/eth_data/yaml_utils.nim | 5 ++++- fluffy/network/history/history_network.nim | 4 ++-- nimbus/core/gaslimit.nim | 4 ++-- nimbus/sync/beacon/worker/blocks_staged.nim | 15 ++++++++------- nimbus/sync/beacon/worker/headers_staged.nim | 12 ++++++------ vendor/nimbus-build-system | 2 +- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/fluffy/eth_data/history_data_json_store.nim b/fluffy/eth_data/history_data_json_store.nim index 5abc93e4a..a9ad2660d 100644 --- a/fluffy/eth_data/history_data_json_store.nim +++ b/fluffy/eth_data/history_data_json_store.nim @@ -80,7 +80,8 @@ func readBlockData*( res.add((contentKey, blockData.body.hexToSeqByte())) block: - let contentKey = ContentKey(contentType: receipts, receiptsKey: contentKeyType) + let contentKey = + ContentKey(contentType: ContentType.receipts, receiptsKey: contentKeyType) res.add((contentKey, blockData.receipts.hexToSeqByte())) except ValueError as e: diff --git a/fluffy/eth_data/history_data_seeding.nim b/fluffy/eth_data/history_data_seeding.nim index 4c660be52..4cd68f580 100644 --- a/fluffy/eth_data/history_data_seeding.nim +++ b/fluffy/eth_data/history_data_seeding.nim @@ -228,7 +228,7 @@ iterator headersWithProof*( let contentKey = ContentKey( - contentType: blockHeader, + contentType: ContentType.blockHeader, blockHeaderKey: BlockKey(blockHash: blockHeader.rlpHash()), ).encode() @@ -256,7 +256,7 @@ iterator blockContent*(f: Era1File): (ContentKeyByteList, seq[byte]) = block: # receipts let contentKey = ContentKey( - contentType: receipts, receiptsKey: BlockKey(blockHash: blockHash) + contentType: ContentType.receipts, receiptsKey: BlockKey(blockHash: blockHash) ).encode() contentValue = encode(receipts) diff --git a/fluffy/eth_data/yaml_utils.nim b/fluffy/eth_data/yaml_utils.nim index 0636774d4..f2f2ca9f3 100644 --- a/fluffy/eth_data/yaml_utils.nim +++ b/fluffy/eth_data/yaml_utils.nim @@ -9,7 +9,10 @@ import std/streams, yaml, results, yaml/parser, yaml/presenter -export yaml +# `except error` is Nim v2.0.10 workaround to avoid ambiguity with +# chronicles.error. If Nim version later than v2.0.10 fix this, it +# can be removed. +export yaml except error type YamlPortalContent* = object content_key*: string diff --git a/fluffy/network/history/history_network.nim b/fluffy/network/history/history_network.nim index 2d0f947ee..7fdfe1892 100644 --- a/fluffy/network/history/history_network.nim +++ b/fluffy/network/history/history_network.nim @@ -436,11 +436,11 @@ proc getVerifiedBlockHeader*( return Opt.none(Header) headerWithProof = decodeSsz(headerContent.content, BlockHeaderWithProof).valueOr: - warn "Failed decoding header with proof", error + warn "Failed decoding header with proof", error = error continue header = validateBlockHeaderBytes(headerWithProof.header.asSeq(), id).valueOr: - warn "Validation of block header failed", error + warn "Validation of block header failed", error = error continue if (let r = n.verifyHeader(header, headerWithProof.proof); r.isErr): diff --git a/nimbus/core/gaslimit.nim b/nimbus/core/gaslimit.nim index 00cfb98bc..ab4feeed0 100644 --- a/nimbus/core/gaslimit.nim +++ b/nimbus/core/gaslimit.nim @@ -8,6 +8,8 @@ # at your option. This file may not be copied, modified, or distributed except # according to those terms. +{.push raises: [].} + import ../common/common, std/strformat, @@ -17,8 +19,6 @@ import export eip1559 -{.push raises: [].} - # ------------------------------------------------------------------------------ # Pre Eip 1559 gas limit validation # ------------------------------------------------------------------------------ diff --git a/nimbus/sync/beacon/worker/blocks_staged.nim b/nimbus/sync/beacon/worker/blocks_staged.nim index 2dafc7266..90921664f 100644 --- a/nimbus/sync/beacon/worker/blocks_staged.nim +++ b/nimbus/sync/beacon/worker/blocks_staged.nim @@ -94,7 +94,7 @@ proc fetchAndCheck( # Public functions # ------------------------------------------------------------------------------ -proc blocksStagedCanImportOk*(ctx: BeaconCtxRef): bool = +func blocksStagedCanImportOk*(ctx: BeaconCtxRef): bool = ## Check whether the queue is at its maximum size so import can start with ## a full queue. if ctx.pool.blocksStagedQuLenMax <= ctx.blk.staged.len: @@ -110,7 +110,7 @@ proc blocksStagedCanImportOk*(ctx: BeaconCtxRef): bool = false -proc blocksStagedFetchOk*(ctx: BeaconCtxRef): bool = +func blocksStagedFetchOk*(ctx: BeaconCtxRef): bool = ## Check whether body records can be fetched and stored on the `staged` queue. ## let uBottom = ctx.blocksUnprocBottom() @@ -237,7 +237,8 @@ proc blocksStagedImport*(ctx: BeaconCtxRef; info: static[string]): bool = let stats = ctx.pool.chain.persistBlocks(qItem.data.blocks).valueOr: # FIXME: should that be rather an `raiseAssert` here? warn info & ": block exec error", B=base.bnStr, - iv=BnRange.new(qItem.key,qItem.key+qItem.data.blocks.len.uint64-1), error + iv=BnRange.new(qItem.key,qItem.key+qItem.data.blocks.len.uint64-1), + error=error doAssert base == ctx.dbStateBlockNumber() return false @@ -251,23 +252,23 @@ proc blocksStagedImport*(ctx: BeaconCtxRef; info: static[string]): bool = true -proc blocksStagedBottomKey*(ctx: BeaconCtxRef): BlockNumber = +func blocksStagedBottomKey*(ctx: BeaconCtxRef): BlockNumber = ## Retrieve to staged block number let qItem = ctx.blk.staged.ge(0).valueOr: return high(BlockNumber) qItem.key -proc blocksStagedQueueLen*(ctx: BeaconCtxRef): int = +func blocksStagedQueueLen*(ctx: BeaconCtxRef): int = ## Number of staged records ctx.blk.staged.len -proc blocksStagedQueueIsEmpty*(ctx: BeaconCtxRef): bool = +func blocksStagedQueueIsEmpty*(ctx: BeaconCtxRef): bool = ## `true` iff no data are on the queue. ctx.blk.staged.len == 0 # ---------------- -proc blocksStagedInit*(ctx: BeaconCtxRef) = +func blocksStagedInit*(ctx: BeaconCtxRef) = ## Constructor ctx.blk.staged = StagedBlocksQueue.init() diff --git a/nimbus/sync/beacon/worker/headers_staged.nim b/nimbus/sync/beacon/worker/headers_staged.nim index f8f6c3673..3074e6f67 100644 --- a/nimbus/sync/beacon/worker/headers_staged.nim +++ b/nimbus/sync/beacon/worker/headers_staged.nim @@ -191,7 +191,7 @@ proc headersStagedProcess*(ctx: BeaconCtxRef; info: static[string]): int = while true: # Fetch largest block let qItem = ctx.lhc.staged.le(high BlockNumber).valueOr: - trace info & ": no staged headers", error + trace info & ": no staged headers", error=error break # all done let @@ -231,7 +231,7 @@ proc headersStagedProcess*(ctx: BeaconCtxRef; info: static[string]): int = ctx.poolMode = true -proc headersStagedReorg*(ctx: BeaconCtxRef; info: static[string]) = +func headersStagedReorg*(ctx: BeaconCtxRef; info: static[string]) = ## Some pool mode intervention. The effect is that all concurrent peers ## finish up their current work and run this function here (which might ## do nothing.) This stopping should be enough in most cases to re-organise @@ -266,23 +266,23 @@ proc headersStagedReorg*(ctx: BeaconCtxRef; info: static[string]) = discard ctx.lhc.staged.delete key -proc headersStagedTopKey*(ctx: BeaconCtxRef): BlockNumber = +func headersStagedTopKey*(ctx: BeaconCtxRef): BlockNumber = ## Retrieve to staged block number let qItem = ctx.lhc.staged.le(high BlockNumber).valueOr: return BlockNumber(0) qItem.key -proc headersStagedQueueLen*(ctx: BeaconCtxRef): int = +func headersStagedQueueLen*(ctx: BeaconCtxRef): int = ## Number of staged records ctx.lhc.staged.len -proc headersStagedQueueIsEmpty*(ctx: BeaconCtxRef): bool = +func headersStagedQueueIsEmpty*(ctx: BeaconCtxRef): bool = ## `true` iff no data are on the queue. ctx.lhc.staged.len == 0 # ---------------- -proc headersStagedInit*(ctx: BeaconCtxRef) = +func headersStagedInit*(ctx: BeaconCtxRef) = ## Constructor ctx.lhc.staged = LinkedHChainQueue.init() diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system index 741274439..c3241765e 160000 --- a/vendor/nimbus-build-system +++ b/vendor/nimbus-build-system @@ -1 +1 @@ -Subproject commit 741274439ce72162ab3c740e7c0ef624d32725f9 +Subproject commit c3241765e3896a06ed372dddc9dd6e3c36fae8f6