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

Commit 7f23f7d

Browse files
committed
Merge branch 'master' into fs-candidate-backing-subsystem
2 parents 4031bc7 + 0306729 commit 7f23f7d

File tree

51 files changed

+800
-500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+800
-500
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ path = "src/main.rs"
44

55
[package]
66
name = "polkadot"
7-
version = "0.8.11"
7+
version = "0.8.12"
88
authors = ["Parity Technologies <[email protected]>"]
99
edition = "2018"
1010

availability-store/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "polkadot-availability-store"
33
description = "Persistent database for parachain data"
4-
version = "0.8.11"
4+
version = "0.8.12"
55
authors = ["Parity Technologies <[email protected]>"]
66
edition = "2018"
77

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polkadot-cli"
3-
version = "0.8.11"
3+
version = "0.8.12"
44
authors = ["Parity Technologies <[email protected]>"]
55
description = "Polkadot Relay-chain Client Node"
66
edition = "2018"

cli/src/command.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ pub fn run() -> Result<()> {
128128
authority_discovery_enabled,
129129
6000,
130130
grandpa_pause,
131-
None,
132131
).map(|(s, _, _)| s)
133132
},
134133
service::KusamaExecutor::native_version().runtime_version
@@ -146,7 +145,6 @@ pub fn run() -> Result<()> {
146145
authority_discovery_enabled,
147146
6000,
148147
grandpa_pause,
149-
None,
150148
).map(|(s, _, _)| s)
151149
},
152150
service::WestendExecutor::native_version().runtime_version
@@ -164,7 +162,6 @@ pub fn run() -> Result<()> {
164162
authority_discovery_enabled,
165163
6000,
166164
grandpa_pause,
167-
None,
168165
).map(|(s, _, _)| s)
169166
},
170167
service::PolkadotExecutor::native_version().runtime_version

collator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polkadot-collator"
3-
version = "0.8.11"
3+
version = "0.8.12"
44
authors = ["Parity Technologies <[email protected]>"]
55
description = "Collator node implementation"
66
edition = "2018"

collator/src/lib.rs

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use std::sync::Arc;
5050
use std::time::Duration;
5151
use std::pin::Pin;
5252

53-
use futures::{future, Future, Stream, FutureExt, TryFutureExt, StreamExt, task::Spawn};
53+
use futures::{future, Future, Stream, FutureExt, StreamExt, task::Spawn};
5454
use log::warn;
5555
use sc_client_api::{StateBackend, BlockchainEvents};
5656
use sp_blockchain::HeaderBackend;
@@ -100,24 +100,17 @@ impl Network for polkadot_network::protocol::Service {
100100
}
101101
}
102102

103-
/// Error to return when the head data was invalid.
104-
#[derive(Clone, Copy, Debug)]
105-
pub struct InvalidHead;
106-
107103
/// Collation errors.
108104
#[derive(Debug)]
109105
pub enum Error {
110106
/// Error on the relay-chain side of things.
111107
Polkadot(String),
112-
/// Error on the collator side of things.
113-
Collator(InvalidHead),
114108
}
115109

116110
impl fmt::Display for Error {
117111
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
118112
match *self {
119113
Error::Polkadot(ref err) => write!(f, "Polkadot node error: {}", err),
120-
Error::Collator(_) => write!(f, "Collator node error: Invalid head data"),
121114
}
122115
}
123116
}
@@ -147,7 +140,7 @@ pub trait BuildParachainContext {
147140
/// This can be implemented through an externally attached service or a stub.
148141
/// This is expected to be a lightweight, shared type like an Arc.
149142
pub trait ParachainContext: Clone {
150-
type ProduceCandidate: Future<Output = Result<(BlockData, HeadData), InvalidHead>>;
143+
type ProduceCandidate: Future<Output = Option<(BlockData, HeadData)>>;
151144

152145
/// Produce a candidate, given the relay parent hash, the latest ingress queue information
153146
/// and the last parachain head.
@@ -167,8 +160,7 @@ pub async fn collate<P>(
167160
local_validation_data: LocalValidationData,
168161
mut para_context: P,
169162
key: Arc<CollatorPair>,
170-
)
171-
-> Result<parachain::Collation, Error>
163+
) -> Option<parachain::Collation>
172164
where
173165
P: ParachainContext,
174166
P::ProduceCandidate: Send,
@@ -177,7 +169,7 @@ pub async fn collate<P>(
177169
relay_parent,
178170
global_validation,
179171
local_validation_data,
180-
).map_err(Error::Collator).await?;
172+
).await?;
181173

182174
let pov_block = PoVBlock {
183175
block_data,
@@ -204,7 +196,7 @@ pub async fn collate<P>(
204196
pov: pov_block,
205197
};
206198

207-
Ok(collation)
199+
Some(collation)
208200
}
209201

210202
#[cfg(feature = "service-rewr")]
@@ -341,8 +333,13 @@ fn build_collator_service<SP, P, C, R, Extrinsic>(
341333
local_validation,
342334
parachain_context,
343335
key,
344-
).map_ok(move |collation| {
345-
network.distribute_collation(targets, collation)
336+
).map(move |collation| {
337+
match collation {
338+
Some(collation) => network.distribute_collation(targets, collation),
339+
None => log::trace!("Skipping collation as `collate` returned `None`"),
340+
}
341+
342+
Ok(())
346343
});
347344

348345
future::Either::Right(collation_work)
@@ -376,7 +373,6 @@ pub async fn start_collator<P>(
376373
para_id: ParaId,
377374
key: Arc<CollatorPair>,
378375
config: Configuration,
379-
informant_prefix: Option<String>,
380376
) -> Result<(), polkadot_service::Error>
381377
where
382378
P: 'static + BuildParachainContext,
@@ -397,7 +393,6 @@ where
397393
false,
398394
6000,
399395
None,
400-
informant_prefix,
401396
)?;
402397
let spawn_handle = service.spawn_task_handle();
403398
build_collator_service(
@@ -416,7 +411,6 @@ where
416411
false,
417412
6000,
418413
None,
419-
informant_prefix,
420414
)?;
421415
let spawn_handle = service.spawn_task_handle();
422416
build_collator_service(
@@ -435,7 +429,6 @@ where
435429
false,
436430
6000,
437431
None,
438-
informant_prefix,
439432
)?;
440433
let spawn_handle = service.spawn_task_handle();
441434
build_collator_service(
@@ -470,7 +463,7 @@ mod tests {
470463
struct DummyParachainContext;
471464

472465
impl ParachainContext for DummyParachainContext {
473-
type ProduceCandidate = future::Ready<Result<(BlockData, HeadData), InvalidHead>>;
466+
type ProduceCandidate = future::Ready<Option<(BlockData, HeadData)>>;
474467

475468
fn produce_candidate(
476469
&mut self,
@@ -479,10 +472,10 @@ mod tests {
479472
_local_validation: LocalValidationData,
480473
) -> Self::ProduceCandidate {
481474
// send messages right back.
482-
future::ok((
475+
future::ready(Some((
483476
BlockData(vec![1, 2, 3, 4, 5,]),
484477
HeadData(vec![9, 9, 9]),
485-
))
478+
)))
486479
}
487480
}
488481

@@ -501,21 +494,20 @@ mod tests {
501494
}
502495
}
503496

504-
// Make sure that the future returned by `start_collator` implementes `Send`.
497+
// Make sure that the future returned by `start_collator` implements `Send`.
505498
#[test]
506499
fn start_collator_is_send() {
507500
fn check_send<T: Send>(_: T) {}
508501

509502
let cli = Cli::from_iter(&["-dev"]);
510-
let task_executor = Arc::new(|_, _| unimplemented!());
511-
let config = cli.create_configuration(&cli.run.base, task_executor).unwrap();
503+
let task_executor = |_, _| unimplemented!();
504+
let config = cli.create_configuration(&cli.run.base, task_executor.into()).unwrap();
512505

513506
check_send(start_collator(
514507
BuildDummyParachainContext,
515508
0.into(),
516509
Arc::new(CollatorPair::generate().0),
517510
config,
518-
None,
519511
));
520512
}
521513
}

docker/sentry-docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ services:
4747
- "--name"
4848
- "${VALIDATOR_NANE:-AlicesNode}"
4949
- "--reserved-nodes"
50-
- "${VALIDATOR_RESERVED_NODES:-/dns4/sentry/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi}"
50+
- "${VALIDATOR_RESERVED_NODES:-/dns/sentry/tcp/30333/p2p/QmV7EhW6J6KgmNdr558RH1mPx2xGGznW7At4BhXzntRFsi}"
5151
# Not only bind to localhost.
5252
- "--ws-external"
5353
- "--rpc-external"
@@ -90,7 +90,7 @@ services:
9090
- "--name"
9191
- "${SENTRY_NAME:-CharliesNode}"
9292
- "--bootnodes"
93-
- "${SENTRY_BOOTNODES:-/dns4/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR}"
93+
- "${SENTRY_BOOTNODES:-/dns/validator-a/tcp/30333/p2p/QmRpheLN4JWdAnY7HGJfWFNbfkQCb6tFf4vvA6hgjMZKrR}"
9494
- "--no-telemetry"
9595
- "--rpc-cors"
9696
- "all"

erasure-coding/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polkadot-erasure-coding"
3-
version = "0.8.11"
3+
version = "0.8.12"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition = "2018"
66

network/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polkadot-network"
3-
version = "0.8.11"
3+
version = "0.8.12"
44
authors = ["Parity Technologies <[email protected]>"]
55
description = "Polkadot-specific networking protocol"
66
edition = "2018"

0 commit comments

Comments
 (0)