log slashing protection database error on failure to load (#5542)

* log slashing protection database error on failure to load

...and fix noreturn warning

* fix the copied one too

* oops

* oops 2
This commit is contained in:
Jacek Sieka 2023-10-31 11:15:38 +01:00 committed by GitHub
parent d289da8cd4
commit 8c81515bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 25 deletions

View File

@ -72,7 +72,7 @@ proc unblindAndRouteBlockMEV*(
if hash_tree_root(
blindedBlock.message.body.execution_payload_header) !=
hash_tree_root(unblindedPayload.data.data):
return err("unblinded payload doesn't match blinded payload header: " &
err("unblinded payload doesn't match blinded payload header: " &
$blindedBlock.message.body.execution_payload_header)
else:
# Signature provided is consistent with unblinded execution payload,
@ -107,19 +107,17 @@ proc unblindAndRouteBlockMEV*(
blockRoot = shortLog(signedBlock.root), blck = shortLog(signedBlock),
signature = shortLog(signedBlock.signature)
return ok newBlockRef
ok newBlockRef
else:
return err("submitBlindedBlock failed with HTTP error code" &
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#proposer-slashing
# This means if a validator publishes a signature for a
# `BlindedBeaconBlock` (via a dissemination of a
# `SignedBlindedBeaconBlock`) then the validator **MUST** not use the
# local build process as a fallback, even in the event of some failure
# with the external builder network.
err("submitBlindedBlock failed with HTTP error code" &
$unblindedPayload.status & ": " & $shortLog(blindedBlock))
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#proposer-slashing
# This means if a validator publishes a signature for a
# `BlindedBeaconBlock` (via a dissemination of a
# `SignedBlindedBeaconBlock`) then the validator **MUST** not use the
# local build process as a fallback, even in the event of some failure
# with the external builder network.
return err("unblindAndRouteBlockMEV error")
# TODO currently cannot be combined into one generic function
proc unblindAndRouteBlockMEV*(
node: BeaconNode, payloadBuilderRestClient: RestClientRef,
@ -150,7 +148,7 @@ proc unblindAndRouteBlockMEV*(
if hash_tree_root(
blindedBlock.message.body.execution_payload_header) !=
hash_tree_root(unblindedPayload.data.data.execution_payload):
return err("unblinded payload doesn't match blinded payload header: " &
err("unblinded payload doesn't match blinded payload header: " &
$blindedBlock.message.body.execution_payload_header)
else:
# Signature provided is consistent with unblinded execution payload,
@ -189,14 +187,14 @@ proc unblindAndRouteBlockMEV*(
discard $denebImplementationMissing & ": route unblinded blobs"
return ok newBlockRef
ok newBlockRef
else:
return err("submitBlindedBlock failed with HTTP error code" &
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#proposer-slashing
# This means if a validator publishes a signature for a
# `BlindedBeaconBlock` (via a dissemination of a
# `SignedBlindedBeaconBlock`) then the validator **MUST** not use the
# local build process as a fallback, even in the event of some failure
# with the external builder network.
err("submitBlindedBlock failed with HTTP error code" &
$unblindedPayload.status & ": " & $shortLog(blindedBlock))
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#proposer-slashing
# This means if a validator publishes a signature for a
# `BlindedBeaconBlock` (via a dissemination of a
# `SignedBlindedBeaconBlock`) then the validator **MUST** not use the
# local build process as a fallback, even in the event of some failure
# with the external builder network.

View File

@ -674,8 +674,9 @@ proc initCompatV1*(
let
alreadyExists = fileExists(databasePath / databaseName & ".sqlite3")
backend = SqStoreRef.init(databasePath, databaseName).valueOr:
fatal "Failed to open slashing protection database"
backendRes = SqStoreRef.init(databasePath, databaseName)
backend = backendRes.valueOr: # TODO https://github.com/nim-lang/Nim/issues/22605
fatal "Failed to open slashing protection database", err = backendRes.error
quit 1
result.db = T(backend: backend)
@ -716,9 +717,10 @@ proc init*(T: type SlashingProtectionDB_v2,
let
alreadyExists = fileExists(databasePath / databaseName & ".sqlite3")
backend = SqStoreRef.init(databasePath, databaseName,
keyspaces = []).valueOr:
fatal "Failed to open slashing protection database"
backendRes = SqStoreRef.init(databasePath, databaseName,
keyspaces = [])
backend = backendRes.valueOr: # TODO https://github.com/nim-lang/Nim/issues/22605
fatal "Failed to open slashing protection database", err = backendRes.error
quit 1
result = T(backend: backend)