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
This commit is contained in:
parent
3822c57ddc
commit
845f3276e3
|
@ -80,7 +80,8 @@ func readBlockData*(
|
||||||
res.add((contentKey, blockData.body.hexToSeqByte()))
|
res.add((contentKey, blockData.body.hexToSeqByte()))
|
||||||
|
|
||||||
block:
|
block:
|
||||||
let contentKey = ContentKey(contentType: receipts, receiptsKey: contentKeyType)
|
let contentKey =
|
||||||
|
ContentKey(contentType: ContentType.receipts, receiptsKey: contentKeyType)
|
||||||
|
|
||||||
res.add((contentKey, blockData.receipts.hexToSeqByte()))
|
res.add((contentKey, blockData.receipts.hexToSeqByte()))
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
|
|
|
@ -228,7 +228,7 @@ iterator headersWithProof*(
|
||||||
|
|
||||||
let
|
let
|
||||||
contentKey = ContentKey(
|
contentKey = ContentKey(
|
||||||
contentType: blockHeader,
|
contentType: ContentType.blockHeader,
|
||||||
blockHeaderKey: BlockKey(blockHash: blockHeader.rlpHash()),
|
blockHeaderKey: BlockKey(blockHash: blockHeader.rlpHash()),
|
||||||
).encode()
|
).encode()
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ iterator blockContent*(f: Era1File): (ContentKeyByteList, seq[byte]) =
|
||||||
block: # receipts
|
block: # receipts
|
||||||
let
|
let
|
||||||
contentKey = ContentKey(
|
contentKey = ContentKey(
|
||||||
contentType: receipts, receiptsKey: BlockKey(blockHash: blockHash)
|
contentType: ContentType.receipts, receiptsKey: BlockKey(blockHash: blockHash)
|
||||||
).encode()
|
).encode()
|
||||||
|
|
||||||
contentValue = encode(receipts)
|
contentValue = encode(receipts)
|
||||||
|
|
|
@ -9,7 +9,10 @@
|
||||||
|
|
||||||
import std/streams, yaml, results, yaml/parser, yaml/presenter
|
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
|
type YamlPortalContent* = object
|
||||||
content_key*: string
|
content_key*: string
|
||||||
|
|
|
@ -436,11 +436,11 @@ proc getVerifiedBlockHeader*(
|
||||||
return Opt.none(Header)
|
return Opt.none(Header)
|
||||||
|
|
||||||
headerWithProof = decodeSsz(headerContent.content, BlockHeaderWithProof).valueOr:
|
headerWithProof = decodeSsz(headerContent.content, BlockHeaderWithProof).valueOr:
|
||||||
warn "Failed decoding header with proof", error
|
warn "Failed decoding header with proof", error = error
|
||||||
continue
|
continue
|
||||||
|
|
||||||
header = validateBlockHeaderBytes(headerWithProof.header.asSeq(), id).valueOr:
|
header = validateBlockHeaderBytes(headerWithProof.header.asSeq(), id).valueOr:
|
||||||
warn "Validation of block header failed", error
|
warn "Validation of block header failed", error = error
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (let r = n.verifyHeader(header, headerWithProof.proof); r.isErr):
|
if (let r = n.verifyHeader(header, headerWithProof.proof); r.isErr):
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
# at your option. This file may not be copied, modified, or distributed except
|
# at your option. This file may not be copied, modified, or distributed except
|
||||||
# according to those terms.
|
# according to those terms.
|
||||||
|
|
||||||
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
../common/common,
|
../common/common,
|
||||||
std/strformat,
|
std/strformat,
|
||||||
|
@ -17,8 +19,6 @@ import
|
||||||
export
|
export
|
||||||
eip1559
|
eip1559
|
||||||
|
|
||||||
{.push raises: [].}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Pre Eip 1559 gas limit validation
|
# Pre Eip 1559 gas limit validation
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -94,7 +94,7 @@ proc fetchAndCheck(
|
||||||
# Public functions
|
# 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
|
## Check whether the queue is at its maximum size so import can start with
|
||||||
## a full queue.
|
## a full queue.
|
||||||
if ctx.pool.blocksStagedQuLenMax <= ctx.blk.staged.len:
|
if ctx.pool.blocksStagedQuLenMax <= ctx.blk.staged.len:
|
||||||
|
@ -110,7 +110,7 @@ proc blocksStagedCanImportOk*(ctx: BeaconCtxRef): bool =
|
||||||
|
|
||||||
false
|
false
|
||||||
|
|
||||||
proc blocksStagedFetchOk*(ctx: BeaconCtxRef): bool =
|
func blocksStagedFetchOk*(ctx: BeaconCtxRef): bool =
|
||||||
## Check whether body records can be fetched and stored on the `staged` queue.
|
## Check whether body records can be fetched and stored on the `staged` queue.
|
||||||
##
|
##
|
||||||
let uBottom = ctx.blocksUnprocBottom()
|
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:
|
let stats = ctx.pool.chain.persistBlocks(qItem.data.blocks).valueOr:
|
||||||
# FIXME: should that be rather an `raiseAssert` here?
|
# FIXME: should that be rather an `raiseAssert` here?
|
||||||
warn info & ": block exec error", B=base.bnStr,
|
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()
|
doAssert base == ctx.dbStateBlockNumber()
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
@ -251,23 +252,23 @@ proc blocksStagedImport*(ctx: BeaconCtxRef; info: static[string]): bool =
|
||||||
true
|
true
|
||||||
|
|
||||||
|
|
||||||
proc blocksStagedBottomKey*(ctx: BeaconCtxRef): BlockNumber =
|
func blocksStagedBottomKey*(ctx: BeaconCtxRef): BlockNumber =
|
||||||
## Retrieve to staged block number
|
## Retrieve to staged block number
|
||||||
let qItem = ctx.blk.staged.ge(0).valueOr:
|
let qItem = ctx.blk.staged.ge(0).valueOr:
|
||||||
return high(BlockNumber)
|
return high(BlockNumber)
|
||||||
qItem.key
|
qItem.key
|
||||||
|
|
||||||
proc blocksStagedQueueLen*(ctx: BeaconCtxRef): int =
|
func blocksStagedQueueLen*(ctx: BeaconCtxRef): int =
|
||||||
## Number of staged records
|
## Number of staged records
|
||||||
ctx.blk.staged.len
|
ctx.blk.staged.len
|
||||||
|
|
||||||
proc blocksStagedQueueIsEmpty*(ctx: BeaconCtxRef): bool =
|
func blocksStagedQueueIsEmpty*(ctx: BeaconCtxRef): bool =
|
||||||
## `true` iff no data are on the queue.
|
## `true` iff no data are on the queue.
|
||||||
ctx.blk.staged.len == 0
|
ctx.blk.staged.len == 0
|
||||||
|
|
||||||
# ----------------
|
# ----------------
|
||||||
|
|
||||||
proc blocksStagedInit*(ctx: BeaconCtxRef) =
|
func blocksStagedInit*(ctx: BeaconCtxRef) =
|
||||||
## Constructor
|
## Constructor
|
||||||
ctx.blk.staged = StagedBlocksQueue.init()
|
ctx.blk.staged = StagedBlocksQueue.init()
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ proc headersStagedProcess*(ctx: BeaconCtxRef; info: static[string]): int =
|
||||||
while true:
|
while true:
|
||||||
# Fetch largest block
|
# Fetch largest block
|
||||||
let qItem = ctx.lhc.staged.le(high BlockNumber).valueOr:
|
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
|
break # all done
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -231,7 +231,7 @@ proc headersStagedProcess*(ctx: BeaconCtxRef; info: static[string]): int =
|
||||||
ctx.poolMode = true
|
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
|
## Some pool mode intervention. The effect is that all concurrent peers
|
||||||
## finish up their current work and run this function here (which might
|
## 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
|
## 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
|
discard ctx.lhc.staged.delete key
|
||||||
|
|
||||||
|
|
||||||
proc headersStagedTopKey*(ctx: BeaconCtxRef): BlockNumber =
|
func headersStagedTopKey*(ctx: BeaconCtxRef): BlockNumber =
|
||||||
## Retrieve to staged block number
|
## Retrieve to staged block number
|
||||||
let qItem = ctx.lhc.staged.le(high BlockNumber).valueOr:
|
let qItem = ctx.lhc.staged.le(high BlockNumber).valueOr:
|
||||||
return BlockNumber(0)
|
return BlockNumber(0)
|
||||||
qItem.key
|
qItem.key
|
||||||
|
|
||||||
proc headersStagedQueueLen*(ctx: BeaconCtxRef): int =
|
func headersStagedQueueLen*(ctx: BeaconCtxRef): int =
|
||||||
## Number of staged records
|
## Number of staged records
|
||||||
ctx.lhc.staged.len
|
ctx.lhc.staged.len
|
||||||
|
|
||||||
proc headersStagedQueueIsEmpty*(ctx: BeaconCtxRef): bool =
|
func headersStagedQueueIsEmpty*(ctx: BeaconCtxRef): bool =
|
||||||
## `true` iff no data are on the queue.
|
## `true` iff no data are on the queue.
|
||||||
ctx.lhc.staged.len == 0
|
ctx.lhc.staged.len == 0
|
||||||
|
|
||||||
# ----------------
|
# ----------------
|
||||||
|
|
||||||
proc headersStagedInit*(ctx: BeaconCtxRef) =
|
func headersStagedInit*(ctx: BeaconCtxRef) =
|
||||||
## Constructor
|
## Constructor
|
||||||
ctx.lhc.staged = LinkedHChainQueue.init()
|
ctx.lhc.staged = LinkedHChainQueue.init()
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 741274439ce72162ab3c740e7c0ef624d32725f9
|
Subproject commit c3241765e3896a06ed372dddc9dd6e3c36fae8f6
|
Loading…
Reference in New Issue