diff --git a/beacon_node/beacon_chain/src/test_utils.rs b/beacon_node/beacon_chain/src/test_utils.rs index b7db2462ca9..86b3ae4d9ff 100644 --- a/beacon_node/beacon_chain/src/test_utils.rs +++ b/beacon_node/beacon_chain/src/test_utils.rs @@ -2584,26 +2584,13 @@ pub fn generate_rand_block_and_data_columns( rng: &mut impl Rng, ) -> ( SignedBeaconBlock>, - Vec>, + Vec>>, ) { let (block, blobs) = generate_rand_block_and_blobs(fork_name, num_blobs, rng); - let blob = blobs.first().expect("should have at least 1 blob"); - - let data_columns = (0..E::number_of_columns()) - .map(|index| DataColumnSidecar { - index: index as u64, - column: <_>::default(), - kzg_commitments: block - .message() - .body() - .blob_kzg_commitments() - .unwrap() - .clone(), - kzg_proofs: (vec![]).into(), - signed_block_header: blob.signed_block_header.clone(), - kzg_commitments_inclusion_proof: <_>::default(), - }) - .collect::>(); + let blob: BlobsList = blobs.into_iter().map(|b| b.blob).collect::>().into(); + let data_columns = DataColumnSidecar::build_sidecars(&blob, &block, &KZG) + .unwrap() + .into(); (block, data_columns) } diff --git a/beacon_node/network/src/sync/block_lookups/tests.rs b/beacon_node/network/src/sync/block_lookups/tests.rs index 173ae761f65..222d58604da 100644 --- a/beacon_node/network/src/sync/block_lookups/tests.rs +++ b/beacon_node/network/src/sync/block_lookups/tests.rs @@ -241,7 +241,9 @@ impl TestRig { generate_rand_block_and_blobs::(fork_name, num_blobs, rng) } - fn rand_block_and_data_columns(&mut self) -> (SignedBeaconBlock, Vec>) { + fn rand_block_and_data_columns( + &mut self, + ) -> (SignedBeaconBlock, Vec>>) { let num_blobs = NumBlobs::Number(1); generate_rand_block_and_data_columns::(self.fork_name, num_blobs, &mut self.rng) } @@ -640,7 +642,7 @@ impl TestRig { fn complete_valid_sampling_column_requests( &mut self, sampling_ids: SamplingIds, - data_columns: Vec>, + data_columns: Vec>>, ) { for (id, column_index) in sampling_ids { self.log(&format!("return valid data column for {column_index}")); @@ -654,7 +656,7 @@ impl TestRig { fn complete_valid_sampling_column_request( &mut self, id: DataColumnsByRootRequestId, - data_column: DataColumnSidecar, + data_column: Arc>, ) { let block_root = data_column.block_root(); let column_index = data_column.index; @@ -677,7 +679,7 @@ impl TestRig { fn complete_valid_custody_request( &mut self, sampling_ids: SamplingIds, - data_columns: Vec>, + data_columns: Vec>>, missing_components: bool, ) { let lookup_id = if let DataColumnsByRootRequester::Custody(id) = @@ -720,14 +722,14 @@ impl TestRig { fn complete_data_columns_by_root_request( &mut self, id: DataColumnsByRootRequestId, - data_column: DataColumnSidecar, + data_column: Arc>, ) { let peer_id = PeerId::random(); // Send chunk self.send_sync_message(SyncMessage::RpcDataColumn { request_id: SyncRequestId::DataColumnsByRoot(id), peer_id, - data_column: Some(Arc::new(data_column)), + data_column: Some(data_column), seen_timestamp: timestamp_now(), }); // Send stream termination diff --git a/consensus/types/src/data_column_sidecar.rs b/consensus/types/src/data_column_sidecar.rs index c6183414c5d..75687a43dfa 100644 --- a/consensus/types/src/data_column_sidecar.rs +++ b/consensus/types/src/data_column_sidecar.rs @@ -461,6 +461,7 @@ mod test { col_sidecar.kzg_commitments_inclusion_proof, block_kzg_commitments_inclusion_proof ); + assert!(col_sidecar.verify_inclusion_proof()); } }