From 4a237cb9087f1a1d965a5f3a8312eb3461fb92e1 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Tue, 22 Mar 2022 09:42:28 +0100 Subject: [PATCH] enable chronosStrictException (#3533) * bump nim-json-rpc --- beacon_chain/eth1/deposit_contract.nim | 7 ++++++- beacon_chain/networking/eth2_network.nim | 2 +- beacon_chain/nim.cfg | 2 ++ beacon_chain/nimbus_beacon_node.nim | 8 +++++++- vendor/nim-json-rpc | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/beacon_chain/eth1/deposit_contract.nim b/beacon_chain/eth1/deposit_contract.nim index f8be33462..908e249b5 100644 --- a/beacon_chain/eth1/deposit_contract.nim +++ b/beacon_chain/eth1/deposit_contract.nim @@ -184,7 +184,12 @@ proc sendDeposits*(deposits: seq[LaunchPadDeposit], {.pop.} # TODO confutils.nim(775, 17) Error: can raise an unlisted exception: ref IOError proc main() {.async.} = - var conf = CliConfig.load() + var conf = try: CliConfig.load() + except CatchableError as exc: + raise exc + except Exception as exc: # TODO fix confutils + raiseAssert exc.msg + let rng = keys.newRng() if conf.cmd == StartUpCommand.generateSimulationDeposits: diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index 83571447d..42ec3d0f2 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -164,7 +164,7 @@ type PeerStateInitializer* = proc(peer: Peer): RootRef {.gcsafe, raises: [Defect].} NetworkStateInitializer* = proc(network: EthereumNode): RootRef {.gcsafe, raises: [Defect].} - OnPeerConnectedHandler* = proc(peer: Peer, incoming: bool): Future[void] {.gcsafe.} + OnPeerConnectedHandler* = proc(peer: Peer, incoming: bool): Future[void] {.gcsafe, raises: [Defect].} OnPeerDisconnectedHandler* = proc(peer: Peer): Future[void] {.gcsafe, raises: [Defect].} ThunkProc* = LPProtoHandler MounterProc* = proc(network: Eth2Node) {.gcsafe, raises: [Defect, CatchableError].} diff --git a/beacon_chain/nim.cfg b/beacon_chain/nim.cfg index e233b3ddc..01876791a 100644 --- a/beacon_chain/nim.cfg +++ b/beacon_chain/nim.cfg @@ -1,2 +1,4 @@ # Use only `secp256k1` public key cryptography as an identity in LibP2P. -d:"libp2p_pki_schemes=secp256k1" + +-d:chronosStrictException diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 59210581d..df223bd81 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -1090,7 +1090,13 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} = # makes sure that all the scratch space we used during slot tasks (logging, # temporary buffers etc) gets recycled for the next slot that is likely to # need similar amounts of memory. - GC_fullCollect() + try: + GC_fullCollect() + except Defect as exc: + raise exc # Reraise to maintain call stack + except Exception as exc: + # TODO upstream + raiseAssert "Unexpected exception during GC collection" # Checkpoint the database to clear the WAL file and make sure changes in # the database are synced with the filesystem. diff --git a/vendor/nim-json-rpc b/vendor/nim-json-rpc index 3a9b77146..b4bab89ab 160000 --- a/vendor/nim-json-rpc +++ b/vendor/nim-json-rpc @@ -1 +1 @@ -Subproject commit 3a9b77146ac89fdcb0f37ea9875091936268a2e8 +Subproject commit b4bab89abdde3653939abe36ab9f6cae4aa1cbd1