Skip to content

Commit

Permalink
Remove legacy block requests
Browse files Browse the repository at this point in the history
  • Loading branch information
timorleph committed Oct 6, 2023
1 parent cc16cc1 commit 8bf4309
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 81 deletions.
8 changes: 0 additions & 8 deletions finality-aleph/src/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ pub use gossip::{
use network_clique::{AddressingInformation, NetworkIdentity, PeerId};
pub use substrate::{ProtocolNaming, SubstrateNetwork};

use crate::BlockId;

/// Abstraction for requesting stale blocks.
pub trait RequestBlocks: Clone + Send + Sync + 'static {
/// Request the given block -- this is supposed to be used only for "old forks".
fn request_stale_block(&self, block: BlockId);
}

/// A basic alias for properties we expect basic data to satisfy.
pub trait Data: Clone + Codec + Send + Sync + 'static {}

Expand Down
27 changes: 3 additions & 24 deletions finality-aleph/src/network/substrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,17 @@ use log::{error, trace};
use sc_network::{
multiaddr::Protocol as MultiaddressProtocol, Event as SubstrateEvent, Multiaddr,
NetworkEventStream as _, NetworkNotification, NetworkPeers, NetworkService,
NetworkSyncForkRequest, NotificationSenderT, PeerId, ProtocolName,
NotificationSenderT, PeerId, ProtocolName,
};
use sc_network_common::{
sync::{SyncEvent, SyncEventStream},
ExHashT,
};
use sc_network_sync::SyncingService;
use sp_runtime::traits::{Block, Header};
use sp_runtime::traits::Block;
use tokio::select;

use crate::{
aleph_primitives::{BlockHash, BlockNumber},
network::{
gossip::{Event, EventStream, NetworkSender, Protocol, RawNetwork},
RequestBlocks,
},
BlockId,
};

impl<B> RequestBlocks for Arc<SyncingService<B>>
where
B: Block<Hash = BlockHash>,
B::Header: Header<Number = BlockNumber>,
{
fn request_stale_block(&self, block_id: BlockId) {
// The below comment is adapted from substrate:
// Notifies the sync service to try and sync the given block from the given peers. If the given vector
// of peers is empty (as in our case) then the underlying implementation should make a best effort to fetch
// the block from any peers it is connected to.
SyncingService::set_sync_fork_request(self, Vec::new(), block_id.hash, block_id.number)
}
}
use crate::network::gossip::{Event, EventStream, NetworkSender, Protocol, RawNetwork};

/// Name of the network protocol used by Aleph Zero to disseminate validator
/// authentications.
Expand Down
11 changes: 3 additions & 8 deletions finality-aleph/src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use crate::{
session_map::{AuthorityProviderImpl, FinalityNotifierImpl, SessionMapUpdater},
sync::{
ChainStatus, FinalizationStatus, Justification, JustificationTranslator,
OldSyncCompatibleRequestBlocks, Service as SyncService, SubstrateChainStatusNotifier,
SubstrateFinalizationInfo, VerifierCache, IO as SyncIO,
Service as SyncService, SubstrateChainStatusNotifier, SubstrateFinalizationInfo,
VerifierCache, IO as SyncIO,
},
AlephConfig,
};
Expand Down Expand Up @@ -116,8 +116,6 @@ where
);
let gossip_network_task = async move { gossip_network_service.run().await };

let block_requester = sync_network.clone();

let map_updater = SessionMapUpdater::new(
AuthorityProviderImpl::new(client.clone()),
FinalityNotifierImpl::new(client.clone()),
Expand Down Expand Up @@ -186,9 +184,6 @@ where
spawn_handle.spawn("aleph/gossip_network", gossip_network_task);
debug!(target: "aleph-party", "Gossip network has started.");

let compatible_block_request =
OldSyncCompatibleRequestBlocks::new(block_requester.clone(), request_block);

let party = ConsensusParty::new(ConsensusPartyParams {
session_authorities,
sync_oracle,
Expand All @@ -204,7 +199,7 @@ where
unit_creation_delay,
justifications_for_sync,
JustificationTranslator::new(chain_status.clone()),
compatible_block_request,
request_block,
metrics,
spawn_handle,
connection_manager,
Expand Down
39 changes: 0 additions & 39 deletions finality-aleph/src/sync/compatibility.rs

This file was deleted.

2 changes: 0 additions & 2 deletions finality-aleph/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use parity_scale_codec::Codec;

use crate::BlockId;

mod compatibility;
mod data;
mod forest;
mod handler;
Expand All @@ -22,7 +21,6 @@ mod task_queue;
mod tasks;
mod ticker;

pub use compatibility::OldSyncCompatibleRequestBlocks;
pub use service::{Service, IO};
pub use substrate::{
Justification as SubstrateJustification, JustificationTranslator, SessionVerifier,
Expand Down

0 comments on commit 8bf4309

Please sign in to comment.