fix missing shuffling dependent slot computation

This commit is contained in:
Jacek Sieka 2023-05-16 10:05:35 +02:00
parent adcabf9ad7
commit 3acbb3ea6c
No known key found for this signature in database
GPG Key ID: A1B09461ABB656B8
3 changed files with 8 additions and 1 deletions

View File

@ -353,6 +353,9 @@ type
block_root* {.serializedFieldName: "block".}: Eth2Digest
optimistic* {.serializedFieldName: "execution_optimistic".}: Option[bool]
func attester_dependent_slot*(shuffling: ShufflingRef): Slot =
dependent_slot((if shuffling.epoch == 0: Epoch(0) else: shuffling.epoch - 1))
template head*(dag: ChainDAGRef): BlockRef = dag.headState.blck
template frontfill*(dagParam: ChainDAGRef): Opt[BlockId] =

View File

@ -104,7 +104,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
res
let optimistic = node.getShufflingOptimistic(
qepoch.shufflingDependentSlot,
shufflingRef.attester_dependent_slot,
shufflingRef.attester_dependent_root)
return RestApiResponse.jsonResponseWRoot(

View File

@ -254,6 +254,10 @@ template start_slot*(period: SyncCommitteePeriod): Slot =
if period >= maxPeriod: FAR_FUTURE_SLOT
else: Slot(period * SLOTS_PER_SYNC_COMMITTEE_PERIOD)
func dependent_slot*(epoch: Epoch): Slot =
if epoch == 0: Slot(0)
else: epoch.start_slot() - 1
func `$`*(t: BeaconTime): string =
if t.ns_since_genesis >= 0:
$(timer.nanoseconds(t.ns_since_genesis))