|
2 | 2 | use beacon_chain::{ |
3 | 3 | ChainConfig, |
4 | 4 | chain_config::{DisallowedReOrgOffsets, ReOrgThreshold}, |
5 | | - test_utils::{AttestationStrategy, BlockStrategy, LightClientStrategy, SyncCommitteeStrategy}, |
| 5 | + test_utils::{ |
| 6 | + AttestationStrategy, BlockStrategy, LightClientStrategy, SyncCommitteeStrategy, test_spec, |
| 7 | + }, |
6 | 8 | }; |
7 | 9 | use beacon_processor::{Work, WorkEvent, work_reprocessing_queue::ReprocessQueueMessage}; |
8 | 10 | use eth2::types::ProduceBlockV3Response; |
@@ -1047,3 +1049,77 @@ async fn proposer_duties_with_gossip_tolerance() { |
1047 | 1049 | proposer_duties_current_epoch |
1048 | 1050 | ); |
1049 | 1051 | } |
| 1052 | + |
| 1053 | +// Test that a request for next epoch proposer duties suceeds when the current slot clock is within |
| 1054 | +// gossip clock disparity (500ms) of the new epoch. |
| 1055 | +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 1056 | +async fn lighthouse_custody_info() { |
| 1057 | + let mut spec = test_spec::<E>(); |
| 1058 | + |
| 1059 | + // Skip pre-Fulu. |
| 1060 | + if !spec.is_fulu_scheduled() { |
| 1061 | + return; |
| 1062 | + } |
| 1063 | + |
| 1064 | + // Use a short DA expiry period so we can observe non-zero values for the oldest data column |
| 1065 | + // slot. |
| 1066 | + spec.min_epochs_for_blob_sidecars_requests = 2; |
| 1067 | + spec.min_epochs_for_data_column_sidecars_requests = 2; |
| 1068 | + |
| 1069 | + let validator_count = 24; |
| 1070 | + |
| 1071 | + let tester = InteractiveTester::<E>::new(Some(spec), validator_count).await; |
| 1072 | + let harness = &tester.harness; |
| 1073 | + let spec = &harness.spec; |
| 1074 | + let client = &tester.client; |
| 1075 | + |
| 1076 | + let num_initial = 2 * E::slots_per_epoch(); |
| 1077 | + let num_secondary = 2 * E::slots_per_epoch(); |
| 1078 | + |
| 1079 | + harness.advance_slot(); |
| 1080 | + harness |
| 1081 | + .extend_chain_with_sync( |
| 1082 | + num_initial as usize, |
| 1083 | + BlockStrategy::OnCanonicalHead, |
| 1084 | + AttestationStrategy::AllValidators, |
| 1085 | + SyncCommitteeStrategy::NoValidators, |
| 1086 | + LightClientStrategy::Disabled, |
| 1087 | + ) |
| 1088 | + .await; |
| 1089 | + |
| 1090 | + assert_eq!(harness.chain.slot().unwrap(), num_initial); |
| 1091 | + |
| 1092 | + let info = client.get_lighthouse_custody_info().await.unwrap(); |
| 1093 | + assert_eq!(info.earliest_custodied_data_column_slot, 0); |
| 1094 | + assert_eq!(info.custody_group_count, spec.custody_requirement); |
| 1095 | + assert_eq!( |
| 1096 | + info.custody_columns.len(), |
| 1097 | + info.custody_group_count as usize |
| 1098 | + ); |
| 1099 | + |
| 1100 | + // Advance the chain some more to expire some blobs. |
| 1101 | + harness.advance_slot(); |
| 1102 | + harness |
| 1103 | + .extend_chain_with_sync( |
| 1104 | + num_secondary as usize, |
| 1105 | + BlockStrategy::OnCanonicalHead, |
| 1106 | + AttestationStrategy::AllValidators, |
| 1107 | + SyncCommitteeStrategy::NoValidators, |
| 1108 | + LightClientStrategy::Disabled, |
| 1109 | + ) |
| 1110 | + .await; |
| 1111 | + |
| 1112 | + assert_eq!(harness.chain.slot().unwrap(), num_initial + num_secondary); |
| 1113 | + |
| 1114 | + let info = client.get_lighthouse_custody_info().await.unwrap(); |
| 1115 | + assert_eq!( |
| 1116 | + info.earliest_custodied_data_column_slot, |
| 1117 | + num_initial + num_secondary |
| 1118 | + - spec.min_epochs_for_data_column_sidecars_requests * E::slots_per_epoch() |
| 1119 | + ); |
| 1120 | + assert_eq!(info.custody_group_count, spec.custody_requirement); |
| 1121 | + assert_eq!( |
| 1122 | + info.custody_columns.len(), |
| 1123 | + info.custody_group_count as usize |
| 1124 | + ); |
| 1125 | +} |
0 commit comments