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

feat: upgrade to Polkadot v0.9.16 #319

Merged
merged 30 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dd2b5a6
chore: bump Polkadot dependencies to v0.9.16
wischli Jan 31, 2022
a4df952
refactor: use AllPalletsWithSystem hook
wischli Jan 31, 2022
0da8631
chore: remove crowdloan pallet
wischli Jan 31, 2022
cfe284f
fix: apply no DefaultAccount check
wischli Jan 31, 2022
8870dbf
fix: switch to default MaxEncodedLen
wischli Jan 31, 2022
a9439cb
fix: apply asset quota + runtime state_version
wischli Jan 31, 2022
9606ae6
fix: Preimage registrar and Scheduler integration
wischli Jan 31, 2022
2471ce1
fix: OrderedSet
wischli Jan 31, 2022
42cde95
fix: apply new fork_id to chainspecs
wischli Feb 1, 2022
bae5e94
fix: apply no default account for SudoConfig
wischli Feb 1, 2022
4130db3
fix: apply name changes for GrandPa
wischli Feb 1, 2022
c76d7ca
fix: EnsureOneOf
wischli Feb 1, 2022
23f3139
fix: preimage weights
wischli Feb 1, 2022
0cde817
fix: parachain client
wischli Feb 1, 2022
495efe1
fix: clippy copied weights
wischli Feb 1, 2022
65a5398
fix: bump deps
wischli Feb 1, 2022
844b60b
tests: attempt staking fix
wischli Feb 1, 2022
1c2acfb
bench: attempt to fix default accountid for dids
wischli Feb 1, 2022
625df70
fix: staking unit test pallet order execution
wischli Feb 1, 2022
d2d48f8
fix: did unit benchmarks
wischli Feb 1, 2022
d43f354
fix: fmt
wischli Feb 2, 2022
6363a5c
fix: revert to old hook order execution
wischli Feb 2, 2022
ae7dc04
bench: run manually for preimage + scheduler
wischli Feb 2, 2022
54d73ab
fix: only import TaskManager for try-runtime feature
wischli Feb 2, 2022
37afc2c
fix: use correct scheduler migration + add logs
wischli Feb 2, 2022
b4c43c7
refactor: use explicit para runtime executors
wischli Feb 2, 2022
825a7fb
fix: apply code review by @Diiaablo95
wischli Feb 2, 2022
a5e9d01
chore: apply suggestion from @weichweich review
wischli Feb 3, 2022
54aa279
chore: bump deps
wischli Feb 9, 2022
00d063b
fix: deps
wischli Feb 9, 2022
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
6 changes: 3 additions & 3 deletions nodes/parachain/src/chain_spec/peregrine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ pub fn make_dev_spec() -> Result<ChainSpec, String> {
let wasm = WASM_BINARY.ok_or("No WASM")?;

Ok(ChainSpec::from_genesis(
"KILT Peregrine Local",
"peregrine_local_testnet",
"KILT Peregrine Develop",
"kilt_peregrine_dev",
ChainType::Local,
move || {
testnet_genesis(
Expand Down Expand Up @@ -112,7 +112,7 @@ pub fn make_new_spec() -> Result<ChainSpec, String> {

Ok(ChainSpec::from_genesis(
"KILT Peregrine Testnet",
"kilt_parachain_testnet",
"kilt_peregrine_testnet",
ChainType::Live,
move || {
testnet_genesis(
Expand Down
4 changes: 2 additions & 2 deletions nodes/parachain/src/chain_spec/spiritnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ pub fn get_chain_spec_dev() -> Result<ChainSpec, String> {
let wasm = WASM_BINARY.ok_or("No WASM")?;

Ok(ChainSpec::from_genesis(
"KILT Local",
"kilt_parachain_local_testnet",
"KILT Spiritnet Develop",
"kilt_spiritnet_dev",
ChainType::Local,
move || {
testnet_genesis(
Expand Down
63 changes: 46 additions & 17 deletions nodes/parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@
use crate::{
chain_spec,
cli::{Cli, RelayChainCli, Subcommand},
service::{new_partial, MashRuntimeExecutor, SpiritRuntimeExecutor},
service::{new_partial, PeregrineRuntimeExecutor, SpiritRuntimeExecutor},
};
use codec::Encode;
use cumulus_client_service::genesis::generate_genesis_block;
use cumulus_primitives_core::ParaId;
use log::info;
#[cfg(feature = "try-runtime")]
use node_executor::ExecutorDispatch;
use polkadot_parachain::primitives::AccountIdConversion;
#[cfg(feature = "try-runtime")]
use polkadot_service::TaskManager;
Expand All @@ -40,6 +38,31 @@ use sp_core::hexdisplay::HexDisplay;
use sp_runtime::traits::Block as BlockT;
use std::{io::Write, net::SocketAddr};

trait IdentifyChain {
fn is_peregrine(&self) -> bool;
fn is_spiritnet(&self) -> bool;
}

impl IdentifyChain for dyn sc_service::ChainSpec {
fn is_peregrine(&self) -> bool {
self.id().starts_with("kilt_peregrine")
}
fn is_spiritnet(&self) -> bool {
self.id().starts_with("kilt_spiritnet")
wischli marked this conversation as resolved.
Show resolved Hide resolved
|| self.id().starts_with("kilt_westend")
|| self.id().starts_with("kilt_rococo")
}
}

impl<T: sc_service::ChainSpec + 'static> IdentifyChain for T {
fn is_peregrine(&self) -> bool {
<dyn sc_service::ChainSpec>::is_peregrine(self)
}
fn is_spiritnet(&self) -> bool {
<dyn sc_service::ChainSpec>::is_spiritnet(self)
}
}

fn load_spec(id: &str, runtime: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
match (id, runtime) {
("dev", _) => Ok(Box::new(chain_spec::peregrine::make_dev_spec()?)),
Expand Down Expand Up @@ -165,9 +188,9 @@ macro_rules! construct_async_run {
},
"peregrine" => {
runner.async_run(|$config| {
let $components = new_partial::<peregrine_runtime::RuntimeApi, MashRuntimeExecutor, _>(
let $components = new_partial::<peregrine_runtime::RuntimeApi, PeregrineRuntimeExecutor, _>(
&$config,
crate::service::build_import_queue::<MashRuntimeExecutor, peregrine_runtime::RuntimeApi>,
crate::service::build_import_queue::<PeregrineRuntimeExecutor, peregrine_runtime::RuntimeApi>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
Expand Down Expand Up @@ -241,7 +264,7 @@ pub fn run() -> Result<()> {
if cfg!(feature = "runtime-benchmarks") {
let runner = cli.create_runner(cmd)?;
match cli.runtime.as_str() {
"peregrine" => runner.sync_run(|config| cmd.run::<Block, MashRuntimeExecutor>(config)),
"peregrine" => runner.sync_run(|config| cmd.run::<Block, PeregrineRuntimeExecutor>(config)),
"spiritnet" => runner.sync_run(|config| cmd.run::<Block, SpiritRuntimeExecutor>(config)),
_ => Err("Unknown runtime".into()),
}
Expand Down Expand Up @@ -297,13 +320,17 @@ pub fn run() -> Result<()> {
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
let runner = cli.create_runner(cmd)?;

// grab the task manager.
let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager = TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;

runner.async_run(|config| Ok((cmd.run::<Block, ExecutorDispatch>(config), task_manager)))
if runner.config().chain_spec.is_peregrine() {
runner.async_run(|config| Ok((cmd.run::<Block, PeregrineRuntimeExecutor>(config), task_manager)))
} else if runner.config().chain_spec.is_spiritnet() {
runner.async_run(|config| Ok((cmd.run::<Block, SpiritRuntimeExecutor>(config), task_manager)))
} else {
Err("Chain doesn't support try-runtime".into())
}
}
#[cfg(not(feature = "try-runtime"))]
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
Expand Down Expand Up @@ -346,14 +373,16 @@ pub fn run() -> Result<()> {
);

match cli.runtime.as_str() {
"peregrine" => crate::service::start_node::<MashRuntimeExecutor, peregrine_runtime::RuntimeApi>(
config,
polkadot_config,
id,
)
.await
.map(|r| r.0)
.map_err(Into::into),
"peregrine" => {
wischli marked this conversation as resolved.
Show resolved Hide resolved
crate::service::start_node::<PeregrineRuntimeExecutor, peregrine_runtime::RuntimeApi>(
config,
polkadot_config,
id,
)
.await
.map(|r| r.0)
.map_err(Into::into)
}
"spiritnet" => crate::service::start_node::<SpiritRuntimeExecutor, spiritnet_runtime::RuntimeApi>(
config,
polkadot_config,
Expand Down
4 changes: 2 additions & 2 deletions nodes/parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ impl sc_executor::NativeExecutionDispatch for SpiritRuntimeExecutor {

/// Native Peregrine executor instance.

pub struct MashRuntimeExecutor;
pub struct PeregrineRuntimeExecutor;

impl sc_executor::NativeExecutionDispatch for MashRuntimeExecutor {
impl sc_executor::NativeExecutionDispatch for PeregrineRuntimeExecutor {
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
Expand Down