Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
chore: update to polkadot-v0.9.40 (#25)
Browse files Browse the repository at this point in the history
* chore: update to polkadot-v0.9.38

* chore: update to polkadot-v0.9.39

* chore: update to polkadot-v0.9.40
  • Loading branch information
evilrobot-01 authored May 20, 2023
1 parent 107aade commit 5612968
Show file tree
Hide file tree
Showing 13 changed files with 1,346 additions and 1,075 deletions.
1,911 changes: 1,067 additions & 844 deletions Cargo.lock

Large diffs are not rendered by default.

101 changes: 50 additions & 51 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ homepage = "https://substrate.io"
license = "Unlicense"
name = "parachain-template-node"
repository = "https://github.com/paritytech/cumulus/"
version = "0.9.370"
version = "0.9.400"

[dependencies]
clap = {version = "4.1.1", features = ["derive"]}
clap = { version = "4.1.8", features = ["derive"] }
codec = {package = "parity-scale-codec", version = "3.0.0"}
jsonrpsee = {version = "0.16.2", features = ["server"]}
log = "0.4.17"
Expand All @@ -20,61 +20,60 @@ serde = {version = "1.0.152", features = ["derive"]}
parachain-template-runtime = {path = "../runtime"}

# Substrate
frame-benchmarking = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-chain-spec = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-network-common = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-tracing = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-block-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-core = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-io = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", optional = true}
sp-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-offchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-runtime = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-session = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
sp-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
try-runtime-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
frame-benchmarking = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-chain-spec = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-tracing = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-block-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-core = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-io = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40", optional = true}
sp-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-offchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-runtime = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-session = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
sp-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}
try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v0.9.40" }

# Polkadot
polkadot-cli = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37"}
polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37"}
polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.37"}
xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.37"}
polkadot-cli = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40"}
polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40"}
polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40"}
xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40"}

# Cumulus
cumulus-client-cli = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-client-network = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-client-service = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-relay-chain-inprocess-interface = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-relay-chain-minimal-node = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-relay-chain-rpc-interface = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.37"}
cumulus-client-cli = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}
cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}
cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}
cumulus-client-service = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}
cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}
cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}
cumulus-relay-chain-inprocess-interface = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}
cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}
cumulus-relay-chain-minimal-node = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}
cumulus-relay-chain-rpc-interface = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40"}

[build-dependencies]
substrate-build-script-utils = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37"}
substrate-build-script-utils = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40"}

[features]
default = []
Expand Down
1 change: 1 addition & 0 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,6 @@ fn testnet_genesis(
polkadot_xcm: parachain_template_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
transaction_payment: Default::default(),
}
}
15 changes: 13 additions & 2 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ pub fn run() -> Result<()> {
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use parachain_template_runtime::MILLISECS_PER_BLOCK;
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
use try_runtime_cli::block_building_info::timestamp_with_aura_info;

let runner = cli.create_runner(cmd)?;

use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
Expand All @@ -246,8 +250,15 @@ pub fn run() -> Result<()> {
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;

let info_provider = timestamp_with_aura_info(MILLISECS_PER_BLOCK);

runner.async_run(|_| {
Ok((cmd.run::<Block, HostFunctionsOf<ParachainNativeExecutor>>(), task_manager))
Ok((
cmd.run::<Block, HostFunctionsOf<ParachainNativeExecutor>, _>(Some(
info_provider,
)),
task_manager,
))
})
},
#[cfg(not(feature = "try-runtime"))]
Expand Down Expand Up @@ -277,7 +288,7 @@ pub fn run() -> Result<()> {
let id = ParaId::from(para_id);

let parachain_account =
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(&id);
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(&id);

let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
let block: Block = generate_genesis_block(&*config.chain_spec, state_version)
Expand Down
60 changes: 34 additions & 26 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ use std::{sync::Arc, time::Duration};

use cumulus_client_cli::CollatorOptions;
// Local Runtime Types
use parachain_template_runtime::{opaque::Block, Hash, RuntimeApi};
use parachain_template_runtime::{opaque::Block, RuntimeApi};

// Cumulus Imports
use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
use cumulus_client_consensus_common::{
ParachainBlockImport as TParachainBlockImport, ParachainConsensus,
};
use cumulus_client_network::BlockAnnounceValidator;
use cumulus_client_service::{
build_relay_chain_interface, prepare_node_config, start_collator, start_full_node,
StartCollatorParams, StartFullNodeParams,
build_network, build_relay_chain_interface, prepare_node_config, start_collator,
start_full_node, BuildNetworkParams, StartCollatorParams, StartFullNodeParams,
};
use cumulus_primitives_core::ParaId;
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface};
use cumulus_relay_chain_interface::RelayChainInterface;

// Substrate Imports
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
use sc_consensus::ImportQueue;
use sc_executor::NativeElseWasmExecutor;
use sc_network::NetworkService;
use sc_network_common::service::NetworkBlock;
use sc_network::NetworkBlock;
use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_keystore::SyncCryptoStorePtr;
Expand Down Expand Up @@ -162,32 +162,25 @@ async fn start_node_impl(
hwbench.clone(),
)
.await
.map_err(|e| match e {
RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x,
s => s.to_string().into(),
})?;

let block_announce_validator =
BlockAnnounceValidator::new(relay_chain_interface.clone(), para_id);
.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;

let force_authoring = parachain_config.force_authoring;
let validator = parachain_config.role.is_authority();
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();

let (network, system_rpc_tx, tx_handler_controller, start_network) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &parachain_config,
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
build_network(BuildNetworkParams {
parachain_config: &parachain_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
para_id,
spawn_handle: task_manager.spawn_handle(),
relay_chain_interface: relay_chain_interface.clone(),
import_queue: params.import_queue,
block_announce_validator_builder: Some(Box::new(|_| {
Box::new(block_announce_validator)
})),
warp_sync: None,
})?;
})
.await?;

if parachain_config.offchain_worker.enabled {
sc_service::build_offchain_workers(
Expand Down Expand Up @@ -222,13 +215,22 @@ async fn start_node_impl(
keystore: params.keystore_container.sync_keystore(),
backend,
network: network.clone(),
sync_service: sync_service.clone(),
system_rpc_tx,
tx_handler_controller,
telemetry: telemetry.as_mut(),
})?;

if let Some(hwbench) = hwbench {
sc_sysinfo::print_hwbench(&hwbench);
// Here you can check whether the hardware meets your chains' requirements. Putting a link
// in there and swapping out the requirements for your own are probably a good idea. The
// requirements for a para-chain are dictated by its relay-chain.
if !SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) && validator {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements for role 'Authority'."
);
}

if let Some(ref mut telemetry) = telemetry {
let telemetry_handle = telemetry.handle();
Expand All @@ -241,12 +243,16 @@ async fn start_node_impl(
}

let announce_block = {
let network = network.clone();
Arc::new(move |hash, data| network.announce_block(hash, data))
let sync_service = sync_service.clone();
Arc::new(move |hash, data| sync_service.announce_block(hash, data))
};

let relay_chain_slot_duration = Duration::from_secs(6);

let overseer_handle = relay_chain_interface
.overseer_handle()
.map_err(|e| sc_service::Error::Application(Box::new(e)))?;

if validator {
let parachain_consensus = build_consensus(
client.clone(),
Expand All @@ -256,7 +262,7 @@ async fn start_node_impl(
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
network,
sync_service,
params.keystore_container.sync_keystore(),
force_authoring,
para_id,
Expand All @@ -275,6 +281,7 @@ async fn start_node_impl(
import_queue: import_queue_service,
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
relay_chain_slot_duration,
recovery_handle: Box::new(overseer_handle),
};

start_collator(params).await?;
Expand All @@ -287,6 +294,7 @@ async fn start_node_impl(
relay_chain_interface,
relay_chain_slot_duration,
import_queue: import_queue_service,
recovery_handle: Box::new(overseer_handle),
};

start_full_node(params)?;
Expand Down Expand Up @@ -343,7 +351,7 @@ fn build_consensus(
task_manager: &TaskManager,
relay_chain_interface: Arc<dyn RelayChainInterface>,
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
sync_oracle: Arc<NetworkService<Block, Hash>>,
sync_oracle: Arc<SyncingService<Block>>,
keystore: SyncCryptoStorePtr,
force_authoring: bool,
para_id: ParaId,
Expand Down
Loading

0 comments on commit 5612968

Please sign in to comment.