From 2b550177bb73ccea9c36dd79bea1c8454f35918e Mon Sep 17 00:00:00 2001 From: realbigsean Date: Fri, 24 May 2024 16:10:50 -0400 Subject: [PATCH] fix tests and remove unused method --- .../beacon_chain/src/data_availability_checker.rs | 8 -------- beacon_node/network/src/sync/block_lookups/tests.rs | 10 ++++++++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/beacon_node/beacon_chain/src/data_availability_checker.rs b/beacon_node/beacon_chain/src/data_availability_checker.rs index d6f2d81de37..c5aa4f896f8 100644 --- a/beacon_node/beacon_chain/src/data_availability_checker.rs +++ b/beacon_node/beacon_chain/src/data_availability_checker.rs @@ -96,14 +96,6 @@ impl DataAvailabilityChecker { .get_execution_valid_block_summary(block_root) } - /// Return the required blobs `block_root` expects if the block is currenlty in the cache. - pub fn num_expected_blobs(&self, block_root: &Hash256) -> Option { - self.availability_cache - .peek_pending_components(block_root, |components| { - components.and_then(|components| components.num_expected_blobs()) - }) - } - /// Return the set of imported blob indexes for `block_root`. Returns None if there is no block /// component for `block_root`. pub fn imported_blob_indexes(&self, block_root: &Hash256) -> Option> { diff --git a/beacon_node/network/src/sync/block_lookups/tests.rs b/beacon_node/network/src/sync/block_lookups/tests.rs index 5a85e57f632..70a8c6174d4 100644 --- a/beacon_node/network/src/sync/block_lookups/tests.rs +++ b/beacon_node/network/src/sync/block_lookups/tests.rs @@ -1452,13 +1452,16 @@ fn block_in_processing_cache_becomes_invalid() { let peer_id = r.new_connected_peer(); r.insert_block_to_processing_cache(block.clone().into()); r.trigger_unknown_block_from_attestation(block_root, peer_id); + // Should trigger blob request + let id = r.expect_blob_lookup_request(block_root); // Should not trigger block request r.expect_empty_network(); // Simulate invalid block, removing it from processing cache r.simulate_block_gossip_processing_becomes_invalid(block_root); // Should download block, then issue blobs request r.complete_lookup_block_download(block); - let id = r.expect_blob_lookup_request(block_root); + // Should not trigger block or blob request + r.expect_empty_network(); r.complete_lookup_block_import_valid(block_root, false); // Resolve blob and expect lookup completed r.complete_single_lookup_blob_lookup_valid(id, peer_id, blobs, true); @@ -1475,11 +1478,14 @@ fn block_in_processing_cache_becomes_valid_imported() { let peer_id = r.new_connected_peer(); r.insert_block_to_processing_cache(block.clone().into()); r.trigger_unknown_block_from_attestation(block_root, peer_id); + // Should trigger blob request + let id = r.expect_blob_lookup_request(block_root); // Should not trigger block request r.expect_empty_network(); // Resolve the block from processing step r.simulate_block_gossip_processing_becomes_valid_missing_components(block.into()); - let id = r.expect_blob_lookup_request(block_root); + // Should not trigger block or blob request + r.expect_empty_network(); // Resolve blob and expect lookup completed r.complete_single_lookup_blob_lookup_valid(id, peer_id, blobs, true); r.expect_no_active_lookups();