Skip to content

Commit 401b8d0

Browse files
committed
Remove unncessary changes
1 parent 13cef6d commit 401b8d0

File tree

1 file changed

+24
-67
lines changed

1 file changed

+24
-67
lines changed

beacon_node/beacon_chain/src/custody_context.rs

Lines changed: 24 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,6 @@ mod tests {
574574

575575
type E = MainnetEthSpec;
576576

577-
// ============================================================================
578-
// Test Helpers and Utilities
579-
// ============================================================================
580-
581577
fn setup_custody_context(
582578
spec: &ChainSpec,
583579
current_epoch: Epoch,
@@ -616,31 +612,6 @@ mod tests {
616612
}
617613
}
618614

619-
/// Helper function to test default CGC initialization for different node custody types.
620-
/// Verifies custody_group_count_at_head and num_of_custody_groups_to_sample match expectations.
621-
fn assert_default_cgc_for_node_custody_type(
622-
node_custody_type: NodeCustodyType,
623-
expected_cgc_at_head: u64,
624-
expected_sampling_size: u64,
625-
spec: &ChainSpec,
626-
) {
627-
let custody_context = CustodyContext::<E>::new(node_custody_type, spec);
628-
629-
assert_eq!(
630-
custody_context.custody_group_count_at_head(spec),
631-
expected_cgc_at_head,
632-
"custody_group_count_at_head should be {}",
633-
expected_cgc_at_head
634-
);
635-
636-
assert_eq!(
637-
custody_context.num_of_custody_groups_to_sample(Epoch::new(0), spec),
638-
expected_sampling_size,
639-
"num_of_custody_groups_to_sample should be {}",
640-
expected_sampling_size
641-
);
642-
}
643-
644615
/// Helper function to test CGC increases when switching node custody types.
645616
/// Verifies that CustodyCountChanged is returned with correct values and
646617
/// that custody_group_count_at_epoch returns appropriate values for current and next epoch.
@@ -762,40 +733,46 @@ mod tests {
762733
#[test]
763734
fn no_validators_supernode_default() {
764735
let spec = E::default_spec();
765-
assert_default_cgc_for_node_custody_type(
766-
NodeCustodyType::Supernode,
767-
spec.number_of_custody_groups,
768-
spec.number_of_custody_groups,
769-
&spec,
736+
let custody_context = CustodyContext::<E>::new(NodeCustodyType::Supernode, &spec);
737+
assert_eq!(
738+
custody_context.custody_group_count_at_head(&spec),
739+
spec.number_of_custody_groups
740+
);
741+
assert_eq!(
742+
custody_context.num_of_custody_groups_to_sample(Epoch::new(0), &spec),
743+
spec.number_of_custody_groups
770744
);
771745
}
772746

773747
#[test]
774748
fn no_validators_semi_supernode_default() {
775749
let spec = E::default_spec();
776-
assert_default_cgc_for_node_custody_type(
777-
NodeCustodyType::SemiSupernode,
778-
spec.number_of_custody_groups / 2,
779-
spec.number_of_custody_groups / 2,
780-
&spec,
750+
let custody_context = CustodyContext::<E>::new(NodeCustodyType::SemiSupernode, &spec);
751+
assert_eq!(
752+
custody_context.custody_group_count_at_head(&spec),
753+
spec.number_of_custody_groups / 2
754+
);
755+
assert_eq!(
756+
custody_context.num_of_custody_groups_to_sample(Epoch::new(0), &spec),
757+
spec.number_of_custody_groups / 2
781758
);
782759
}
783760

784761
#[test]
785762
fn no_validators_fullnode_default() {
786763
let spec = E::default_spec();
787-
assert_default_cgc_for_node_custody_type(
788-
NodeCustodyType::Fullnode,
764+
let custody_context = CustodyContext::<E>::new(NodeCustodyType::Fullnode, &spec);
765+
assert_eq!(
766+
custody_context.custody_group_count_at_head(&spec),
789767
spec.custody_requirement,
790-
spec.samples_per_slot,
791-
&spec,
768+
"head custody count should be minimum spec custody requirement"
769+
);
770+
assert_eq!(
771+
custody_context.num_of_custody_groups_to_sample(Epoch::new(0), &spec),
772+
spec.samples_per_slot
792773
);
793774
}
794775

795-
// ============================================================================
796-
// Validator Registration and CGC Updates
797-
// ============================================================================
798-
799776
#[test]
800777
fn register_single_validator_should_update_cgc() {
801778
let spec = E::default_spec();
@@ -926,10 +903,6 @@ mod tests {
926903
);
927904
}
928905

929-
// ============================================================================
930-
// Validator Expiry Tests
931-
// ============================================================================
932-
933906
#[test]
934907
fn validator_dropped_after_no_registrations_within_expiry_should_not_reduce_cgc() {
935908
let spec = E::default_spec();
@@ -1022,10 +995,6 @@ mod tests {
1022995
);
1023996
}
1024997

1025-
// ============================================================================
1026-
// Custody Columns and Data Column Initialization
1027-
// ============================================================================
1028-
1029998
#[test]
1030999
fn should_init_ordered_data_columns_and_return_sampling_columns() {
10311000
let spec = E::default_spec();
@@ -1157,10 +1126,6 @@ mod tests {
11571126
);
11581127
}
11591128

1160-
// ============================================================================
1161-
// Persistence and Restoration Tests
1162-
// ============================================================================
1163-
11641129
#[test]
11651130
fn restore_from_persisted_fullnode_no_validators() {
11661131
let spec = E::default_spec();
@@ -1184,10 +1149,6 @@ mod tests {
11841149
);
11851150
}
11861151

1187-
// ============================================================================
1188-
// Node Custody Type Switching Tests
1189-
// ============================================================================
1190-
11911152
/// Tests CLI flag change: Fullnode (CGC=0) → Supernode (CGC=128)
11921153
/// CGC should increase and trigger backfill via CustodyCountChanged.
11931154
#[test]
@@ -1340,10 +1301,6 @@ mod tests {
13401301
);
13411302
}
13421303

1343-
// ============================================================================
1344-
// Historical Custody and Backfill Tests
1345-
// ============================================================================
1346-
13471304
#[test]
13481305
fn restore_with_validator_custody_history_across_epochs() {
13491306
let spec = E::default_spec();

0 commit comments

Comments
 (0)