Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
691 changes: 328 additions & 363 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/bioauth-consensus/src/aura.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ mod tests {
use mockall::*;
use node_primitives::{Block, Header};
use sp_api::{ApiError, ApiRef, NativeOrEncoded, ProvideRuntimeApi};
use sp_runtime::{traits::DigestItemFor, Digest};
use sp_runtime::{Digest, DigestItem};
use std::sync::Arc;

type MockAuraAuthorityId = sp_consensus_aura::sr25519::AuthorityId;
Expand Down Expand Up @@ -146,7 +146,7 @@ mod tests {
let mut digest_items = vec![];
if !empty_digest {
let slot = sp_consensus_aura::Slot::from(1);
let item = <DigestItemFor<Block> as CompatibleDigestItem<
let item = <DigestItem as CompatibleDigestItem<
sp_consensus_aura::sr25519::AuthoritySignature,
>>::aura_pre_digest(slot);
digest_items.push(item);
Expand Down
6 changes: 3 additions & 3 deletions crates/bioauth-consensus/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use sc_consensus::{BlockCheckParams, BlockImport, BlockImportParams, ImportResul
use sp_api::{ApiRef, ProvideRuntimeApi, TransactionFor};
use sp_blockchain::{well_known_cache_keys, HeaderBackend};
use sp_consensus::{Environment, Error as ConsensusError};
use sp_runtime::traits::{Block as BlockT, DigestFor};
use sp_runtime::{traits::Block as BlockT, Digest};
use std::{collections::HashMap, sync::Arc, time::Duration};

type MockPublicKeyType = ();
Expand Down Expand Up @@ -147,7 +147,7 @@ mock! {
fn propose(
&self,
inherent_data: sp_inherents::InherentData,
inherent_digests: DigestFor<Block>,
inherent_digests: Digest,
max_duration: Duration,
block_size_limit: Option<usize>,
) -> MockProposal;
Expand Down Expand Up @@ -184,7 +184,7 @@ impl sp_consensus::Proposer<Block> for MockWrapperProposer {
fn propose(
self,
inherent_data: sp_inherents::InherentData,
inherent_digests: DigestFor<Block>,
inherent_digests: Digest,
max_duration: Duration,
block_size_limit: Option<usize>,
) -> MockProposal {
Expand Down
1 change: 0 additions & 1 deletion crates/humanode-peer/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ fn testnet_genesis(
system: SystemConfig {
// Add Wasm runtime to storage.
code: wasm_binary.to_vec(),
changes_trie_config: Default::default(),
},
balances: BalancesConfig {
// Configure endowed accounts with initial balance of 1 << 60.
Expand Down
10 changes: 3 additions & 7 deletions crates/humanode-peer/src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,9 @@ pub async fn run() -> sc_cli::Result<()> {
sc_cli::print_node_infos::<Root>(&runner.config().substrate);
runner
.run_node(|config| async move {
match config.substrate.role {
sc_cli::Role::Light => Err(sc_service::Error::Other(
"light client is not supported yet".into(),
)),
_ => service::new_full(config).await,
}
.map_err(sc_cli::Error::Service)
service::new_full(config)
.await
.map_err(sc_cli::Error::Service)
})
.await
}
Expand Down
16 changes: 2 additions & 14 deletions crates/humanode-peer/src/cli/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ use crate::configuration::Configuration;

use super::{CliConfigurationExt, Root};

/// Run the given future and then clean shutdown the task manager before returning the control.
async fn with_clean_shutdown<F, O>(fut: F, task_manager: TaskManager) -> O
where
F: Future<Output = O>,
{
let res = fut.await;
task_manager.clean_shutdown().await;
res
}

/// Run a future until it completes or a signal is recevied.
async fn with_signal<F, E>(future: F) -> std::result::Result<(), E>
where
Expand Down Expand Up @@ -56,7 +46,7 @@ impl<C: SubstrateCli> Runner<C> {
})
}

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

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

Expand Down
18 changes: 10 additions & 8 deletions crates/humanode-peer/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ pub fn new_partial(
let client = Arc::new(client);

let telemetry = telemetry.map(|(worker, telemetry)| {
task_manager.spawn_handle().spawn("telemetry", worker.run());
task_manager
.spawn_handle()
.spawn("telemetry", None, worker.run());
telemetry
});

Expand Down Expand Up @@ -268,7 +270,6 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
transaction_pool: Arc::clone(&transaction_pool),
spawn_handle: task_manager.spawn_handle(),
import_queue,
on_demand: None,
block_announce_validator_builder: None,
warp_sync: Some(warp_sync),
})?;
Expand Down Expand Up @@ -304,8 +305,6 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
task_manager: &mut task_manager,
transaction_pool: Arc::clone(&transaction_pool),
rpc_extensions_builder,
on_demand: None,
remote_blockchain: None,
backend,
system_rpc_tx,
config,
Expand Down Expand Up @@ -346,7 +345,7 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
// fails we take down the service with it.
task_manager
.spawn_essential_handle()
.spawn_blocking("aura", aura);
.spawn_blocking("aura", Some("block-authoring"), aura);

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

task_manager.spawn_essential_handle().spawn_blocking(
"grandpa-voter",
Some("block-finalization"),
sc_finality_grandpa::run_grandpa_voter(grandpa_config)?,
);
}
Expand Down Expand Up @@ -495,9 +495,11 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
})
};

task_manager
.spawn_handle()
.spawn_blocking("bioauth-flow", bioauth_flow_future);
task_manager.spawn_handle().spawn_blocking(
"bioauth-flow",
Some("bioauth"),
bioauth_flow_future,
);

Ok(task_manager)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/humanode-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

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

[dependencies]
bioauth-consensus-api = { version = "0.1", path = "../bioauth-consensus-api", default-features = false }
Expand Down Expand Up @@ -49,7 +49,7 @@ sp-version = { default-features = false, git = "https://github.com/humanode-netw
default = ["std"]
runtime-benchmarks = [
"hex-literal",
"frame-benchmarking",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking",
"frame-system/runtime-benchmarks",
Expand Down
2 changes: 1 addition & 1 deletion crates/humanode-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ pub type Executive = frame_executive::Executive<
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
AllPalletsWithSystem,
>;

impl_runtime_apis! {
Expand Down
2 changes: 1 addition & 1 deletion crates/pallet-bioauth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ std = [
"sp-std/std",
"sp-runtime/std",
]
runtime-benchmarks = ["frame-benchmarking"]
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]
try-runtime = ["frame-support/try-runtime"]
4 changes: 1 addition & 3 deletions crates/pallet-bioauth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ pub mod pallet {
CurrentMoment, TryConvert, ValidatorSetUpdater, Verifier,
};

use frame_support::{
dispatch::DispatchResult, pallet_prelude::*, sp_tracing::error, storage::types::ValueQuery,
};
use frame_support::{pallet_prelude::*, sp_tracing::error, storage::types::ValueQuery};
use frame_system::pallet_prelude::*;
use sp_runtime::{app_crypto::MaybeHash, traits::AtLeast32Bit};
use sp_std::prelude::*;
Expand Down