mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-15 09:48:20 +00:00
Merge remote-tracking branch 'sigp/unstable' into gloas-lookup-sync-fixes
This commit is contained in:
@@ -1470,12 +1470,6 @@ impl TestRig {
|
||||
self.assert_empty_network();
|
||||
}
|
||||
|
||||
fn assert_pending_lookup_sync(&self) {
|
||||
assert!(self.created_lookups() > 0, "no created lookups");
|
||||
assert_eq!(self.dropped_lookups(), 0, "some dropped lookups");
|
||||
assert_eq!(self.completed_lookups(), 0, "some completed lookups");
|
||||
}
|
||||
|
||||
/// Assert there is at least one range sync chain created and that all sync chains completed
|
||||
pub(super) fn assert_successful_range_sync(&self) {
|
||||
assert!(
|
||||
@@ -1565,15 +1559,6 @@ impl TestRig {
|
||||
genesis_fork().fulu_enabled().then(Self::default)
|
||||
}
|
||||
|
||||
fn new_after_deneb_before_fulu() -> Option<Self> {
|
||||
let fork = genesis_fork();
|
||||
if fork.deneb_enabled() && !fork.fulu_enabled() {
|
||||
Some(Self::default())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_fulu_peer_test(fulu_test_type: FuluTestType) -> Option<Self> {
|
||||
genesis_fork().fulu_enabled().then(|| {
|
||||
Self::new(TestRigConfig {
|
||||
@@ -1912,56 +1897,6 @@ impl TestRig {
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_block_to_da_checker_as_pre_execution(&mut self, block: Arc<SignedBeaconBlock<E>>) {
|
||||
self.log(&format!(
|
||||
"Inserting block to availability_cache as pre_execution_block {:?}",
|
||||
block.canonical_root()
|
||||
));
|
||||
self.harness
|
||||
.chain
|
||||
.data_availability_checker
|
||||
.put_pre_execution_block(block.canonical_root(), block, BlockImportSource::Gossip)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn simulate_block_gossip_processing_becomes_invalid(&mut self, block_root: Hash256) {
|
||||
self.log(&format!(
|
||||
"Marking block {block_root:?} in da_checker as execution error"
|
||||
));
|
||||
self.harness
|
||||
.chain
|
||||
.data_availability_checker
|
||||
.remove_block_on_execution_error(&block_root);
|
||||
|
||||
self.send_sync_message(SyncMessage::GossipBlockProcessResult {
|
||||
block_root,
|
||||
imported: false,
|
||||
});
|
||||
}
|
||||
|
||||
async fn simulate_block_gossip_processing_becomes_valid(
|
||||
&mut self,
|
||||
block: Arc<SignedBeaconBlock<E>>,
|
||||
) {
|
||||
let block_root = block.canonical_root();
|
||||
|
||||
match self.import_block_to_da_checker(block).await {
|
||||
AvailabilityProcessingStatus::Imported(block_root) => {
|
||||
self.log(&format!(
|
||||
"insert block to da_checker and it imported {block_root:?}"
|
||||
));
|
||||
}
|
||||
AvailabilityProcessingStatus::MissingComponents(_, _) => {
|
||||
panic!("block not imported after adding to da_checker");
|
||||
}
|
||||
}
|
||||
|
||||
self.send_sync_message(SyncMessage::GossipBlockProcessResult {
|
||||
block_root,
|
||||
imported: false,
|
||||
});
|
||||
}
|
||||
|
||||
fn requests_count(&self) -> HashMap<&'static str, usize> {
|
||||
let mut requests_count = HashMap::new();
|
||||
for (request, _) in &self.requests {
|
||||
@@ -2584,48 +2519,6 @@ async fn block_in_da_checker_skips_download() {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn block_in_processing_cache_becomes_invalid() {
|
||||
let Some(mut r) = TestRig::new_after_deneb_before_fulu() else {
|
||||
return;
|
||||
};
|
||||
r.build_chain(1).await;
|
||||
let block = r.block_at_slot(1);
|
||||
r.insert_block_to_da_checker_as_pre_execution(block.clone());
|
||||
r.trigger_with_last_block();
|
||||
r.simulate(SimulateConfig::happy_path()).await;
|
||||
r.assert_pending_lookup_sync();
|
||||
// Here the only active lookup is waiting for the block to finish processing
|
||||
|
||||
// Simulate invalid block, removing it from processing cache
|
||||
r.simulate_block_gossip_processing_becomes_invalid(block.canonical_root());
|
||||
// Should download block, then issue blobs request
|
||||
r.simulate(SimulateConfig::happy_path()).await;
|
||||
r.assert_successful_lookup_sync();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn block_in_processing_cache_becomes_valid_imported() {
|
||||
let Some(mut r) = TestRig::new_after_deneb_before_fulu() else {
|
||||
return;
|
||||
};
|
||||
r.build_chain(1).await;
|
||||
let block = r.block_at_slot(1);
|
||||
r.insert_block_to_da_checker_as_pre_execution(block.clone());
|
||||
r.trigger_with_last_block();
|
||||
r.simulate(SimulateConfig::happy_path()).await;
|
||||
r.assert_pending_lookup_sync();
|
||||
// Here the only active lookup is waiting for the block to finish processing
|
||||
|
||||
// Resolve the block from processing step
|
||||
r.simulate_block_gossip_processing_becomes_valid(block)
|
||||
.await;
|
||||
// Should not trigger block or blob request
|
||||
r.assert_empty_network();
|
||||
// Resolve blob and expect lookup completed
|
||||
r.assert_no_active_lookups();
|
||||
}
|
||||
|
||||
macro_rules! fulu_peer_matrix_tests {
|
||||
(
|
||||
[$($name:ident => $variant:expr),+ $(,)?]
|
||||
|
||||
Reference in New Issue
Block a user