Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 88fd180

Browse files
committed
Merge branch 'master' into bernhard-integrate-dispute-finality
* master: enable disputes (#3478) Do not leak active head data in statement distribution (#3519) Fix TransactAsset Implementation (#3345)
2 parents 95d852b + 2d19780 commit 88fd180

File tree

24 files changed

+529
-386
lines changed

24 files changed

+529
-386
lines changed

Cargo.lock

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

node/core/chain-selection/src/lib.rs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use polkadot_node_subsystem::{
2828
use kvdb::KeyValueDB;
2929
use parity_scale_codec::Error as CodecError;
3030
use futures::channel::oneshot;
31+
use futures::future::Either;
3132
use futures::prelude::*;
3233

3334
use std::time::{UNIX_EPOCH, Duration,SystemTime};
@@ -244,7 +245,7 @@ impl Clock for SystemClock {
244245

245246
/// The interval, in seconds to check for stagnant blocks.
246247
#[derive(Debug, Clone)]
247-
pub struct StagnantCheckInterval(Duration);
248+
pub struct StagnantCheckInterval(Option<Duration>);
248249

249250
impl Default for StagnantCheckInterval {
250251
fn default() -> Self {
@@ -255,28 +256,37 @@ impl Default for StagnantCheckInterval {
255256
// between 2 validators is D + 5s.
256257
const DEFAULT_STAGNANT_CHECK_INTERVAL: Duration = Duration::from_secs(5);
257258

258-
StagnantCheckInterval(DEFAULT_STAGNANT_CHECK_INTERVAL)
259+
StagnantCheckInterval(Some(DEFAULT_STAGNANT_CHECK_INTERVAL))
259260
}
260261
}
261262

262263
impl StagnantCheckInterval {
263264
/// Create a new stagnant-check interval wrapping the given duration.
264265
pub fn new(interval: Duration) -> Self {
265-
StagnantCheckInterval(interval)
266+
StagnantCheckInterval(Some(interval))
266267
}
267268

268-
fn timeout_stream(&self) -> impl Stream<Item = ()> {
269-
let interval = self.0;
270-
let mut delay = futures_timer::Delay::new(interval);
269+
/// Create a `StagnantCheckInterval` which never triggers.
270+
pub fn never() -> Self {
271+
StagnantCheckInterval(None)
272+
}
271273

272-
futures::stream::poll_fn(move |cx| {
273-
let poll = delay.poll_unpin(cx);
274-
if poll.is_ready() {
275-
delay.reset(interval)
276-
}
274+
fn timeout_stream(&self) -> impl Stream<Item = ()> {
275+
match self.0 {
276+
Some(interval) => Either::Left({
277+
let mut delay = futures_timer::Delay::new(interval);
278+
279+
futures::stream::poll_fn(move |cx| {
280+
let poll = delay.poll_unpin(cx);
281+
if poll.is_ready() {
282+
delay.reset(interval)
283+
}
277284

278-
poll.map(Some)
279-
})
285+
poll.map(Some)
286+
})
287+
}),
288+
None => Either::Right(futures::stream::pending()),
289+
}
280290
}
281291
}
282292

node/malus/src/variant-a.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use polkadot_cli::{
2727
create_default_subsystems,
2828
service::{
2929
AuthorityDiscoveryApi, AuxStore, BabeApi, Block, Error, HeaderBackend, Overseer,
30-
OverseerGen, OverseerGenArgs, Handle, ParachainHost, ProvideRuntimeApi,
30+
OverseerGen, OverseerGenArgs, OverseerHandle, ParachainHost, ProvideRuntimeApi,
3131
SpawnNamed,
3232
},
3333
Cli,
@@ -73,7 +73,7 @@ impl OverseerGen for BehaveMaleficient {
7373
fn generate<'a, Spawner, RuntimeClient>(
7474
&self,
7575
args: OverseerGenArgs<'a, Spawner, RuntimeClient>,
76-
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, Handle), Error>
76+
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandle), Error>
7777
where
7878
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
7979
RuntimeClient::Api: ParachainHost<Block> + BabeApi<Block> + AuthorityDiscoveryApi<Block>,

node/network/statement-distribution/src/lib.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,6 +1847,16 @@ impl StatementDistribution {
18471847
FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate { activated, deactivated })) => {
18481848
let _timer = metrics.time_active_leaves_update();
18491849

1850+
for deactivated in deactivated {
1851+
if active_heads.remove(&deactivated).is_some() {
1852+
tracing::trace!(
1853+
target: LOG_TARGET,
1854+
hash = ?deactivated,
1855+
"Deactivating leaf",
1856+
);
1857+
}
1858+
}
1859+
18501860
for activated in activated {
18511861
let relay_parent = activated.hash;
18521862
let span = PerLeafSpan::new(activated.span, "statement-distribution");
@@ -1862,18 +1872,6 @@ impl StatementDistribution {
18621872

18631873
active_heads.entry(relay_parent)
18641874
.or_insert(ActiveHeadData::new(session_info.validators.clone(), session_index, span));
1865-
1866-
active_heads.retain(|h, _| {
1867-
let live = !deactivated.contains(h);
1868-
if !live {
1869-
tracing::trace!(
1870-
target: LOG_TARGET,
1871-
hash = ?h,
1872-
"Deactivating leaf",
1873-
);
1874-
}
1875-
live
1876-
});
18771875
}
18781876
}
18791877
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {

node/overseer/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ client = { package = "sc-client-api", git = "https://github.com/paritytech/subst
1010
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
1111
futures = "0.3.15"
1212
futures-timer = "3.0.2"
13+
parking_lot = "0.11.1"
1314
polkadot-node-network-protocol = { path = "../network/protocol" }
1415
polkadot-node-primitives = { path = "../primitives" }
1516
polkadot-node-subsystem-types = { path = "../subsystem-types" }

node/overseer/examples/minimal-example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ fn main() {
174174
.replace_candidate_backing(Subsystem1)
175175
;
176176

177-
let (overseer, _handler) = Overseer::new(
177+
let (overseer, _handle) = Overseer::new(
178178
vec![],
179179
all_subsystems,
180180
None,

node/overseer/overseer-gen/examples/dummy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl SpawnNamed for DummySpawner{
123123
struct DummyCtx;
124124

125125
fn main() {
126-
let (overseer, _handler): (Xxx<_>, _) = Xxx::builder()
126+
let (overseer, _handle): (Xxx<_>, _) = Xxx::builder()
127127
.sub0(AwesomeSubSys::default())
128128
.plinkos(GoblinTower::default())
129129
.i_like_pi(::std::f64::consts::PI)

0 commit comments

Comments
 (0)