Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor deneb networking #4561

Merged
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b2246c6
Revert "fix merge"
realbigsean Jul 14, 2023
b19883e
refactor deneb block processing
realbigsean Jul 14, 2023
e3ee0c6
cargo fmt
realbigsean Jul 14, 2023
985bbc5
Merge branch 'merge-unstable-deneb-jul-14' of https://github.com/real…
realbigsean Jul 17, 2023
8a6e8d5
make block and blob single lookups generic
realbigsean Jul 25, 2023
c2d8ac0
Merge branch 'deneb-free-blobs' of https://github.com/sigp/lighthouse…
realbigsean Jul 25, 2023
fd0fd3d
Merge branch 'deneb-free-blobs' of https://github.com/sigp/lighthouse…
realbigsean Jul 25, 2023
e27161e
get tests compiling
realbigsean Jul 25, 2023
6bcfaf4
clean up everything add child component, fix peer scoring and retry l…
realbigsean Aug 1, 2023
4215160
smol cleanup and a bugfix
realbigsean Aug 1, 2023
c71e011
remove ParentLookupReqId
realbigsean Aug 1, 2023
122def5
Update beacon_node/network/src/sync/manager.rs
realbigsean Aug 3, 2023
5736891
Update beacon_node/network/src/sync/manager.rs
realbigsean Aug 3, 2023
064bf64
update unreachables to crits
realbigsean Aug 3, 2023
460f712
Revert "update unreachables to crits"
realbigsean Aug 3, 2023
74373a9
update make request/build request to make more sense
realbigsean Aug 3, 2023
af5e0d4
pr feedback
realbigsean Aug 3, 2023
ba1dc38
Merge branch 'deneb-free-blobs' of https://github.com/sigp/lighthouse…
realbigsean Aug 4, 2023
335e57d
Update beacon_node/network/src/sync/block_lookups/mod.rs
realbigsean Aug 4, 2023
8404cc8
Update beacon_node/network/src/sync/block_lookups/mod.rs
realbigsean Aug 4, 2023
4db34e9
more pr feedback, fix availability check error handling
realbigsean Aug 4, 2023
1975378
Merge branch 'refactor-deneb-networking' of https://github.com/realbi…
realbigsean Aug 4, 2023
b8c1e53
improve block component processed log
realbigsean Aug 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions beacon_node/beacon_chain/src/block_verification_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use crate::eth1_finalization_cache::Eth1FinalizationData;
use crate::{data_availability_checker, GossipVerifiedBlock, PayloadVerificationOutcome};
use derivative::Derivative;
use ssz_derive::{Decode, Encode};
use ssz_types::VariableList;
use state_processing::ConsensusContext;
use std::sync::Arc;
use types::blob_sidecar::FixedBlobSidecarList;
use types::{
blob_sidecar::BlobIdentifier, ssz_tagged_beacon_state, ssz_tagged_signed_beacon_block,
ssz_tagged_signed_beacon_block_arc,
Expand Down Expand Up @@ -73,6 +75,22 @@ impl<E: EthSpec> RpcBlock<E> {
Ok(Self { block: inner })
}

pub fn new_from_fixed(
block: Arc<SignedBeaconBlock<E>>,
blobs: FixedBlobSidecarList<E>,
) -> Result<Self, AvailabilityCheckError> {
let filtered = blobs
.into_iter()
.filter_map(|b| b.clone())
.collect::<Vec<_>>();
let blobs = if filtered.is_empty() {
None
} else {
Some(VariableList::from(filtered))
};
Self::new(block, blobs)
}

pub fn deconstruct(self) -> (Arc<SignedBeaconBlock<E>>, Option<BlobSidecarList<E>>) {
match self.block {
RpcBlockInner::Block(block) => (block, None),
Expand Down
1 change: 0 additions & 1 deletion beacon_node/beacon_chain/src/data_availability_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub enum AvailabilityCheckError {
num_blobs: usize,
},
MissingBlobs,
TxKzgCommitmentMismatch(String),
KzgCommitmentMismatch {
blob_index: u64,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
AvailabilityCheckError::Kzg(_)
| AvailabilityCheckError::KzgVerificationFailed
| AvailabilityCheckError::NumBlobsMismatch { .. }
| AvailabilityCheckError::TxKzgCommitmentMismatch(_)
| AvailabilityCheckError::BlobIndexInvalid(_)
| AvailabilityCheckError::UnorderedBlobs { .. }
| AvailabilityCheckError::BlockBlobRootMismatch { .. }
Expand Down
4 changes: 4 additions & 0 deletions beacon_node/network/src/network_beacon_processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
seen_timestamp: Duration,
process_type: BlockProcessType,
) -> Result<(), Error<T::EthSpec>> {
let blob_count = blobs.iter().filter(|b| b.is_some()).count();
if blob_count == 0 {
return Ok(());
}
let process_fn = self.clone().generate_rpc_blobs_process_fn(
block_root,
blobs,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::metrics;
use crate::network_beacon_processor::{NetworkBeaconProcessor, FUTURE_SLOT_TOLERANCE};
use crate::sync::manager::ResponseType;
use crate::sync::BatchProcessResult;
use crate::sync::{
manager::{BlockProcessType, SyncMessage},
Expand Down Expand Up @@ -96,7 +95,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
self.send_sync_message(SyncMessage::BlockComponentProcessed {
process_type,
result: crate::sync::manager::BlockProcessingResult::Ignored,
response_type: crate::sync::manager::ResponseType::Block,
});
};
(process_fn, Box::new(ignore_fn))
Expand Down Expand Up @@ -249,7 +247,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
self.send_sync_message(SyncMessage::BlockComponentProcessed {
process_type,
result: result.into(),
response_type: ResponseType::Block,
});

// Drop the handle to remove the entry from the cache
Expand Down Expand Up @@ -301,7 +298,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
self.send_sync_message(SyncMessage::BlockComponentProcessed {
process_type,
result: result.into(),
response_type: ResponseType::Blob,
});
}

Expand Down
41 changes: 32 additions & 9 deletions beacon_node/network/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use lighthouse_network::{
MessageId, NetworkGlobals, PeerId, PeerRequestId, PubsubMessage, Request, Response,
};
use logging::TimeLatch;
use slog::{debug, o, trace};
use slog::{crit, debug, o, trace};
use slog::{error, warn};
use std::sync::Arc;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
Expand Down Expand Up @@ -482,15 +482,22 @@ impl<T: BeaconChainTypes> Router<T> {
) {
let request_id = match request_id {
RequestId::Sync(sync_id) => match sync_id {
SyncId::SingleBlock { .. } | SyncId::ParentLookup { .. } => {
unreachable!("Block lookups do not request BBRange requests")
SyncId::SingleBlock { .. }
| SyncId::SingleBlob { .. }
| SyncId::ParentLookup { .. }
| SyncId::ParentLookupBlob { .. } => {
crit!(self.log, "Block lookups do not request BBRange requests"; "peer_id" => %peer_id);
return;
}
id @ (SyncId::BackFillBlocks { .. }
| SyncId::RangeBlocks { .. }
| SyncId::BackFillBlockAndBlobs { .. }
| SyncId::RangeBlockAndBlobs { .. }) => id,
},
RequestId::Router => unreachable!("All BBRange requests belong to sync"),
RequestId::Router => {
crit!(self.log, "All BBRange requests belong to sync"; "peer_id" => %peer_id);
return;
}
};

trace!(
Expand Down Expand Up @@ -548,10 +555,18 @@ impl<T: BeaconChainTypes> Router<T> {
| SyncId::RangeBlocks { .. }
| SyncId::RangeBlockAndBlobs { .. }
| SyncId::BackFillBlockAndBlobs { .. } => {
unreachable!("Batch syncing do not request BBRoot requests")
crit!(self.log, "Batch syncing do not request BBRoot requests"; "peer_id" => %peer_id);
return;
}
SyncId::SingleBlob { .. } | SyncId::ParentLookupBlob { .. } => {
crit!(self.log, "Blob response to block by roots request"; "peer_id" => %peer_id);
return;
}
},
RequestId::Router => unreachable!("All BBRoot requests belong to sync"),
RequestId::Router => {
crit!(self.log, "All BBRoot requests belong to sync"; "peer_id" => %peer_id);
return;
}
};

trace!(
Expand All @@ -576,15 +591,23 @@ impl<T: BeaconChainTypes> Router<T> {
) {
let request_id = match request_id {
RequestId::Sync(sync_id) => match sync_id {
id @ (SyncId::SingleBlock { .. } | SyncId::ParentLookup { .. }) => id,
id @ (SyncId::SingleBlob { .. } | SyncId::ParentLookupBlob { .. }) => id,
SyncId::SingleBlock { .. } | SyncId::ParentLookup { .. } => {
crit!(self.log, "Block response to blobs by roots request"; "peer_id" => %peer_id);
return;
}
SyncId::BackFillBlocks { .. }
| SyncId::RangeBlocks { .. }
| SyncId::RangeBlockAndBlobs { .. }
| SyncId::BackFillBlockAndBlobs { .. } => {
unreachable!("Batch syncing does not request BBRoot requests")
crit!(self.log, "Batch syncing does not request BBRoot requests"; "peer_id" => %peer_id);
return;
}
},
RequestId::Router => unreachable!("All BlobsByRoot requests belong to sync"),
RequestId::Router => {
crit!(self.log, "All BlobsByRoot requests belong to sync"; "peer_id" => %peer_id);
return;
}
};

trace!(
Expand Down
Loading
Loading