mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-15 17:58:23 +00:00
Merge remote-tracking branch 'sigp/unstable' into gloas-lookup-sync-fixes
# Conflicts: # beacon_node/network/src/sync/manager.rs
This commit is contained in:
@@ -548,13 +548,19 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn no_blobs_into_responses() {
|
||||
let spec = Arc::new(test_spec::<E>());
|
||||
|
||||
let mut u = types::test_utils::test_unstructured();
|
||||
let blocks = (0..4)
|
||||
.map(|_| {
|
||||
generate_rand_block_and_blobs::<E>(ForkName::Base, NumBlobs::None, &mut u)
|
||||
.unwrap()
|
||||
.0
|
||||
.into()
|
||||
generate_rand_block_and_blobs::<E>(
|
||||
spec.fork_name_at_epoch(Epoch::new(0)),
|
||||
NumBlobs::None,
|
||||
&mut u,
|
||||
)
|
||||
.unwrap()
|
||||
.0
|
||||
.into()
|
||||
})
|
||||
.collect::<Vec<Arc<SignedBeaconBlock<E>>>>();
|
||||
|
||||
@@ -565,7 +571,6 @@ mod tests {
|
||||
// Send blocks and complete terminate response
|
||||
info.add_blocks(blocks_req_id, blocks).unwrap();
|
||||
|
||||
let spec = Arc::new(test_spec::<E>());
|
||||
let da_checker = Arc::new(test_da_checker(spec.clone(), NodeCustodyType::Fullnode));
|
||||
|
||||
// Assert response is finished and RpcBlocks can be constructed
|
||||
|
||||
@@ -182,7 +182,9 @@ pub enum SyncMessage<E: EthSpec> {
|
||||
result: BlockProcessingResult,
|
||||
},
|
||||
|
||||
/// A block from gossip has completed processing,
|
||||
/// A gossip-received component has completed processing and the block may now be imported.
|
||||
/// In Fulu this is sent after block or blob processing. In Gloas this is also sent after
|
||||
/// data column or payload envelope processing triggers availability.
|
||||
GossipBlockProcessResult { block_root: Hash256, imported: bool },
|
||||
}
|
||||
|
||||
|
||||
@@ -1180,10 +1180,22 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
block_root: Hash256,
|
||||
lookup_peers: Arc<RwLock<HashSet<PeerId>>>,
|
||||
) -> Result<LookupRequestResult, RpcRequestSendError> {
|
||||
let slot = self
|
||||
.chain
|
||||
.canonical_head
|
||||
.fork_choice_read_lock()
|
||||
.get_block(&block_root)
|
||||
.map(|block| block.slot)
|
||||
.or_else(|| self.chain.slot().ok())
|
||||
.ok_or_else(|| {
|
||||
RpcRequestSendError::InternalError(format!(
|
||||
"Unable to determine slot for block {block_root:?}"
|
||||
))
|
||||
})?;
|
||||
|
||||
let custody_indexes_imported = self
|
||||
.chain
|
||||
.data_availability_checker
|
||||
.cached_data_column_indexes(&block_root)
|
||||
.cached_data_column_indexes(&block_root, slot)
|
||||
.unwrap_or_default();
|
||||
|
||||
let current_epoch = self.chain.epoch().map_err(|e| {
|
||||
|
||||
@@ -2160,8 +2160,7 @@ async fn too_many_processing_failures(depth: usize) {
|
||||
r.build_chain_and_trigger_last_block(depth).await;
|
||||
// Simulate that a peer always returns empty
|
||||
r.simulate(
|
||||
SimulateConfig::new()
|
||||
.with_process_result(|| BlockProcessingResult::Err(BlockError::BlockSlotLimitReached)),
|
||||
SimulateConfig::new().with_process_result(|| BlockError::BlockSlotLimitReached.into()),
|
||||
)
|
||||
.await;
|
||||
// We register multiple penalties, the lookup fails and sync does not progress
|
||||
@@ -2229,9 +2228,10 @@ async fn test_single_block_lookup_duplicate_response() {
|
||||
let mut r = TestRig::default();
|
||||
r.build_chain_and_trigger_last_block(1).await;
|
||||
// Send a DuplicateFullyImported response, the lookup should complete successfully
|
||||
r.simulate(SimulateConfig::new().with_process_result(|| {
|
||||
BlockProcessingResult::Err(BlockError::DuplicateFullyImported(Hash256::ZERO))
|
||||
}))
|
||||
r.simulate(
|
||||
SimulateConfig::new()
|
||||
.with_process_result(|| BlockError::DuplicateFullyImported(Hash256::ZERO).into()),
|
||||
)
|
||||
.await;
|
||||
// The block was not actually imported
|
||||
r.assert_head_slot(0);
|
||||
|
||||
Reference in New Issue
Block a user