Skip to content

Commit 86246ae

Browse files
Update substrate to latest master (#216)
* Changes based on substrate commits till the current master * Apply required changes for tests * Update to the latest substrate that includes release sp-core: 4.0.0
1 parent 3e4822f commit 86246ae

File tree

11 files changed

+353
-405
lines changed

11 files changed

+353
-405
lines changed

Cargo.lock

+328-363
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bioauth-consensus/src/aura.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ mod tests {
100100
use mockall::*;
101101
use node_primitives::{Block, Header};
102102
use sp_api::{ApiError, ApiRef, NativeOrEncoded, ProvideRuntimeApi};
103-
use sp_runtime::{traits::DigestItemFor, Digest};
103+
use sp_runtime::{Digest, DigestItem};
104104
use std::sync::Arc;
105105

106106
type MockAuraAuthorityId = sp_consensus_aura::sr25519::AuthorityId;
@@ -146,7 +146,7 @@ mod tests {
146146
let mut digest_items = vec![];
147147
if !empty_digest {
148148
let slot = sp_consensus_aura::Slot::from(1);
149-
let item = <DigestItemFor<Block> as CompatibleDigestItem<
149+
let item = <DigestItem as CompatibleDigestItem<
150150
sp_consensus_aura::sr25519::AuthoritySignature,
151151
>>::aura_pre_digest(slot);
152152
digest_items.push(item);

crates/bioauth-consensus/src/mock.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use sc_consensus::{BlockCheckParams, BlockImport, BlockImportParams, ImportResul
66
use sp_api::{ApiRef, ProvideRuntimeApi, TransactionFor};
77
use sp_blockchain::{well_known_cache_keys, HeaderBackend};
88
use sp_consensus::{Environment, Error as ConsensusError};
9-
use sp_runtime::traits::{Block as BlockT, DigestFor};
9+
use sp_runtime::{traits::Block as BlockT, Digest};
1010
use std::{collections::HashMap, sync::Arc, time::Duration};
1111

1212
type MockPublicKeyType = ();
@@ -147,7 +147,7 @@ mock! {
147147
fn propose(
148148
&self,
149149
inherent_data: sp_inherents::InherentData,
150-
inherent_digests: DigestFor<Block>,
150+
inherent_digests: Digest,
151151
max_duration: Duration,
152152
block_size_limit: Option<usize>,
153153
) -> MockProposal;
@@ -184,7 +184,7 @@ impl sp_consensus::Proposer<Block> for MockWrapperProposer {
184184
fn propose(
185185
self,
186186
inherent_data: sp_inherents::InherentData,
187-
inherent_digests: DigestFor<Block>,
187+
inherent_digests: Digest,
188188
max_duration: Duration,
189189
block_size_limit: Option<usize>,
190190
) -> MockProposal {

crates/humanode-peer/src/chain_spec.rs

-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ fn testnet_genesis(
184184
system: SystemConfig {
185185
// Add Wasm runtime to storage.
186186
code: wasm_binary.to_vec(),
187-
changes_trie_config: Default::default(),
188187
},
189188
balances: BalancesConfig {
190189
// Configure endowed accounts with initial balance of 1 << 60.

crates/humanode-peer/src/cli/run.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,9 @@ pub async fn run() -> sc_cli::Result<()> {
123123
sc_cli::print_node_infos::<Root>(&runner.config().substrate);
124124
runner
125125
.run_node(|config| async move {
126-
match config.substrate.role {
127-
sc_cli::Role::Light => Err(sc_service::Error::Other(
128-
"light client is not supported yet".into(),
129-
)),
130-
_ => service::new_full(config).await,
131-
}
132-
.map_err(sc_cli::Error::Service)
126+
service::new_full(config)
127+
.await
128+
.map_err(sc_cli::Error::Service)
133129
})
134130
.await
135131
}

crates/humanode-peer/src/cli/runner.rs

+2-14
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ use crate::configuration::Configuration;
1010

1111
use super::{CliConfigurationExt, Root};
1212

13-
/// Run the given future and then clean shutdown the task manager before returning the control.
14-
async fn with_clean_shutdown<F, O>(fut: F, task_manager: TaskManager) -> O
15-
where
16-
F: Future<Output = O>,
17-
{
18-
let res = fut.await;
19-
task_manager.clean_shutdown().await;
20-
res
21-
}
22-
2313
/// Run a future until it completes or a signal is recevied.
2414
async fn with_signal<F, E>(future: F) -> std::result::Result<(), E>
2515
where
@@ -56,7 +46,7 @@ impl<C: SubstrateCli> Runner<C> {
5646
})
5747
}
5848

59-
/// Run the task manager to completion, or till the signal, with clean shutdown.
49+
/// Run the task manager to completion, or till the signal.
6050
pub async fn run_node<F, E>(
6151
self,
6252
initialize: impl FnOnce(Configuration) -> F,
@@ -69,13 +59,11 @@ impl<C: SubstrateCli> Runner<C> {
6959
let future = task_manager.future();
7060
let future = with_signal(future);
7161
let res = future.await;
72-
task_manager.clean_shutdown().await;
7362
Ok(res?)
7463
}
7564

7665
/// Run some tasks with task manager.
7766
/// The runner is executing till completion, or until till the signal is received.
78-
/// Task manager is shutdown cleanly at the end (even on error).
7967
pub async fn run_tasks<R, F, E>(
8068
self,
8169
runner: impl FnOnce(Configuration) -> R,
@@ -87,7 +75,7 @@ impl<C: SubstrateCli> Runner<C> {
8775
{
8876
let (future, task_manager) = runner(self.config).await?;
8977
let future = with_signal(future);
90-
let future = with_clean_shutdown(future, task_manager);
78+
drop(task_manager);
9179
future.await
9280
}
9381

crates/humanode-peer/src/service.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ pub fn new_partial(
122122
let client = Arc::new(client);
123123

124124
let telemetry = telemetry.map(|(worker, telemetry)| {
125-
task_manager.spawn_handle().spawn("telemetry", worker.run());
125+
task_manager
126+
.spawn_handle()
127+
.spawn("telemetry", None, worker.run());
126128
telemetry
127129
});
128130

@@ -268,7 +270,6 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
268270
transaction_pool: Arc::clone(&transaction_pool),
269271
spawn_handle: task_manager.spawn_handle(),
270272
import_queue,
271-
on_demand: None,
272273
block_announce_validator_builder: None,
273274
warp_sync: Some(warp_sync),
274275
})?;
@@ -304,8 +305,6 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
304305
task_manager: &mut task_manager,
305306
transaction_pool: Arc::clone(&transaction_pool),
306307
rpc_extensions_builder,
307-
on_demand: None,
308-
remote_blockchain: None,
309308
backend,
310309
system_rpc_tx,
311310
config,
@@ -346,7 +345,7 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
346345
// fails we take down the service with it.
347346
task_manager
348347
.spawn_essential_handle()
349-
.spawn_blocking("aura", aura);
348+
.spawn_blocking("aura", Some("block-authoring"), aura);
350349

351350
let grandpa_config = sc_finality_grandpa::Config {
352351
// FIXME #1578 make this available through chainspec.
@@ -373,6 +372,7 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
373372

374373
task_manager.spawn_essential_handle().spawn_blocking(
375374
"grandpa-voter",
375+
Some("block-finalization"),
376376
sc_finality_grandpa::run_grandpa_voter(grandpa_config)?,
377377
);
378378
}
@@ -495,9 +495,11 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
495495
})
496496
};
497497

498-
task_manager
499-
.spawn_handle()
500-
.spawn_blocking("bioauth-flow", bioauth_flow_future);
498+
task_manager.spawn_handle().spawn_blocking(
499+
"bioauth-flow",
500+
Some("bioauth"),
501+
bioauth_flow_future,
502+
);
501503

502504
Ok(task_manager)
503505
}

crates/humanode-runtime/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ publish = false
66

77
[build-dependencies]
88
# See https://github.com/paritytech/substrate/pull/10284
9-
substrate-wasm-builder = { git = "https://github.com/humanode-network/substrate", branch = "wasm-builder-fix" }
9+
substrate-wasm-builder = { git = "https://github.com/humanode-network/substrate", branch = "master" }
1010

1111
[dependencies]
1212
bioauth-consensus-api = { version = "0.1", path = "../bioauth-consensus-api", default-features = false }
@@ -49,7 +49,7 @@ sp-version = { default-features = false, git = "https://github.com/humanode-netw
4949
default = ["std"]
5050
runtime-benchmarks = [
5151
"hex-literal",
52-
"frame-benchmarking",
52+
"frame-benchmarking/runtime-benchmarks",
5353
"frame-support/runtime-benchmarks",
5454
"frame-system-benchmarking",
5555
"frame-system/runtime-benchmarks",

crates/humanode-runtime/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ pub type Executive = frame_executive::Executive<
479479
Block,
480480
frame_system::ChainContext<Runtime>,
481481
Runtime,
482-
AllPallets,
482+
AllPalletsWithSystem,
483483
>;
484484

485485
impl_runtime_apis! {

crates/pallet-bioauth/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ std = [
3232
"sp-std/std",
3333
"sp-runtime/std",
3434
]
35-
runtime-benchmarks = ["frame-benchmarking"]
35+
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]
3636
try-runtime = ["frame-support/try-runtime"]

crates/pallet-bioauth/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ pub mod pallet {
122122
CurrentMoment, TryConvert, ValidatorSetUpdater, Verifier,
123123
};
124124

125-
use frame_support::{
126-
dispatch::DispatchResult, pallet_prelude::*, sp_tracing::error, storage::types::ValueQuery,
127-
};
125+
use frame_support::{pallet_prelude::*, sp_tracing::error, storage::types::ValueQuery};
128126
use frame_system::pallet_prelude::*;
129127
use sp_runtime::{app_crypto::MaybeHash, traits::AtLeast32Bit};
130128
use sp_std::prelude::*;

0 commit comments

Comments
 (0)