Skip to content

Commit

Permalink
wip: fix features
Browse files Browse the repository at this point in the history
  • Loading branch information
wischli committed Nov 16, 2022
1 parent 5fb4855 commit dd81eac
Show file tree
Hide file tree
Showing 48 changed files with 861 additions and 1,228 deletions.
46 changes: 46 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ cumulus-client-service = {git = "https://github.com/paritytech/cumulus", branch
cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.32"}
cumulus-relay-chain-inprocess-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.32"}
cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.32"}
cumulus-relay-chain-minimal-node = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.32"}
cumulus-relay-chain-rpc-interface = {git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.32"}
pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.32"}
polkadot-cli = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.32"}
Expand Down
1 change: 1 addition & 0 deletions nodes/parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ cumulus-primitives-core = {workspace = true, features = ["std"]}
cumulus-primitives-parachain-inherent = {workspace = true, features = ["std"]}
cumulus-relay-chain-inprocess-interface.workspace = true
cumulus-relay-chain-interface.workspace = true
cumulus-relay-chain-minimal-node.workspace = true
cumulus-relay-chain-rpc-interface.workspace = true

# Polkadot dependencies
Expand Down
7 changes: 2 additions & 5 deletions nodes/parachain/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ pub(crate) enum Subcommand {
/// be enabled.
#[cfg(not(feature = "try-runtime"))]
TryRuntime,

/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
}

/// Command for building the genesis state of the parachain
Expand All @@ -76,7 +73,7 @@ pub(crate) struct BuildSpecCmd {
pub(crate) inner_args: sc_cli::BuildSpecCmd,

/// The name of the runtime which should get executed.
#[command(long, default_value = DEFAULT_RUNTIME)]
#[arg(long, default_value = DEFAULT_RUNTIME)]
pub(crate) runtime: String,
}

Expand Down Expand Up @@ -117,7 +114,7 @@ pub(crate) struct Cli {

/// Relaychain arguments
#[arg(raw = true)]
pub(crate) relaychain_args: Vec<String>,
pub(crate) relay_chain_args: Vec<String>,
}

#[derive(Debug)]
Expand Down
4 changes: 2 additions & 2 deletions nodes/parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub fn run() -> Result<()> {
&config,
[RelayChainCli::executable_name()]
.iter()
.chain(cli.relaychain_args.iter()),
.chain(cli.relay_chain_args.iter()),
);

let polkadot_config =
Expand Down Expand Up @@ -433,7 +433,7 @@ pub fn run() -> Result<()> {
&config,
[RelayChainCli::executable_name()]
.iter()
.chain(cli.relaychain_args.iter()),
.chain(cli.relay_chain_args.iter()),
);

let id = ParaId::from(para_id);
Expand Down
46 changes: 20 additions & 26 deletions nodes/parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ use cumulus_client_service::{
use cumulus_primitives_core::ParaId;
use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult};
use cumulus_relay_chain_rpc_interface::{create_client_and_start_worker, RelayChainRpcInterface};
use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;
use polkadot_service::{CollatorPair, NativeExecutionDispatch};
use sc_client_api::ExecutorProvider;
use sc_executor::NativeElseWasmExecutor;
use sc_network::{NetworkBlock, NetworkService};
use sc_service::{Configuration, TFullBackend, TFullClient, TaskManager};
Expand Down Expand Up @@ -202,10 +201,7 @@ async fn build_relay_chain_interface(
hwbench: Option<sc_sysinfo::HwBench>,
) -> RelayChainResult<(Arc<(dyn RelayChainInterface + 'static)>, Option<CollatorPair>)> {
match collator_options.relay_chain_rpc_url {
Some(relay_chain_url) => {
let client = create_client_and_start_worker(relay_chain_url, task_manager).await?;
Ok((Arc::new(RelayChainRpcInterface::new(client)) as Arc<_>, None))
}
Some(relay_chain_url) => build_minimal_relay_chain_node(polkadot_config, task_manager, relay_chain_url).await,
None => build_inprocess_relay_chain(
polkadot_config,
parachain_config,
Expand Down Expand Up @@ -308,15 +304,16 @@ where
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let transaction_pool = params.transaction_pool.clone();
let import_queue = cumulus_client_service::SharedImportQueue::new(params.import_queue);
let (network, system_rpc_tx, start_network) = sc_service::build_network(sc_service::BuildNetworkParams {
config: &parachain_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue: import_queue.clone(),
block_announce_validator_builder: Some(Box::new(|_| Box::new(block_announce_validator))),
warp_sync: None,
})?;
let (network, system_rpc_tx, tx_handler_controller, start_network) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &parachain_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue: import_queue.clone(),
block_announce_validator_builder: Some(Box::new(|_| Box::new(block_announce_validator))),
warp_sync: None,
})?;

let rpc_builder = {
let client = client.clone();
Expand All @@ -343,6 +340,7 @@ where
backend: backend.clone(),
network: network.clone(),
system_rpc_tx,
tx_handler_controller,
telemetry: telemetry.as_mut(),
})?;

Expand Down Expand Up @@ -377,11 +375,9 @@ where
network,
params.keystore_container.sync_keystore(),
force_authoring,
id,
)?;

let spawner = task_manager.spawn_handle();

let params = StartCollatorParams {
para_id: id,
block_status: client.clone(),
Expand All @@ -406,7 +402,6 @@ where
relay_chain_interface,
relay_chain_slot_duration,
import_queue,
collator_options,
};

start_full_node(params)?;
Expand Down Expand Up @@ -445,22 +440,21 @@ where
{
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;

cumulus_client_consensus_aura::import_queue::<sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _>(
cumulus_client_consensus_aura::import_queue::<sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _>(
cumulus_client_consensus_aura::ImportQueueParams {
block_import: client.clone(),
client: client.clone(),
create_inherent_data_providers: move |_, _| async move {
let time = sp_timestamp::InherentDataProvider::from_system_time();
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();

let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*time,
*timestamp,
slot_duration,
);

Ok((time, slot))
Ok((slot, timestamp))
},
registry: config.prometheus_registry(),
can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
spawner: &task_manager.spawn_essential_handle(),
telemetry,
},
Expand Down Expand Up @@ -538,17 +532,17 @@ where
id,
)
.await;
let time = sp_timestamp::InherentDataProvider::from_system_time();
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();

let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
*time,
*timestamp,
slot_duration,
);

let parachain_inherent = parachain_inherent.ok_or_else(|| {
Box::<dyn std::error::Error + Send + Sync>::from("Failed to create parachain inherent")
})?;
Ok((time, slot, parachain_inherent))
Ok((slot, timestamp, parachain_inherent))
}
},
block_import: client.clone(),
Expand Down
2 changes: 1 addition & 1 deletion nodes/standalone/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
pub fn create_benchmark_extrinsic(
client: &FullClient,
sender: sp_core::sr25519::Pair,
call: runtime::Call,
call: runtime::RuntimeCall,
nonce: u32,
) -> runtime::UncheckedExtrinsic {
let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed");
Expand Down
3 changes: 0 additions & 3 deletions nodes/standalone/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,4 @@ pub enum Subcommand {

/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),

/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
}
4 changes: 2 additions & 2 deletions pallets/attestation/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ benchmarks! {

let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), attester);
Pallet::<T>::add(origin, claim_hash, ctype_hash, None)?;
let origin = RawRuntimeOrigin::signed(sender);
let origin = RawOrigin::Signed(sender);
}: _(origin, claim_hash)
verify {
assert!(!Attestations::<T>::contains_key(claim_hash));
Expand Down Expand Up @@ -160,7 +160,7 @@ benchmarks! {
let origin = <T as Config>::EnsureOrigin::generate_origin(deposit_owner.clone(), attester.clone());
Pallet::<T>::add(origin, claim_hash, ctype_hash, None).expect("claim should be added");

let origin = RawRuntimeOrigin::signed(deposit_owner.clone());
let origin = RawOrigin::Signed(deposit_owner.clone());
}: _(origin, claim_hash)
verify {
assert_eq!(Attestations::<T>::get(claim_hash), Some(AttestationDetails {
Expand Down
2 changes: 1 addition & 1 deletion pallets/attestation/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub(crate) mod runtime {
}

impl mock_origin::Config for Test {
type RuntimeOrigin = RuntimeOrigin;
type Origin = RuntimeOrigin;
type AccountId = AccountId;
type SubjectId = SubjectId;
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/ctype/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ runtime-benchmarks = [
]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"kilt-support/std",
Expand Down
2 changes: 1 addition & 1 deletion pallets/ctype/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub mod runtime {
}

impl mock_origin::Config for Test {
type RuntimeOrigin = RuntimeOrigin;
type Origin = RuntimeOrigin;
type AccountId = AccountId;
type SubjectId = SubjectId;
}
Expand Down
4 changes: 2 additions & 2 deletions pallets/delegation/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ benchmarks! {
let child_delegation = DelegationNodes::<T>::get(child_id).ok_or("Child of root should have delegation id")?;
assert!(!<T as Config>::Currency::reserved_balance(&sender).is_zero());

let origin = RawRuntimeOrigin::signed(sender.clone());
let origin = RawOrigin::Signed(sender.clone());
}: _(origin, hierarchy_id, r)
verify {
assert!(!DelegationNodes::<T>::contains_key(hierarchy_id));
Expand Down Expand Up @@ -471,7 +471,7 @@ benchmarks! {
<T as Config>::Currency::minimum_balance() + <T as Config>::Deposit::get(),
);

let origin = RawRuntimeOrigin::signed(deposit_owner);
let origin = RawOrigin::Signed(deposit_owner);
}: _(origin, hierarchy_id)
verify {
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/delegation/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub(crate) mod runtime {
}

impl mock_origin::Config for Test {
type RuntimeOrigin = RuntimeOrigin;
type Origin = RuntimeOrigin;
type AccountId = AccountId;
type SubjectId = SubjectId;
}
Expand Down
Loading

0 comments on commit dd81eac

Please sign in to comment.