fix XDeclaredButNotUsed warnings (#5648)
This commit is contained in:
parent
4a56faa579
commit
c36d2aa103
|
@ -214,7 +214,6 @@ proc processObject(
|
||||||
obj: SomeForkedLightClientObject,
|
obj: SomeForkedLightClientObject,
|
||||||
wallTime: BeaconTime): Result[void, VerifierError] =
|
wallTime: BeaconTime): Result[void, VerifierError] =
|
||||||
let
|
let
|
||||||
wallSlot = wallTime.slotOrZero()
|
|
||||||
res = withForkyObject(obj):
|
res = withForkyObject(obj):
|
||||||
when lcDataFork > LightClientDataFork.None:
|
when lcDataFork > LightClientDataFork.None:
|
||||||
when forkyObject is ForkyLightClientBootstrap:
|
when forkyObject is ForkyLightClientBootstrap:
|
||||||
|
@ -242,7 +241,9 @@ proc processObject(
|
||||||
self.store[].migrateToDataFork(lcDataFork)
|
self.store[].migrateToDataFork(lcDataFork)
|
||||||
withForkyStore(self.store[]):
|
withForkyStore(self.store[]):
|
||||||
when lcDataFork > LightClientDataFork.None:
|
when lcDataFork > LightClientDataFork.None:
|
||||||
let upgradedObject = obj.migratingToDataFork(lcDataFork)
|
let
|
||||||
|
wallSlot = wallTime.slotOrZero()
|
||||||
|
upgradedObject = obj.migratingToDataFork(lcDataFork)
|
||||||
process_light_client_update(
|
process_light_client_update(
|
||||||
forkyStore, upgradedObject.forky(lcDataFork), wallSlot,
|
forkyStore, upgradedObject.forky(lcDataFork), wallSlot,
|
||||||
self.cfg, self.genesis_validators_root)
|
self.cfg, self.genesis_validators_root)
|
||||||
|
|
|
@ -427,7 +427,7 @@ template runWithSignals(sn: SigningNodeRef, body: untyped): bool =
|
||||||
discard await race(future, sn.sigintHandleFut, sn.sigtermHandleFut)
|
discard await race(future, sn.sigintHandleFut, sn.sigtermHandleFut)
|
||||||
if future.finished():
|
if future.finished():
|
||||||
if future.failed() or future.cancelled():
|
if future.failed() or future.cancelled():
|
||||||
let exc = future.readError()
|
discard future.readError()
|
||||||
debug "Signing node initialization failed"
|
debug "Signing node initialization failed"
|
||||||
var pending: seq[Future[void]]
|
var pending: seq[Future[void]]
|
||||||
if not(sn.sigintHandleFut.finished()):
|
if not(sn.sigintHandleFut.finished()):
|
||||||
|
|
|
@ -289,7 +289,6 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
node.withStateForBlockSlotId(bslot):
|
node.withStateForBlockSlotId(bslot):
|
||||||
let
|
let
|
||||||
stateEpoch = getStateField(state, slot).epoch()
|
stateEpoch = getStateField(state, slot).epoch()
|
||||||
validatorsCount = lenu64(getStateField(state, validators))
|
|
||||||
indices = node.getIndices(validatorIds, state).valueOr:
|
indices = node.getIndices(validatorIds, state).valueOr:
|
||||||
return RestApiResponse.jsonError(error)
|
return RestApiResponse.jsonError(error)
|
||||||
response =
|
response =
|
||||||
|
|
|
@ -14,7 +14,6 @@ import "."/[common, fallback_service, scoring]
|
||||||
export eth2_rest_serialization, common
|
export eth2_rest_serialization, common
|
||||||
|
|
||||||
const
|
const
|
||||||
ResponseSuccess = "Received successful response"
|
|
||||||
ResponseInvalidError = "Received invalid request response"
|
ResponseInvalidError = "Received invalid request response"
|
||||||
ResponseInternalError = "Received internal error response"
|
ResponseInternalError = "Received internal error response"
|
||||||
ResponseUnexpectedError = "Received unexpected error response"
|
ResponseUnexpectedError = "Received unexpected error response"
|
||||||
|
|
|
@ -243,8 +243,8 @@ proc publishBlock(vc: ValidatorClientRef, currentSlot, slot: Slot,
|
||||||
if not(normalBlockFut.finished()):
|
if not(normalBlockFut.finished()):
|
||||||
await normalBlockFut.cancelAndWait()
|
await normalBlockFut.cancelAndWait()
|
||||||
raise exc
|
raise exc
|
||||||
except CatchableError as exc:
|
except CatchableError:
|
||||||
# This should not be happened, because all the exceptions handled.
|
# This should not happen, because all the exceptions are handled.
|
||||||
Opt.none(PreparedBlindedBeaconBlock)
|
Opt.none(PreparedBlindedBeaconBlock)
|
||||||
|
|
||||||
let normalBlock =
|
let normalBlock =
|
||||||
|
@ -253,8 +253,8 @@ proc publishBlock(vc: ValidatorClientRef, currentSlot, slot: Slot,
|
||||||
await normalBlockFut
|
await normalBlockFut
|
||||||
except CancelledError as exc:
|
except CancelledError as exc:
|
||||||
raise exc
|
raise exc
|
||||||
except CatchableError as exc:
|
except CatchableError:
|
||||||
# This should not be happened, because all the exceptions handled.
|
# This should not happen, because all the exceptions are handled.
|
||||||
Opt.none(PreparedBeaconBlock)
|
Opt.none(PreparedBeaconBlock)
|
||||||
else:
|
else:
|
||||||
if not(normalBlockFut.finished()):
|
if not(normalBlockFut.finished()):
|
||||||
|
@ -449,7 +449,7 @@ proc proposeBlock(vc: ValidatorClientRef, slot: Slot,
|
||||||
debug "Block proposing process was interrupted",
|
debug "Block proposing process was interrupted",
|
||||||
slot = slot, validator = shortLog(proposerKey)
|
slot = slot, validator = shortLog(proposerKey)
|
||||||
raise exc
|
raise exc
|
||||||
except CatchableError as exc:
|
except CatchableError:
|
||||||
error "Unexpected error encountered while proposing block",
|
error "Unexpected error encountered while proposing block",
|
||||||
slot = slot, validator = shortLog(validator)
|
slot = slot, validator = shortLog(validator)
|
||||||
|
|
||||||
|
@ -814,7 +814,7 @@ proc mainLoop(service: BlockServiceRef) {.async.} =
|
||||||
# Future is not going to be completed, so the only way to exit, is to
|
# Future is not going to be completed, so the only way to exit, is to
|
||||||
# cancel it.
|
# cancel it.
|
||||||
await future
|
await future
|
||||||
except CancelledError as exc:
|
except CancelledError:
|
||||||
debug "Service interrupted"
|
debug "Service interrupted"
|
||||||
except CatchableError as exc:
|
except CatchableError as exc:
|
||||||
error "Service crashed with unexpected error", err_name = exc.name,
|
error "Service crashed with unexpected error", err_name = exc.name,
|
||||||
|
|
|
@ -406,7 +406,6 @@ func getFailureReason*(failure: ApiNodeFailure): string =
|
||||||
[failure.reason, status, request, $failure.failure].join(";")
|
[failure.reason, status, request, $failure.failure].join(";")
|
||||||
|
|
||||||
proc getFailureReason*(exc: ref ValidatorApiError): string =
|
proc getFailureReason*(exc: ref ValidatorApiError): string =
|
||||||
var counts: array[int(high(ApiFailure)) + 1, int]
|
|
||||||
let
|
let
|
||||||
errors = exc[].data
|
errors = exc[].data
|
||||||
errorsCount = len(errors)
|
errorsCount = len(errors)
|
||||||
|
@ -825,7 +824,6 @@ proc getDurationToNextAttestation*(vc: ValidatorClientRef,
|
||||||
for key, item in vc.attesters:
|
for key, item in vc.attesters:
|
||||||
let duty = item.duties.getOrDefault(epoch, DefaultDutyAndProof)
|
let duty = item.duties.getOrDefault(epoch, DefaultDutyAndProof)
|
||||||
if not(duty.isDefault()):
|
if not(duty.isDefault()):
|
||||||
let dutySlotTime = duty.data.slot
|
|
||||||
if (duty.data.slot < minSlot) and (duty.data.slot >= slot):
|
if (duty.data.slot < minSlot) and (duty.data.slot >= slot):
|
||||||
minSlot = duty.data.slot
|
minSlot = duty.data.slot
|
||||||
if minSlot != FAR_FUTURE_SLOT:
|
if minSlot != FAR_FUTURE_SLOT:
|
||||||
|
|
|
@ -484,7 +484,7 @@ proc mainLoop(service: FallbackServiceRef) {.async.} =
|
||||||
if await service.checkNodes(): service.changesEvent.fire()
|
if await service.checkNodes(): service.changesEvent.fire()
|
||||||
await sleepAsync(2.seconds)
|
await sleepAsync(2.seconds)
|
||||||
false
|
false
|
||||||
except CancelledError as exc:
|
except CancelledError:
|
||||||
debug "Service interrupted"
|
debug "Service interrupted"
|
||||||
if not(timeMonitorFut.finished()): await timeMonitorFut.cancelAndWait()
|
if not(timeMonitorFut.finished()): await timeMonitorFut.cancelAndWait()
|
||||||
true
|
true
|
||||||
|
|
|
@ -1815,9 +1815,7 @@ proc handleValidatorDuties*(node: BeaconNode, lastSlot, slot: Slot) {.async.} =
|
||||||
|
|
||||||
curSlot += 1
|
curSlot += 1
|
||||||
|
|
||||||
let
|
let newHead = await handleProposal(node, head, slot)
|
||||||
newHead = await handleProposal(node, head, slot)
|
|
||||||
didSubmitBlock = (newHead != head)
|
|
||||||
head = newHead
|
head = newHead
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
|
@ -44,13 +44,6 @@ type
|
||||||
desc: "A directory to store the generated validator keystores"
|
desc: "A directory to store the generated validator keystores"
|
||||||
name: "out-dir" }: OutDir
|
name: "out-dir" }: OutDir
|
||||||
|
|
||||||
template valueOr(x: Option, elseBlock: untyped): untyped =
|
|
||||||
let val = x
|
|
||||||
if val.isSome:
|
|
||||||
val.get
|
|
||||||
else:
|
|
||||||
elseBlock
|
|
||||||
|
|
||||||
proc main =
|
proc main =
|
||||||
let conf = load Config
|
let conf = load Config
|
||||||
if conf.threshold == 0:
|
if conf.threshold == 0:
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
# 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.
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[os, strutils, streams, parsecsv],
|
std/[parsecsv, streams],
|
||||||
stew/[io2, byteutils], chronicles, confutils, snappy,
|
stew/[io2, byteutils], chronicles, confutils, snappy,
|
||||||
../beacon_chain/spec/datatypes/base,
|
../beacon_chain/spec/datatypes/base,
|
||||||
./ncli_common
|
./ncli_common
|
||||||
|
|
||||||
when defined(posix):
|
from std/os import fileExists
|
||||||
import system/ansi_c
|
from std/strutils import parseBiggestInt, parseBiggestUInt
|
||||||
|
|
||||||
type
|
type
|
||||||
AggregatorConf = object
|
AggregatorConf = object
|
||||||
|
@ -199,6 +199,10 @@ proc advanceEpochs*(aggregator: var ValidatorDbAggregator, epoch: Epoch,
|
||||||
aggregator.inclusionDelaysCount.setLen(0)
|
aggregator.inclusionDelaysCount.setLen(0)
|
||||||
aggregator.epochsAggregated = 0
|
aggregator.epochsAggregated = 0
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
when defined(posix):
|
||||||
|
import system/ansi_c
|
||||||
|
|
||||||
proc aggregateEpochs(startEpoch, endEpoch: Epoch, resolution: uint,
|
proc aggregateEpochs(startEpoch, endEpoch: Epoch, resolution: uint,
|
||||||
inputDir, outputDir: string) =
|
inputDir, outputDir: string) =
|
||||||
if startEpoch > endEpoch:
|
if startEpoch > endEpoch:
|
||||||
|
@ -243,7 +247,6 @@ proc exitOnSigterm(signal: cint) {.noconv.} =
|
||||||
notice "Shutting down after having received SIGTERM."
|
notice "Shutting down after having received SIGTERM."
|
||||||
shouldShutDown = true
|
shouldShutDown = true
|
||||||
|
|
||||||
when isMainModule:
|
|
||||||
proc main =
|
proc main =
|
||||||
setControlCHook(controlCHook)
|
setControlCHook(controlCHook)
|
||||||
when defined(posix):
|
when defined(posix):
|
||||||
|
|
Loading…
Reference in New Issue