Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to polkadot-v0.9.43 as a base for substrate related deps #940

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
1,917 changes: 490 additions & 1,427 deletions Cargo.lock

Large diffs are not rendered by default.

182 changes: 91 additions & 91 deletions Cargo.toml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions crates/humanode-peer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ sc-consensus = { workspace = true }
sc-consensus-babe = { workspace = true }
sc-consensus-grandpa = { workspace = true }
sc-executor = { workspace = true }
sc-network = { workspace = true }
sc-service = { workspace = true }
sc-telemetry = { workspace = true }
sc-transaction-pool = { workspace = true }
Expand Down
36 changes: 10 additions & 26 deletions crates/humanode-peer/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ pub trait CliConfigurationExt: SubstrateCliConfigurationProvider {
.unwrap_or_default();

let bioauth_flow = self.bioauth_params().map(|params| {
let rpc_http_port = substrate.rpc_http.map(|v| v.port());
let rpc_ws_port = substrate.rpc_ws.map(|v| v.port());
let rpc_url = rpc_url_from_params(params, rpc_http_port, rpc_ws_port);
let rpc_port = substrate.rpc_addr.map(|v| v.port());
let rpc_url = rpc_url_from_params(params, rpc_port);

configuration::BioauthFlow {
rpc_url_resolver: Default::default(),
Expand Down Expand Up @@ -124,48 +123,33 @@ impl<T: sc_cli::CliConfiguration> SubstrateCliConfigurationProvider for T {
}

/// Construct an RPC URL from the bioauth flow params and an RPC endpoint port.
fn rpc_url_from_params(
params: &BioauthFlowParams,
rpc_http_port: Option<u16>,
rpc_ws_port: Option<u16>,
) -> RpcUrl {
fn rpc_url_from_params(params: &BioauthFlowParams, rpc_port: Option<u16>) -> RpcUrl {
if let Some(val) = &params.rpc_url {
return RpcUrl::Set(val.clone());
}
if params.rpc_url_unset {
return RpcUrl::Unset;
}
if params.rpc_url_ngrok_detect {
let ws_rpc_endpoint_port = match params.rpc_url_scheme_preference {
// If there's no preference - try switching to WebSocket if it's available.
RpcUrlSchemePreference::NoPreference | RpcUrlSchemePreference::Ws => rpc_ws_port,
RpcUrlSchemePreference::Http => None,
};
return RpcUrl::DetectFromNgrok {
tunnel_name: params.rpc_url_ngrok_detect_from.clone(),
ws_rpc_endpoint_port,
ws_rpc_endpoint_port: rpc_port,
};
}

match (
&params.rpc_url_scheme_preference,
rpc_http_port,
rpc_ws_port,
) {
match (&params.rpc_url_scheme_preference, rpc_port) {
// Try WebSocket first if the user has no preference.
(RpcUrlSchemePreference::Ws | RpcUrlSchemePreference::NoPreference, _, Some(port)) => {
(RpcUrlSchemePreference::Ws | RpcUrlSchemePreference::NoPreference, Some(port)) => {
RpcUrl::LocalhostWithPort {
rpc_endpoint_port: port,
scheme: "ws",
}
}
// Try HTTP second if the user has no preference.
(RpcUrlSchemePreference::Http | RpcUrlSchemePreference::NoPreference, Some(port), _) => {
RpcUrl::LocalhostWithPort {
rpc_endpoint_port: port,
scheme: "http",
}
}
(RpcUrlSchemePreference::Http, Some(port)) => RpcUrl::LocalhostWithPort {
rpc_endpoint_port: port,
scheme: "http",
},
// If everything fails - fallback to unset.
_ => RpcUrl::Unset,
}
Expand Down
12 changes: 2 additions & 10 deletions crates/humanode-peer/src/service/frontier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@ use std::{path::Path, sync::Arc};

use fc_storage::OverrideHandle;
use humanode_runtime::opaque::Block;
use sc_cli::SubstrateCli;
use sc_client_api::backend::Backend;
use sc_service::{BasePath, Configuration};
use sc_service::Configuration;

use super::{FrontierBackend, FullClient, ServiceError};
use crate::configuration::{self, FrontierBackendType};

/// Create frontier dir.
pub fn db_config_dir(config: &sc_service::Configuration) -> std::path::PathBuf {
config
.base_path
.as_ref()
.map(|base_path| base_path.config_dir(config.chain_spec.id()))
.unwrap_or_else(|| {
BasePath::from_project("", "", &crate::cli::Root::executable_name())
.config_dir(config.chain_spec.id())
})
config.base_path.config_dir(config.chain_spec.id())
}

/// Create frontier backend.
Expand Down
13 changes: 6 additions & 7 deletions crates/humanode-peer/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
),
} = new_partial(&config)?;
let Configuration {
substrate: mut config,
substrate: config,
bioauth_flow: bioauth_flow_config,
ethereum_rpc: ethereum_rpc_config,
..
Expand All @@ -245,12 +245,10 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
&config.chain_spec,
);

config
.network
.extra_sets
.push(sc_consensus_grandpa::grandpa_peers_set_config(
grandpa_protocol_name.clone(),
));
let mut net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);
net_config.add_notification_protocol(sc_consensus_grandpa::grandpa_peers_set_config(
grandpa_protocol_name.clone(),
));

let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new(
Arc::clone(&backend),
Expand Down Expand Up @@ -297,6 +295,7 @@ pub async fn new_full(config: Configuration) -> Result<TaskManager, ServiceError
let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
net_config,
client: Arc::clone(&client),
transaction_pool: Arc::clone(&transaction_pool),
spawn_handle: task_manager.spawn_handle(),
Expand Down
1 change: 1 addition & 0 deletions crates/humanode-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ runtime-benchmarks = [
"pallet-humanode-session/runtime-benchmarks",
"pallet-im-online/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-token-claims/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
Expand Down
Loading