mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 21:45:41 +00:00
remove on_exit from grandpa (#5098)
This commit is contained in:
@@ -154,7 +154,6 @@ pub fn new_full(config: Configuration<GenesisConfig>)
|
|||||||
link: grandpa_link,
|
link: grandpa_link,
|
||||||
network: service.network(),
|
network: service.network(),
|
||||||
inherent_data_providers: inherent_data_providers.clone(),
|
inherent_data_providers: inherent_data_providers.clone(),
|
||||||
on_exit: service.on_exit(),
|
|
||||||
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
|
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
|
||||||
voting_rule: grandpa::VotingRulesBuilder::default().build(),
|
voting_rule: grandpa::VotingRulesBuilder::default().build(),
|
||||||
prometheus_registry: service.prometheus_registry()
|
prometheus_registry: service.prometheus_registry()
|
||||||
|
|||||||
@@ -225,7 +225,6 @@ macro_rules! new_full {
|
|||||||
link: grandpa_link,
|
link: grandpa_link,
|
||||||
network: service.network(),
|
network: service.network(),
|
||||||
inherent_data_providers: inherent_data_providers.clone(),
|
inherent_data_providers: inherent_data_providers.clone(),
|
||||||
on_exit: service.on_exit(),
|
|
||||||
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
|
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
|
||||||
voting_rule: grandpa::VotingRulesBuilder::default().build(),
|
voting_rule: grandpa::VotingRulesBuilder::default().build(),
|
||||||
prometheus_registry: service.prometheus_registry(),
|
prometheus_registry: service.prometheus_registry(),
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ fn register_finality_tracker_inherent_data_provider<Block: BlockT, Client>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Parameters used to run Grandpa.
|
/// Parameters used to run Grandpa.
|
||||||
pub struct GrandpaParams<Block: BlockT, C, N, SC, VR, X> {
|
pub struct GrandpaParams<Block: BlockT, C, N, SC, VR> {
|
||||||
/// Configuration for the GRANDPA service.
|
/// Configuration for the GRANDPA service.
|
||||||
pub config: Config,
|
pub config: Config,
|
||||||
/// A link to the block import worker.
|
/// A link to the block import worker.
|
||||||
@@ -545,8 +545,6 @@ pub struct GrandpaParams<Block: BlockT, C, N, SC, VR, X> {
|
|||||||
pub network: N,
|
pub network: N,
|
||||||
/// The inherent data providers.
|
/// The inherent data providers.
|
||||||
pub inherent_data_providers: InherentDataProviders,
|
pub inherent_data_providers: InherentDataProviders,
|
||||||
/// Handle to a future that will resolve on exit.
|
|
||||||
pub on_exit: X,
|
|
||||||
/// If supplied, can be used to hook on telemetry connection established events.
|
/// If supplied, can be used to hook on telemetry connection established events.
|
||||||
pub telemetry_on_connect: Option<futures::channel::mpsc::UnboundedReceiver<()>>,
|
pub telemetry_on_connect: Option<futures::channel::mpsc::UnboundedReceiver<()>>,
|
||||||
/// A voting rule used to potentially restrict target votes.
|
/// A voting rule used to potentially restrict target votes.
|
||||||
@@ -557,8 +555,8 @@ pub struct GrandpaParams<Block: BlockT, C, N, SC, VR, X> {
|
|||||||
|
|
||||||
/// Run a GRANDPA voter as a task. Provide configuration and a link to a
|
/// Run a GRANDPA voter as a task. Provide configuration and a link to a
|
||||||
/// block import worker that has already been instantiated with `block_import`.
|
/// block import worker that has already been instantiated with `block_import`.
|
||||||
pub fn run_grandpa_voter<Block: BlockT, BE: 'static, C, N, SC, VR, X>(
|
pub fn run_grandpa_voter<Block: BlockT, BE: 'static, C, N, SC, VR>(
|
||||||
grandpa_params: GrandpaParams<Block, C, N, SC, VR, X>,
|
grandpa_params: GrandpaParams<Block, C, N, SC, VR>,
|
||||||
) -> sp_blockchain::Result<impl Future<Output = ()> + Unpin + Send + 'static> where
|
) -> sp_blockchain::Result<impl Future<Output = ()> + Unpin + Send + 'static> where
|
||||||
Block::Hash: Ord,
|
Block::Hash: Ord,
|
||||||
BE: Backend<Block> + 'static,
|
BE: Backend<Block> + 'static,
|
||||||
@@ -567,7 +565,6 @@ pub fn run_grandpa_voter<Block: BlockT, BE: 'static, C, N, SC, VR, X>(
|
|||||||
VR: VotingRule<Block, C> + Clone + 'static,
|
VR: VotingRule<Block, C> + Clone + 'static,
|
||||||
NumberFor<Block>: BlockNumberOps,
|
NumberFor<Block>: BlockNumberOps,
|
||||||
DigestFor<Block>: Encode,
|
DigestFor<Block>: Encode,
|
||||||
X: futures::Future<Output=()> + Clone + Send + Unpin + 'static,
|
|
||||||
C: ClientForGrandpa<Block, BE> + 'static,
|
C: ClientForGrandpa<Block, BE> + 'static,
|
||||||
{
|
{
|
||||||
let GrandpaParams {
|
let GrandpaParams {
|
||||||
@@ -575,7 +572,6 @@ pub fn run_grandpa_voter<Block: BlockT, BE: 'static, C, N, SC, VR, X>(
|
|||||||
link,
|
link,
|
||||||
network,
|
network,
|
||||||
inherent_data_providers,
|
inherent_data_providers,
|
||||||
on_exit,
|
|
||||||
telemetry_on_connect,
|
telemetry_on_connect,
|
||||||
voting_rule,
|
voting_rule,
|
||||||
prometheus_registry,
|
prometheus_registry,
|
||||||
@@ -647,7 +643,7 @@ pub fn run_grandpa_voter<Block: BlockT, BE: 'static, C, N, SC, VR, X>(
|
|||||||
let telemetry_task = telemetry_task
|
let telemetry_task = telemetry_task
|
||||||
.then(|_| future::pending::<()>());
|
.then(|_| future::pending::<()>());
|
||||||
|
|
||||||
Ok(future::select(future::select(voter_work, on_exit), telemetry_task).map(drop))
|
Ok(future::select(voter_work, telemetry_task).map(drop))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Future that powers the voter.
|
/// Future that powers the voter.
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ pub fn run_grandpa_observer<BE, Block: BlockT, Client, N, SC>(
|
|||||||
config: Config,
|
config: Config,
|
||||||
link: LinkHalf<Block, Client, SC>,
|
link: LinkHalf<Block, Client, SC>,
|
||||||
network: N,
|
network: N,
|
||||||
on_exit: impl futures::Future<Output=()> + Clone + Send + Unpin + 'static,
|
) -> sp_blockchain::Result<impl Future<Output = ()> + Unpin + Send + 'static>
|
||||||
) -> sp_blockchain::Result<impl Future<Output = ()> + Unpin + Send + 'static> where
|
where
|
||||||
BE: Backend<Block> + Unpin + 'static,
|
BE: Backend<Block> + Unpin + 'static,
|
||||||
N: NetworkT<Block> + Send + Clone + 'static,
|
N: NetworkT<Block> + Send + Clone + 'static,
|
||||||
SC: SelectChain<Block> + 'static,
|
SC: SelectChain<Block> + 'static,
|
||||||
@@ -194,7 +194,7 @@ pub fn run_grandpa_observer<BE, Block: BlockT, Client, N, SC>(
|
|||||||
warn!("GRANDPA Observer failed: {:?}", e);
|
warn!("GRANDPA Observer failed: {:?}", e);
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(future::select(observer_work, on_exit).map(drop))
|
Ok(observer_work.map(drop))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Future that powers the observer.
|
/// Future that powers the observer.
|
||||||
|
|||||||
@@ -190,17 +190,6 @@ impl TestNetFactory for GrandpaTestNet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
struct Exit;
|
|
||||||
|
|
||||||
impl futures::Future for Exit {
|
|
||||||
type Output = ();
|
|
||||||
|
|
||||||
fn poll(self: Pin<&mut Self>, _: &mut task::Context) -> task::Poll<()> {
|
|
||||||
task::Poll::Pending
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
pub(crate) struct TestApi {
|
pub(crate) struct TestApi {
|
||||||
genesis_authorities: AuthorityList,
|
genesis_authorities: AuthorityList,
|
||||||
@@ -444,7 +433,6 @@ fn run_to_completion_with<F>(
|
|||||||
link: link,
|
link: link,
|
||||||
network: net_service,
|
network: net_service,
|
||||||
inherent_data_providers: InherentDataProviders::new(),
|
inherent_data_providers: InherentDataProviders::new(),
|
||||||
on_exit: Exit,
|
|
||||||
telemetry_on_connect: None,
|
telemetry_on_connect: None,
|
||||||
voting_rule: (),
|
voting_rule: (),
|
||||||
prometheus_registry: None,
|
prometheus_registry: None,
|
||||||
@@ -576,7 +564,6 @@ fn finalize_3_voters_1_full_observer() {
|
|||||||
link: link,
|
link: link,
|
||||||
network: net_service,
|
network: net_service,
|
||||||
inherent_data_providers: InherentDataProviders::new(),
|
inherent_data_providers: InherentDataProviders::new(),
|
||||||
on_exit: Exit,
|
|
||||||
telemetry_on_connect: None,
|
telemetry_on_connect: None,
|
||||||
voting_rule: (),
|
voting_rule: (),
|
||||||
prometheus_registry: None,
|
prometheus_registry: None,
|
||||||
@@ -740,7 +727,6 @@ fn transition_3_voters_twice_1_full_observer() {
|
|||||||
link: link,
|
link: link,
|
||||||
network: net_service,
|
network: net_service,
|
||||||
inherent_data_providers: InherentDataProviders::new(),
|
inherent_data_providers: InherentDataProviders::new(),
|
||||||
on_exit: Exit,
|
|
||||||
telemetry_on_connect: None,
|
telemetry_on_connect: None,
|
||||||
voting_rule: (),
|
voting_rule: (),
|
||||||
prometheus_registry: None,
|
prometheus_registry: None,
|
||||||
@@ -1166,7 +1152,6 @@ fn voter_persists_its_votes() {
|
|||||||
link,
|
link,
|
||||||
network: this.net.lock().peers[0].network_service().clone(),
|
network: this.net.lock().peers[0].network_service().clone(),
|
||||||
inherent_data_providers: InherentDataProviders::new(),
|
inherent_data_providers: InherentDataProviders::new(),
|
||||||
on_exit: Exit,
|
|
||||||
telemetry_on_connect: None,
|
telemetry_on_connect: None,
|
||||||
voting_rule: VotingRulesBuilder::default().build(),
|
voting_rule: VotingRulesBuilder::default().build(),
|
||||||
prometheus_registry: None,
|
prometheus_registry: None,
|
||||||
@@ -1382,7 +1367,6 @@ fn finalize_3_voters_1_light_observer() {
|
|||||||
},
|
},
|
||||||
link,
|
link,
|
||||||
net.lock().peers[3].network_service().clone(),
|
net.lock().peers[3].network_service().clone(),
|
||||||
Exit,
|
|
||||||
).unwrap()
|
).unwrap()
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1512,7 +1496,6 @@ fn voter_catches_up_to_latest_round_when_behind() {
|
|||||||
link,
|
link,
|
||||||
network: net.lock().peer(peer_id).network_service().clone(),
|
network: net.lock().peer(peer_id).network_service().clone(),
|
||||||
inherent_data_providers: InherentDataProviders::new(),
|
inherent_data_providers: InherentDataProviders::new(),
|
||||||
on_exit: Exit,
|
|
||||||
telemetry_on_connect: None,
|
telemetry_on_connect: None,
|
||||||
voting_rule: (),
|
voting_rule: (),
|
||||||
prometheus_registry: None,
|
prometheus_registry: None,
|
||||||
|
|||||||
Reference in New Issue
Block a user