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

Commit 47b794b

Browse files
committed
Merge branch 'master' into na-sgx-hello-world
* master: Ensure the listen addresses are consistent with the transport (#6436) client/network/service: Add primary dimension to connection metrics (#6472) `pallet-scheduler`: Check that `when` is not in the past (#6480) bound some missing bound for elevated trait (#6487) Fix the browser node and ensure it doesn't colour the informant output (#6457) Fix `sp-api` handling of multiple arguments (#6484) impl Debug for sc_service::Configuration (#6400) Remove lingering runtime upgrades (#6476) Optimize offchain worker api by re-using http-client (#6454) Implement nested storage transactions (#6269) Avoid panic on dropping a `sc_network::service::out_events::Receiver`. (#6458) network: remove unused variable (#6460) [CI] Don't tag PRs on companion job cancels (#6470) update collective events docs to be consistent with changes (#6463) `pallet-staking`: Expose missing consts (#6456) Fix issues with `Operational` transactions validity and prioritization. (#6435) pallet-atomic-swap: generialized swap action (#6421) node: spawn block authoring and grandpa voter as blocking tasks (#6446) change everything to transaction (#6440)
2 parents 2e8f570 + d59281f commit 47b794b

File tree

63 files changed

+2346
-1041
lines changed

Some content is hidden

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

63 files changed

+2346
-1041
lines changed

.github/workflows/polkadot-companion-labels.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Monitor the status of the gitlab-check-companion-build job
12-
uses: s3krit/await-status-action@4528ebbdf6e29bbec77c41caad1b2dec148ba894
12+
uses: s3krit/await-status-action@v1.0.1
1313
id: 'check-companion-status'
1414
with:
1515
authToken: ${{ secrets.GITHUB_TOKEN }}
1616
ref: ${{ github.event.pull_request.head.sha }}
1717
contexts: 'continuous-integration/gitlab-check-polkadot-companion-build'
1818
timeout: 1800
1919
notPresentTimeout: 3600 # It can take quite a while before the job starts...
20+
failedStates: failure
21+
interruptedStates: error # Error = job was probably cancelled. We don't want to label the PR in that case
2022
- name: Label success
2123
uses: andymckay/labeler@master
2224
if: steps.check-companion-status.outputs.result == 'success'

Cargo.lock

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

bin/node-template/node/src/service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ pub fn new_full(config: Configuration) -> Result<impl AbstractService, ServiceEr
142142

143143
// the AURA authoring task is considered essential, i.e. if it
144144
// fails we take down the service with it.
145-
service.spawn_essential_task("aura", aura);
145+
service.spawn_essential_task_handle().spawn_blocking("aura", aura);
146146
}
147147

148148
// if the node isn't actively participating in consensus then it doesn't
@@ -184,7 +184,7 @@ pub fn new_full(config: Configuration) -> Result<impl AbstractService, ServiceEr
184184

185185
// the GRANDPA voter task is considered infallible, i.e.
186186
// if it fails we take down the service with it.
187-
service.spawn_essential_task(
187+
service.spawn_essential_task_handle().spawn_blocking(
188188
"grandpa-voter",
189189
sc_finality_grandpa::run_grandpa_voter(grandpa_config)?
190190
);

bin/node/cli/src/service.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ macro_rules! new_full {
217217
};
218218

219219
let babe = sc_consensus_babe::start_babe(babe_config)?;
220-
service.spawn_essential_task("babe-proposer", babe);
220+
service.spawn_essential_task_handle().spawn_blocking("babe-proposer", babe);
221221
}
222222

223223
// Spawn authority discovery module.
@@ -250,7 +250,7 @@ macro_rules! new_full {
250250
service.prometheus_registry(),
251251
);
252252

253-
service.spawn_task("authority-discovery", authority_discovery);
253+
service.spawn_task_handle().spawn("authority-discovery", authority_discovery);
254254
}
255255

256256
// if the node isn't actively participating in consensus then it doesn't
@@ -292,7 +292,7 @@ macro_rules! new_full {
292292

293293
// the GRANDPA voter task is considered infallible, i.e.
294294
// if it fails we take down the service with it.
295-
service.spawn_essential_task(
295+
service.spawn_essential_task_handle().spawn_blocking(
296296
"grandpa-voter",
297297
grandpa::run_grandpa_voter(grandpa_config)?
298298
);

bin/node/runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
9797
// and set impl_version to 0. If only runtime
9898
// implementation changes and behavior does not, then leave spec_version as
9999
// is and increment impl_version.
100-
spec_version: 253,
100+
spec_version: 254,
101101
impl_version: 0,
102102
apis: RUNTIME_API_VERSIONS,
103103
transaction_version: 1,

client/chain-spec/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,9 @@ pub trait ChainSpec: BuildStorage + Send {
158158
/// This will be used as storage at genesis.
159159
fn set_storage(&mut self, storage: Storage);
160160
}
161+
162+
impl std::fmt::Debug for dyn ChainSpec {
163+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
164+
write!(f, "ChainSpec(name = {:?}, id = {:?})", self.name(), self.id())
165+
}
166+
}

client/cli/src/config.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@ use names::{Generator, Name};
2828
use sc_client_api::execution_extensions::ExecutionStrategies;
2929
use sc_service::config::{
3030
BasePath, Configuration, DatabaseConfig, ExtTransport, KeystoreConfig, NetworkConfiguration,
31-
NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, RpcMethods, TaskType,
32-
TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod,
31+
NodeKeyConfig, OffchainWorkerConfig, PrometheusConfig, PruningMode, Role, RpcMethods,
32+
TaskExecutor, TelemetryEndpoints, TransactionPoolOptions, WasmExecutionMethod,
3333
};
3434
use sc_service::{ChainSpec, TracingReceiver};
35-
use std::future::Future;
3635
use std::net::SocketAddr;
3736
use std::path::PathBuf;
38-
use std::pin::Pin;
39-
use std::sync::Arc;
4037

4138
/// The maximum number of characters for a node name.
4239
pub(crate) const NODE_NAME_MAX_LENGTH: usize = 32;
@@ -409,7 +406,7 @@ pub trait CliConfiguration: Sized {
409406
fn create_configuration<C: SubstrateCli>(
410407
&self,
411408
cli: &C,
412-
task_executor: Arc<dyn Fn(Pin<Box<dyn Future<Output = ()> + Send>>, TaskType) + Send + Sync>,
409+
task_executor: TaskExecutor,
413410
) -> Result<Configuration> {
414411
let is_dev = self.is_dev()?;
415412
let chain_id = self.chain_id(is_dev)?;
@@ -477,6 +474,7 @@ pub trait CliConfiguration: Sized {
477474
announce_block: self.announce_block()?,
478475
role,
479476
base_path: Some(base_path),
477+
informant_output_format: Default::default(),
480478
})
481479
}
482480

client/cli/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ use log::info;
3737
pub use params::*;
3838
use regex::Regex;
3939
pub use runner::*;
40-
use sc_service::{ChainSpec, Configuration, TaskType};
41-
use std::future::Future;
40+
use sc_service::{ChainSpec, Configuration, TaskExecutor};
4241
use std::io::Write;
43-
use std::pin::Pin;
44-
use std::sync::Arc;
4542
pub use structopt;
4643
use structopt::{
4744
clap::{self, AppSettings},
@@ -199,7 +196,7 @@ pub trait SubstrateCli: Sized {
199196
fn create_configuration<T: CliConfiguration>(
200197
&self,
201198
command: &T,
202-
task_executor: Arc<dyn Fn(Pin<Box<dyn Future<Output = ()> + Send>>, TaskType) + Send + Sync>,
199+
task_executor: TaskExecutor,
203200
) -> error::Result<Configuration> {
204201
command.create_configuration(self, task_executor)
205202
}

client/cli/src/runner.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use sc_service::{AbstractService, Configuration, Role, ServiceBuilderCommand, Ta
2929
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
3030
use sp_utils::metrics::{TOKIO_THREADS_ALIVE, TOKIO_THREADS_TOTAL};
3131
use sp_version::RuntimeVersion;
32-
use std::{fmt::Debug, marker::PhantomData, str::FromStr, sync::Arc};
32+
use std::{fmt::Debug, marker::PhantomData, str::FromStr};
3333

3434
#[cfg(target_family = "unix")]
3535
async fn main<F, E>(func: F) -> std::result::Result<(), Box<dyn std::error::Error>>
@@ -119,23 +119,21 @@ impl<C: SubstrateCli> Runner<C> {
119119
let tokio_runtime = build_runtime()?;
120120
let runtime_handle = tokio_runtime.handle().clone();
121121

122-
let task_executor = Arc::new(
123-
move |fut, task_type| {
124-
match task_type {
125-
TaskType::Async => { runtime_handle.spawn(fut); }
126-
TaskType::Blocking => {
127-
runtime_handle.spawn( async move {
128-
// `spawn_blocking` is looking for the current runtime, and as such has to be called
129-
// from within `spawn`.
130-
tokio::task::spawn_blocking(move || futures::executor::block_on(fut))
131-
});
132-
}
122+
let task_executor = move |fut, task_type| {
123+
match task_type {
124+
TaskType::Async => { runtime_handle.spawn(fut); }
125+
TaskType::Blocking => {
126+
runtime_handle.spawn(async move {
127+
// `spawn_blocking` is looking for the current runtime, and as such has to
128+
// be called from within `spawn`.
129+
tokio::task::spawn_blocking(move || futures::executor::block_on(fut))
130+
});
133131
}
134132
}
135-
);
133+
};
136134

137135
Ok(Runner {
138-
config: command.create_configuration(cli, task_executor)?,
136+
config: command.create_configuration(cli, task_executor.into())?,
139137
tokio_runtime,
140138
phantom: PhantomData,
141139
})

client/db/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ pub struct DatabaseSettings {
271271
}
272272

273273
/// Where to find the database..
274-
#[derive(Clone)]
274+
#[derive(Debug, Clone)]
275275
pub enum DatabaseSettingsSrc {
276276
/// Load a RocksDB database from a given path. Recommended for most uses.
277277
RocksDb {

0 commit comments

Comments
 (0)