@@ -97,7 +97,7 @@ proc compute_slots_since_epoch_start(slot: Slot): uint64 =
9797
9898proc on_tick (self: var Checkpoints , dag: ChainDAGRef , time: Slot ): FcResult [void ] =
9999 if self.time > time:
100- return err ( ForkChoiceError (kind: fcInconsistentTick) )
100+ return err ForkChoiceError (kind: fcInconsistentTick)
101101
102102 let newEpoch = self.time.epoch () != time.epoch ()
103103 self.time = time
@@ -106,8 +106,9 @@ proc on_tick(self: var Checkpoints, dag: ChainDAGRef, time: Slot): FcResult[void
106106 self.best_justified.epoch > self.justified.epoch:
107107 let blck = dag.getRef (self.best_justified.root)
108108 if blck.isNil:
109- return err (ForkChoiceError (
110- kind: fcJustifiedNodeUnknown, block_root: self.best_justified.root))
109+ return err ForkChoiceError (
110+ kind: fcJustifiedNodeUnknown,
111+ blockRoot: self.best_justified.root)
111112
112113 let epochRef = dag.getEpochRef (blck, self.best_justified.epoch)
113114 self.justified = BalanceCheckpoint (
@@ -117,6 +118,7 @@ proc on_tick(self: var Checkpoints, dag: ChainDAGRef, time: Slot): FcResult[void
117118 ok ()
118119
119120proc process_attestation_queue (self: var ForkChoice ) {.gcsafe .}
121+
120122proc update_time (self: var ForkChoice , dag: ChainDAGRef , time: Slot ): FcResult [void ] =
121123 if time > self.checkpoints.time:
122124 while time > self.checkpoints.time:
@@ -209,8 +211,9 @@ proc should_update_justified_checkpoint(
209211 justified_blck = dag.getRef (new_justified_checkpoint.root)
210212
211213 if justified_blck.isNil:
212- return err (ForkChoiceError (
213- kind: fcJustifiedNodeUnknown, block_root: new_justified_checkpoint.root))
214+ return err ForkChoiceError (
215+ kind: fcJustifiedNodeUnknown,
216+ blockRoot: new_justified_checkpoint.root)
214217
215218 let justified_ancestor = justified_blck.atSlot (justified_slot)
216219
@@ -275,7 +278,7 @@ proc process_block*(self: var ForkChoiceBackend,
275278 parent_root: Eth2Digest ,
276279 justified_epoch: Epoch ,
277280 finalized_epoch: Epoch ): FcResult [void ] =
278- self.proto_array.on_block (
281+ self.proto_array.onBlock (
279282 block_root, parent_root, justified_epoch, finalized_epoch)
280283
281284proc process_block * (self: var ForkChoice ,
@@ -336,15 +339,15 @@ proc find_head*(
336339 )
337340
338341 # Apply score changes
339- ? self.proto_array.apply_score_changes (
342+ ? self.proto_array.applyScoreChanges (
340343 deltas, justified_epoch, finalized_epoch
341344 )
342345
343346 self.balances = justified_state_balances
344347
345348 # Find the best block
346349 var new_head{.noInit .}: Eth2Digest
347- ? self.proto_array.find_head (new_head, justified_root)
350+ ? self.proto_array.findHead (new_head, justified_root)
348351
349352 {.noSideEffect .}:
350353 trace " Fork choice requested" ,
@@ -425,8 +428,7 @@ func compute_deltas(
425428 if index >= deltas.len:
426429 return err ForkChoiceError (
427430 kind: fcInvalidNodeDelta,
428- index: index
429- )
431+ index: index)
430432 deltas[index] -= Delta old_balance
431433 # Note that delta can be negative
432434 # TODO : is int64 big enough?
@@ -436,8 +438,7 @@ func compute_deltas(
436438 if index >= deltas.len:
437439 return err ForkChoiceError (
438440 kind: fcInvalidNodeDelta,
439- index: index
440- )
441+ index: index)
441442 deltas[index] += Delta new_balance
442443 # Note that delta can be negative
443444 # TODO : is int64 big enough?
0 commit comments