Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
* Remove CanAuthorWith trait

CanAuthotWith trait removed. Also all dependencies, parameters, type
paramers were removed. This is related to removal of native runtime.

* Companion for paritytech/substrate#12219

* Fixes

* polkadot-runtime-common updated

cargo update -p polkadot-runtime-common

* warning fixed

* Update cid

* update lockfile for {"polkadot", "substrate"}

* Update substrate

* update lockfile for {"polkadot", "substrate"}

* Update polkadot

* Fix tests

* 🤦

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <info@kchr.de>
  • Loading branch information
3 people committed Sep 14, 2022
1 parent b43bc58 commit 1f2b85c
Show file tree
Hide file tree
Showing 20 changed files with 486 additions and 361 deletions.
694 changes: 407 additions & 287 deletions Cargo.lock

Large diffs are not rendered by default.

34 changes: 12 additions & 22 deletions client/consensus/aura/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sc_telemetry::TelemetryHandle;
use sp_api::{ApiExt, ProvideRuntimeApi};
use sp_block_builder::BlockBuilder as BlockBuilderApi;
use sp_blockchain::HeaderBackend;
use sp_consensus::{CanAuthorWith, Error as ConsensusError};
use sp_consensus::Error as ConsensusError;
use sp_consensus_aura::AuraApi;
use sp_core::crypto::Pair;
use sp_inherents::CreateInherentDataProviders;
Expand All @@ -34,7 +34,7 @@ use std::{fmt::Debug, hash::Hash, sync::Arc};
use substrate_prometheus_endpoint::Registry;

/// Parameters of [`import_queue`].
pub struct ImportQueueParams<'a, I, C, CIDP, S, CAW> {
pub struct ImportQueueParams<'a, I, C, CIDP, S> {
/// The block import to use.
pub block_import: I,
/// The client to interact with the chain.
Expand All @@ -45,23 +45,20 @@ pub struct ImportQueueParams<'a, I, C, CIDP, S, CAW> {
pub spawner: &'a S,
/// The prometheus registry.
pub registry: Option<&'a Registry>,
/// Can we author with the current node?
pub can_author_with: CAW,
/// The telemetry handle.
pub telemetry: Option<TelemetryHandle>,
}

/// Start an import queue for the Aura consensus algorithm.
pub fn import_queue<'a, P, Block, I, C, S, CAW, CIDP>(
pub fn import_queue<'a, P, Block, I, C, S, CIDP>(
ImportQueueParams {
block_import,
client,
create_inherent_data_providers,
spawner,
registry,
can_author_with,
telemetry,
}: ImportQueueParams<'a, I, C, CIDP, S, CAW>,
}: ImportQueueParams<'a, I, C, CIDP, S>,
) -> Result<DefaultImportQueue<Block, C>, sp_consensus::Error>
where
Block: BlockT,
Expand All @@ -82,48 +79,41 @@ where
P::Public: Clone + Eq + Send + Sync + Hash + Debug + Codec,
P::Signature: Codec,
S: sp_core::traits::SpawnEssentialNamed,
CAW: CanAuthorWith<Block> + Send + Sync + 'static,
CIDP: CreateInherentDataProviders<Block, ()> + Sync + Send + 'static,
CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync,
{
sc_consensus_aura::import_queue::<P, _, _, _, _, _, _>(sc_consensus_aura::ImportQueueParams {
sc_consensus_aura::import_queue::<P, _, _, _, _, _>(sc_consensus_aura::ImportQueueParams {
block_import: cumulus_client_consensus_common::ParachainBlockImport::new(block_import),
justification_import: None,
client,
create_inherent_data_providers,
spawner,
registry,
can_author_with,
check_for_equivocation: sc_consensus_aura::CheckForEquivocation::No,
telemetry,
})
}

/// Parameters of [`build_verifier`].
pub struct BuildVerifierParams<C, CIDP, CAW> {
pub struct BuildVerifierParams<C, CIDP> {
/// The client to interact with the chain.
pub client: Arc<C>,
/// The inherent data providers, to create the inherent data.
pub create_inherent_data_providers: CIDP,
/// Can we author with the current node?
pub can_author_with: CAW,
/// The telemetry handle.
pub telemetry: Option<TelemetryHandle>,
}

/// Build the [`AuraVerifier`].
pub fn build_verifier<P, C, CIDP, CAW>(
BuildVerifierParams {
client,
create_inherent_data_providers,
can_author_with,
telemetry,
}: BuildVerifierParams<C, CIDP, CAW>,
) -> AuraVerifier<C, P, CAW, CIDP> {
pub fn build_verifier<P, C, CIDP>(
BuildVerifierParams { client, create_inherent_data_providers, telemetry }: BuildVerifierParams<
C,
CIDP,
>,
) -> AuraVerifier<C, P, CIDP> {
sc_consensus_aura::build_verifier(sc_consensus_aura::BuildVerifierParams {
client,
create_inherent_data_providers,
can_author_with,
telemetry,
check_for_equivocation: sc_consensus_aura::CheckForEquivocation::No,
})
Expand Down
3 changes: 1 addition & 2 deletions pallets/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub mod pallet {
pub use crate::weights::WeightInfo;
use core::ops::Div;
use frame_support::{
dispatch::DispatchResultWithPostInfo,
dispatch::{DispatchClass, DispatchResultWithPostInfo},
inherent::Vec,
pallet_prelude::*,
sp_runtime::{
Expand All @@ -88,7 +88,6 @@ pub mod pallet {
Currency, EnsureOrigin, ExistenceRequirement::KeepAlive, ReservableCurrency,
ValidatorRegistration,
},
weights::DispatchClass,
BoundedVec, PalletId,
};
use frame_system::{pallet_prelude::*, Config as SystemConfig};
Expand Down
5 changes: 3 additions & 2 deletions pallets/dmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
use codec::{Decode, DecodeLimit, Encode};
use cumulus_primitives_core::{relay_chain::BlockNumber as RelayBlockNumber, DmpMessageHandler};
use frame_support::{
dispatch::Weight, traits::EnsureOrigin, weights::constants::WEIGHT_PER_MILLIS,
traits::EnsureOrigin,
weights::{constants::WEIGHT_PER_MILLIS, Weight},
};
pub use pallet::*;
use scale_info::TypeInfo;
Expand Down Expand Up @@ -760,7 +761,7 @@ mod tests {
super::Call::<Test>::service_overweight { index: 0, weight_limit: Weight::zero() }
.get_dispatch_info()
.weight;
use frame_support::weights::GetDispatchInfo;
use frame_support::dispatch::GetDispatchInfo;
let info =
DmpQueue::service_overweight(Origin::root(), 0, Weight::from_ref_time(20000))
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions pallets/parachain-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ use cumulus_primitives_core::{
};
use cumulus_primitives_parachain_inherent::{MessageQueueChain, ParachainInherentData};
use frame_support::{
dispatch::{DispatchError, DispatchResult},
dispatch::{DispatchError, DispatchResult, Pays, PostDispatchInfo},
ensure,
inherent::{InherentData, InherentIdentifier, ProvideInherent},
storage,
traits::Get,
weights::{Pays, PostDispatchInfo, Weight},
weights::Weight,
};
use frame_system::{ensure_none, ensure_root};
use polkadot_parachain::primitives::RelayChainBlockNumber;
Expand Down
5 changes: 4 additions & 1 deletion pallets/solo-to-para/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

use codec::{Decode, Encode};
use cumulus_pallet_parachain_system as parachain_system;
use frame_support::{dispatch::DispatchResult, pallet_prelude::*, weights::DispatchInfo};
use frame_support::{
dispatch::{DispatchInfo, DispatchResult},
pallet_prelude::*,
};
use frame_system::pallet_prelude::*;
pub use pallet::*;
use polkadot_primitives::v2::PersistedValidationData;
Expand Down
3 changes: 0 additions & 3 deletions parachain-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayC
use cumulus_relay_chain_rpc_interface::{create_client_and_start_worker, RelayChainRpcInterface};

// Substrate Imports
use sc_client_api::ExecutorProvider;
use sc_executor::NativeElseWasmExecutor;
use sc_network::NetworkService;
use sc_network_common::service::NetworkBlock;
Expand Down Expand Up @@ -424,7 +423,6 @@ pub fn parachain_build_import_queue(
_,
_,
_,
_,
>(cumulus_client_consensus_aura::ImportQueueParams {
block_import: client.clone(),
client: client.clone(),
Expand All @@ -440,7 +438,6 @@ pub fn parachain_build_import_queue(
Ok((time, slot))
},
registry: config.prometheus_registry(),
can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
spawner: &task_manager.spawn_essential_handle(),
telemetry,
})
Expand Down
8 changes: 5 additions & 3 deletions parachain-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::Everything,
weights::{
constants::WEIGHT_PER_SECOND, ConstantMultiplier, DispatchClass, Weight,
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
constants::WEIGHT_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
WeightToFeeCoefficients, WeightToFeePolynomial,
},
PalletId,
};
Expand Down
6 changes: 4 additions & 2 deletions parachains/runtimes/assets/statemine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ use sp_version::RuntimeVersion;
use codec::{Decode, Encode, MaxEncodedLen};
use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{AsEnsureOriginWithArg, EitherOfDiverse, InstanceFilter},
weights::{ConstantMultiplier, DispatchClass, Weight},
weights::{ConstantMultiplier, Weight},
PalletId, RuntimeDebug,
};
use frame_system::{
Expand Down
6 changes: 4 additions & 2 deletions parachains/runtimes/assets/statemint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ use sp_version::RuntimeVersion;
use codec::{Decode, Encode, MaxEncodedLen};
use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{AsEnsureOriginWithArg, EitherOfDiverse, InstanceFilter},
weights::{ConstantMultiplier, DispatchClass, Weight},
weights::{ConstantMultiplier, Weight},
PalletId, RuntimeDebug,
};
use frame_system::{
Expand Down
6 changes: 4 additions & 2 deletions parachains/runtimes/assets/westmint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ use sp_version::RuntimeVersion;
use codec::{Decode, Encode, MaxEncodedLen};
use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{AsEnsureOriginWithArg, InstanceFilter},
weights::{ConstantMultiplier, DispatchClass, Weight},
weights::{ConstantMultiplier, Weight},
PalletId, RuntimeDebug,
};
use frame_system::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ use sp_version::RuntimeVersion;
use codec::{Decode, Encode, MaxEncodedLen};
use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{ConstU16, ConstU32, ConstU64, ConstU8, EitherOfDiverse, InstanceFilter},
weights::{ConstantMultiplier, DispatchClass, Weight},
weights::{ConstantMultiplier, Weight},
PalletId, RuntimeDebug,
};
use frame_system::{
Expand Down
6 changes: 4 additions & 2 deletions parachains/runtimes/contracts/contracts-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ use sp_version::RuntimeVersion;

use constants::{currency::*, fee::WeightToFee};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Everything},
weights::{ConstantMultiplier, DispatchClass, Weight},
weights::{ConstantMultiplier, Weight},
PalletId,
};
use frame_system::limits::{BlockLength, BlockWeights};
Expand Down
6 changes: 4 additions & 2 deletions parachains/runtimes/starters/seedling/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ use sp_version::RuntimeVersion;

// A few exports that help ease life for downstream crates.
pub use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{IsInVec, Randomness},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, IdentityFee, Weight,
IdentityFee, Weight,
},
StorageValue,
};
Expand Down
6 changes: 4 additions & 2 deletions parachains/runtimes/starters/shell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ use sp_version::RuntimeVersion;

// A few exports that help ease life for downstream crates.
pub use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{Everything, IsInVec, Randomness},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
DispatchClass, IdentityFee, Weight,
IdentityFee, Weight,
},
StorageValue,
};
Expand Down
8 changes: 5 additions & 3 deletions parachains/runtimes/testing/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ pub mod xcm_config;

use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::Everything,
weights::{
constants::WEIGHT_PER_SECOND, ConstantMultiplier, DispatchClass, Weight,
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
constants::WEIGHT_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
WeightToFeeCoefficients, WeightToFeePolynomial,
},
PalletId,
};
Expand Down
6 changes: 4 additions & 2 deletions parachains/runtimes/testing/rococo-parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ use sp_version::RuntimeVersion;

// A few exports that help ease life for downstream crates.
pub use frame_support::{
construct_runtime, match_types, parameter_types,
construct_runtime,
dispatch::DispatchClass,
match_types, parameter_types,
traits::{EitherOfDiverse, Everything, IsInVec, Randomness},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
ConstantMultiplier, DispatchClass, IdentityFee, Weight,
ConstantMultiplier, IdentityFee, Weight,
},
StorageValue,
};
Expand Down
Loading

0 comments on commit 1f2b85c

Please sign in to comment.