Skip to content

Commit

Permalink
fix syncCommitteeDuties log in Slot end message (#5416)
Browse files Browse the repository at this point in the history
In `Slot end`, sync duties are reported one slot too late,
because sync committee duties are determined by the next slot
instead of the current one. Address that by taking account of this.
  • Loading branch information
etan-status authored Sep 11, 2023
1 parent 4d8e972 commit ff176a1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1281,15 +1281,18 @@ proc onSlotEnd(node: BeaconNode, slot: Slot) {.async.} =
toGaugeValue(x)

template formatSyncCommitteeStatus(): string =
let slotsToNextSyncCommitteePeriod =
SLOTS_PER_SYNC_COMMITTEE_PERIOD - since_sync_committee_period_start(slot)
let
syncCommitteeSlot = slot + 1
slotsToNextSyncCommitteePeriod =
SLOTS_PER_SYNC_COMMITTEE_PERIOD -
since_sync_committee_period_start(syncCommitteeSlot)

# int64 conversion is safe
doAssert slotsToNextSyncCommitteePeriod <= SLOTS_PER_SYNC_COMMITTEE_PERIOD

if not node.getCurrentSyncCommiteeSubnets(slot.epoch).isZeros:
if not node.getCurrentSyncCommiteeSubnets(syncCommitteeSlot.epoch).isZeros:
"current"
elif not node.getNextSyncCommitteeSubnets(slot.epoch).isZeros:
elif not node.getNextSyncCommitteeSubnets(syncCommitteeSlot.epoch).isZeros:
"in " & toTimeLeftString(
SECONDS_PER_SLOT.int64.seconds * slotsToNextSyncCommitteePeriod.int64)
else:
Expand Down

0 comments on commit ff176a1

Please sign in to comment.