Skip to content

Commit 2c53894

Browse files
committed
Merge branch 'master' into tsv-disabling-node-side
2 parents 2a5af89 + 769bdd3 commit 2c53894

File tree

13 files changed

+680
-564
lines changed

13 files changed

+680
-564
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

polkadot/node/core/runtime-api/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,15 +579,15 @@ where
579579
query!(
580580
ParaBackingState,
581581
para_backing_state(para),
582-
ver = Request::STAGING_BACKING_STATE,
582+
ver = Request::ASYNC_BACKING_STATE_RUNTIME_REQUIREMENT,
583583
sender
584584
)
585585
},
586586
Request::AsyncBackingParams(sender) => {
587587
query!(
588588
AsyncBackingParams,
589589
async_backing_params(),
590-
ver = Request::STAGING_BACKING_STATE,
590+
ver = Request::ASYNC_BACKING_STATE_RUNTIME_REQUIREMENT,
591591
sender
592592
)
593593
},

polkadot/node/subsystem-types/src/messages.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ impl RuntimeApiRequest {
727727
pub const MINIMUM_BACKING_VOTES_RUNTIME_REQUIREMENT: u32 = 6;
728728

729729
/// Minimum version to enable asynchronous backing: `AsyncBackingParams` and `ParaBackingState`.
730-
pub const STAGING_BACKING_STATE: u32 = 7;
730+
pub const ASYNC_BACKING_STATE_RUNTIME_REQUIREMENT: u32 = 7;
731731

732732
/// `DisabledValidators`
733733
pub const DISABLED_VALIDATORS_RUNTIME_REQUIREMENT: u32 = 8;

polkadot/node/subsystem-util/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ specialize_requests! {
227227
fn request_key_ownership_proof(validator_id: ValidatorId) -> Option<slashing::OpaqueKeyOwnershipProof>; KeyOwnershipProof;
228228
fn request_submit_report_dispute_lost(dp: slashing::DisputeProof, okop: slashing::OpaqueKeyOwnershipProof) -> Option<()>; SubmitReportDisputeLost;
229229
fn request_disabled_validators() -> Vec<ValidatorIndex>; DisabledValidators;
230-
231230
fn request_async_backing_params() -> AsyncBackingParams; AsyncBackingParams;
232231
}
233232

substrate/client/network/common/src/sync.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use sp_runtime::{
3636
};
3737
use warp::WarpSyncProgress;
3838

39-
use std::{any::Any, fmt, fmt::Formatter, pin::Pin, sync::Arc, task::Poll};
39+
use std::{any::Any, fmt, fmt::Formatter, pin::Pin, sync::Arc};
4040

4141
/// The sync status of a peer we are trying to sync with
4242
#[derive(Debug)]
@@ -204,6 +204,23 @@ pub enum PeerRequest<B: BlockT> {
204204
WarpProof,
205205
}
206206

207+
#[derive(Debug)]
208+
pub enum PeerRequestType {
209+
Block,
210+
State,
211+
WarpProof,
212+
}
213+
214+
impl<B: BlockT> PeerRequest<B> {
215+
pub fn get_type(&self) -> PeerRequestType {
216+
match self {
217+
PeerRequest::Block(_) => PeerRequestType::Block,
218+
PeerRequest::State => PeerRequestType::State,
219+
PeerRequest::WarpProof => PeerRequestType::WarpProof,
220+
}
221+
}
222+
}
223+
207224
/// Wrapper for implementation-specific state request.
208225
///
209226
/// NOTE: Implementation must be able to encode and decode it for network purposes.
@@ -289,9 +306,6 @@ pub trait ChainSync<Block: BlockT>: Send {
289306
/// Returns the current number of peers stored within this state machine.
290307
fn num_peers(&self) -> usize;
291308

292-
/// Returns the number of peers we're connected to and that are being queried.
293-
fn num_active_peers(&self) -> usize;
294-
295309
/// Handle a new connected peer.
296310
///
297311
/// Call this method whenever we connect to a new peer.
@@ -369,10 +383,4 @@ pub trait ChainSync<Block: BlockT>: Send {
369383

370384
/// Return some key metrics.
371385
fn metrics(&self) -> Metrics;
372-
373-
/// Advance the state of `ChainSync`
374-
fn poll(&mut self, cx: &mut std::task::Context) -> Poll<()>;
375-
376-
/// Send block request to peer
377-
fn send_block_request(&mut self, who: PeerId, request: BlockRequest<Block>);
378386
}

substrate/client/network/sync/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ prost = "0.11"
2929
schnellru = "0.2.1"
3030
smallvec = "1.11.0"
3131
thiserror = "1.0"
32+
tokio-stream = "0.1.14"
3233
fork-tree = { path = "../../../utils/fork-tree" }
3334
prometheus-endpoint = { package = "substrate-prometheus-endpoint", path = "../../../utils/prometheus" }
3435
sc-client-api = { path = "../../api" }

0 commit comments

Comments
 (0)