mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-01 05:37:05 +00:00
Remove generic Id param from RequestId (#6032)
* rename RequestId's for better context, and move them to lighthouse_network crate. * remove unrequired generic AppReqId from RequestID
This commit is contained in:
@@ -2,10 +2,10 @@ use crate::sync::block_lookups::single_block_lookup::{
|
||||
LookupRequestError, SingleBlockLookup, SingleLookupRequestState,
|
||||
};
|
||||
use crate::sync::block_lookups::{BlobRequestState, BlockRequestState, PeerId};
|
||||
use crate::sync::manager::Id;
|
||||
use crate::sync::network_context::{LookupRequestResult, SyncNetworkContext};
|
||||
use beacon_chain::block_verification_types::RpcBlock;
|
||||
use beacon_chain::BeaconChainTypes;
|
||||
use lighthouse_network::service::api_types::Id;
|
||||
use std::sync::Arc;
|
||||
use types::blob_sidecar::FixedBlobSidecarList;
|
||||
use types::SignedBeaconBlock;
|
||||
|
||||
@@ -28,12 +28,12 @@ use super::network_context::{RpcResponseResult, SyncNetworkContext};
|
||||
use crate::metrics;
|
||||
use crate::sync::block_lookups::common::ResponseType;
|
||||
use crate::sync::block_lookups::parent_chain::find_oldest_fork_ancestor;
|
||||
use crate::sync::manager::{Id, SingleLookupReqId};
|
||||
use beacon_chain::block_verification_types::AsBlock;
|
||||
use beacon_chain::data_availability_checker::AvailabilityCheckErrorCategory;
|
||||
use beacon_chain::{AvailabilityProcessingStatus, BeaconChainTypes, BlockError};
|
||||
pub use common::RequestState;
|
||||
use fnv::FnvHashMap;
|
||||
use lighthouse_network::service::api_types::SingleLookupReqId;
|
||||
use lighthouse_network::{PeerAction, PeerId};
|
||||
use lru_cache::LRUTimeCache;
|
||||
pub use single_block_lookup::{BlobRequestState, BlockRequestState};
|
||||
@@ -107,6 +107,9 @@ pub struct BlockLookups<T: BeaconChainTypes> {
|
||||
log: Logger,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
use lighthouse_network::service::api_types::Id;
|
||||
|
||||
#[cfg(test)]
|
||||
/// Tuple of `SingleLookupId`, requested block root, awaiting parent block root (if any),
|
||||
/// and list of peers that claim to have imported this set of block components.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use super::common::ResponseType;
|
||||
use super::{BlockComponent, PeerId, SINGLE_BLOCK_LOOKUP_MAX_ATTEMPTS};
|
||||
use crate::sync::block_lookups::common::RequestState;
|
||||
use crate::sync::block_lookups::Id;
|
||||
use crate::sync::network_context::{
|
||||
LookupRequestResult, ReqId, RpcRequestSendError, SendErrorProcessor, SyncNetworkContext,
|
||||
};
|
||||
use beacon_chain::BeaconChainTypes;
|
||||
use derivative::Derivative;
|
||||
use lighthouse_network::service::api_types::Id;
|
||||
use rand::seq::IteratorRandom;
|
||||
use std::collections::HashSet;
|
||||
use std::fmt::Debug;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
use crate::network_beacon_processor::NetworkBeaconProcessor;
|
||||
|
||||
use crate::service::RequestId;
|
||||
use crate::sync::manager::{
|
||||
BlockProcessType, RequestId as SyncRequestId, SingleLookupReqId, SyncManager,
|
||||
};
|
||||
use crate::sync::manager::{BlockProcessType, SyncManager};
|
||||
use crate::sync::SyncMessage;
|
||||
use crate::NetworkMessage;
|
||||
use std::sync::Arc;
|
||||
@@ -24,6 +21,7 @@ use beacon_chain::{
|
||||
};
|
||||
use beacon_processor::WorkEvent;
|
||||
use lighthouse_network::rpc::{RPCError, RPCResponseErrorCode};
|
||||
use lighthouse_network::service::api_types::{AppRequestId, Id, SingleLookupReqId, SyncRequestId};
|
||||
use lighthouse_network::types::SyncState;
|
||||
use lighthouse_network::{NetworkGlobals, Request};
|
||||
use slog::info;
|
||||
@@ -550,7 +548,7 @@ impl TestRig {
|
||||
while let Ok(request_id) = self.pop_received_network_event(|ev| match ev {
|
||||
NetworkMessage::SendRequest {
|
||||
peer_id,
|
||||
request_id: RequestId::Sync(id),
|
||||
request_id: AppRequestId::Sync(id),
|
||||
..
|
||||
} if *peer_id == disconnected_peer_id => Some(*id),
|
||||
_ => None,
|
||||
@@ -631,7 +629,7 @@ impl TestRig {
|
||||
NetworkMessage::SendRequest {
|
||||
peer_id: _,
|
||||
request: Request::BlocksByRoot(request),
|
||||
request_id: RequestId::Sync(SyncRequestId::SingleBlock { id }),
|
||||
request_id: AppRequestId::Sync(SyncRequestId::SingleBlock { id }),
|
||||
} if request.block_roots().to_vec().contains(&for_block) => Some(*id),
|
||||
_ => None,
|
||||
})
|
||||
@@ -651,7 +649,7 @@ impl TestRig {
|
||||
NetworkMessage::SendRequest {
|
||||
peer_id: _,
|
||||
request: Request::BlobsByRoot(request),
|
||||
request_id: RequestId::Sync(SyncRequestId::SingleBlob { id }),
|
||||
request_id: AppRequestId::Sync(SyncRequestId::SingleBlob { id }),
|
||||
} if request
|
||||
.blob_ids
|
||||
.to_vec()
|
||||
@@ -676,7 +674,7 @@ impl TestRig {
|
||||
NetworkMessage::SendRequest {
|
||||
peer_id: _,
|
||||
request: Request::BlocksByRoot(request),
|
||||
request_id: RequestId::Sync(SyncRequestId::SingleBlock { id }),
|
||||
request_id: AppRequestId::Sync(SyncRequestId::SingleBlock { id }),
|
||||
} if request.block_roots().to_vec().contains(&for_block) => Some(*id),
|
||||
_ => None,
|
||||
})
|
||||
@@ -698,7 +696,7 @@ impl TestRig {
|
||||
NetworkMessage::SendRequest {
|
||||
peer_id: _,
|
||||
request: Request::BlobsByRoot(request),
|
||||
request_id: RequestId::Sync(SyncRequestId::SingleBlob { id }),
|
||||
request_id: AppRequestId::Sync(SyncRequestId::SingleBlob { id }),
|
||||
} if request
|
||||
.blob_ids
|
||||
.to_vec()
|
||||
|
||||
Reference in New Issue
Block a user