@@ -51,7 +51,7 @@ impl ValidatorRegistrations {
5151 /// and is equivalent to registering validator(s) with the same custody requirement.
5252 ///
5353 /// The node will backfill all the way back to either data_availability_boundary or fulu epoch,
54- /// and because this is a fresh node, setting the epoch to 0 is fine, as backfill will done via
54+ /// and because this is a fresh node, setting the epoch to 0 is fine, as backfill will be done via
5555 /// backfill sync instead of column backfill.
5656 fn new ( cgc_override : Option < u64 > ) -> Self {
5757 let mut registrations = ValidatorRegistrations {
@@ -129,7 +129,7 @@ impl ValidatorRegistrations {
129129 }
130130 }
131131
132- /// Updates the `epoch -> cgc` map after backfill has been completed for
132+ /// Updates the `epoch -> cgc` map after custody backfill has been completed for
133133 /// the specified epoch.
134134 ///
135135 /// This is done by pruning all values on/after `effective_epoch` and updating the map to store
@@ -254,8 +254,8 @@ impl<E: EthSpec> CustodyContext<E> {
254254 /// Restore the custody context from disk.
255255 ///
256256 /// # Behavior
257- /// * If [`NodeCustodyType::get_custody_count_override`] < validator_custody_at_head, it means the attached
258- /// validator stake has increased the node's CGC. We ignore the CLI input.
257+ /// * If [`NodeCustodyType::get_custody_count_override`] < validator_custody_at_head, it means
258+ /// validators have increased the CGC beyond the derived CGC from cli flags . We ignore the CLI input.
259259 /// * If [`NodeCustodyType::get_custody_count_override`] > validator_custody_at_head, it means the user has
260260 /// changed the node's custody type via either the --supernode or --semi-supernode flags which
261261 /// has resulted in a CGC increase. **The new CGC will be made effective from the next epoch**.
@@ -268,7 +268,7 @@ impl<E: EthSpec> CustodyContext<E> {
268268 pub fn new_from_persisted_custody_context (
269269 ssz_context : CustodyContextSsz ,
270270 node_custody_type : NodeCustodyType ,
271- current_epoch : Epoch ,
271+ head_epoch : Epoch ,
272272 spec : & ChainSpec ,
273273 ) -> ( Self , Option < CustodyCountChanged > ) {
274274 let CustodyContextSsz {
@@ -288,7 +288,7 @@ impl<E: EthSpec> CustodyContext<E> {
288288
289289 if cgc_from_cli > validator_custody_at_head {
290290 // Make the CGC from CLI effective from the next epoch
291- let effective_epoch = current_epoch + 1 ;
291+ let effective_epoch = head_epoch + 1 ;
292292 let old_custody_group_count = validator_custody_at_head;
293293 validator_custody_at_head = cgc_from_cli;
294294
@@ -576,7 +576,7 @@ mod tests {
576576
577577 fn setup_custody_context (
578578 spec : & ChainSpec ,
579- current_epoch : Epoch ,
579+ head_epoch : Epoch ,
580580 epoch_and_cgc_tuples : Vec < ( Epoch , u64 ) > ,
581581 ) -> CustodyContext < E > {
582582 let cgc_at_head = epoch_and_cgc_tuples. last ( ) . unwrap ( ) . 1 ;
@@ -589,7 +589,7 @@ mod tests {
589589 let ( custody_context, _) = CustodyContext :: < E > :: new_from_persisted_custody_context (
590590 ssz_context,
591591 NodeCustodyType :: Fullnode ,
592- current_epoch ,
592+ head_epoch ,
593593 spec,
594594 ) ;
595595
@@ -619,7 +619,7 @@ mod tests {
619619 persisted_cgc : u64 ,
620620 target_node_custody_type : NodeCustodyType ,
621621 expected_new_cgc : u64 ,
622- current_epoch : Epoch ,
622+ head_epoch : Epoch ,
623623 spec : & ChainSpec ,
624624 ) {
625625 let ssz_context = CustodyContextSsz {
@@ -632,7 +632,7 @@ mod tests {
632632 CustodyContext :: < E > :: new_from_persisted_custody_context (
633633 ssz_context,
634634 target_node_custody_type,
635- current_epoch ,
635+ head_epoch ,
636636 spec,
637637 ) ;
638638
@@ -659,8 +659,8 @@ mod tests {
659659 ) ;
660660 assert_eq ! (
661661 cgc_changed. effective_epoch,
662- current_epoch + 1 ,
663- "effective epoch should be current_epoch + 1"
662+ head_epoch + 1 ,
663+ "effective epoch should be head_epoch + 1"
664664 ) ;
665665 assert_eq ! (
666666 cgc_changed. sampling_count,
@@ -671,13 +671,13 @@ mod tests {
671671
672672 // Verify custody_group_count_at_epoch returns correct values
673673 assert_eq ! (
674- custody_context. custody_group_count_at_epoch( current_epoch , spec) ,
674+ custody_context. custody_group_count_at_epoch( head_epoch , spec) ,
675675 persisted_cgc,
676676 "current epoch should still use old cgc ({})" ,
677677 persisted_cgc
678678 ) ;
679679 assert_eq ! (
680- custody_context. custody_group_count_at_epoch( current_epoch + 1 , spec) ,
680+ custody_context. custody_group_count_at_epoch( head_epoch + 1 , spec) ,
681681 expected_new_cgc,
682682 "next epoch should use new cgc ({})" ,
683683 expected_new_cgc
@@ -689,7 +689,7 @@ mod tests {
689689 fn assert_custody_type_switch_unchanged_cgc (
690690 persisted_cgc : u64 ,
691691 target_node_custody_type : NodeCustodyType ,
692- current_epoch : Epoch ,
692+ head_epoch : Epoch ,
693693 spec : & ChainSpec ,
694694 ) {
695695 let ssz_context = CustodyContextSsz {
@@ -702,7 +702,7 @@ mod tests {
702702 CustodyContext :: < E > :: new_from_persisted_custody_context (
703703 ssz_context,
704704 target_node_custody_type,
705- current_epoch ,
705+ head_epoch ,
706706 spec,
707707 ) ;
708708
@@ -1145,14 +1145,14 @@ mod tests {
11451145 #[ test]
11461146 fn restore_fullnode_then_switch_to_supernode_increases_cgc ( ) {
11471147 let spec = E :: default_spec ( ) ;
1148- let current_epoch = Epoch :: new ( 10 ) ;
1148+ let head_epoch = Epoch :: new ( 10 ) ;
11491149 let supernode_cgc = spec. number_of_custody_groups ;
11501150
11511151 assert_custody_type_switch_increases_cgc (
11521152 0 ,
11531153 NodeCustodyType :: Supernode ,
11541154 supernode_cgc,
1155- current_epoch ,
1155+ head_epoch ,
11561156 & spec,
11571157 ) ;
11581158 }
@@ -1228,12 +1228,12 @@ mod tests {
12281228 fn restore_supernode_then_switch_to_semi_supernode_keeps_supernode_cgc ( ) {
12291229 let spec = E :: default_spec ( ) ;
12301230 let supernode_cgc = spec. number_of_custody_groups ;
1231- let current_epoch = Epoch :: new ( 10 ) ;
1231+ let head_epoch = Epoch :: new ( 10 ) ;
12321232
12331233 assert_custody_type_switch_unchanged_cgc (
12341234 supernode_cgc,
12351235 NodeCustodyType :: SemiSupernode ,
1236- current_epoch ,
1236+ head_epoch ,
12371237 & spec,
12381238 ) ;
12391239 }
@@ -1245,13 +1245,13 @@ mod tests {
12451245 let spec = E :: default_spec ( ) ;
12461246 let persisted_cgc = 32u64 ;
12471247 let semi_supernode_cgc = spec. number_of_custody_groups / 2 ;
1248- let current_epoch = Epoch :: new ( 10 ) ;
1248+ let head_epoch = Epoch :: new ( 10 ) ;
12491249
12501250 assert_custody_type_switch_increases_cgc (
12511251 persisted_cgc,
12521252 NodeCustodyType :: SemiSupernode ,
12531253 semi_supernode_cgc,
1254- current_epoch ,
1254+ head_epoch ,
12551255 & spec,
12561256 ) ;
12571257 }
@@ -1263,13 +1263,13 @@ mod tests {
12631263 let spec = E :: default_spec ( ) ;
12641264 let semi_supernode_cgc = spec. number_of_custody_groups / 2 ;
12651265 let supernode_cgc = spec. number_of_custody_groups ;
1266- let current_epoch = Epoch :: new ( 10 ) ;
1266+ let head_epoch = Epoch :: new ( 10 ) ;
12671267
12681268 assert_custody_type_switch_increases_cgc (
12691269 semi_supernode_cgc,
12701270 NodeCustodyType :: Supernode ,
12711271 supernode_cgc,
1272- current_epoch ,
1272+ head_epoch ,
12731273 & spec,
12741274 ) ;
12751275 }
@@ -1281,13 +1281,13 @@ mod tests {
12811281 let spec = E :: default_spec ( ) ;
12821282 let persisted_cgc = 32u64 ;
12831283 let supernode_cgc = spec. number_of_custody_groups ;
1284- let current_epoch = Epoch :: new ( 10 ) ;
1284+ let head_epoch = Epoch :: new ( 10 ) ;
12851285
12861286 assert_custody_type_switch_increases_cgc (
12871287 persisted_cgc,
12881288 NodeCustodyType :: Supernode ,
12891289 supernode_cgc,
1290- current_epoch ,
1290+ head_epoch ,
12911291 & spec,
12921292 ) ;
12931293 }
@@ -1359,16 +1359,16 @@ mod tests {
13591359 let default_cgc = spec. custody_requirement ;
13601360
13611361 // Setup: Node restart after validators were registered, causing CGC increase to 32 at epoch 20
1362- let current_epoch = Epoch :: new ( 20 ) ;
1363- let epoch_and_cgc_tuples = vec ! [ ( current_epoch , final_cgc) ] ;
1364- let custody_context = setup_custody_context ( & spec, current_epoch , epoch_and_cgc_tuples) ;
1362+ let head_epoch = Epoch :: new ( 20 ) ;
1363+ let epoch_and_cgc_tuples = vec ! [ ( head_epoch , final_cgc) ] ;
1364+ let custody_context = setup_custody_context ( & spec, head_epoch , epoch_and_cgc_tuples) ;
13651365 assert_eq ! (
13661366 custody_context. custody_group_count_at_epoch( Epoch :: new( 15 ) , & spec) ,
13671367 default_cgc,
13681368 ) ;
13691369
13701370 // Backfill from epoch 20 down to 15 (simulating backfill)
1371- complete_backfill_for_epochs ( & custody_context, current_epoch , Epoch :: new ( 15 ) ) ;
1371+ complete_backfill_for_epochs ( & custody_context, head_epoch , Epoch :: new ( 15 ) ) ;
13721372
13731373 // After backfilling to epoch 15, it should use latest CGC (32)
13741374 assert_eq ! (
@@ -1397,13 +1397,13 @@ mod tests {
13971397 let final_cgc = 32u64 ;
13981398
13991399 // Setup: Node restart after multiple validator registrations causing CGC increases
1400- let current_epoch = Epoch :: new ( 20 ) ;
1400+ let head_epoch = Epoch :: new ( 20 ) ;
14011401 let epoch_and_cgc_tuples = vec ! [
14021402 ( Epoch :: new( 0 ) , initial_cgc) ,
14031403 ( Epoch :: new( 10 ) , mid_cgc) ,
1404- ( current_epoch , final_cgc) ,
1404+ ( head_epoch , final_cgc) ,
14051405 ] ;
1406- let custody_context = setup_custody_context ( & spec, current_epoch , epoch_and_cgc_tuples) ;
1406+ let custody_context = setup_custody_context ( & spec, head_epoch , epoch_and_cgc_tuples) ;
14071407
14081408 // Backfill to epoch 15 (between the two CGC increases)
14091409 complete_backfill_for_epochs ( & custody_context, Epoch :: new ( 20 ) , Epoch :: new ( 15 ) ) ;
0 commit comments