Skip to content

Commit

Permalink
Bump Substrate Dependency (paritytech#684)
Browse files Browse the repository at this point in the history
* Bump Substrate to commit `0b0d124d5`

* Get Millau node compiling

* Get Rialto node compiling

* Increase account reference count before test

* Fix Clippy warnings for Millau node

* Fix Clippy warnings for Rialto node

* Trigger build.

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
  • Loading branch information
2 people authored and serban300 committed Apr 8, 2024
1 parent 5402c8d commit d2179be
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 48 deletions.
1 change: 1 addition & 0 deletions bridges/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,4 @@ Element channel.

The [Substrate Technical](https://app.element.io/#/room/#substrate-technical:matrix.org) Element
channel is most suited for discussions regarding Substrate itself.

2 changes: 2 additions & 0 deletions bridges/bin/millau/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ sc-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branc
sc-executor = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
Expand Down
1 change: 1 addition & 0 deletions bridges/bin/millau/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ pub fn run() -> sc_cli::Result<()> {
Role::Light => service::new_light(config),
_ => service::new_full(config),
}
.map_err(sc_cli::Error::Service)
})
}
}
Expand Down
58 changes: 43 additions & 15 deletions bridges/bin/millau/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ use sc_client_api::{ExecutorProvider, RemoteBackend};
use sc_executor::native_executor_instance;
pub use sc_executor::NativeExecutor;
use sc_finality_grandpa::SharedVoterState;
use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::TelemetrySpan;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use sp_inherents::InherentDataProviders;
use std::sync::Arc;
Expand Down Expand Up @@ -69,13 +71,17 @@ pub fn new_partial(
AuraPair,
>,
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
Option<TelemetrySpan>,
),
>,
ServiceError,
> {
if config.keystore_remote.is_some() {
return Err(ServiceError::Other("Remote Keystores are not supported.".to_string()));
}
let inherent_data_providers = sp_inherents::InherentDataProviders::new();

let (client, backend, keystore_container, task_manager) =
let (client, backend, keystore_container, task_manager, telemetry_span) =
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
let client = Arc::new(client);

Expand Down Expand Up @@ -114,24 +120,43 @@ pub fn new_partial(
select_chain,
transaction_pool,
inherent_data_providers,
other: (aura_block_import, grandpa_link),
other: (aura_block_import, grandpa_link, telemetry_span),
})
}

fn remote_keystore(_url: &str) -> Result<Arc<LocalKeystore>, &'static str> {
// FIXME: here would the concrete keystore be built,
// must return a concrete type (NOT `LocalKeystore`) that
// implements `CryptoStore` and `SyncCryptoStore`
Err("Remote Keystore not supported.")
}

/// Builds a new service for a full client.
pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let sc_service::PartialComponents {
client,
backend,
mut task_manager,
import_queue,
keystore_container,
mut keystore_container,
select_chain,
transaction_pool,
inherent_data_providers,
other: (block_import, grandpa_link),
other: (block_import, grandpa_link, telemetry_span),
} = new_partial(&config)?;

if let Some(url) = &config.keystore_remote {
match remote_keystore(url) {
Ok(k) => keystore_container.set_remote_keystore(k),
Err(e) => {
return Err(ServiceError::Other(format!(
"Error hooking up remote keystore for {}: {}",
url, e
)))
}
};
}

config
.network
.extra_sets
Expand Down Expand Up @@ -164,7 +189,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
let name = config.network.node_name.clone();
let enable_grandpa = !config.disable_grandpa;
let prometheus_registry = config.prometheus_registry().cloned();
let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default();

let rpc_extensions_builder = {
use bp_message_lane::{LaneId, MessageNonce};
Expand Down Expand Up @@ -211,11 +235,12 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>

let justification_stream = grandpa_link.justification_stream();
let shared_authority_set = grandpa_link.shared_authority_set().clone();
let finality_proof_provider = GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
let shared_voter_state = sc_finality_grandpa::SharedVoterState::empty();

Box::new(move |_, subscription_executor| {
let shared_voter_state = SharedVoterState::empty();
let finality_proof_provider =
GrandpaFinalityProofProvider::new_for_service(backend.clone(), Some(shared_authority_set.clone()));

Box::new(move |_, subscription_executor| {
let mut io = jsonrpc_core::IoHandler::default();
io.extend_with(SystemApi::to_delegate(FullSystem::new(
client.clone(),
Expand All @@ -224,7 +249,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
)));
io.extend_with(GrandpaApi::to_delegate(GrandpaRpcHandler::new(
shared_authority_set.clone(),
shared_voter_state,
shared_voter_state.clone(),
justification_stream.clone(),
subscription_executor,
finality_proof_provider.clone(),
Expand All @@ -238,20 +263,20 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
})
};

sc_service::spawn_tasks(sc_service::SpawnTasksParams {
let (_rpc_handlers, telemetry_connection_notifier) = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
network: network.clone(),
client: client.clone(),
keystore: keystore_container.sync_keystore(),
task_manager: &mut task_manager,
transaction_pool: transaction_pool.clone(),
telemetry_connection_sinks: telemetry_connection_sinks.clone(),
rpc_extensions_builder,
on_demand: None,
remote_blockchain: None,
backend,
network_status_sinks,
system_rpc_tx,
config,
telemetry_span,
})?;

if role.is_authority() {
Expand Down Expand Up @@ -312,7 +337,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
config: grandpa_config,
link: grandpa_link,
network,
telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()),
telemetry_on_connect: telemetry_connection_notifier.map(|x| x.on_connect_stream()),
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry,
shared_voter_state: SharedVoterState::empty(),
Expand All @@ -331,7 +356,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>

/// Builds a new service for a light client.
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
let (client, backend, keystore_container, mut task_manager, on_demand) =
let (client, backend, keystore_container, mut task_manager, on_demand, telemetry_span) =
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;

config
Expand All @@ -352,9 +377,12 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
let (grandpa_block_import, _) =
sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?;

let aura_block_import =
sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(grandpa_block_import.clone(), client.clone());

let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _, _>(
sc_consensus_aura::slot_duration(&*client)?,
grandpa_block_import.clone(),
aura_block_import,
Some(Box::new(grandpa_block_import)),
client.clone(),
InherentDataProviders::new(),
Expand Down Expand Up @@ -390,14 +418,14 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
task_manager: &mut task_manager,
on_demand: Some(on_demand),
rpc_extensions_builder: Box::new(|_, _| ()),
telemetry_connection_sinks: sc_service::TelemetryConnectionSinks::default(),
config,
client,
keystore: keystore_container.sync_keystore(),
backend,
network,
network_status_sinks,
system_rpc_tx,
telemetry_span,
})?;

network_starter.start_network();
Expand Down
2 changes: 2 additions & 0 deletions bridges/bin/rialto/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ sc-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branc
sc-executor = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
Expand Down
14 changes: 8 additions & 6 deletions bridges/bin/rialto/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ pub fn run() -> sc_cli::Result<()> {
}
None => {
let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|config| async move {
match config.role {
Role::Light => service::new_light(config),
_ => service::new_full(config),
}
})
runner
.run_node_until_exit(|config| async move {
match config.role {
Role::Light => service::new_light(config),
_ => service::new_full(config),
}
})
.map_err(sc_cli::Error::Service)
}
}
}
Loading

0 comments on commit d2179be

Please sign in to comment.