Skip to content

Commit

Permalink
fix tests and remove unused method
Browse files Browse the repository at this point in the history
  • Loading branch information
realbigsean committed May 24, 2024
1 parent dbcd7d1 commit 2b55017
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 0 additions & 8 deletions beacon_node/beacon_chain/src/data_availability_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ impl<T: BeaconChainTypes> DataAvailabilityChecker<T> {
.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<usize> {
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<Vec<u64>> {
Expand Down
10 changes: 8 additions & 2 deletions beacon_node/network/src/sync/block_lookups/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down

0 comments on commit 2b55017

Please sign in to comment.