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

Commit

Permalink
Update to Polkadot-v1.1.0 (#85)
Browse files Browse the repository at this point in the history
* Update to polkadot-v1.1.0

* Update lockfile

* Update zombienet instructions

* Update build_import_queue

* Bump zombinet version

* Rename generic BIC -> SC

* Remove CheckInherents from Runtime

* Update rust-setup to include protobuf prerequisite and use stable over nightly rust

* Add build badge on README

* Revert "Add build badge on README"; to be incl. on separate PR

This reverts commit d2ed6d5.

* Add Hash as opaque type

* Include ConsensusHooks for cumulus_pallet_parachain_system

---------

Co-authored-by: Steve Degosserie <steve@parity.io>
  • Loading branch information
weezy20 and Steve Degosserie authored Sep 28, 2023
1 parent 4834765 commit 6a11baf
Show file tree
Hide file tree
Showing 15 changed files with 1,874 additions and 1,118 deletions.
2,365 changes: 1,575 additions & 790 deletions Cargo.lock

Large diffs are not rendered by default.

186 changes: 94 additions & 92 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cargo build --release
```

### 🕸️ Run a local network
Next you will need a compatible release of [Polkadot](https://github.com/paritytech/polkadot) to run a testnet. You may also want to use [Zombienet (available for Linux and MacOS)](https://github.com/paritytech/zombienet/releases) for spinning up a testnet:
Next you will need a compatible release of [Polkadot](https://github.com/paritytech/polkadot-sdk) to run a testnet. You may also want to use [Zombienet (available for Linux and MacOS)](https://github.com/paritytech/zombienet/releases) for spinning up a testnet:


You can find linux and macOS executables of the Zombienet CLI here:
Expand Down
8 changes: 4 additions & 4 deletions docs/rust-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source ~/.cargo/env
Ubuntu:
```sh
sudo apt update
sudo apt install -y cmake pkg-config libssl-dev git gcc build-essential git clang libclang-dev
sudo apt install -y cmake pkg-config libssl-dev git gcc build-essential git clang libclang-dev protobuf-compiler
```
Arch Linux:
```sh
Expand All @@ -23,9 +23,9 @@ brew update
brew install openssl cmake llvm
```

- ### Install the `wasm` target and the `nightly` toolchain for rust
- ### Install the `wasm` target for your rust toolchain

```sh
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup update
rustup target add wasm32-unknown-unknown
```
2 changes: 1 addition & 1 deletion docs/zombienet.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Commands:

You may use a reference implementation from the folder `zombienet-config` or make your own. We provide a simple configuration for you called [zombienet-config.toml](../zombienet-config.toml) which spins up two validators for the relay chain, and one collator for your parachain to get you quickly upto speed.

⚠️ Take note: the path of the polkadot executable used there is `../bin/polkadot` which means you need to have a folder called `bin` outside the repository directory which contains your compiled polkadot binary which must be named as `polkadot`. Also please take care to compile the correct version of `polkadot` when testing out on your machine. You can do so by cloning `polkadot` and then checking out the appropriate branch that corresponds to the substrate/cumulus version used to build the template.
⚠️ Note: the path of the polkadot executable used there is `./bin/polkadot` which means you need to have your compiled polkadot binary inside a folder `./bin`. Also since `polkadot-v1.1.0`, two additional binaries would be needed to run the relay chain node called `polkadot-prepare-worker` and `polkadot-execute-worker` both of which can be found in the [Polkadot-Sdk release page](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.1.0). Place these binaries alongside the main `polkadot` binary.

More instructions here: [Simulate parachains in a test network
](https://docs.substrate.io/test/simulate-parachains/)
4 changes: 3 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homepage = { workspace = true }
license = { workspace = true }
name = "parachain-template-node"
repository = { workspace = true }
version = "1.0.0"
version = "1.1.0"

[dependencies]
clap = { workspace = true }
Expand Down Expand Up @@ -71,9 +71,11 @@ xcm = { workspace = true, default-features = false }
cumulus-client-cli = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
cumulus-client-consensus-common = { workspace = true }
cumulus-client-collator = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-client-consensus-proposer = { workspace = true }
cumulus-relay-chain-inprocess-interface = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }
cumulus-relay-chain-minimal-node = { workspace = true }
Expand Down
58 changes: 33 additions & 25 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{net::SocketAddr, path::PathBuf};
use cumulus_client_cli::generate_genesis_block;
use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::{info, warn};
use log::info;
use parity_scale_codec::Encode;
use runtime_common::Block;
use sc_cli::{
Expand Down Expand Up @@ -369,11 +369,12 @@ pub fn run() -> Result<()> {
let collator_options = cli.run.collator_options();

runner.run_node_until_exit(|config| async move {
let hwbench = (!cli.no_hardware_benchmarks).then_some(
config.database.path().map(|database_path| {
let hwbench = (!cli.no_hardware_benchmarks)
.then_some(config.database.path().map(|database_path| {
let _ = std::fs::create_dir_all(database_path);
sc_sysinfo::gather_hwbench(Some(database_path))
})).flatten();
}))
.flatten();

let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
.map(|e| e.para_id)
Expand All @@ -387,10 +388,13 @@ pub fn run() -> Result<()> {
let id = ParaId::from(para_id);

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

let block: Block = generate_genesis_block(&*config.chain_spec, sp_runtime::StateVersion::V1)
.map_err(|e| format!("{:?}", e))?;
let block: Block =
generate_genesis_block(&*config.chain_spec, sp_runtime::StateVersion::V1)
.map_err(|e| format!("{:?}", e))?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));

let tokio_handle = config.tokio_handle.clone();
Expand All @@ -403,31 +407,35 @@ pub fn run() -> Result<()> {
info!("Parachain genesis state: {}", genesis_state);
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });

if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relay_chain_args.is_empty() {
warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options.");
}
match config.chain_spec.runtime() {
Runtime::Default | Runtime::Devnet => {
// If you want to support a custom SS58 prefix (that isn’t yet registered in the ss58-registry),
// you are required to call this function with your desired prefix [Ss58AddressFormat::custom].
// This will enable the node to decode ss58 addresses with this prefix.
// This SS58 version/format is also only used by the node and not by the runtime.
sp_core::crypto::set_default_ss58_version(devnet_runtime::SS58Prefix::get().into());
crate::service::start_parachain_node::<devnet_runtime::RuntimeApi, DevnetRuntimeExecutor>
(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0)
.map_err(Into::into)

}
sp_core::crypto::set_default_ss58_version(
devnet_runtime::SS58Prefix::get().into(),
);
crate::service::start_parachain_node::<
devnet_runtime::RuntimeApi,
DevnetRuntimeExecutor,
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0)
.map_err(Into::into)
},
Runtime::Mainnet => {
sp_core::crypto::set_default_ss58_version(mainnet_runtime::SS58Prefix::get().into());
crate::service::start_parachain_node::<mainnet_runtime::RuntimeApi, MainnetRuntimeExecutor>
(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0)
.map_err(Into::into)
}
sp_core::crypto::set_default_ss58_version(
mainnet_runtime::SS58Prefix::get().into(),
);
crate::service::start_parachain_node::<
mainnet_runtime::RuntimeApi,
MainnetRuntimeExecutor,
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0)
.map_err(Into::into)
},
}
})
},
Expand Down
Loading

0 comments on commit 6a11baf

Please sign in to comment.