mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
fix merge conflict issues
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
use crate::sync::SyncMessage;
|
||||
use beacon_chain::{BeaconChain, BeaconChainTypes};
|
||||
use slog::{crit, warn};
|
||||
use slog::{crit, };
|
||||
use slot_clock::SlotClock;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::time::interval_at;
|
||||
use tokio::time::Instant;
|
||||
use types::Hash256;
|
||||
use types::{ Hash256};
|
||||
use crate::network_beacon_processor::NetworkBeaconProcessor;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum DelayedLookupMessage {
|
||||
@@ -35,7 +35,7 @@ pub fn spawn_delayed_lookup_service<T: BeaconChainTypes>(
|
||||
executor: &task_executor::TaskExecutor,
|
||||
beacon_chain: Arc<BeaconChain<T>>,
|
||||
mut delayed_lookups_recv: mpsc::Receiver<DelayedLookupMessage>,
|
||||
sync_send: mpsc::UnboundedSender<SyncMessage<T::EthSpec>>,
|
||||
beacon_processor: Arc<NetworkBeaconProcessor<T>>,
|
||||
log: slog::Logger,
|
||||
) {
|
||||
executor.spawn(
|
||||
@@ -52,8 +52,8 @@ pub fn spawn_delayed_lookup_service<T: BeaconChainTypes>(
|
||||
} else {
|
||||
delay - seconds_from_current_slot_start
|
||||
};
|
||||
tokio::time::Instant::now() + duration_until_start
|
||||
}
|
||||
Instant::now() + duration_until_start
|
||||
}
|
||||
_ => {
|
||||
crit!(log,
|
||||
"Failed to read slot clock, delayed lookup service timing will be inaccurate.\
|
||||
@@ -69,11 +69,8 @@ pub fn spawn_delayed_lookup_service<T: BeaconChainTypes>(
|
||||
while let Ok(msg) = delayed_lookups_recv.try_recv() {
|
||||
match msg {
|
||||
DelayedLookupMessage::MissingComponents(block_root) => {
|
||||
if let Err(e) = sync_send
|
||||
.send(SyncMessage::MissingGossipBlockComponentsDelayed(block_root))
|
||||
{
|
||||
warn!(log, "Failed to send delayed lookup message"; "error" => ?e);
|
||||
}
|
||||
beacon_processor
|
||||
.send_delayed_lookup(block_root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::HashMap;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::network_beacon_processor::ChainSegmentProcessId;
|
||||
use beacon_chain::{BeaconChainTypes, BlockError};
|
||||
use fnv::FnvHashMap;
|
||||
use lighthouse_network::{PeerAction, PeerId};
|
||||
use lru_cache::LRUTimeCache;
|
||||
use slog::{debug, error, trace, warn, Logger};
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
use store::{Hash256, SignedBeaconBlock};
|
||||
|
||||
use crate::metrics;
|
||||
|
||||
use self::parent_lookup::PARENT_FAIL_TOLERANCE;
|
||||
use self::parent_lookup::{ParentLookup, ParentVerifyError};
|
||||
use self::single_block_lookup::{LookupVerifyError, SingleBlockLookup};
|
||||
@@ -25,10 +7,26 @@ use super::{
|
||||
manager::{BlockProcessType, Id},
|
||||
network_context::SyncNetworkContext,
|
||||
};
|
||||
use crate::beacon_processor::{ChainSegmentProcessId, WorkEvent};
|
||||
use crate::metrics;
|
||||
use crate::network_beacon_processor::ChainSegmentProcessId;
|
||||
use crate::sync::block_lookups::single_block_lookup::LookupId;
|
||||
use beacon_chain::block_verification_types::{AsBlock, RpcBlock};
|
||||
use beacon_chain::data_availability_checker::{AvailabilityCheckError, DataAvailabilityChecker};
|
||||
use beacon_chain::{AvailabilityProcessingStatus, BeaconChainTypes, BlockError};
|
||||
use lighthouse_network::rpc::RPCError;
|
||||
use lighthouse_network::{PeerAction, PeerId};
|
||||
use lru_cache::LRUTimeCache;
|
||||
pub use single_block_lookup::UnknownParentComponents;
|
||||
use slog::{debug, error, trace, warn, Logger};
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Debug;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use store::{Hash256, SignedBeaconBlock};
|
||||
use strum::Display;
|
||||
use types::blob_sidecar::FixedBlobSidecarList;
|
||||
use types::{BlobSidecar, Slot};
|
||||
|
||||
pub(crate) mod delayed_lookup;
|
||||
mod parent_lookup;
|
||||
@@ -36,7 +34,7 @@ mod single_block_lookup;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub type DownloadedBlocks<T> = (Hash256, BlockWrapper<T>);
|
||||
pub type DownloadedBlocks<T> = (Hash256, RpcBlock<T>);
|
||||
pub type RootBlockTuple<T> = (Hash256, Arc<SignedBeaconBlock<T>>);
|
||||
pub type RootBlobsTuple<T> = (Hash256, FixedBlobSidecarList<T>);
|
||||
|
||||
@@ -381,13 +379,13 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
};
|
||||
|
||||
if !has_pending_parent_request {
|
||||
let block_wrapper = request_ref
|
||||
let rpc_block = request_ref
|
||||
.get_downloaded_block()
|
||||
.unwrap_or(BlockWrapper::Block(block));
|
||||
.unwrap_or(RpcBlock::new_without_blobs(block));
|
||||
// This is the correct block, send it for processing
|
||||
match self.send_block_for_processing(
|
||||
block_root,
|
||||
block_wrapper,
|
||||
rpc_block,
|
||||
seen_timestamp,
|
||||
BlockProcessType::SingleBlock { id },
|
||||
cx,
|
||||
@@ -563,14 +561,13 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
match parent_lookup.verify_block(block, &mut self.failed_chains) {
|
||||
Ok(Some((block_root, block))) => {
|
||||
parent_lookup.add_current_request_block(block);
|
||||
if let Some(block_wrapper) =
|
||||
parent_lookup.current_parent_request.get_downloaded_block()
|
||||
if let Some(rpc_block) = parent_lookup.current_parent_request.get_downloaded_block()
|
||||
{
|
||||
let chain_hash = parent_lookup.chain_hash();
|
||||
if self
|
||||
.send_block_for_processing(
|
||||
block_root,
|
||||
block_wrapper,
|
||||
rpc_block,
|
||||
seen_timestamp,
|
||||
BlockProcessType::ParentLookup { chain_hash },
|
||||
cx,
|
||||
@@ -644,13 +641,12 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
Ok(Some((block_root, blobs))) => {
|
||||
parent_lookup.add_current_request_blobs(blobs);
|
||||
let chain_hash = parent_lookup.chain_hash();
|
||||
if let Some(block_wrapper) =
|
||||
parent_lookup.current_parent_request.get_downloaded_block()
|
||||
if let Some(rpc_block) = parent_lookup.current_parent_request.get_downloaded_block()
|
||||
{
|
||||
if self
|
||||
.send_block_for_processing(
|
||||
block_root,
|
||||
block_wrapper,
|
||||
rpc_block,
|
||||
seen_timestamp,
|
||||
BlockProcessType::ParentLookup { chain_hash },
|
||||
cx,
|
||||
@@ -914,11 +910,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
BlockError::ParentUnknown(block) => {
|
||||
let slot = block.slot();
|
||||
let parent_root = block.parent_root();
|
||||
let (block, blobs) = block.deconstruct();
|
||||
request_ref.add_unknown_parent_block(block);
|
||||
if let Some(blobs) = blobs {
|
||||
request_ref.add_unknown_parent_blobs(blobs);
|
||||
}
|
||||
request_ref.add_unknown_parent_components(block.into());
|
||||
self.search_parent(slot, root, parent_root, peer_id.to_peer_id(), cx);
|
||||
ShouldRemoveLookup::False
|
||||
}
|
||||
@@ -1077,7 +1069,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
blocks.push(child_block);
|
||||
};
|
||||
let process_id = ChainSegmentProcessId::ParentLookup(chain_hash);
|
||||
let work = WorkEvent::chain_segment(process_id, blocks);
|
||||
|
||||
match beacon_processor.send_chain_segment(process_id, blocks) {
|
||||
Ok(_) => {
|
||||
@@ -1171,7 +1162,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
.enumerate()
|
||||
.find(|(_, req)| req.block_request_state.requested_block_root == chain_hash)
|
||||
{
|
||||
if let Some((lookup_id, block_wrapper)) =
|
||||
if let Some((lookup_id, rpc_block)) =
|
||||
self.single_block_lookups.get_mut(index).and_then(|lookup| {
|
||||
lookup
|
||||
.get_downloaded_block()
|
||||
@@ -1191,7 +1182,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
if self
|
||||
.send_block_for_processing(
|
||||
chain_hash,
|
||||
block_wrapper,
|
||||
rpc_block,
|
||||
Duration::from_secs(0), //TODO(sean) pipe this through
|
||||
BlockProcessType::SingleBlock { id },
|
||||
cx,
|
||||
@@ -1231,7 +1222,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
fn send_block_for_processing(
|
||||
&mut self,
|
||||
block_root: Hash256,
|
||||
block: BlockWrapper<T::EthSpec>,
|
||||
block: RpcBlock<T::EthSpec>,
|
||||
duration: Duration,
|
||||
process_type: BlockProcessType,
|
||||
cx: &mut SyncNetworkContext<T>,
|
||||
@@ -1274,11 +1265,12 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
if blob_count == 0 {
|
||||
return Ok(());
|
||||
}
|
||||
match cx.processor_channel_if_enabled() {
|
||||
Some(beacon_processor_send) => {
|
||||
match cx.beacon_processor_if_enabled() {
|
||||
Some(beacon_processor) => {
|
||||
trace!(self.log, "Sending blobs for processing"; "block" => ?block_root, "process_type" => ?process_type);
|
||||
let event = WorkEvent::rpc_blobs(block_root, blobs, duration, process_type);
|
||||
if let Err(e) = beacon_processor_send.try_send(event) {
|
||||
if let Err(e) =
|
||||
beacon_processor.send_rpc_blobs(block_root, blobs, duration, process_type)
|
||||
{
|
||||
error!(
|
||||
self.log,
|
||||
"Failed to send sync blobs to processor";
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
#![cfg(feature = "spec-minimal")]
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::network_beacon_processor::NetworkBeaconProcessor;
|
||||
use crate::service::RequestId;
|
||||
use crate::sync::manager::RequestId as SyncId;
|
||||
use crate::NetworkMessage;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::*;
|
||||
|
||||
use beacon_chain::builder::Witness;
|
||||
use beacon_chain::eth1_chain::CachingEth1Backend;
|
||||
use beacon_chain::test_utils::{build_log, BeaconChainHarness, EphemeralHarnessType};
|
||||
use beacon_processor::WorkEvent;
|
||||
use execution_layer::BlobsBundleV1;
|
||||
use lighthouse_network::rpc::RPCResponseErrorCode;
|
||||
use lighthouse_network::{NetworkGlobals, Request};
|
||||
use slog::{Drain, Level};
|
||||
use slot_clock::ManualSlotClock;
|
||||
use slot_clock::{ManualSlotClock, SlotClock, TestingSlotClock};
|
||||
use store::MemoryStore;
|
||||
use tokio::sync::mpsc;
|
||||
use types::{
|
||||
@@ -212,7 +213,7 @@ impl TestRig {
|
||||
},
|
||||
ResponseType::Blob => match self.beacon_processor_rx.try_recv() {
|
||||
Ok(work) => {
|
||||
assert_eq!(work.work_type(), beacon_processor::RPC_BLOB);
|
||||
assert_eq!(work.work_type(), beacon_processor::RPC_BLOBS);
|
||||
}
|
||||
other => panic!("Expected blob process, found {:?}", other),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user