Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions .github/workflows/test.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ jobs:
run: |
rustup update stable --no-self-update
rustup target add wasm32-unknown-unknown
rustup component add clippy

# Check the build
- name: Check Build
run: |
SKIP_WASM_BUILD=1 cargo check --release

# # Test code
# - name: Test
# run: cargo test
- name: Check clippy
run: |
cargo clippy --all-targets --workspace --features runtime-benchmarks --features try-runtime
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cumulus_primitives_core::ParaId;
use parachain_template_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT, SudoConfig};
use parachain_template_runtime::{AccountId, AuraId, Signature, SudoConfig, EXISTENTIAL_DEPOSIT};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
Expand All @@ -15,7 +15,7 @@ const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;

/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
TPublic::Pair::from_string(&format!("//{seed}"), None)
.expect("static values are valid; qed")
.public()
}
Expand Down
1 change: 1 addition & 0 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::path::PathBuf;

/// Sub-commands supported by the collator.
#[derive(Debug, clap::Subcommand)]
#[allow(clippy::large_enum_variant)]
pub enum Subcommand {
/// Build a chain specification.
BuildSpec(sc_cli::BuildSpecCmd),
Expand Down
31 changes: 17 additions & 14 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ use crate::{

fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
Ok(match id {
"arrakis" => Box::new(chain_spec::ChainSpec::from_json_bytes(&include_bytes!("../../specs/arrakis.json")[..])?),
"arrakis" => Box::new(chain_spec::ChainSpec::from_json_bytes(
&include_bytes!("../../specs/arrakis.json")[..],
)?),
"dev" => Box::new(chain_spec::development_config()),
"template-rococo" => Box::new(chain_spec::local_testnet_config()),
"" | "local" => Box::new(chain_spec::local_testnet_config()),
Expand Down Expand Up @@ -104,8 +106,11 @@ impl SubstrateCli for RelayChainCli {

fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
match id {
"rococo_freeverse" => Ok(Box::new(RococoChainSpec::from_json_bytes(&include_bytes!("../../specs/rococo-freeverse-chainspec.json")[..])?)),
_ => polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id),
"rococo_freeverse" => Ok(Box::new(RococoChainSpec::from_json_bytes(
&include_bytes!("../../specs/rococo-freeverse-chainspec.json")[..],
)?)),
_ => polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter())
.load_spec(id),
}
}

Expand Down Expand Up @@ -173,7 +178,7 @@ pub fn run() -> Result<()> {
&polkadot_cli,
config.tokio_handle.clone(),
)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
.map_err(|err| format!("Relay chain argument error: {err}"))?;

cmd.run(config, polkadot_config)
})
Expand Down Expand Up @@ -211,12 +216,11 @@ pub fn run() -> Result<()> {
}),
#[cfg(not(feature = "runtime-benchmarks"))]
BenchmarkCmd::Storage(_) =>
return Err(sc_cli::Error::Input(
Err(sc_cli::Error::Input(
"Compile with --features=runtime-benchmarks \
to enable storage benchmarks."
.into(),
)
.into()),
)),
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
let partials = new_partial(&config)?;
Expand Down Expand Up @@ -249,7 +253,7 @@ pub fn run() -> Result<()> {
let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager =
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;
.map_err(|e| format!("Error: {e}"))?;

let info_provider = timestamp_with_aura_info(MILLISECS_PER_BLOCK);

Expand All @@ -273,13 +277,13 @@ pub fn run() -> Result<()> {
runner.run_node_until_exit(|config| async move {
let hwbench = (!cli.no_hardware_benchmarks).then_some(
config.database.path().map(|database_path| {
let _ = std::fs::create_dir_all(&database_path);
let _ = std::fs::create_dir_all(database_path);
sc_sysinfo::gather_hwbench(Some(database_path))
})).flatten();

let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
.map(|e| e.para_id)
.ok_or_else(|| "Could not find parachain ID in chain-spec.")?;
.ok_or("Could not find parachain ID in chain-spec.")?;

let polkadot_cli = RelayChainCli::new(
&config,
Expand All @@ -292,21 +296,20 @@ pub fn run() -> Result<()> {
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)
.map_err(|e| format!("{:?}", e))?;
let block: Block = generate_genesis_block(&*config.chain_spec, state_version)?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));

let tokio_handle = config.tokio_handle.clone();
let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
.map_err(|err| format!("Relay chain argument error: {}", err))?;
.map_err(|err| format!("Relay chain argument error: {err}"))?;

info!("Parachain id: {:?}", id);
info!("Parachain Account: {}", parachain_account);
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.len() > 0 {
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.");
}

Expand Down
2 changes: 2 additions & 0 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type ParachainBlockImport = TParachainBlockImport<Block, Arc<ParachainClient>, P
///
/// Use this macro if you don't actually need the full service, but just the builder in order to
/// be able to perform chain operations.
#[allow(clippy::type_complexity)]
pub fn new_partial(
config: &Configuration,
) -> Result<
Expand Down Expand Up @@ -354,6 +355,7 @@ fn build_import_queue(
.map_err(Into::into)
}

#[allow(clippy::too_many_arguments)]
fn build_consensus(
client: Arc<ParachainClient>,
block_import: ParachainBlockImport,
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }

pallet-livingassets-ownership = { git = "https://github.com/freeverseio/pallet-livingassets-ownership", rev="a15098e080aee626580a383df1382b3cd020deae", default-features = false }
pallet-livingassets-ownership = { git = "https://github.com/freeverseio/pallet-livingassets-ownership", branch="dev", default-features = false }

# Polkadot
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.42" }
Expand Down
12 changes: 6 additions & 6 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,24 +478,24 @@ construct_runtime!(
ParachainSystem: cumulus_pallet_parachain_system = 1,
Timestamp: pallet_timestamp = 2,
ParachainInfo: parachain_info = 3,

// Monetary stuff.
Balances: pallet_balances = 10,
TransactionPayment: pallet_transaction_payment = 11,

// Collator support. The order of these 4 are important and shall not change.
Authorship: pallet_authorship = 20,
CollatorSelection: pallet_collator_selection = 21,
Session: pallet_session = 22,
Aura: pallet_aura = 23,
AuraExt: cumulus_pallet_aura_ext = 24,

// XCM helpers.
XcmpQueue: cumulus_pallet_xcmp_queue = 30,
PolkadotXcm: pallet_xcm = 31,
CumulusXcm: cumulus_pallet_xcm = 32,
DmpQueue: cumulus_pallet_dmp_queue = 33,

// Template
Sudo: pallet_sudo = 40,
LivingassetsOwnership: pallet_livingassets_ownership = 41,
Expand Down Expand Up @@ -692,13 +692,13 @@ impl_runtime_apis! {
list_benchmarks!(list, extra);

let storage_info = AllPalletsWithSystem::storage_info();
return (list, storage_info)
(list, storage_info)
}

fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
use frame_benchmarking::{Benchmarking, BenchmarkBatch};

use frame_system_benchmarking::Pallet as SystemBench;
impl frame_system_benchmarking::Config for Runtime {}
Expand Down