mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
update code paths in the network crate (#4065)
* wip * fix router * arc the byroot responses we send * add placeholder for blob verification * respond to blobs by range and blobs by root request in the most horrible and gross way ever * everything in sync is now unimplemented * fix compiation issues * http_pi change is very small, just add it * remove ctrl-c ctrl-v's docs
This commit is contained in:
@@ -56,9 +56,7 @@ use std::ops::Sub;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::sync::mpsc;
|
||||
use types::{
|
||||
BlobsSidecar, EthSpec, Hash256, SignedBeaconBlock, SignedBeaconBlockAndBlobsSidecar, Slot,
|
||||
};
|
||||
use types::{BlobSidecar, EthSpec, Hash256, SignedBeaconBlock, Slot};
|
||||
|
||||
/// The number of slots ahead of us that is allowed before requesting a long-range (batch) Sync
|
||||
/// from a peer. If a peer is within this tolerance (forwards or backwards), it is treated as a
|
||||
@@ -106,15 +104,7 @@ pub enum SyncMessage<T: EthSpec> {
|
||||
RpcBlobs {
|
||||
request_id: RequestId,
|
||||
peer_id: PeerId,
|
||||
blob_sidecar: Option<Arc<BlobsSidecar<T>>>,
|
||||
seen_timestamp: Duration,
|
||||
},
|
||||
|
||||
/// A block and blobs have been received from the RPC.
|
||||
RpcBlockAndBlobs {
|
||||
request_id: RequestId,
|
||||
peer_id: PeerId,
|
||||
block_and_blobs: Option<SignedBeaconBlockAndBlobsSidecar<T>>,
|
||||
blob_sidecar: Option<Arc<BlobSidecar<T>>>,
|
||||
seen_timestamp: Duration,
|
||||
},
|
||||
|
||||
@@ -654,17 +644,6 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
blob_sidecar,
|
||||
seen_timestamp,
|
||||
} => self.rpc_blobs_received(request_id, peer_id, blob_sidecar, seen_timestamp),
|
||||
SyncMessage::RpcBlockAndBlobs {
|
||||
request_id,
|
||||
peer_id,
|
||||
block_and_blobs,
|
||||
seen_timestamp,
|
||||
} => self.rpc_block_block_and_blobs_received(
|
||||
request_id,
|
||||
peer_id,
|
||||
block_and_blobs,
|
||||
seen_timestamp,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -897,7 +876,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
&mut self,
|
||||
request_id: RequestId,
|
||||
peer_id: PeerId,
|
||||
maybe_sidecar: Option<Arc<BlobsSidecar<<T>::EthSpec>>>,
|
||||
maybe_blob: Option<Arc<BlobSidecar<<T>::EthSpec>>>,
|
||||
_seen_timestamp: Duration,
|
||||
) {
|
||||
match request_id {
|
||||
@@ -907,48 +886,17 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
RequestId::BackFillBlocks { .. } => {
|
||||
unreachable!("An only blocks request does not receive sidecars")
|
||||
}
|
||||
RequestId::BackFillBlobs { id } => {
|
||||
self.blobs_backfill_response(id, peer_id, maybe_sidecar.into())
|
||||
RequestId::BackFillBlobs { .. } => {
|
||||
unimplemented!("Adjust backfill sync");
|
||||
}
|
||||
RequestId::RangeBlocks { .. } => {
|
||||
unreachable!("Only-blocks range requests don't receive sidecars")
|
||||
}
|
||||
RequestId::RangeBlobs { id } => {
|
||||
self.blobs_range_response(id, peer_id, maybe_sidecar.into())
|
||||
unimplemented!("Adjust range");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn rpc_block_block_and_blobs_received(
|
||||
&mut self,
|
||||
request_id: RequestId,
|
||||
peer_id: PeerId,
|
||||
block_sidecar_pair: Option<SignedBeaconBlockAndBlobsSidecar<T::EthSpec>>,
|
||||
seen_timestamp: Duration,
|
||||
) {
|
||||
match request_id {
|
||||
RequestId::SingleBlock { id } => self.block_lookups.single_block_lookup_response(
|
||||
id,
|
||||
peer_id,
|
||||
block_sidecar_pair.map(|block_sidecar_pair| block_sidecar_pair.into()),
|
||||
seen_timestamp,
|
||||
&mut self.network,
|
||||
),
|
||||
RequestId::ParentLookup { id } => self.block_lookups.parent_lookup_response(
|
||||
id,
|
||||
peer_id,
|
||||
block_sidecar_pair.map(|block_sidecar_pair| block_sidecar_pair.into()),
|
||||
seen_timestamp,
|
||||
&mut self.network,
|
||||
),
|
||||
RequestId::BackFillBlocks { .. }
|
||||
| RequestId::BackFillBlobs { .. }
|
||||
| RequestId::RangeBlocks { .. }
|
||||
| RequestId::RangeBlobs { .. } => unreachable!(
|
||||
"since range requests are not block-glob coupled, this should never be reachable"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<IgnoredOkVal, T: EthSpec> From<Result<IgnoredOkVal, BlockError<T>>> for BlockProcessResult<T> {
|
||||
|
||||
@@ -426,7 +426,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
"count" => request.block_roots.len(),
|
||||
"peer" => %peer_id
|
||||
);
|
||||
Request::BlobsByRoot(request.into())
|
||||
unimplemented!("There is no longer such thing as a single block lookup, since we nede to ask for blobs and blocks separetely");
|
||||
} else {
|
||||
trace!(
|
||||
self.log,
|
||||
@@ -467,7 +467,9 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
"count" => request.block_roots.len(),
|
||||
"peer" => %peer_id
|
||||
);
|
||||
Request::BlobsByRoot(request.into())
|
||||
unimplemented!(
|
||||
"Parent requests now need to interleave blocks and blobs or something like that."
|
||||
)
|
||||
} else {
|
||||
trace!(
|
||||
self.log,
|
||||
|
||||
Reference in New Issue
Block a user