From eea523a89eeda530a02085e7b1503861bda578bc Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Tue, 10 Dec 2019 10:55:37 +0100 Subject: [PATCH] logging fixes * don't log out-of-sync when there's no work to do * small logging fixes --- beacon_chain/attestation_pool.nim | 2 +- beacon_chain/beacon_node.nim | 7 +++++-- beacon_chain/spec/beaconstate.nim | 2 +- beacon_chain/spec/datatypes.nim | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/beacon_chain/attestation_pool.nim b/beacon_chain/attestation_pool.nim index ab37c19bb..d325e57ca 100644 --- a/beacon_chain/attestation_pool.nim +++ b/beacon_chain/attestation_pool.nim @@ -257,7 +257,7 @@ proc getAttestationsForBlock*( logScope: pcs = "retrieve_attestation" if newBlockSlot < (GENESIS_SLOT + MIN_ATTESTATION_INCLUSION_DELAY): - debug "[Attestion Pool] Too early for attestations", + debug "Too early for attestations", newBlockSlot = shortLog(newBlockSlot), cat = "query" return diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index 3a87cbe29..e6763a149 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -760,7 +760,11 @@ proc onSlotStart(node: BeaconNode, lastSlot, scheduledSlot: Slot) {.gcsafe, asyn # disappear naturally - risky because user is not aware, # and might lose stake on canonical chain but "just works" # when reconnected.. - if not node.isSynced(head): + if node.attachedValidators.count == 0: + # There are no validators, thus we don't have any additional work to do + # beyond keeping track of the head + discard + elif not node.isSynced(head): warn "Node out of sync, skipping block and attestation production for this slot", slot, headSlot = head.slot else: @@ -1198,4 +1202,3 @@ when isMainModule: quit 1 echo navigator.navigatePath(pathFragments[1 .. ^1]).toJson - diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index 6d20db3e8..f547e156c 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -479,7 +479,7 @@ proc check_attestation*( else: if not (ffg_check_data == (state.previous_justified_checkpoint.epoch, state.previous_justified_checkpoint.root, get_previous_epoch(state))): - warn("FFG data not matching current justified epoch") + warn("FFG data not matching previous justified epoch") return if not is_valid_indexed_attestation( diff --git a/beacon_chain/spec/datatypes.nim b/beacon_chain/spec/datatypes.nim index e5a316bfc..52e1c78c5 100644 --- a/beacon_chain/spec/datatypes.nim +++ b/beacon_chain/spec/datatypes.nim @@ -552,6 +552,7 @@ func shortLog*(v: BeaconBlock): auto = func shortLog*(v: AttestationData): auto = ( + slot: shortLog(v.slot), beacon_block_root: shortLog(v.beacon_block_root), source_epoch: shortLog(v.source.epoch), source_root: shortLog(v.source.root),