Merge branch 'unstable' into gloas-lookup-sync-fixes

This commit is contained in:
dapplion
2026-06-04 14:04:26 +02:00
4 changed files with 148 additions and 23 deletions

View File

@@ -31,13 +31,15 @@ use lighthouse_network::{
types::SyncState,
};
use slot_clock::{SlotClock, TestingSlotClock};
use std::collections::HashSet;
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::mpsc;
use tracing::info;
use types::{
BlobSidecar, BlockImportSource, ColumnIndex, DataColumnSidecar, ForkContext, ForkName, Hash256,
MinimalEthSpec as E, SignedBeaconBlock, SignedExecutionPayloadEnvelope, Slot,
BlobSidecar, BlockImportSource, ColumnIndex, DataColumnSidecar, DataColumnSubnetId,
ForkContext, ForkName, Hash256, MinimalEthSpec as E, SignedBeaconBlock,
SignedExecutionPayloadEnvelope, Slot,
};
const D: Duration = Duration::new(0, 0);
@@ -1535,7 +1537,7 @@ impl TestRig {
.network_globals
.peers
.write()
.__add_connected_peer_testing_only(false, &self.harness.spec, key);
.__add_connected_peer_with_custody_subnets(false, &self.harness.spec, key);
// Assumes custody subnet count == column count
let custody_subnets = self
@@ -1566,13 +1568,38 @@ impl TestRig {
.network_globals
.peers
.write()
.__add_connected_peer_testing_only(true, &self.harness.spec, key);
.__add_connected_peer_with_custody_subnets(true, &self.harness.spec, key);
self.log(&format!(
"Added new peer for testing {peer_id:?}, custody: supernode"
));
peer_id
}
/// Add a connected supernode peer, but without setting the peers' custody subnet.
/// This is to simulate the real behaviour where metadata is only received some time after
/// a connection is established.
pub fn new_connected_supernode_peer_no_metadata_custody_subnet(&mut self) -> PeerId {
let key = self.determinstic_key();
self.network_globals
.peers
.write()
.__add_connected_peer(true, key, &self.harness.spec)
}
/// Update the peer's custody subnet in PeerDB and send a `UpdatedPeerCgc` message to sync.
pub fn send_peer_cgc_update_to_sync(
&mut self,
peer_id: &PeerId,
subnets: HashSet<DataColumnSubnetId>,
) {
self.network_globals
.peers
.write()
.__set_custody_subnets(peer_id, subnets)
.unwrap();
self.send_sync_message(SyncMessage::UpdatedPeerCgc(*peer_id))
}
fn determinstic_key(&mut self) -> CombinedKey {
k256::ecdsa::SigningKey::random(&mut self.rng_08).into()
}