mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 22:36:01 +00:00
handle Exception
during EraFile.verify
(#5900)
`Taskpool.new()` is marked as `{.raises: [Exception].}`. Catch this.
This commit is contained in:
parent
3b5056db92
commit
30b7c6153f
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -221,6 +221,7 @@ jobs:
|
|||||||
- name: Build files with isMainModule
|
- name: Build files with isMainModule
|
||||||
run: |
|
run: |
|
||||||
source env.sh
|
source env.sh
|
||||||
|
nim c beacon_chain/era_db
|
||||||
nim c beacon_chain/trusted_node_sync
|
nim c beacon_chain/trusted_node_sync
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/os,
|
std/os,
|
||||||
chronicles,
|
chronicles,
|
||||||
@ -186,15 +189,19 @@ proc verify*(f: EraFile, cfg: RuntimeConfig): Result[Eth2Digest, string] =
|
|||||||
# We'll load the full state and compute its root - then we'll load the blocks
|
# We'll load the full state and compute its root - then we'll load the blocks
|
||||||
# and make sure that they match the state and that their signatures check out
|
# and make sure that they match the state and that their signatures check out
|
||||||
let
|
let
|
||||||
startSlot = f.stateIdx.startSlot
|
slot = f.stateIdx.startSlot
|
||||||
era = startSlot.era
|
era = slot.era
|
||||||
|
|
||||||
rng = HmacDrbgContext.new()
|
rng = HmacDrbgContext.new()
|
||||||
taskpool = Taskpool.new()
|
taskpool =
|
||||||
|
try:
|
||||||
|
Taskpool.new()
|
||||||
|
except Exception as exc:
|
||||||
|
return err("Failed to initialize Taskpool: " & exc.msg)
|
||||||
var verifier = BatchVerifier.init(rng, taskpool)
|
var verifier = BatchVerifier.init(rng, taskpool)
|
||||||
|
|
||||||
var tmp: seq[byte]
|
var tmp: seq[byte]
|
||||||
? f.getStateSSZ(startSlot, tmp)
|
? f.getStateSSZ(slot, tmp)
|
||||||
|
|
||||||
let
|
let
|
||||||
state =
|
state =
|
||||||
@ -464,8 +471,6 @@ when isMainModule:
|
|||||||
# Testing EraDB gets messy because of the large amounts of data involved:
|
# Testing EraDB gets messy because of the large amounts of data involved:
|
||||||
# this snippet contains some sanity checks for mainnet at least
|
# this snippet contains some sanity checks for mainnet at least
|
||||||
|
|
||||||
import stew/arrayops
|
|
||||||
|
|
||||||
let
|
let
|
||||||
dbPath =
|
dbPath =
|
||||||
if os.paramCount() == 1: os.paramStr(1)
|
if os.paramCount() == 1: os.paramStr(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user