mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-06-11 15:21:03 +00:00
V1.7.0 (#121)
* upgrade to v1.7.0 from v1.6.0 * update rust version * fix dalek and tests (use rust-src in components) * remove pallet template
This commit is contained in:
+8
-12
@@ -8,18 +8,15 @@ repository = { workspace = true }
|
||||
version = "0.1.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = [ "x86_64-unknown-linux-gnu" ]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
hex-literal = { workspace = true, optional = true }
|
||||
log = { workspace = true }
|
||||
parity-scale-codec = { workspace = true, features = [ "derive" ] }
|
||||
scale-info = { workspace = true, features = [ "derive" ] }
|
||||
parity-scale-codec = { workspace = true, features = ["derive"] }
|
||||
scale-info = { workspace = true, features = ["derive"] }
|
||||
smallvec = { workspace = true }
|
||||
|
||||
# Local
|
||||
pallet-template = { path = "../pallets/template", default-features = false }
|
||||
|
||||
# Substrate
|
||||
frame-benchmarking = { workspace = true, optional = true }
|
||||
frame-executive = { workspace = true }
|
||||
@@ -65,7 +62,9 @@ xcm-executor = { workspace = true }
|
||||
# Cumulus
|
||||
assets-common = { workspace = true }
|
||||
cumulus-pallet-aura-ext = { workspace = true }
|
||||
cumulus-pallet-parachain-system = { workspace = true, features = [ "parameterized-consensus-hook" ] }
|
||||
cumulus-pallet-parachain-system = { workspace = true, features = [
|
||||
"parameterized-consensus-hook",
|
||||
] }
|
||||
cumulus-pallet-session-benchmarking = { workspace = true }
|
||||
cumulus-pallet-xcm = { workspace = true }
|
||||
cumulus-pallet-xcmp-queue = { workspace = true }
|
||||
@@ -82,7 +81,7 @@ sp-io = { workspace = true }
|
||||
substrate-wasm-builder = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"assets-common/std",
|
||||
"cumulus-pallet-aura-ext/std",
|
||||
@@ -110,7 +109,6 @@ std = [
|
||||
"pallet-proxy/std",
|
||||
"pallet-session/std",
|
||||
"pallet-sudo/std",
|
||||
"pallet-template/std",
|
||||
"pallet-timestamp/std",
|
||||
"pallet-transaction-payment-rpc-runtime-api/std",
|
||||
"pallet-transaction-payment/std",
|
||||
@@ -156,7 +154,6 @@ runtime-benchmarks = [
|
||||
"pallet-message-queue/runtime-benchmarks",
|
||||
"pallet-multisig/runtime-benchmarks",
|
||||
"pallet-sudo/runtime-benchmarks",
|
||||
"pallet-template/runtime-benchmarks",
|
||||
"pallet-timestamp/runtime-benchmarks",
|
||||
"pallet-utility/runtime-benchmarks",
|
||||
"pallet-xcm/runtime-benchmarks",
|
||||
@@ -188,7 +185,6 @@ try-runtime = [
|
||||
"pallet-session/try-runtime",
|
||||
"pallet-session/try-runtime",
|
||||
"pallet-sudo/try-runtime",
|
||||
"pallet-template/try-runtime",
|
||||
"pallet-timestamp/try-runtime",
|
||||
"pallet-transaction-payment/try-runtime",
|
||||
"pallet-utility/try-runtime",
|
||||
@@ -198,4 +194,4 @@ try-runtime = [
|
||||
"sp-runtime/try-runtime",
|
||||
]
|
||||
|
||||
experimental = [ "pallet-aura/experimental" ]
|
||||
experimental = ["pallet-aura/experimental"]
|
||||
|
||||
+8
-24
@@ -13,7 +13,7 @@ pub mod xcm_config;
|
||||
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
|
||||
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
|
||||
use frame_support::{
|
||||
construct_runtime,
|
||||
construct_runtime, derive_impl,
|
||||
dispatch::DispatchClass,
|
||||
genesis_builder_helper::{build_config, create_default_config},
|
||||
parameter_types,
|
||||
@@ -294,7 +294,10 @@ impl Contains<RuntimeCall> for NormalFilter {
|
||||
}
|
||||
}
|
||||
|
||||
// Configure FRAME pallets to include in runtime.
|
||||
/// The default types are being injected by [`derive_impl`](`frame_support::derive_impl`) from
|
||||
/// [`ParaChainDefaultConfig`](`struct@frame_system::config_preludes::ParaChainDefaultConfig`),
|
||||
/// but overridden as needed.
|
||||
#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
|
||||
impl frame_system::Config for Runtime {
|
||||
/// The data to be stored in an account.
|
||||
type AccountData = pallet_balances::AccountData<Balance>;
|
||||
@@ -304,8 +307,7 @@ impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = NormalFilter;
|
||||
/// The block type.
|
||||
type Block = Block;
|
||||
/// Maximum number of block number to block hash mappings to keep (oldest
|
||||
/// pruned first).
|
||||
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
|
||||
type BlockHashCount = BlockHashCount;
|
||||
/// The maximum length of a block (in bytes).
|
||||
type BlockLength = RuntimeBlockLength;
|
||||
@@ -315,18 +317,13 @@ impl frame_system::Config for Runtime {
|
||||
type DbWeight = RocksDbWeight;
|
||||
/// The type for hashing blocks and tries.
|
||||
type Hash = Hash;
|
||||
/// The hashing algorithm used.
|
||||
type Hashing = BlakeTwo256;
|
||||
/// The lookup mechanism to get account ID from whatever is passed in
|
||||
/// dispatchers.
|
||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||
/// The maximum number of consumers allowed on a single account.
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
/// The index type for storing how many extrinsics an account has signed.
|
||||
type Nonce = Nonce;
|
||||
/// What to do if an account is fully reaped from the system.
|
||||
type OnKilledAccount = ();
|
||||
/// What to do if a new account is created.
|
||||
type OnNewAccount = ();
|
||||
/// The action to take on a Runtime Upgrade
|
||||
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
|
||||
/// Converts a module to an index of this module in the runtime.
|
||||
@@ -337,11 +334,8 @@ impl frame_system::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
/// The ubiquitous origin type.
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
/// This is used as an identifier of the chain. 42 is the generic substrate
|
||||
/// prefix.
|
||||
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
|
||||
type SS58Prefix = SS58Prefix;
|
||||
/// Weight information for the extrinsics of this pallet.
|
||||
type SystemWeightInfo = ();
|
||||
/// Runtime version.
|
||||
type Version = Version;
|
||||
}
|
||||
@@ -431,7 +425,6 @@ impl pallet_proxy::Config for Runtime {
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
pub const MaxFreezes: u32 = 0;
|
||||
pub const MaxHolds: u32 = 0;
|
||||
pub const MaxLocks: u32 = 50;
|
||||
pub const MaxReserves: u32 = 50;
|
||||
}
|
||||
@@ -444,7 +437,6 @@ impl pallet_balances::Config for Runtime {
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type FreezeIdentifier = ();
|
||||
type MaxFreezes = MaxFreezes;
|
||||
type MaxHolds = MaxHolds;
|
||||
type MaxLocks = MaxLocks;
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
@@ -670,11 +662,6 @@ impl pallet_collator_selection::Config for Runtime {
|
||||
type WeightInfo = pallet_collator_selection::weights::SubstrateWeight<Runtime>;
|
||||
}
|
||||
|
||||
/// Configure the pallet template in pallets/template.
|
||||
impl pallet_template::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
}
|
||||
|
||||
impl pallet_utility::Config for Runtime {
|
||||
type PalletsOrigin = OriginCaller;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
@@ -717,9 +704,6 @@ construct_runtime!(
|
||||
PolkadotXcm: pallet_xcm = 31,
|
||||
CumulusXcm: cumulus_pallet_xcm = 32,
|
||||
MessageQueue: pallet_message_queue = 33,
|
||||
|
||||
// Template
|
||||
TemplatePallet: pallet_template = 50,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
+20
-18
@@ -1,6 +1,6 @@
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
traits::{ConstU32, Everything, Nothing, PalletInfoAccess},
|
||||
parameter_types,
|
||||
traits::{ConstU32, Contains, Everything, Nothing, PalletInfoAccess},
|
||||
weights::Weight,
|
||||
};
|
||||
use frame_system::EnsureRoot;
|
||||
@@ -10,11 +10,12 @@ use polkadot_runtime_common::impls::ToAuthor;
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
|
||||
CurrencyAdapter, DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin,
|
||||
FixedWeightBounds, FungiblesAdapter, IsConcrete, NativeAsset, NoChecking, ParentIsPreset,
|
||||
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
|
||||
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
|
||||
TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
|
||||
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds,
|
||||
FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, IsConcrete, NativeAsset,
|
||||
NoChecking, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
|
||||
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
|
||||
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
|
||||
WithComputedOrigin, WithUniqueTopic,
|
||||
};
|
||||
use xcm_executor::XcmExecutor;
|
||||
|
||||
@@ -24,20 +25,20 @@ use super::{
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
pub const RelayLocation: MultiLocation = MultiLocation::parent();
|
||||
pub const RelayLocation: Location = Location::parent();
|
||||
pub const RelayNetwork: Option<NetworkId> = None;
|
||||
pub PlaceholderAccount: AccountId = PolkadotXcm::check_account();
|
||||
pub AssetsPalletLocation: MultiLocation =
|
||||
pub AssetsPalletLocation: Location =
|
||||
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
}
|
||||
|
||||
/// `AssetId/Balancer` converter for `TrustBackedAssets`
|
||||
pub type TrustBackedAssetsConvertedConcreteId =
|
||||
assets_common::TrustBackedAssetsConvertedConcreteId<AssetsPalletLocation, Balance>;
|
||||
|
||||
/// Type for specifying how a `MultiLocation` can be converted into an
|
||||
/// Type for specifying how a `Location` can be converted into an
|
||||
/// `AccountId`. This is used when determining ownership of accounts for asset
|
||||
/// transacting and when attempting to use XCM `Transact` in order to determine
|
||||
/// the dispatch Origin.
|
||||
@@ -51,12 +52,12 @@ pub type LocationToAccountId = (
|
||||
);
|
||||
|
||||
/// Means for transacting assets on this chain.
|
||||
pub type LocalAssetTransactor = CurrencyAdapter<
|
||||
pub type LocalAssetTransactor = FungibleAdapter<
|
||||
// Use this currency:
|
||||
Balances,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
IsConcrete<RelayLocation>,
|
||||
// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
|
||||
// Do a simple punn to convert an AccountId32 Location into a native chain account ID:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
@@ -113,11 +114,11 @@ parameter_types! {
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
}
|
||||
|
||||
match_types! {
|
||||
pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: Here } |
|
||||
MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) }
|
||||
};
|
||||
pub struct ParentOrParentsExecutivePlurality;
|
||||
impl Contains<Location> for ParentOrParentsExecutivePlurality {
|
||||
fn contains(location: &Location) -> bool {
|
||||
matches!(location.unpack(), (1, []) | (1, [Plurality { id: BodyId::Executive, .. }]))
|
||||
}
|
||||
}
|
||||
|
||||
pub type Barrier = TrailingSetTopicAsId<
|
||||
@@ -162,6 +163,7 @@ impl xcm_executor::Config for XcmConfig {
|
||||
type SubscriptionService = PolkadotXcm;
|
||||
type Trader =
|
||||
UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
||||
type TransactionalProcessor = FrameTransactionalProcessor;
|
||||
type UniversalAliases = Nothing;
|
||||
// Teleporting is disabled.
|
||||
type UniversalLocation = UniversalLocation;
|
||||
|
||||
@@ -88,8 +88,6 @@ mod runtime_tests {
|
||||
fn balances_constants() {
|
||||
assert_eq!(MaxFreezes::get(), 0);
|
||||
|
||||
assert_eq!(MaxHolds::get(), 0);
|
||||
|
||||
assert_eq!(MaxLocks::get(), 50);
|
||||
|
||||
assert_eq!(MaxReserves::get(), 50);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
use frame_support::traits::PalletInfo;
|
||||
use parachain_template_runtime::{
|
||||
Aura, AuraExt, Authorship, Balances, CollatorSelection, CumulusXcm, MessageQueue, Multisig,
|
||||
ParachainInfo, ParachainSystem, PolkadotXcm, Proxy, Runtime, Session, Sudo, System,
|
||||
TemplatePallet, Timestamp, TransactionPayment, XcmpQueue,
|
||||
ParachainInfo, ParachainSystem, PolkadotXcm, Proxy, Runtime, Session, Sudo, System, Timestamp,
|
||||
TransactionPayment, XcmpQueue,
|
||||
};
|
||||
|
||||
fn assert_pallet_prefix<P: 'static>(name: &str) {
|
||||
@@ -30,5 +30,4 @@ fn verify_pallet_prefixes() {
|
||||
assert_pallet_prefix::<PolkadotXcm>("PolkadotXcm");
|
||||
assert_pallet_prefix::<CumulusXcm>("CumulusXcm");
|
||||
assert_pallet_prefix::<MessageQueue>("MessageQueue");
|
||||
assert_pallet_prefix::<TemplatePallet>("TemplatePallet");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user