mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Merge remote-tracking branch 'origin' into gav-xcm-v3
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# Parachains
|
||||
|
||||
This directory is the home of Parity-developed parachain runtimes. This directory is _runtime
|
||||
focused_, and does not include builds of parachain _nodes_.
|
||||
|
||||
The general internal structure is:
|
||||
|
||||
- `chain-specs`: Chain specs for the runtimes contained in its sibling dir `runtimes`.
|
||||
- `common`: Common configurations, `impl`s, etc. used by several parachain runtimes.
|
||||
- `integration-tests`: Integration tests to test parachain interactions via XCM.
|
||||
- `pallets`: FRAME pallets that are specific to parachains.
|
||||
- `runtimes`: The entry point for parachain runtimes.
|
||||
|
||||
## Common Good Parachains
|
||||
|
||||
The `runtimes` directory includes many, but is not limited to,
|
||||
[common good parachains](https://wiki.polkadot.network/docs/learn-common-goods). Likewise, not all
|
||||
common good parachains are in this repo.
|
||||
|
||||
## Releases
|
||||
|
||||
The project maintainers generally try to release a set of parachain runtimes for each Polkadot
|
||||
Relay Chain runtime release.
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
0x000000000000000000000000000000000000000000000000000000000000000000c1ef26b567de07159e4ecd415fbbb0340c56a09c4d72c82516d0f3bc2b782c8003170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,67 @@
|
||||
[package]
|
||||
name = "parachains-common"
|
||||
version = "1.0.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Logic which is common to all parachain runtimes"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
|
||||
# Substrate
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
|
||||
# Polkadot
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus
|
||||
pallet-collator-selection = { path = "../../pallets/collator-selection", default-features = false }
|
||||
cumulus-primitives-utility = { path = "../../primitives/utility", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"scale-info/std",
|
||||
"frame-executive/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"pallet-asset-tx-payment/std",
|
||||
"pallet-assets/std",
|
||||
"pallet-authorship/std",
|
||||
"pallet-balances/std",
|
||||
"polkadot-primitives/std",
|
||||
"polkadot-runtime-common/std",
|
||||
"sp-consensus-aura/std",
|
||||
"sp-io/std",
|
||||
"sp-std/std",
|
||||
"pallet-collator-selection/std",
|
||||
"cumulus-primitives-utility/std",
|
||||
"xcm-builder/std"
|
||||
]
|
||||
@@ -0,0 +1,278 @@
|
||||
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Auxiliary struct/enums for parachain runtimes.
|
||||
//! Taken from polkadot/runtime/common (at a21cd64) and adapted for parachains.
|
||||
|
||||
use frame_support::traits::{
|
||||
fungibles::{self, Balanced, CreditOf},
|
||||
Contains, ContainsPair, Currency, Get, Imbalance, OnUnbalanced,
|
||||
};
|
||||
use pallet_asset_tx_payment::HandleCredit;
|
||||
use sp_runtime::traits::Zero;
|
||||
use sp_std::marker::PhantomData;
|
||||
use xcm::latest::{AssetId, Fungibility::Fungible, MultiAsset, MultiLocation};
|
||||
|
||||
/// Type alias to conveniently refer to the `Currency::NegativeImbalance` associated type.
|
||||
pub type NegativeImbalance<T> = <pallet_balances::Pallet<T> as Currency<
|
||||
<T as frame_system::Config>::AccountId,
|
||||
>>::NegativeImbalance;
|
||||
|
||||
/// Type alias to conveniently refer to `frame_system`'s `Config::AccountId`.
|
||||
pub type AccountIdOf<R> = <R as frame_system::Config>::AccountId;
|
||||
|
||||
/// Implementation of `OnUnbalanced` that deposits the fees into a staking pot for later payout.
|
||||
pub struct ToStakingPot<R>(PhantomData<R>);
|
||||
impl<R> OnUnbalanced<NegativeImbalance<R>> for ToStakingPot<R>
|
||||
where
|
||||
R: pallet_balances::Config + pallet_collator_selection::Config,
|
||||
AccountIdOf<R>:
|
||||
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
|
||||
<R as frame_system::Config>::Event: From<pallet_balances::Event<R>>,
|
||||
{
|
||||
fn on_nonzero_unbalanced(amount: NegativeImbalance<R>) {
|
||||
let staking_pot = <pallet_collator_selection::Pallet<R>>::account_id();
|
||||
<pallet_balances::Pallet<R>>::resolve_creating(&staking_pot, amount);
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation of `OnUnbalanced` that deals with the fees by combining tip and fee and passing
|
||||
/// the result on to `ToStakingPot`.
|
||||
pub struct DealWithFees<R>(PhantomData<R>);
|
||||
impl<R> OnUnbalanced<NegativeImbalance<R>> for DealWithFees<R>
|
||||
where
|
||||
R: pallet_balances::Config + pallet_collator_selection::Config,
|
||||
AccountIdOf<R>:
|
||||
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
|
||||
<R as frame_system::Config>::Event: From<pallet_balances::Event<R>>,
|
||||
{
|
||||
fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance<R>>) {
|
||||
if let Some(mut fees) = fees_then_tips.next() {
|
||||
if let Some(tips) = fees_then_tips.next() {
|
||||
tips.merge_into(&mut fees);
|
||||
}
|
||||
<ToStakingPot<R> as OnUnbalanced<_>>::on_unbalanced(fees);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A `HandleCredit` implementation that naively transfers the fees to the block author.
|
||||
/// Will drop and burn the assets in case the transfer fails.
|
||||
pub struct AssetsToBlockAuthor<R>(PhantomData<R>);
|
||||
impl<R> HandleCredit<AccountIdOf<R>, pallet_assets::Pallet<R>> for AssetsToBlockAuthor<R>
|
||||
where
|
||||
R: pallet_authorship::Config + pallet_assets::Config,
|
||||
AccountIdOf<R>:
|
||||
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
|
||||
{
|
||||
fn handle_credit(credit: CreditOf<AccountIdOf<R>, pallet_assets::Pallet<R>>) {
|
||||
if let Some(author) = pallet_authorship::Pallet::<R>::author() {
|
||||
// In case of error: Will drop the result triggering the `OnDrop` of the imbalance.
|
||||
let _ = pallet_assets::Pallet::<R>::resolve(&author, credit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Allow checking in assets that have issuance > 0.
|
||||
pub struct NonZeroIssuance<AccountId, Assets>(PhantomData<(AccountId, Assets)>);
|
||||
impl<AccountId, Assets> Contains<<Assets as fungibles::Inspect<AccountId>>::AssetId>
|
||||
for NonZeroIssuance<AccountId, Assets>
|
||||
where
|
||||
Assets: fungibles::Inspect<AccountId>,
|
||||
{
|
||||
fn contains(id: &<Assets as fungibles::Inspect<AccountId>>::AssetId) -> bool {
|
||||
!Assets::total_issuance(*id).is_zero()
|
||||
}
|
||||
}
|
||||
|
||||
/// Asset filter that allows all assets from a certain location.
|
||||
pub struct AssetsFrom<T>(PhantomData<T>);
|
||||
impl<T: Get<MultiLocation>> ContainsPair<MultiAsset, MultiLocation> for AssetsFrom<T> {
|
||||
fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool {
|
||||
let loc = T::get();
|
||||
&loc == origin &&
|
||||
matches!(asset, MultiAsset { id: AssetId::Concrete(asset_loc), fun: Fungible(_a) }
|
||||
if asset_loc.match_and_split(&loc).is_some())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{FindAuthor, ValidatorRegistration},
|
||||
PalletId,
|
||||
};
|
||||
use frame_system::{limits, EnsureRoot};
|
||||
use pallet_collator_selection::IdentityCollator;
|
||||
use polkadot_primitives::v2::AccountId;
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
Perbill,
|
||||
};
|
||||
use xcm::prelude::*;
|
||||
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
const TEST_ACCOUNT: AccountId = AccountId::new([1; 32]);
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
pub enum Test where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub BlockLength: limits::BlockLength = limits::BlockLength::max(2 * 1024);
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
pub const MaxReserves: u32 = 50;
|
||||
}
|
||||
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type Call = Call;
|
||||
type Hash = H256;
|
||||
type Hashing = BlakeTwo256;
|
||||
type AccountId = AccountId;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type BlockLength = BlockLength;
|
||||
type BlockWeights = ();
|
||||
type DbWeight = ();
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
type AccountData = pallet_balances::AccountData<u64>;
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
|
||||
impl pallet_balances::Config for Test {
|
||||
type Balance = u64;
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ();
|
||||
type AccountStore = System;
|
||||
type MaxLocks = ();
|
||||
type WeightInfo = ();
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
}
|
||||
|
||||
pub struct OneAuthor;
|
||||
impl FindAuthor<AccountId> for OneAuthor {
|
||||
fn find_author<'a, I>(_: I) -> Option<AccountId>
|
||||
where
|
||||
I: 'a,
|
||||
{
|
||||
Some(TEST_ACCOUNT)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct IsRegistered;
|
||||
impl ValidatorRegistration<AccountId> for IsRegistered {
|
||||
fn is_registered(_id: &AccountId) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const PotId: PalletId = PalletId(*b"PotStake");
|
||||
pub const MaxCandidates: u32 = 20;
|
||||
pub const MaxInvulnerables: u32 = 20;
|
||||
pub const MinCandidates: u32 = 1;
|
||||
}
|
||||
|
||||
impl pallet_collator_selection::Config for Test {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type UpdateOrigin = EnsureRoot<AccountId>;
|
||||
type PotId = PotId;
|
||||
type MaxCandidates = MaxCandidates;
|
||||
type MinCandidates = MinCandidates;
|
||||
type MaxInvulnerables = MaxInvulnerables;
|
||||
type ValidatorId = <Self as frame_system::Config>::AccountId;
|
||||
type ValidatorIdOf = IdentityCollator;
|
||||
type ValidatorRegistration = IsRegistered;
|
||||
type KickThreshold = ();
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl pallet_authorship::Config for Test {
|
||||
type FindAuthor = OneAuthor;
|
||||
type UncleGenerations = ();
|
||||
type FilterUncle = ();
|
||||
type EventHandler = ();
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
// We use default for brevity, but you can configure as desired if needed.
|
||||
pallet_balances::GenesisConfig::<Test>::default()
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
t.into()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fees_and_tip_split() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let fee = Balances::issue(10);
|
||||
let tip = Balances::issue(20);
|
||||
|
||||
assert_eq!(Balances::free_balance(TEST_ACCOUNT), 0);
|
||||
|
||||
DealWithFees::on_unbalanceds(vec![fee, tip].into_iter());
|
||||
|
||||
// Author gets 100% of tip and 100% of fee = 30
|
||||
assert_eq!(Balances::free_balance(CollatorSelection::account_id()), 30);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assets_from_filters_correctly() {
|
||||
parameter_types! {
|
||||
pub SomeSiblingParachain: MultiLocation = MultiLocation::new(1, X1(Parachain(1234)));
|
||||
}
|
||||
|
||||
let asset_location = SomeSiblingParachain::get()
|
||||
.clone()
|
||||
.pushed_with_interior(GeneralIndex(42))
|
||||
.expect("multilocation will only have 2 junctions; qed");
|
||||
let asset = MultiAsset { id: Concrete(asset_location), fun: 1_000_000u128.into() };
|
||||
assert!(
|
||||
AssetsFrom::<SomeSiblingParachain>::contains(&asset, &SomeSiblingParachain::get()),
|
||||
"AssetsFrom should allow assets from any of its interior locations"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
pub mod impls;
|
||||
pub mod xcm_config;
|
||||
pub use constants::*;
|
||||
pub use opaque::*;
|
||||
pub use types::*;
|
||||
|
||||
/// Common types of parachains.
|
||||
mod types {
|
||||
use sp_runtime::traits::{IdentifyAccount, Verify};
|
||||
|
||||
/// An index to a block.
|
||||
pub type BlockNumber = u32;
|
||||
|
||||
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
|
||||
pub type Signature = sp_runtime::MultiSignature;
|
||||
|
||||
/// Some way of identifying an account on the chain. We intentionally make it equivalent
|
||||
/// to the public key of our transaction signing scheme.
|
||||
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
|
||||
|
||||
/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
|
||||
/// never know...
|
||||
pub type AccountIndex = u32;
|
||||
|
||||
/// Balance of an account.
|
||||
pub type Balance = u128;
|
||||
|
||||
/// Index of a transaction in the chain.
|
||||
pub type Index = u32;
|
||||
|
||||
/// A hash of some data used by the chain.
|
||||
pub type Hash = sp_core::H256;
|
||||
|
||||
/// Digest item type.
|
||||
pub type DigestItem = sp_runtime::generic::DigestItem;
|
||||
|
||||
// Aura consensus authority.
|
||||
pub type AuraId = sp_consensus_aura::sr25519::AuthorityId;
|
||||
|
||||
// Aura consensus authority used by Statemint.
|
||||
//
|
||||
// Because of registering the authorities with an ed25519 key before switching from Shell
|
||||
// to Statemint, we were required to deploy a hotfix that changed Statemint to ed22519.
|
||||
// In the future that may change again.
|
||||
pub type StatemintAuraId = sp_consensus_aura::ed25519::AuthorityId;
|
||||
|
||||
// Id used for identifying assets.
|
||||
pub type AssetId = u32;
|
||||
}
|
||||
|
||||
/// Common constants of parachains.
|
||||
mod constants {
|
||||
use super::types::BlockNumber;
|
||||
use frame_support::weights::{constants::WEIGHT_PER_SECOND, Weight};
|
||||
use sp_runtime::Perbill;
|
||||
/// This determines the average expected block time that we are targeting. Blocks will be
|
||||
/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by
|
||||
/// `pallet_timestamp` which is in turn picked up by `pallet_aura` to implement `fn
|
||||
/// slot_duration()`.
|
||||
///
|
||||
/// Change this to adjust the block time.
|
||||
pub const MILLISECS_PER_BLOCK: u64 = 12000;
|
||||
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
|
||||
|
||||
// Time is measured by number of blocks.
|
||||
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
|
||||
pub const HOURS: BlockNumber = MINUTES * 60;
|
||||
pub const DAYS: BlockNumber = HOURS * 24;
|
||||
|
||||
/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is
|
||||
/// used to limit the maximal weight of a single extrinsic.
|
||||
pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
|
||||
/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by
|
||||
/// Operational extrinsics.
|
||||
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||
|
||||
/// We allow for 0.5 seconds of compute with a 6 second average block time.
|
||||
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2;
|
||||
}
|
||||
|
||||
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
|
||||
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
|
||||
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
|
||||
/// to even the core data structures.
|
||||
pub mod opaque {
|
||||
use super::*;
|
||||
use sp_runtime::{generic, traits::BlakeTwo256};
|
||||
|
||||
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
|
||||
/// Opaque block header type.
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
/// Opaque block type.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
/// Opaque block identifier type.
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
use crate::impls::AccountIdOf;
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::{
|
||||
log,
|
||||
traits::{fungibles::Inspect, tokens::BalanceConversion},
|
||||
weights::{Weight, WeightToFee, WeightToFeePolynomial},
|
||||
};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_executor::traits::ShouldExecute;
|
||||
|
||||
//TODO: move DenyThenTry to polkadot's xcm module.
|
||||
/// Deny executing the XCM if it matches any of the Deny filter regardless of anything else.
|
||||
/// If it passes the Deny, and matches one of the Allow cases then it is let through.
|
||||
pub struct DenyThenTry<Deny, Allow>(PhantomData<Deny>, PhantomData<Allow>)
|
||||
where
|
||||
Deny: ShouldExecute,
|
||||
Allow: ShouldExecute;
|
||||
|
||||
impl<Deny, Allow> ShouldExecute for DenyThenTry<Deny, Allow>
|
||||
where
|
||||
Deny: ShouldExecute,
|
||||
Allow: ShouldExecute,
|
||||
{
|
||||
fn should_execute<Call>(
|
||||
origin: &MultiLocation,
|
||||
message: &mut Xcm<Call>,
|
||||
max_weight: Weight,
|
||||
weight_credit: &mut Weight,
|
||||
) -> Result<(), ()> {
|
||||
Deny::should_execute(origin, message, max_weight, weight_credit)?;
|
||||
Allow::should_execute(origin, message, max_weight, weight_credit)
|
||||
}
|
||||
}
|
||||
|
||||
// See issue #5233
|
||||
pub struct DenyReserveTransferToRelayChain;
|
||||
impl ShouldExecute for DenyReserveTransferToRelayChain {
|
||||
fn should_execute<Call>(
|
||||
origin: &MultiLocation,
|
||||
message: &mut Xcm<Call>,
|
||||
_max_weight: Weight,
|
||||
_weight_credit: &mut Weight,
|
||||
) -> Result<(), ()> {
|
||||
if message.0.iter().any(|inst| {
|
||||
matches!(
|
||||
inst,
|
||||
InitiateReserveWithdraw {
|
||||
reserve: MultiLocation { parents: 1, interior: Here },
|
||||
..
|
||||
} | DepositReserveAsset { dest: MultiLocation { parents: 1, interior: Here }, .. } |
|
||||
TransferReserveAsset {
|
||||
dest: MultiLocation { parents: 1, interior: Here },
|
||||
..
|
||||
}
|
||||
)
|
||||
}) {
|
||||
return Err(()) // Deny
|
||||
}
|
||||
|
||||
// An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve`
|
||||
// should not allow this, but we just log it here.
|
||||
if matches!(origin, MultiLocation { parents: 1, interior: Here }) &&
|
||||
message.0.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. }))
|
||||
{
|
||||
log::warn!(
|
||||
target: "xcm::barrier",
|
||||
"Unexpected ReserveAssetDeposited from the Relay Chain",
|
||||
);
|
||||
}
|
||||
// Permit everything else
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// A `ChargeFeeInFungibles` implementation that converts the output of
|
||||
/// a given WeightToFee implementation an amount charged in
|
||||
/// a particular assetId from pallet-assets
|
||||
pub struct AssetFeeAsExistentialDepositMultiplier<Runtime, WeightToFee, BalanceConverter>(
|
||||
PhantomData<(Runtime, WeightToFee, BalanceConverter)>,
|
||||
);
|
||||
impl<CurrencyBalance, Runtime, WeightToFee, BalanceConverter>
|
||||
cumulus_primitives_utility::ChargeWeightInFungibles<
|
||||
AccountIdOf<Runtime>,
|
||||
pallet_assets::Pallet<Runtime>,
|
||||
> for AssetFeeAsExistentialDepositMultiplier<Runtime, WeightToFee, BalanceConverter>
|
||||
where
|
||||
Runtime: pallet_assets::Config,
|
||||
WeightToFee: WeightToFeePolynomial<Balance = CurrencyBalance>,
|
||||
BalanceConverter: BalanceConversion<
|
||||
CurrencyBalance,
|
||||
<Runtime as pallet_assets::Config>::AssetId,
|
||||
<Runtime as pallet_assets::Config>::Balance,
|
||||
>,
|
||||
AccountIdOf<Runtime>:
|
||||
From<polkadot_primitives::v2::AccountId> + Into<polkadot_primitives::v2::AccountId>,
|
||||
{
|
||||
fn charge_weight_in_fungibles(
|
||||
asset_id: <pallet_assets::Pallet<Runtime> as Inspect<AccountIdOf<Runtime>>>::AssetId,
|
||||
weight: Weight,
|
||||
) -> Result<<pallet_assets::Pallet<Runtime> as Inspect<AccountIdOf<Runtime>>>::Balance, XcmError>
|
||||
{
|
||||
let amount = WeightToFee::weight_to_fee(&weight);
|
||||
// If the amount gotten is not at least the ED, then make it be the ED of the asset
|
||||
// This is to avoid burning assets and decreasing the supply
|
||||
let asset_amount = BalanceConverter::to_asset_balance(amount, asset_id)
|
||||
.map_err(|_| XcmError::TooExpensive)?;
|
||||
Ok(asset_amount)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
[relaychain]
|
||||
default_command = "./bin/polkadot"
|
||||
default_args = [ "-lparachain=debug" ]
|
||||
chain = "kusama-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
ws_port = 9900
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "charlie"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "dave"
|
||||
validator = true
|
||||
|
||||
[[parachains]]
|
||||
id = 1000
|
||||
chain = "statemine-local"
|
||||
cumulus_based = true
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator1"
|
||||
ws_port = 9910
|
||||
command = "./bin/polkadot-parachain"
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator2"
|
||||
command = "./bin/polkadot-parachain"
|
||||
|
||||
[[parachains]]
|
||||
id = 2000
|
||||
chain = "penpal-kusama-2000"
|
||||
cumulus_based = true
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator3"
|
||||
ws_port = 9920
|
||||
command = "./bin/polkadot-parachain"
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator4"
|
||||
command = "./bin/polkadot-parachain"
|
||||
@@ -0,0 +1,144 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
penpal_parachain: &penpal_parachain
|
||||
wsPort: 9920
|
||||
paraId: &pp_id 2000
|
||||
variables:
|
||||
common:
|
||||
xcm_verison: &xcm_version '2'
|
||||
require_weight_at_most: &weight_at_most 1000000000
|
||||
chains:
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
penpal_parachain:
|
||||
signer: &pp_signer //Alice
|
||||
decodedCalls:
|
||||
ap_force_xcm_version:
|
||||
chain: *assets_parachain
|
||||
pallet: polkadotXcm
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 1,
|
||||
interior: Here
|
||||
},
|
||||
*xcm_version # xcmVersion
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: Initialize Chains
|
||||
its:
|
||||
- name: XCM supported versions between chains
|
||||
actions:
|
||||
- extrinsics: # Relay Chain sets supported version for Assset Parachain
|
||||
- chain: *relay_chain
|
||||
sudo: true
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 0,
|
||||
interior: {
|
||||
X1: {
|
||||
Parachain: *ap_id
|
||||
}
|
||||
}
|
||||
},
|
||||
*xcm_version # xcmVersion
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.SupportedVersionChanged
|
||||
attribute:
|
||||
type: u32
|
||||
value: *xcm_version
|
||||
- extrinsics: # Relay Chain sets supported version for Penpal Parachain
|
||||
- chain: *relay_chain
|
||||
sudo: true
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 0,
|
||||
interior: {
|
||||
X1: {
|
||||
Parachain: *pp_id
|
||||
}
|
||||
}
|
||||
},
|
||||
*xcm_version # xcmVersion
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.SupportedVersionChanged
|
||||
attribute:
|
||||
type: u32
|
||||
value: *xcm_version
|
||||
- extrinsics: # Assset Parachain sets supported version for Relay Chain through it
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $ap_force_xcm_version
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: polkadotXcm.SupportedVersionChanged
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: u32
|
||||
value: *xcm_version
|
||||
- extrinsics: # Penpal Parachain sets supported version for Relay Chain
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 1,
|
||||
interior: Here
|
||||
},
|
||||
*xcm_version # xcmVersion
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: polkadotXcm.SupportedVersionChanged
|
||||
attribute:
|
||||
type: u32
|
||||
value: *xcm_version
|
||||
@@ -0,0 +1,254 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
variables:
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
assets_parachain_destination: &ap_dest { v1: { parents: 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}}
|
||||
ksm: &rc_ksm { concrete: { parents: 0, interior: { here: true }}}
|
||||
amount: &amount 1000000000000
|
||||
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
|
||||
require_weight_at_most: &rc_weight_at_most 1000000000
|
||||
assets_parachain_account:
|
||||
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
asset_id: &asset_id 1
|
||||
asset_min_balance: &asset_ed 1000
|
||||
decodedCalls:
|
||||
force_create_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: forceCreate
|
||||
args: [
|
||||
*asset_id,
|
||||
{ Id: *ap_wallet }, # owner
|
||||
true, # isSufficient
|
||||
*asset_ed # minBalance
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: DMP
|
||||
its: []
|
||||
describes:
|
||||
- name: xcmPallet.limitedTeleportAssets
|
||||
before: &before_get_balances
|
||||
- name: Get the balances of the Relay Chain's sender & Assets Parachain's receiver
|
||||
actions:
|
||||
- queries:
|
||||
balance_rc_sender_before:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
balance_ap_receiver_before:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
its:
|
||||
- name: Should teleport native assets from the Relay Chain to the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: limitedTeleportAssets
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
*ap_benf, # beneficiary
|
||||
{ v1: [ *rc_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000,000
|
||||
- queries:
|
||||
balance_rc_sender_after:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
balance_ap_receiver_after:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
|
||||
- name: Should reduce the balance of the sender
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_sender_before,
|
||||
after: $balance_rc_sender_after,
|
||||
},
|
||||
amount: *amount
|
||||
}
|
||||
]
|
||||
|
||||
- name: Should increase the balance of the receiver
|
||||
actions:
|
||||
- asserts:
|
||||
balanceIncreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_ap_receiver_before,
|
||||
after: $balance_ap_receiver_after,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
- name: xcmPallet.send | Superuser - Transact(assets.forceCreate)
|
||||
its:
|
||||
- name: Relay Chain Superuser account SHOULD be able to execute a XCM Transact instruction in the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *rc_weight_at_most,
|
||||
call: $force_create_asset
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- queries:
|
||||
forced_created_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: asset
|
||||
args: [ *asset_id ]
|
||||
- asserts:
|
||||
isSome:
|
||||
args: [ $forced_created_asset ]
|
||||
|
||||
- name: xcmPallet.send | Native - Transact(assets.forceCreate)
|
||||
its:
|
||||
- name: Relay Chain Native account SHOULD NOT be able to execute a XCM Transact instruction in the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *rc_weight_at_most,
|
||||
call: $force_create_asset
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: system.ExtrinsicFailed
|
||||
attribute:
|
||||
type: SpRuntimeDispatchError
|
||||
value: BadOrigin
|
||||
|
||||
- name: xcmPallet.limitedReserveTransferAssets
|
||||
before: *before_get_balances
|
||||
its:
|
||||
- name: SHOULD NOT reserved transfer native assets from the Relay Chain to the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: limitedReserveTransferAssets
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
*ap_benf, # beneficiary
|
||||
{ v1: [ *rc_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 750,645,000
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isIncomplete: true
|
||||
value: ['1,000,000,000' , UntrustedReserveLocation]
|
||||
- queries:
|
||||
balance_rc_sender_after:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
balance_ap_receiver_after:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
|
||||
- name: Should reduce the balance of the sender
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_sender_before,
|
||||
after: $balance_rc_sender_after,
|
||||
},
|
||||
amount: *amount
|
||||
}
|
||||
]
|
||||
|
||||
- name: Should keep the balance of the receiver
|
||||
actions:
|
||||
- asserts:
|
||||
equal:
|
||||
args:
|
||||
[
|
||||
$balance_ap_receiver_before,
|
||||
$balance_ap_receiver_after
|
||||
]
|
||||
@@ -0,0 +1,196 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
variables:
|
||||
common:
|
||||
amount: &amount 1000000000000
|
||||
require_weight_at_most: &weight_at_most 1000000000
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F #Alice
|
||||
assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}}
|
||||
ksm: &rc_ksm { concrete: { 0, interior: { here: true }}}
|
||||
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
|
||||
assets_parachain_account:
|
||||
signer: &ap_signer //Alice
|
||||
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
relay_chain_destination: &rc_dest { v1: { parents: 1, interior: { here: true }}}
|
||||
assets_parachain_account: &rc_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d' #Alice
|
||||
relay_chain_beneficiary: &rc_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *rc_acc }}}}}
|
||||
ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}}
|
||||
ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }}
|
||||
decodedCalls:
|
||||
system_remark:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: remark
|
||||
args: [ 0x0011 ]
|
||||
|
||||
tests:
|
||||
- name: UMP
|
||||
describes:
|
||||
- name: polkadotXcm.limitedTeleportAssets
|
||||
before:
|
||||
- name: DEPENDANCY | Do a 'limitedTeleportAssets' from the Relay Chain to the Assets Parachain to have funds to send them back
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: limitedTeleportAssets
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
*ap_benf, # beneficiary
|
||||
{ v1: [ *rc_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000,000
|
||||
|
||||
- name: Get the balances of the Assets Parachain's sender & Relay Chain's receiver
|
||||
actions:
|
||||
- queries:
|
||||
balance_ap_sender_before:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
balance_rc_receiver_before:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
its:
|
||||
- name: Should teleport native assets back from Assets Parachain to the Relay Chain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: limitedTeleportAssets
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
*rc_benf, # beneficiary
|
||||
{ v1: [ *ap_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: polkadotXcm.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- name: ump.ExecutedUpward
|
||||
chain: *relay_chain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 297,578,000
|
||||
- queries:
|
||||
balance_ap_sender_after:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
balance_rc_receiver_after:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
|
||||
- name: Should reduce the balance of the sender
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_ap_sender_before,
|
||||
after: $balance_ap_sender_after,
|
||||
},
|
||||
amount: *amount
|
||||
}
|
||||
]
|
||||
|
||||
- name: Should increase the balance of the receiver
|
||||
actions:
|
||||
- asserts:
|
||||
balanceIncreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_receiver_before,
|
||||
after: $balance_rc_receiver_after,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
- name: polkadotXcm.send | Native - Transact(system.remark)
|
||||
its:
|
||||
- name: Assets Parachain SHOULD NOT be able to dipatch 'send' call
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $system_remark
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: system.ExtrinsicFailed
|
||||
attribute:
|
||||
type: SpRuntimeDispatchError
|
||||
value: BadOrigin
|
||||
|
||||
- name: polkadotXcm.limitedReserveTransferAssets
|
||||
its:
|
||||
- name: Should NOT be able to reserve transfer native assets from the Assets Parachain to the Relay Chain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: limitedReserveTransferAssets
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
*rc_benf, # beneficiary
|
||||
{ v1: [ *ap_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: polkadotXcm.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isError: true
|
||||
value: Barrier
|
||||
@@ -0,0 +1,402 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
penpal_parachain: &penpal_parachain
|
||||
wsPort: 9920
|
||||
paraId: &pp_id 2000
|
||||
variables:
|
||||
common:
|
||||
amount: &amount 2000000000000
|
||||
require_weight_at_most: &weight_at_most 1000000000
|
||||
hrmp_channels:
|
||||
proposed_max_capacity: &max_capacity 8
|
||||
proposed_max_message_size: &max_message_size 8192
|
||||
channel: &channel {
|
||||
maxCapacity: 8,
|
||||
maxTotalSize: 8192,
|
||||
maxMessageSize: 8192,
|
||||
msgCount: 0,
|
||||
totalSize: 0,
|
||||
mqcHead: null,
|
||||
senderDeposit: 0,
|
||||
recipientDeposit: 0
|
||||
}
|
||||
chains:
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}}
|
||||
ksm: &rc_ksm { concrete: { 0, interior: { here: true }}}
|
||||
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
|
||||
assets_parachain_account:
|
||||
sovereign_account: &ap_sovereign F7fq1jSNVTPfJmaHaXCMtatT1EZefCUsa7rRiQVNR5efcah
|
||||
relay_chain_destination: &rc_dest { v1: { parents: 1, interior: { here: true }}}
|
||||
penpal_parachain:
|
||||
sovereign_account: &pp_sovereign F7fq1jMZkfuCuoMTyiEVAP2DMpMt18WopgBqTJznLihLNbZ
|
||||
signer: &pp_signer //Alice
|
||||
decodedCalls:
|
||||
init_open_channel_with_ap:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpInitOpenChannel
|
||||
args: [
|
||||
*ap_id, # recipient
|
||||
*max_capacity, # proposedMaxCapacity
|
||||
*max_message_size # proposedMaxMessageSize
|
||||
]
|
||||
init_open_channel_with_cp:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpInitOpenChannel
|
||||
args: [
|
||||
*pp_id, # recipient
|
||||
*max_capacity, # proposedMaxCapacity
|
||||
*max_message_size # proposedMaxMessageSize
|
||||
]
|
||||
accept_open_channel_with_ap:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpAcceptOpenChannel
|
||||
args: [
|
||||
*ap_id, # recipient
|
||||
]
|
||||
accept_init_open_request_from_cp:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpAcceptOpenChannel
|
||||
args: [
|
||||
*pp_id, # sender
|
||||
]
|
||||
xcm_accept_init_open_request_from_cp:
|
||||
chain: *assets_parachain
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*rc_ksm_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *rc_ksm_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $accept_init_open_request_from_cp
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
xcm_init_open_channel_with_cp:
|
||||
chain: *assets_parachain
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*rc_ksm_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *rc_ksm_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $init_open_channel_with_cp
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: HRMP
|
||||
beforeEach:
|
||||
- name: DEPENDANCY | Penpal Parachain Sovereign account in the Relay Chain needs to be funded
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: balances
|
||||
call: transfer
|
||||
args: [
|
||||
*pp_sovereign, # destination
|
||||
*amount, # value
|
||||
]
|
||||
events:
|
||||
- name: balances.Transfer
|
||||
|
||||
- name: DEPENDANCY | Assets Parachain Sovereign account in the Relay Chain needs to be funded
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: balances
|
||||
call: transfer
|
||||
args: [
|
||||
*ap_sovereign, # destination
|
||||
*amount, # value
|
||||
]
|
||||
events:
|
||||
- name: balances.Transfer
|
||||
describes:
|
||||
- name: hrmp.hrmpInitOpenChannel (Penpal Parachain → Assets Parachain)
|
||||
its:
|
||||
- name: Penpal Parachain sends a request to the Relay Chain to open a channel with the Assets Parchain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*rc_ksm_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *rc_ksm_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $init_open_channel_with_ap
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: polkadotXcm.Sent
|
||||
- name: ump.ExecutedUpward
|
||||
chain: *relay_chain
|
||||
attributes:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000
|
||||
- name: hrmp.OpenChannelRequested
|
||||
chain: *relay_chain
|
||||
- queries:
|
||||
requested_channels:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpOpenChannelRequestsList
|
||||
args: []
|
||||
- asserts:
|
||||
equal:
|
||||
args: [
|
||||
$requested_channels,
|
||||
[
|
||||
{
|
||||
sender: *pp_id,
|
||||
recipient: *ap_id
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
- name: hrmp.hrmpAcceptOpenChannel (Assets Parachain → Penpal Parachain)
|
||||
its:
|
||||
- name: Assets Parachain sends a response to the Relay Chain accepting the Penpal Parachain's request for openning a HRMP channel
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $xcm_accept_init_open_request_from_cp
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- name: polkadotXcm.Sent
|
||||
chain: *assets_parachain
|
||||
- name: ump.ExecutedUpward
|
||||
timeout: 40000
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 1,160,892,000
|
||||
- name: hrmp.OpenChannelAccepted
|
||||
timeout: 40000
|
||||
- queries:
|
||||
open_channels:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpChannels
|
||||
delay: 80000
|
||||
args: [
|
||||
{
|
||||
sender: *pp_id,
|
||||
recipient: *ap_id
|
||||
}
|
||||
]
|
||||
- asserts:
|
||||
equal:
|
||||
args: [
|
||||
$open_channels,
|
||||
*channel
|
||||
]
|
||||
|
||||
- name: hrmp.hrmpInitOpenChannel (Assets Parachain → Penpal Parachain)
|
||||
its:
|
||||
- name: Assets Parchain sends a request to the Relay Chain to open a channel with a Penpal Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $xcm_init_open_channel_with_cp
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- name: polkadotXcm.Sent
|
||||
chain: *assets_parachain
|
||||
- name: ump.ExecutedUpward
|
||||
timeout: 40000
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 1,160,892,000
|
||||
- name: hrmp.OpenChannelRequested
|
||||
timeout: 40000
|
||||
- queries:
|
||||
requested_channels:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpOpenChannelRequestsList
|
||||
args: []
|
||||
- asserts:
|
||||
equal:
|
||||
args: [
|
||||
$requested_channels,
|
||||
[
|
||||
{
|
||||
sender: *ap_id,
|
||||
recipient: *pp_id
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
- name: hrmp.hrmpAcceptOpenChannel (Penpal Parachain → Assets Parachain)
|
||||
its:
|
||||
- name: Penpal Parachain sends a response to the Relay Chain accepting the Assets Parachain's request for openning a HRMP channel
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*rc_ksm_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *rc_ksm_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $accept_open_channel_with_ap
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: polkadotXcm.Sent
|
||||
- name: ump.ExecutedUpward
|
||||
chain: *relay_chain
|
||||
attributes:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000
|
||||
- name: hrmp.OpenChannelAccepted
|
||||
chain: *relay_chain
|
||||
@@ -0,0 +1,353 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
penpal_parachain: &penpal_parachain
|
||||
wsPort: 9920
|
||||
paraId: &pp_id 2000
|
||||
variables:
|
||||
common:
|
||||
amount: &amount 1000000000000
|
||||
require_weight_at_most: &weight_at_most 1000000000
|
||||
amount_to_send: &amount_to_send 500000000000
|
||||
chains:
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
assets_parachain_dest_routed: &ap_dest_routed { v1: { parents: 1, interior: { x1: { parachain: *ap_id } }}}
|
||||
assets_parachain_account:
|
||||
signer: &ap_signer //Alice
|
||||
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
asset_id: &asset_id 2
|
||||
assets_pallet_id: &assets_pallet_id 50
|
||||
asset_min_balance: &asset_ed 1000
|
||||
penpal_parachain_destination: &pp_dest { v1: { parents: 1, interior: { x1: { parachain: *pp_id } }}}
|
||||
ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}}
|
||||
ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }}
|
||||
suff_asset: &suff_asset { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: *asset_id } ] }}}
|
||||
suff_asset_fail: &suff_asset_fail { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: 3 } ] }}}
|
||||
suff_asset_fungible: &ap_suff_asset_fungible { id: *suff_asset, fun: { fungible: *weight_at_most }}
|
||||
suff_asset_fungible_fail: &ap_suff_asset_fungible_fail { id: *suff_asset_fail, fun: { fungible: *weight_at_most }}
|
||||
penpal_parachain:
|
||||
sovereign_account: &pp_sovereign_sibl FBeL7EAeUroLWXW1yfKboiqTqVfbRBcsUKd6QqVf4kGBySS
|
||||
signer: &pp_signer //Alice
|
||||
penpal_parachain_account: &pp_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
decodedCalls:
|
||||
force_create_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: forceCreate
|
||||
args: [
|
||||
*asset_id,
|
||||
{ Id: *ap_wallet }, # owner
|
||||
true, # isSufficient
|
||||
*asset_ed # minBalance
|
||||
]
|
||||
system_remark_with_event:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: remarkWithEvent
|
||||
args: [ 0x0011 ]
|
||||
|
||||
tests:
|
||||
- name: HRMP
|
||||
describes:
|
||||
- name: polkadotXcm.limitedReserveTransferAssets (Asset) | Assets Parachain -> Penpal Parachain
|
||||
before:
|
||||
- name: DEPENDANCY | A sufficient Asset should exist in the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $force_create_asset
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- queries:
|
||||
forced_created_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: asset
|
||||
args: [ *asset_id ]
|
||||
- asserts:
|
||||
isSome:
|
||||
args: [ $forced_created_asset ]
|
||||
|
||||
- name: DEPENDANCY | Some Assets should be minted for the sender
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: assets
|
||||
call: mint
|
||||
args: [
|
||||
*asset_id,
|
||||
*ap_wallet,
|
||||
*amount
|
||||
]
|
||||
events:
|
||||
- name: assets.Issued
|
||||
|
||||
its:
|
||||
- name: Assets Parachain should be able to reserve transfer an Asset to Penpal Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: limitedReserveTransferAssets
|
||||
args: [
|
||||
*pp_dest, # destination
|
||||
{ # beneficiary
|
||||
V1: {
|
||||
parents: 0,
|
||||
interior: {
|
||||
X1: {
|
||||
AccountId32: {
|
||||
network: Any,
|
||||
id: *pp_acc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ # assets
|
||||
V1: [
|
||||
{
|
||||
id: {
|
||||
Concrete: {
|
||||
parents: 0,
|
||||
interior: {
|
||||
X2: [
|
||||
{
|
||||
PalletInstance: 50
|
||||
},
|
||||
{
|
||||
GeneralIndex: *asset_id
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
fun: {
|
||||
Fungible: *amount_to_send
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
0, # feeAssetItem
|
||||
Unlimited # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: polkadotXcm.Attempted
|
||||
attributes:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 1,000,000,000
|
||||
- name: assets.Transferred
|
||||
attributes:
|
||||
type: AccountId32
|
||||
value: *pp_sovereign_sibl
|
||||
- name: assets.Transferred
|
||||
attributes:
|
||||
type: u128
|
||||
value: *amount_to_send
|
||||
|
||||
- name: polkadotXcm.limitedReserveTransferAssets (KSM) | Assets Parachain -> Penpal Parachain
|
||||
its:
|
||||
- name: Assets Parachain should be able to reserve transfer KSM to Penpal Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: limitedReserveTransferAssets
|
||||
args: [
|
||||
*pp_dest, # destination
|
||||
{ # beneficiary
|
||||
V1: {
|
||||
parents: 0,
|
||||
interior: {
|
||||
X1: {
|
||||
AccountId32: {
|
||||
network: Any,
|
||||
id: *pp_acc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ # assets
|
||||
V1: [
|
||||
*ap_ksm_fungible
|
||||
]
|
||||
},
|
||||
0, # feeAssetItem
|
||||
Unlimited # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: polkadotXcm.Attempted
|
||||
attributes:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 1,000,000,000
|
||||
- name: balances.Endowed
|
||||
attributes:
|
||||
type: AccountId32
|
||||
value: *pp_sovereign_sibl
|
||||
- name: balances.Endowed
|
||||
attributes:
|
||||
type: u128
|
||||
value: *amount
|
||||
|
||||
- name: polkadotXcm.send( system.remarkWithEvent() ) | Penpal Parachain -> Assets Parachain
|
||||
before:
|
||||
- name: Get the asset balance of the Penpal Parachain Sovereign account in Assets Parachain
|
||||
actions:
|
||||
- queries:
|
||||
assets_balance_pp_sovereign_before:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: account
|
||||
args: [
|
||||
*asset_id,
|
||||
*pp_sovereign_sibl
|
||||
]
|
||||
its:
|
||||
- name: Penpal Parachain should be able to send XCM message paying its fee with sufficient asset in Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest_routed, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*ap_suff_asset_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *ap_suff_asset_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: SovereignAccount,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $system_remark_with_event
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: polkadotXcm.Sent
|
||||
- name: assets.Burned
|
||||
chain: *assets_parachain
|
||||
attributes:
|
||||
type: AccountId32
|
||||
value: *pp_sovereign_sibl
|
||||
- name: assets.Issued
|
||||
chain: *assets_parachain
|
||||
attributes:
|
||||
type: u32
|
||||
value: *asset_id
|
||||
- name: system.Remarked
|
||||
chain: *assets_parachain
|
||||
attributes:
|
||||
type: AccountId32
|
||||
value: *pp_sovereign_sibl
|
||||
- queries:
|
||||
assets_balance_pp_sovereign_after:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: account
|
||||
args: [
|
||||
*asset_id,
|
||||
*pp_sovereign_sibl
|
||||
]
|
||||
|
||||
- name: Should reduce the assets balance of the Penpal Parachain's SovereignAccount in the Assets Parachain
|
||||
actions:
|
||||
- asserts:
|
||||
assetsDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $assets_balance_pp_sovereign_before,
|
||||
after: $assets_balance_pp_sovereign_after,
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
- name: Penpal Parachain SHOULD NOT be able to send XCM message paying its fee with sufficient assets if not enough balance
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest_routed, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*ap_suff_asset_fungible_fail]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *ap_suff_asset_fungible_fail,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: SovereignAccount,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $system_remark_with_event
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: xcmpQueue.Fail
|
||||
chain: *assets_parachain
|
||||
attributes:
|
||||
type: XcmV2TraitsError
|
||||
value: FailedToTransactAsset
|
||||
@@ -0,0 +1,49 @@
|
||||
[relaychain]
|
||||
default_command = "./bin/polkadot"
|
||||
default_args = [ "-lparachain=debug" ]
|
||||
chain = "polkadot-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
ws_port = 9900
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "charlie"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "dave"
|
||||
validator = true
|
||||
|
||||
[[parachains]]
|
||||
id = 1000
|
||||
chain = "statemint-local"
|
||||
cumulus_based = true
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator1"
|
||||
ws_port = 9910
|
||||
command = "./bin/polkadot-parachain"
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator2"
|
||||
command = "./bin/polkadot-parachain"
|
||||
|
||||
[[parachains]]
|
||||
id = 2000
|
||||
chain = "penpal-polkadot-2000"
|
||||
cumulus_based = true
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator3"
|
||||
ws_port = 9920
|
||||
command = "./bin/polkadot-parachain"
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator4"
|
||||
command = "./bin/polkadot-parachain"
|
||||
@@ -0,0 +1,144 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
penpal_parachain: &penpal_parachain
|
||||
wsPort: 9920
|
||||
paraId: &pp_id 2000
|
||||
variables:
|
||||
common:
|
||||
xcm_verison: &xcm_version '2'
|
||||
require_weight_at_most: &weight_at_most 1000000000
|
||||
chains:
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
penpal_parachain:
|
||||
signer: &pp_signer //Alice
|
||||
decodedCalls:
|
||||
ap_force_xcm_version:
|
||||
chain: *assets_parachain
|
||||
pallet: polkadotXcm
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 1,
|
||||
interior: Here
|
||||
},
|
||||
*xcm_version # xcmVersion
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: Initialize Chains
|
||||
its:
|
||||
- name: XCM supported versions between chains
|
||||
actions:
|
||||
- extrinsics: # Relay Chain sets supported version for Assset Parachain
|
||||
- chain: *relay_chain
|
||||
sudo: true
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 0,
|
||||
interior: {
|
||||
X1: {
|
||||
Parachain: *ap_id
|
||||
}
|
||||
}
|
||||
},
|
||||
*xcm_version # xcmVersion
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.SupportedVersionChanged
|
||||
attribute:
|
||||
type: u32
|
||||
value: *xcm_version
|
||||
- extrinsics: # Relay Chain sets supported version for Penpal Parachain
|
||||
- chain: *relay_chain
|
||||
sudo: true
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 0,
|
||||
interior: {
|
||||
X1: {
|
||||
Parachain: *pp_id
|
||||
}
|
||||
}
|
||||
},
|
||||
*xcm_version # xcmVersion
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.SupportedVersionChanged
|
||||
attribute:
|
||||
type: u32
|
||||
value: *xcm_version
|
||||
- extrinsics: # Assset Parachain sets supported version for Relay Chain through it
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $ap_force_xcm_version
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: polkadotXcm.SupportedVersionChanged
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: u32
|
||||
value: *xcm_version
|
||||
- extrinsics: # Penpal Parachain sets supported version for Relay Chain
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 1,
|
||||
interior: Here
|
||||
},
|
||||
*xcm_version # xcmVersion
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: polkadotXcm.SupportedVersionChanged
|
||||
attribute:
|
||||
type: u32
|
||||
value: *xcm_version
|
||||
@@ -0,0 +1,254 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
variables:
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
assets_parachain_destination: &ap_dest { v1: { parents: 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}}
|
||||
ksm: &rc_ksm { concrete: { parents: 0, interior: { here: true }}}
|
||||
amount: &amount 1000000000000
|
||||
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
|
||||
require_weight_at_most: &rc_weight_at_most 1000000000
|
||||
assets_parachain_account:
|
||||
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
asset_id: &asset_id 1
|
||||
asset_min_balance: &asset_ed 1000
|
||||
decodedCalls:
|
||||
force_create_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: forceCreate
|
||||
args: [
|
||||
*asset_id,
|
||||
{ Id: *ap_wallet }, # owner
|
||||
true, # isSufficient
|
||||
*asset_ed # minBalance
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: DMP
|
||||
its: []
|
||||
describes:
|
||||
- name: xcmPallet.limitedTeleportAssets
|
||||
before: &before_get_balances
|
||||
- name: Get the balances of the Relay Chain's sender & Assets Parachain's receiver
|
||||
actions:
|
||||
- queries:
|
||||
balance_rc_sender_before:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
balance_ap_receiver_before:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
its:
|
||||
- name: Should teleport native assets from the Relay Chain to the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: limitedTeleportAssets
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
*ap_benf, # beneficiary
|
||||
{ v1: [ *rc_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000,000
|
||||
- queries:
|
||||
balance_rc_sender_after:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
balance_ap_receiver_after:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
|
||||
- name: Should reduce the balance of the sender
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_sender_before,
|
||||
after: $balance_rc_sender_after,
|
||||
},
|
||||
amount: *amount
|
||||
}
|
||||
]
|
||||
|
||||
- name: Should increase the balance of the receiver
|
||||
actions:
|
||||
- asserts:
|
||||
balanceIncreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_ap_receiver_before,
|
||||
after: $balance_ap_receiver_after,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
- name: xcmPallet.send | Superuser - Transact(assets.forceCreate)
|
||||
its:
|
||||
- name: Relay Chain Superuser account SHOULD be able to execute a XCM Transact instruction in the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *rc_weight_at_most,
|
||||
call: $force_create_asset
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- queries:
|
||||
forced_created_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: asset
|
||||
args: [ *asset_id ]
|
||||
- asserts:
|
||||
isSome:
|
||||
args: [ $forced_created_asset ]
|
||||
|
||||
- name: xcmPallet.send | Native - Transact(assets.forceCreate)
|
||||
its:
|
||||
- name: Relay Chain Native account SHOULD NOT be able to execute a XCM Transact instruction in the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *rc_weight_at_most,
|
||||
call: $force_create_asset
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: system.ExtrinsicFailed
|
||||
attribute:
|
||||
type: SpRuntimeDispatchError
|
||||
value: BadOrigin
|
||||
|
||||
- name: xcmPallet.limitedReserveTransferAssets
|
||||
before: *before_get_balances
|
||||
its:
|
||||
- name: SHOULD NOT reserved transfer native assets from the Relay Chain to the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: limitedReserveTransferAssets
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
*ap_benf, # beneficiary
|
||||
{ v1: [ *rc_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 1,000,000,000
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isIncomplete: true
|
||||
value: ['1,000,000,000' , UntrustedReserveLocation]
|
||||
- queries:
|
||||
balance_rc_sender_after:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
balance_ap_receiver_after:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
|
||||
- name: Should reduce the balance of the sender
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_sender_before,
|
||||
after: $balance_rc_sender_after,
|
||||
},
|
||||
amount: *amount
|
||||
}
|
||||
]
|
||||
|
||||
- name: Should keep the balance of the receiver
|
||||
actions:
|
||||
- asserts:
|
||||
equal:
|
||||
args:
|
||||
[
|
||||
$balance_ap_receiver_before,
|
||||
$balance_ap_receiver_after
|
||||
]
|
||||
@@ -0,0 +1,197 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
variables:
|
||||
common:
|
||||
amount: &amount 1000000000000
|
||||
require_weight_at_most: &weight_at_most 1000000000
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}}
|
||||
ksm: &rc_ksm { concrete: { 0, interior: { here: true }}}
|
||||
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
|
||||
assets_parachain_account:
|
||||
signer: &ap_signer //Alice
|
||||
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
relay_chain_destination: &rc_dest { v1: { parents: 1, interior: { here: true }}}
|
||||
assets_parachain_account: &rc_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
relay_chain_beneficiary: &rc_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *rc_acc }}}}}
|
||||
ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}}
|
||||
ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }}
|
||||
decodedCalls:
|
||||
system_remark:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: remark
|
||||
args: [ 0x0011 ]
|
||||
|
||||
tests:
|
||||
- name: UMP
|
||||
describes:
|
||||
- name: polkadotXcm.limitedTeleportAssets
|
||||
before:
|
||||
- name: DEPENDANCY | Do a 'limitedTeleportAssets' from the Relay Chain to the Assets Parachain to have funds to send them back
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: limitedTeleportAssets
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
*ap_benf, # beneficiary
|
||||
{ v1: [ *rc_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000,000
|
||||
|
||||
- name: Get the balances of the Assets Parachain's sender & Relay Chain's receiver
|
||||
actions:
|
||||
- queries:
|
||||
balance_ap_sender_before:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
balance_rc_receiver_before:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
|
||||
its:
|
||||
- name: Should be able to teleport native assets back from Assets Parachain to the Relay Chain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: limitedTeleportAssets
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
*rc_benf, # beneficiary
|
||||
{ v1: [ *ap_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: polkadotXcm.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- name: ump.ExecutedUpward
|
||||
chain: *relay_chain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000,000
|
||||
- queries:
|
||||
balance_ap_sender_after:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
balance_rc_receiver_after:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
|
||||
- name: Should reduce the balance of the sender
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_ap_sender_before,
|
||||
after: $balance_ap_sender_after,
|
||||
},
|
||||
amount: *amount
|
||||
}
|
||||
]
|
||||
|
||||
- name: Should increase the balance of the receiver
|
||||
actions:
|
||||
- asserts:
|
||||
balanceIncreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_receiver_before,
|
||||
after: $balance_rc_receiver_after,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
- name: polkadotXcm.send | Native - Transact(system.remark)
|
||||
its:
|
||||
- name: Assets Parachain SHOULD NOT be able to dipatch 'send' call
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $system_remark
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: system.ExtrinsicFailed
|
||||
attribute:
|
||||
type: SpRuntimeDispatchError
|
||||
value: BadOrigin
|
||||
|
||||
- name: polkadotXcm.limitedReserveTransferAssets
|
||||
its:
|
||||
- name: Should NOT be able to reserve transfer native assets from the Assets Parachain to the Relay Chain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: limitedReserveTransferAssets
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
*rc_benf, # beneficiary
|
||||
{ v1: [ *ap_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: polkadotXcm.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isError: true
|
||||
value: Barrier
|
||||
@@ -0,0 +1,400 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
penpal_parachain: &penpal_parachain
|
||||
wsPort: 9920
|
||||
paraId: &pp_id 2000
|
||||
variables:
|
||||
common:
|
||||
amount: &amount 2000000000000
|
||||
require_weight_at_most: &weight_at_most 1000000000
|
||||
hrmp_channels:
|
||||
proposed_max_capacity: &max_capacity 8
|
||||
proposed_max_message_size: &max_message_size 8192
|
||||
channel: &channel {
|
||||
maxCapacity: 8,
|
||||
maxTotalSize: 8192,
|
||||
maxMessageSize: 8192,
|
||||
msgCount: 0,
|
||||
totalSize: 0,
|
||||
mqcHead: null,
|
||||
senderDeposit: 0,
|
||||
recipientDeposit: 0
|
||||
}
|
||||
chains:
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
ksm: &rc_ksm { concrete: { 0, interior: { here: true }}}
|
||||
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
|
||||
assets_parachain_account:
|
||||
sovereign_account: &ap_sovereign F7fq1jSNVTPfJmaHaXCMtatT1EZefCUsa7rRiQVNR5efcah
|
||||
relay_chain_destination: &rc_dest { v1: { parents: 1, interior: { here: true }}}
|
||||
penpal_parachain:
|
||||
sovereign_account: &pp_sovereign F7fq1jMZkfuCuoMTyiEVAP2DMpMt18WopgBqTJznLihLNbZ
|
||||
signer: &pp_signer //Alice
|
||||
decodedCalls:
|
||||
init_open_channel_with_ap:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpInitOpenChannel
|
||||
args: [
|
||||
*ap_id, # recipient
|
||||
*max_capacity, # proposedMaxCapacity
|
||||
*max_message_size # proposedMaxMessageSize
|
||||
]
|
||||
init_open_channel_with_cp:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpInitOpenChannel
|
||||
args: [
|
||||
*pp_id, # recipient
|
||||
*max_capacity, # proposedMaxCapacity
|
||||
*max_message_size # proposedMaxMessageSize
|
||||
]
|
||||
accept_open_channel_with_ap:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpAcceptOpenChannel
|
||||
args: [
|
||||
*ap_id, # recipient
|
||||
]
|
||||
accept_init_open_request_from_cp:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpAcceptOpenChannel
|
||||
args: [
|
||||
*pp_id, # sender
|
||||
]
|
||||
xcm_accept_init_open_request_from_cp:
|
||||
chain: *assets_parachain
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*rc_ksm_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *rc_ksm_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $accept_init_open_request_from_cp
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
xcm_init_open_channel_with_cp:
|
||||
chain: *assets_parachain
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*rc_ksm_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *rc_ksm_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $init_open_channel_with_cp
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: HRMP
|
||||
beforeEach:
|
||||
- name: DEPENDANCY | Penpal Parachain Sovereign account in the Relay Chain needs to be funded
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: balances
|
||||
call: transfer
|
||||
args: [
|
||||
*pp_sovereign, # destination
|
||||
*amount, # value
|
||||
]
|
||||
events:
|
||||
- name: balances.Transfer
|
||||
|
||||
- name: DEPENDANCY | Assets Parachain Sovereign account in the Relay Chain needs to be funded
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: balances
|
||||
call: transfer
|
||||
args: [
|
||||
*ap_sovereign, # destination
|
||||
*amount, # value
|
||||
]
|
||||
events:
|
||||
- name: balances.Transfer
|
||||
describes:
|
||||
- name: hrmp.hrmpInitOpenChannel (Penpal Parachain → Assets Parachain)
|
||||
its:
|
||||
- name: Penpal Parachain sends a request to the Relay Chain to open a channel with the Assets Parchain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*rc_ksm_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *rc_ksm_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $init_open_channel_with_ap
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: polkadotXcm.Sent
|
||||
- name: ump.ExecutedUpward
|
||||
chain: *relay_chain
|
||||
attributes:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000
|
||||
- name: hrmp.OpenChannelRequested
|
||||
chain: *relay_chain
|
||||
- queries:
|
||||
requested_channels:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpOpenChannelRequestsList
|
||||
args: []
|
||||
- asserts:
|
||||
equal:
|
||||
args: [
|
||||
$requested_channels,
|
||||
[
|
||||
{
|
||||
sender: *pp_id,
|
||||
recipient: *ap_id
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
- name: hrmp.hrmpAcceptOpenChannel (Assets Parachain → Penpal Parachain)
|
||||
its:
|
||||
- name: Assets Parachain sends a response to the Relay Chain accepting the Penpal Parachain's request for openning a HRMP channel
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $xcm_accept_init_open_request_from_cp
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- name: polkadotXcm.Sent
|
||||
chain: *assets_parachain
|
||||
- name: ump.ExecutedUpward
|
||||
timeout: 40000
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000,000
|
||||
- name: hrmp.OpenChannelAccepted
|
||||
timeout: 40000
|
||||
- queries:
|
||||
open_channels:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpChannels
|
||||
delay: 80000
|
||||
args: [
|
||||
{
|
||||
sender: *pp_id,
|
||||
recipient: *ap_id
|
||||
}
|
||||
]
|
||||
- asserts:
|
||||
equal:
|
||||
args: [
|
||||
$open_channels,
|
||||
*channel
|
||||
]
|
||||
|
||||
- name: hrmp.hrmpInitOpenChannel (Assets Parachain → Penpal Parachain)
|
||||
its:
|
||||
- name: Assets Parchain sends a request to the Relay Chain to open a channel with a Penpal Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $xcm_init_open_channel_with_cp
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- name: polkadotXcm.Sent
|
||||
chain: *assets_parachain
|
||||
- name: ump.ExecutedUpward
|
||||
timeout: 40000
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000,000
|
||||
- name: hrmp.OpenChannelRequested
|
||||
timeout: 40000
|
||||
- queries:
|
||||
requested_channels:
|
||||
chain: *relay_chain
|
||||
pallet: hrmp
|
||||
call: hrmpOpenChannelRequestsList
|
||||
args: []
|
||||
- asserts:
|
||||
equal:
|
||||
args: [
|
||||
$requested_channels,
|
||||
[
|
||||
{
|
||||
sender: *ap_id,
|
||||
recipient: *pp_id
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
- name: hrmp.hrmpAcceptOpenChannel (Penpal Parachain → Assets Parachain)
|
||||
its:
|
||||
- name: Penpal Parachain sends a response to the Relay Chain accepting the Assets Parachain's request for openning a HRMP channel
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*rc_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*rc_ksm_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *rc_ksm_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $accept_open_channel_with_ap
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: polkadotXcm.Sent
|
||||
- name: ump.ExecutedUpward
|
||||
chain: *relay_chain
|
||||
attributes:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000
|
||||
- name: hrmp.OpenChannelAccepted
|
||||
chain: *relay_chain
|
||||
@@ -0,0 +1,352 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
penpal_parachain: &penpal_parachain
|
||||
wsPort: 9920
|
||||
paraId: &pp_id 2000
|
||||
variables:
|
||||
common:
|
||||
amount: &amount 1000000000000
|
||||
require_weight_at_most: &weight_at_most 1000000000
|
||||
amount_to_send: &amount_to_send 500000000000
|
||||
chains:
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
assets_parachain_dest_routed: &ap_dest_routed { v1: { parents: 1, interior: { x1: { parachain: *ap_id } }}}
|
||||
assets_parachain_account:
|
||||
signer: &ap_signer //Alice
|
||||
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
asset_id: &asset_id 2
|
||||
assets_pallet_id: &assets_pallet_id 50
|
||||
asset_min_balance: &asset_ed 1000
|
||||
penpal_parachain_destination: &pp_dest { v1: { parents: 1, interior: { x1: { parachain: *pp_id } }}}
|
||||
ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}}
|
||||
ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }}
|
||||
suff_asset: &suff_asset { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: *asset_id } ] }}}
|
||||
suff_asset_fail: &suff_asset_fail { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: 3 } ] }}}
|
||||
suff_asset_fungible: &ap_suff_asset_fungible { id: *suff_asset, fun: { fungible: *weight_at_most }}
|
||||
suff_asset_fungible_fail: &ap_suff_asset_fungible_fail { id: *suff_asset_fail, fun: { fungible: *weight_at_most }}
|
||||
penpal_parachain:
|
||||
sovereign_account: &pp_sovereign_sibl FBeL7EAeUroLWXW1yfKboiqTqVfbRBcsUKd6QqVf4kGBySS
|
||||
signer: &pp_signer //Alice
|
||||
penpal_parachain_account: &pp_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
decodedCalls:
|
||||
force_create_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: forceCreate
|
||||
args: [
|
||||
*asset_id,
|
||||
{ Id: *ap_wallet }, # owner
|
||||
true, # isSufficient
|
||||
*asset_ed # minBalance
|
||||
]
|
||||
system_remark_with_event:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: remarkWithEvent
|
||||
args: [ 0x0011 ]
|
||||
|
||||
tests:
|
||||
- name: HRMP
|
||||
describes:
|
||||
- name: polkadotXcm.limitedReserveTransferAssets (Asset) | Assets Parachain -> Penpal Parachain
|
||||
before:
|
||||
- name: DEPENDANCY | A sufficient Asset should exist in the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $force_create_asset
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- queries:
|
||||
forced_created_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: asset
|
||||
args: [ *asset_id ]
|
||||
- asserts:
|
||||
isSome:
|
||||
args: [ $forced_created_asset ]
|
||||
|
||||
- name: DEPENDANCY | Some Assets should be minted for the sender
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: assets
|
||||
call: mint
|
||||
args: [
|
||||
*asset_id,
|
||||
*ap_wallet,
|
||||
*amount
|
||||
]
|
||||
events:
|
||||
- name: assets.Issued
|
||||
its:
|
||||
- name: Assets Parachain should be able to reserve transfer an Asset to Penpal Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: limitedReserveTransferAssets
|
||||
args: [
|
||||
*pp_dest, # destination
|
||||
{ # beneficiary
|
||||
V1: {
|
||||
parents: 0,
|
||||
interior: {
|
||||
X1: {
|
||||
AccountId32: {
|
||||
network: Any,
|
||||
id: *pp_acc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ # assets
|
||||
V1: [
|
||||
{
|
||||
id: {
|
||||
Concrete: {
|
||||
parents: 0,
|
||||
interior: {
|
||||
X2: [
|
||||
{
|
||||
PalletInstance: 50
|
||||
},
|
||||
{
|
||||
GeneralIndex: *asset_id
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
fun: {
|
||||
Fungible: *amount_to_send
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
0, # feeAssetItem
|
||||
Unlimited # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: polkadotXcm.Attempted
|
||||
attributes:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 1,000,000,000
|
||||
- name: assets.Transferred
|
||||
attributes:
|
||||
type: AccountId32
|
||||
value: *pp_sovereign_sibl
|
||||
- name: assets.Transferred
|
||||
attributes:
|
||||
type: u128
|
||||
value: *amount_to_send
|
||||
|
||||
- name: polkadotXcm.limitedReserveTransferAssets (KSM) | Assets Parachain -> Penpal Parachain
|
||||
its:
|
||||
- name: Assets Parachain should be able to reserve transfer KSM to Penpal Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *assets_parachain
|
||||
signer: *ap_signer
|
||||
pallet: polkadotXcm
|
||||
call: limitedReserveTransferAssets
|
||||
args: [
|
||||
*pp_dest, # destination
|
||||
{ # beneficiary
|
||||
V1: {
|
||||
parents: 0,
|
||||
interior: {
|
||||
X1: {
|
||||
AccountId32: {
|
||||
network: Any,
|
||||
id: *pp_acc
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ # assets
|
||||
V1: [
|
||||
*ap_ksm_fungible
|
||||
]
|
||||
},
|
||||
0, # feeAssetItem
|
||||
Unlimited # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: polkadotXcm.Attempted
|
||||
attributes:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 1,000,000,000
|
||||
- name: balances.Endowed
|
||||
attributes:
|
||||
type: AccountId32
|
||||
value: *pp_sovereign_sibl
|
||||
- name: balances.Endowed
|
||||
attributes:
|
||||
type: u128
|
||||
value: *amount
|
||||
|
||||
- name: polkadotXcm.send( system.remarkWithEvent() ) | Penpal Parachain -> Assets Parachain
|
||||
before:
|
||||
- name: Get the asset balance of the Penpal Parachain Sovereign account in Assets Parachain
|
||||
actions:
|
||||
- queries:
|
||||
assets_balance_pp_sovereign_before:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: account
|
||||
args: [
|
||||
*asset_id,
|
||||
*pp_sovereign_sibl
|
||||
]
|
||||
its:
|
||||
- name: Penpal Parachain should be able to send XCM message paying its fee with sufficient asset[2] in Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest_routed, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*ap_suff_asset_fungible]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *ap_suff_asset_fungible,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: SovereignAccount,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $system_remark_with_event
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attribute:
|
||||
type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: polkadotXcm.Sent
|
||||
- name: assets.Burned
|
||||
chain: *assets_parachain
|
||||
attributes:
|
||||
type: AccountId32
|
||||
value: *pp_sovereign_sibl
|
||||
- name: assets.Issued
|
||||
chain: *assets_parachain
|
||||
attributes:
|
||||
type: u32
|
||||
value: *asset_id
|
||||
- name: system.Remarked
|
||||
chain: *assets_parachain
|
||||
attributes:
|
||||
type: AccountId32
|
||||
value: *pp_sovereign_sibl
|
||||
- queries:
|
||||
assets_balance_pp_sovereign_after:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: account
|
||||
args: [
|
||||
*asset_id,
|
||||
*pp_sovereign_sibl
|
||||
]
|
||||
|
||||
- name: Should reduce the asset[2] balance of the Penpal Parachain's SovereignAccount in the Assets Parachain
|
||||
actions:
|
||||
- asserts:
|
||||
assetsDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $assets_balance_pp_sovereign_before,
|
||||
after: $assets_balance_pp_sovereign_after,
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
- name: Penpal Parachain SHOULD NOT be able to send XCM message paying its fee with sufficient asset[3] if not balance
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *penpal_parachain
|
||||
signer: *pp_signer
|
||||
sudo: true
|
||||
pallet: polkadotXcm
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest_routed, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
WithdrawAsset: [*ap_suff_asset_fungible_fail]
|
||||
},
|
||||
{
|
||||
BuyExecution: {
|
||||
fees: *ap_suff_asset_fungible_fail,
|
||||
weightLimit: Unlimited
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originType: SovereignAccount,
|
||||
requireWeightAtMost: *weight_at_most,
|
||||
call: $system_remark_with_event
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: xcmpQueue.Fail
|
||||
chain: *assets_parachain
|
||||
attributes:
|
||||
type: XcmV2TraitsError
|
||||
value: FailedToTransactAsset
|
||||
@@ -0,0 +1,26 @@
|
||||
[package]
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
name = "parachain-info"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
cumulus-primitives-core = { path = "../../../primitives/core", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"scale-info/std",
|
||||
"serde",
|
||||
"cumulus-primitives-core/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
]
|
||||
@@ -0,0 +1,76 @@
|
||||
// Copyright 2020-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Minimal Pallet that injects a ParachainId into Runtime storage from
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
pub use pallet::*;
|
||||
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet {
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::generate_store(pub(super) trait Store)]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config {}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {}
|
||||
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig {
|
||||
pub parachain_id: ParaId,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl Default for GenesisConfig {
|
||||
fn default() -> Self {
|
||||
Self { parachain_id: 100.into() }
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> GenesisBuild<T> for GenesisConfig {
|
||||
fn build(&self) {
|
||||
<ParachainId<T>>::put(&self.parachain_id);
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::type_value]
|
||||
pub(super) fn DefaultForParachainId() -> ParaId {
|
||||
100.into()
|
||||
}
|
||||
|
||||
#[pallet::storage]
|
||||
#[pallet::getter(fn parachain_id)]
|
||||
pub(super) type ParachainId<T: Config> =
|
||||
StorageValue<_, ParaId, ValueQuery, DefaultForParachainId>;
|
||||
|
||||
impl<T: Config> Get<ParaId> for Pallet<T> {
|
||||
fn get() -> ParaId {
|
||||
Self::parachain_id()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
[package]
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
name = "cumulus-ping"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
cumulus-primitives-core = { path = "../../../primitives/core", default-features = false }
|
||||
cumulus-pallet-xcm = { path = "../../../pallets/xcm", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"scale-info/std",
|
||||
"serde",
|
||||
"cumulus-primitives-core/std",
|
||||
"sp-std/std",
|
||||
"sp-runtime/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
]
|
||||
@@ -0,0 +1,235 @@
|
||||
// Copyright 2020-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Pallet to spam the XCM/UMP.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use cumulus_pallet_xcm::{ensure_sibling_para, Origin as CumulusOrigin};
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use frame_support::{parameter_types, BoundedVec};
|
||||
use frame_system::Config as SystemConfig;
|
||||
use sp_runtime::traits::Saturating;
|
||||
use sp_std::prelude::*;
|
||||
use xcm::latest::prelude::*;
|
||||
|
||||
pub use pallet::*;
|
||||
|
||||
parameter_types! {
|
||||
const MaxParachains: u32 = 100;
|
||||
const MaxPayloadSize: u32 = 1024;
|
||||
}
|
||||
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use frame_system::pallet_prelude::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::generate_store(pub(super) trait Store)]
|
||||
pub struct Pallet<T>(_);
|
||||
|
||||
/// The module configuration trait.
|
||||
#[pallet::config]
|
||||
pub trait Config: frame_system::Config {
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
|
||||
|
||||
type Origin: From<<Self as SystemConfig>::Origin>
|
||||
+ Into<Result<CumulusOrigin, <Self as Config>::Origin>>;
|
||||
|
||||
/// The overarching call type; we assume sibling chains use the same type.
|
||||
type Call: From<Call<Self>> + Encode;
|
||||
|
||||
type XcmSender: SendXcm;
|
||||
}
|
||||
|
||||
/// The target parachains to ping.
|
||||
#[pallet::storage]
|
||||
pub(super) type Targets<T: Config> = StorageValue<
|
||||
_,
|
||||
BoundedVec<(ParaId, BoundedVec<u8, MaxPayloadSize>), MaxParachains>,
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
/// The total number of pings sent.
|
||||
#[pallet::storage]
|
||||
pub(super) type PingCount<T: Config> = StorageValue<_, u32, ValueQuery>;
|
||||
|
||||
/// The sent pings.
|
||||
#[pallet::storage]
|
||||
pub(super) type Pings<T: Config> =
|
||||
StorageMap<_, Blake2_128Concat, u32, T::BlockNumber, OptionQuery>;
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config> {
|
||||
PingSent(ParaId, u32, Vec<u8>, XcmHash, MultiAssets),
|
||||
Pinged(ParaId, u32, Vec<u8>),
|
||||
PongSent(ParaId, u32, Vec<u8>, XcmHash, MultiAssets),
|
||||
Ponged(ParaId, u32, Vec<u8>, T::BlockNumber),
|
||||
ErrorSendingPing(SendError, ParaId, u32, Vec<u8>),
|
||||
ErrorSendingPong(SendError, ParaId, u32, Vec<u8>),
|
||||
UnknownPong(ParaId, u32, Vec<u8>),
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
pub enum Error<T> {
|
||||
/// Too many parachains have been added as a target.
|
||||
TooManyTargets,
|
||||
/// The payload provided is too large, limit is 1024 bytes.
|
||||
PayloadTooLarge,
|
||||
}
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||
fn on_finalize(n: T::BlockNumber) {
|
||||
for (para, payload) in Targets::<T>::get().into_iter() {
|
||||
let seq = PingCount::<T>::mutate(|seq| {
|
||||
*seq += 1;
|
||||
*seq
|
||||
});
|
||||
match send_xcm::<T::XcmSender>(
|
||||
(Parent, Junction::Parachain(para.into())).into(),
|
||||
Xcm(vec![Transact {
|
||||
origin_kind: OriginKind::Native,
|
||||
require_weight_at_most: 1_000,
|
||||
call: <T as Config>::Call::from(Call::<T>::ping {
|
||||
seq,
|
||||
payload: payload.clone().to_vec(),
|
||||
})
|
||||
.encode()
|
||||
.into(),
|
||||
}]),
|
||||
) {
|
||||
Ok((hash, cost)) => {
|
||||
Pings::<T>::insert(seq, n);
|
||||
Self::deposit_event(Event::PingSent(para, seq, payload.to_vec(), hash, cost));
|
||||
},
|
||||
Err(e) => {
|
||||
Self::deposit_event(Event::ErrorSendingPing(
|
||||
e,
|
||||
para,
|
||||
seq,
|
||||
payload.to_vec(),
|
||||
));
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::weight(0)]
|
||||
pub fn start(origin: OriginFor<T>, para: ParaId, payload: Vec<u8>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
let payload = BoundedVec::<u8, MaxPayloadSize>::try_from(payload)
|
||||
.map_err(|_| Error::<T>::PayloadTooLarge)?;
|
||||
Targets::<T>::try_mutate(|t| {
|
||||
t.try_push((para, payload)).map_err(|_| Error::<T>::TooManyTargets)
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
pub fn start_many(
|
||||
origin: OriginFor<T>,
|
||||
para: ParaId,
|
||||
count: u32,
|
||||
payload: Vec<u8>,
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
let bounded_payload = BoundedVec::<u8, MaxPayloadSize>::try_from(payload)
|
||||
.map_err(|_| Error::<T>::PayloadTooLarge)?;
|
||||
for _ in 0..count {
|
||||
Targets::<T>::try_mutate(|t| {
|
||||
t.try_push((para, bounded_payload.clone()))
|
||||
.map_err(|_| Error::<T>::TooManyTargets)
|
||||
})?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
pub fn stop(origin: OriginFor<T>, para: ParaId) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
Targets::<T>::mutate(|t| {
|
||||
if let Some(p) = t.iter().position(|(p, _)| p == ¶) {
|
||||
t.swap_remove(p);
|
||||
}
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
pub fn stop_all(origin: OriginFor<T>, maybe_para: Option<ParaId>) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
if let Some(para) = maybe_para {
|
||||
Targets::<T>::mutate(|t| t.retain(|&(x, _)| x != para));
|
||||
} else {
|
||||
Targets::<T>::kill();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
pub fn ping(origin: OriginFor<T>, seq: u32, payload: Vec<u8>) -> DispatchResult {
|
||||
// Only accept pings from other chains.
|
||||
let para = ensure_sibling_para(<T as Config>::Origin::from(origin))?;
|
||||
|
||||
Self::deposit_event(Event::Pinged(para, seq, payload.clone()));
|
||||
match send_xcm::<T::XcmSender>(
|
||||
(Parent, Junction::Parachain(para.into())).into(),
|
||||
Xcm(vec![Transact {
|
||||
origin_kind: OriginKind::Native,
|
||||
require_weight_at_most: 1_000,
|
||||
call: <T as Config>::Call::from(Call::<T>::pong {
|
||||
seq,
|
||||
payload: payload.clone(),
|
||||
})
|
||||
.encode()
|
||||
.into(),
|
||||
}]),
|
||||
) {
|
||||
Ok((hash, cost)) =>
|
||||
Self::deposit_event(Event::PongSent(para, seq, payload, hash, cost)),
|
||||
Err(e) => Self::deposit_event(Event::ErrorSendingPong(e, para, seq, payload)),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
pub fn pong(origin: OriginFor<T>, seq: u32, payload: Vec<u8>) -> DispatchResult {
|
||||
// Only accept pings from other chains.
|
||||
let para = ensure_sibling_para(<T as Config>::Origin::from(origin))?;
|
||||
|
||||
if let Some(sent_at) = Pings::<T>::take(seq) {
|
||||
Self::deposit_event(Event::Ponged(
|
||||
para,
|
||||
seq,
|
||||
payload,
|
||||
frame_system::Pallet::<T>::block_number().saturating_sub(sent_at),
|
||||
));
|
||||
} else {
|
||||
// Pong received for a ping we apparently didn't send?!
|
||||
Self::deposit_event(Event::UnknownPong(para, seq, payload));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
# Assets Parachain
|
||||
|
||||
Implementation of _Statemint_, a blockchain to support generic assets in the Polkadot and Kusama
|
||||
networks.
|
||||
|
||||
Statemint allows users to:
|
||||
|
||||
- Deploy promise-backed assets, both fungible and non-fungible, with a DOT/KSM deposit.
|
||||
- Set admin roles to manage assets and asset classes.
|
||||
- Register assets as "self-sufficient" if the Relay Chain agrees, i.e. gain the ability for an
|
||||
asset to justify the existance of accounts sans DOT/KSM.
|
||||
- Pay transaction fees using sufficient assets.
|
||||
- Transfer (and approve transfer) assets.
|
||||
- Interact with the chain via its transactional API or XCM.
|
||||
|
||||
Statemint must stay fully aligned with the Relay Chain it is connected to. As such, it will accept
|
||||
the Relay Chain's governance origins as its own.
|
||||
|
||||
See
|
||||
[the article on Statemint as common good parachain](https://www.parity.io/blog/statemint-generic-assets-chain-proposing-a-common-good-parachain-to-polkadot-governance/)
|
||||
for a higher level description.
|
||||
|
||||
Wallets, custodians, etc. should see
|
||||
[the Polkadot Wiki's Integration Guide](https://wiki.polkadot.network/docs/build-integrate-assets)
|
||||
for details about support.
|
||||
@@ -0,0 +1,163 @@
|
||||
[package]
|
||||
name = "statemine-runtime"
|
||||
version = "2.0.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Kusama variant of Statemint parachain runtime"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
smallvec = "1.9.0"
|
||||
|
||||
# Substrate
|
||||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
|
||||
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" }
|
||||
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-uniques = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-utility = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Polkadot
|
||||
kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus
|
||||
cumulus-pallet-aura-ext = { path = "../../../../pallets/aura-ext", default-features = false }
|
||||
cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-features = false }
|
||||
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false }
|
||||
cumulus-pallet-session-benchmarking = {path = "../../../../pallets/session-benchmarking", default-features = false, version = "3.0.0"}
|
||||
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
|
||||
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false }
|
||||
cumulus-ping = { path = "../../../pallets/ping", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
|
||||
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
|
||||
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
|
||||
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
|
||||
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.4"
|
||||
asset-test-utils = { path = "../test-utils"}
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
runtime-benchmarks = [
|
||||
"hex-literal",
|
||||
"frame-benchmarking/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system-benchmarking",
|
||||
"frame-system/runtime-benchmarks",
|
||||
"pallet-assets/runtime-benchmarks",
|
||||
"pallet-balances/runtime-benchmarks",
|
||||
"pallet-multisig/runtime-benchmarks",
|
||||
"pallet-proxy/runtime-benchmarks",
|
||||
"pallet-timestamp/runtime-benchmarks",
|
||||
"pallet-uniques/runtime-benchmarks",
|
||||
"pallet-utility/runtime-benchmarks",
|
||||
"pallet-xcm/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||
"pallet-collator-selection/runtime-benchmarks",
|
||||
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-executive/try-runtime",
|
||||
"frame-try-runtime",
|
||||
]
|
||||
std = [
|
||||
"codec/std",
|
||||
"log/std",
|
||||
"scale-info/std",
|
||||
"serde",
|
||||
"frame-executive/std",
|
||||
"frame-support/std",
|
||||
"frame-system-rpc-runtime-api/std",
|
||||
"frame-system/std",
|
||||
"kusama-runtime-constants/std",
|
||||
"pallet-asset-tx-payment/std",
|
||||
"pallet-assets/std",
|
||||
"pallet-aura/std",
|
||||
"pallet-authorship/std",
|
||||
"pallet-balances/std",
|
||||
"pallet-multisig/std",
|
||||
"pallet-proxy/std",
|
||||
"pallet-session/std",
|
||||
"pallet-timestamp/std",
|
||||
"pallet-transaction-payment-rpc-runtime-api/std",
|
||||
"pallet-transaction-payment/std",
|
||||
"pallet-uniques/std",
|
||||
"pallet-utility/std",
|
||||
"pallet-xcm/std",
|
||||
"polkadot-core-primitives/std",
|
||||
"polkadot-parachain/std",
|
||||
"polkadot-runtime-common/std",
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-consensus-aura/std",
|
||||
"sp-core/std",
|
||||
"sp-inherents/std",
|
||||
"sp-io/std",
|
||||
"sp-offchain/std",
|
||||
"sp-runtime/std",
|
||||
"sp-session/std",
|
||||
"sp-std/std",
|
||||
"sp-transaction-pool/std",
|
||||
"sp-version/std",
|
||||
"xcm-builder/std",
|
||||
"xcm-executor/std",
|
||||
"xcm/std",
|
||||
"cumulus-pallet-aura-ext/std",
|
||||
"cumulus-pallet-dmp-queue/std",
|
||||
"cumulus-pallet-parachain-system/std",
|
||||
"cumulus-pallet-xcm/std",
|
||||
"cumulus-pallet-xcmp-queue/std",
|
||||
"cumulus-ping/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"cumulus-primitives-timestamp/std",
|
||||
"cumulus-primitives-utility/std",
|
||||
"pallet-collator-selection/std",
|
||||
"parachain-info/std",
|
||||
"parachains-common/std",
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
use substrate_wasm_builder::WasmBuilder;
|
||||
|
||||
fn main() {
|
||||
WasmBuilder::new()
|
||||
.with_current_project()
|
||||
.export_heap_base()
|
||||
.import_memory()
|
||||
.build()
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod currency {
|
||||
use kusama_runtime_constants as constants;
|
||||
use polkadot_core_primitives::Balance;
|
||||
|
||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain.
|
||||
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
|
||||
|
||||
pub const UNITS: Balance = constants::currency::UNITS;
|
||||
pub const CENTS: Balance = constants::currency::CENTS;
|
||||
pub const GRAND: Balance = constants::currency::GRAND;
|
||||
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
|
||||
|
||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||
// map to 1/100 of what the kusama relay chain charges (v9020)
|
||||
constants::currency::deposit(items, bytes) / 100
|
||||
}
|
||||
}
|
||||
|
||||
/// Fee-related.
|
||||
pub mod fee {
|
||||
use frame_support::weights::{
|
||||
constants::ExtrinsicBaseWeight, WeightToFeeCoefficient, WeightToFeeCoefficients,
|
||||
WeightToFeePolynomial,
|
||||
};
|
||||
use polkadot_core_primitives::Balance;
|
||||
use smallvec::smallvec;
|
||||
pub use sp_runtime::Perbill;
|
||||
|
||||
/// The block saturation level. Fees will be updates based on this value.
|
||||
pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);
|
||||
|
||||
/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
|
||||
/// node's balance type.
|
||||
///
|
||||
/// This should typically create a mapping between the following ranges:
|
||||
/// - [0, MAXIMUM_BLOCK_WEIGHT]
|
||||
/// - [Balance::min, Balance::max]
|
||||
///
|
||||
/// Yet, it can be used for any other sort of change to weight-fee. Some examples being:
|
||||
/// - Setting it to `0` will essentially disable the weight fee.
|
||||
/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged.
|
||||
pub struct WeightToFee;
|
||||
impl WeightToFeePolynomial for WeightToFee {
|
||||
type Balance = Balance;
|
||||
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
|
||||
// in Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
|
||||
// in Statemine, we map to 1/10 of that, or 1/100 CENT
|
||||
let p = super::currency::CENTS;
|
||||
let q = 100 * Balance::from(ExtrinsicBaseWeight::get());
|
||||
smallvec![WeightToFeeCoefficient {
|
||||
degree: 1,
|
||||
negative: false,
|
||||
coeff_frac: Perbill::from_rational(p % q, q),
|
||||
coeff_integer: p / q,
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,844 @@
|
||||
// Copyright (C) 2021-2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! # Statemine Runtime
|
||||
//!
|
||||
//! Statemine is the canary network for its Polkadot cousin, Statemint.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
// Make the WASM binary available.
|
||||
#[cfg(feature = "std")]
|
||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
|
||||
pub mod constants;
|
||||
mod weights;
|
||||
pub mod xcm_config;
|
||||
|
||||
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
|
||||
use sp_api::impl_runtime_apis;
|
||||
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto},
|
||||
transaction_validity::{TransactionSource, TransactionValidity},
|
||||
ApplyExtrinsicResult,
|
||||
};
|
||||
|
||||
use sp_std::prelude::*;
|
||||
#[cfg(feature = "std")]
|
||||
use sp_version::NativeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use constants::{currency::*, fee::WeightToFee};
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{AsEnsureOriginWithArg, EitherOfDiverse, InstanceFilter},
|
||||
weights::{ConstantMultiplier, DispatchClass, Weight},
|
||||
PalletId, RuntimeDebug,
|
||||
};
|
||||
use frame_system::{
|
||||
limits::{BlockLength, BlockWeights},
|
||||
EnsureRoot, EnsureSigned,
|
||||
};
|
||||
pub use parachains_common as common;
|
||||
use parachains_common::{
|
||||
impls::{AssetsToBlockAuthor, DealWithFees},
|
||||
opaque, AccountId, AssetId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
||||
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||
};
|
||||
use xcm_config::{KsmLocation, XcmConfig};
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sp_runtime::BuildStorage;
|
||||
|
||||
// Polkadot imports
|
||||
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
|
||||
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||
use xcm::latest::BodyId;
|
||||
use xcm_executor::XcmExecutor;
|
||||
|
||||
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||
|
||||
impl_opaque_keys! {
|
||||
pub struct SessionKeys {
|
||||
pub aura: Aura,
|
||||
}
|
||||
}
|
||||
|
||||
#[sp_version::runtime_version]
|
||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("statemine"),
|
||||
impl_name: create_runtime_str!("statemine"),
|
||||
authoring_version: 1,
|
||||
spec_version: 9230,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
transaction_version: 7,
|
||||
state_version: 0,
|
||||
};
|
||||
|
||||
/// The version information used to identify this runtime when compiled natively.
|
||||
#[cfg(feature = "std")]
|
||||
pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub RuntimeBlockLength: BlockLength =
|
||||
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
|
||||
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
|
||||
.base_block(BlockExecutionWeight::get())
|
||||
.for_class(DispatchClass::all(), |weights| {
|
||||
weights.base_extrinsic = ExtrinsicBaseWeight::get();
|
||||
})
|
||||
.for_class(DispatchClass::Normal, |weights| {
|
||||
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
|
||||
})
|
||||
.for_class(DispatchClass::Operational, |weights| {
|
||||
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
|
||||
// Operational transactions have some extra reserved space, so that they
|
||||
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
|
||||
weights.reserved = Some(
|
||||
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
|
||||
);
|
||||
})
|
||||
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
|
||||
.build_or_panic();
|
||||
pub const SS58Prefix: u8 = 2;
|
||||
}
|
||||
|
||||
// Configure FRAME pallets to include in runtime.
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type BlockWeights = RuntimeBlockWeights;
|
||||
type BlockLength = RuntimeBlockLength;
|
||||
type AccountId = AccountId;
|
||||
type Call = Call;
|
||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||
type Index = Index;
|
||||
type BlockNumber = BlockNumber;
|
||||
type Hash = Hash;
|
||||
type Hashing = BlakeTwo256;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type Origin = Origin;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type DbWeight = RocksDbWeight;
|
||||
type Version = Version;
|
||||
type PalletInfo = PalletInfo;
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type AccountData = pallet_balances::AccountData<Balance>;
|
||||
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
|
||||
type SS58Prefix = SS58Prefix;
|
||||
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||
}
|
||||
|
||||
impl pallet_timestamp::Config for Runtime {
|
||||
/// A timestamp: milliseconds since the unix epoch.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = ();
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const UncleGenerations: u32 = 0;
|
||||
}
|
||||
|
||||
impl pallet_authorship::Config for Runtime {
|
||||
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
|
||||
type UncleGenerations = UncleGenerations;
|
||||
type FilterUncle = ();
|
||||
type EventHandler = (CollatorSelection,);
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
pub const MaxLocks: u32 = 50;
|
||||
pub const MaxReserves: u32 = 50;
|
||||
}
|
||||
|
||||
impl pallet_balances::Config for Runtime {
|
||||
type MaxLocks = MaxLocks;
|
||||
/// The type for recording an account's balance.
|
||||
type Balance = Balance;
|
||||
/// The ubiquitous event type.
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
/// Relay Chain `TransactionByteFee` / 10
|
||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
||||
pub const OperationalFeeMultiplier: u8 = 5;
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnChargeTransaction =
|
||||
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
|
||||
type WeightToFee = WeightToFee;
|
||||
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
|
||||
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
|
||||
type OperationalFeeMultiplier = OperationalFeeMultiplier;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const AssetDeposit: Balance = UNITS / 10; // 1 / 10 UNITS deposit to create asset
|
||||
pub const AssetAccountDeposit: Balance = deposit(1, 16);
|
||||
pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
pub const AssetsStringLimit: u32 = 50;
|
||||
/// Key = 32 bytes, Value = 36 bytes (32+1+1+1+1)
|
||||
// https://github.com/paritytech/substrate/blob/069917b/frame/assets/src/lib.rs#L257L271
|
||||
pub const MetadataDepositBase: Balance = deposit(1, 68);
|
||||
pub const MetadataDepositPerByte: Balance = deposit(0, 1);
|
||||
pub const ExecutiveBody: BodyId = BodyId::Executive;
|
||||
}
|
||||
|
||||
/// We allow root and the Relay Chain council to execute privileged asset operations.
|
||||
pub type AssetsForceOrigin =
|
||||
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<KsmLocation, ExecutiveBody>>>;
|
||||
|
||||
impl pallet_assets::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Balance = Balance;
|
||||
type AssetId = AssetId;
|
||||
type Currency = Balances;
|
||||
type ForceOrigin = AssetsForceOrigin;
|
||||
type AssetDeposit = AssetDeposit;
|
||||
type MetadataDepositBase = MetadataDepositBase;
|
||||
type MetadataDepositPerByte = MetadataDepositPerByte;
|
||||
type ApprovalDeposit = ApprovalDeposit;
|
||||
type StringLimit = AssetsStringLimit;
|
||||
type Freezer = ();
|
||||
type Extra = ();
|
||||
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
|
||||
type AssetAccountDeposit = AssetAccountDeposit;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
|
||||
pub const DepositBase: Balance = deposit(1, 88);
|
||||
// Additional storage item size of 32 bytes.
|
||||
pub const DepositFactor: Balance = deposit(0, 32);
|
||||
pub const MaxSignatories: u16 = 100;
|
||||
}
|
||||
|
||||
impl pallet_multisig::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type Currency = Balances;
|
||||
type DepositBase = DepositBase;
|
||||
type DepositFactor = DepositFactor;
|
||||
type MaxSignatories = MaxSignatories;
|
||||
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_utility::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type PalletsOrigin = OriginCaller;
|
||||
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One storage item; key size 32, value size 8; .
|
||||
pub const ProxyDepositBase: Balance = deposit(1, 40);
|
||||
// Additional storage item size of 33 bytes.
|
||||
pub const ProxyDepositFactor: Balance = deposit(0, 33);
|
||||
pub const MaxProxies: u16 = 32;
|
||||
// One storage item; key size 32, value size 16
|
||||
pub const AnnouncementDepositBase: Balance = deposit(1, 48);
|
||||
pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
|
||||
pub const MaxPending: u16 = 32;
|
||||
}
|
||||
|
||||
/// The type used to represent the kinds of proxying allowed.
|
||||
#[derive(
|
||||
Copy,
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Encode,
|
||||
Decode,
|
||||
RuntimeDebug,
|
||||
MaxEncodedLen,
|
||||
scale_info::TypeInfo,
|
||||
)]
|
||||
pub enum ProxyType {
|
||||
/// Fully permissioned proxy. Can execute any call on behalf of _proxied_.
|
||||
Any,
|
||||
/// Can execute any call that does not transfer funds or assets.
|
||||
NonTransfer,
|
||||
/// Proxy with the ability to reject time-delay proxy announcements.
|
||||
CancelProxy,
|
||||
/// Assets proxy. Can execute any call from `assets`, **including asset transfers**.
|
||||
Assets,
|
||||
/// Owner proxy. Can execute calls related to asset ownership.
|
||||
AssetOwner,
|
||||
/// Asset manager. Can execute calls related to asset management.
|
||||
AssetManager,
|
||||
/// Collator selection proxy. Can execute calls related to collator selection mechanism.
|
||||
Collator,
|
||||
}
|
||||
impl Default for ProxyType {
|
||||
fn default() -> Self {
|
||||
Self::Any
|
||||
}
|
||||
}
|
||||
impl InstanceFilter<Call> for ProxyType {
|
||||
fn filter(&self, c: &Call) -> bool {
|
||||
match self {
|
||||
ProxyType::Any => true,
|
||||
ProxyType::NonTransfer =>
|
||||
!matches!(c, Call::Balances { .. } | Call::Assets { .. } | Call::Uniques { .. }),
|
||||
ProxyType::CancelProxy => matches!(
|
||||
c,
|
||||
Call::Proxy(pallet_proxy::Call::reject_announcement { .. }) |
|
||||
Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
ProxyType::Assets => {
|
||||
matches!(
|
||||
c,
|
||||
Call::Assets { .. } |
|
||||
Call::Utility { .. } | Call::Multisig { .. } |
|
||||
Call::Uniques { .. }
|
||||
)
|
||||
},
|
||||
ProxyType::AssetOwner => matches!(
|
||||
c,
|
||||
Call::Assets(pallet_assets::Call::create { .. }) |
|
||||
Call::Assets(pallet_assets::Call::destroy { .. }) |
|
||||
Call::Assets(pallet_assets::Call::transfer_ownership { .. }) |
|
||||
Call::Assets(pallet_assets::Call::set_team { .. }) |
|
||||
Call::Assets(pallet_assets::Call::set_metadata { .. }) |
|
||||
Call::Assets(pallet_assets::Call::clear_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::create { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::destroy { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::transfer_ownership { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_team { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_attribute { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_collection_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::clear_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::clear_attribute { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::clear_collection_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_collection_max_supply { .. }) |
|
||||
Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
ProxyType::AssetManager => matches!(
|
||||
c,
|
||||
Call::Assets(pallet_assets::Call::mint { .. }) |
|
||||
Call::Assets(pallet_assets::Call::burn { .. }) |
|
||||
Call::Assets(pallet_assets::Call::freeze { .. }) |
|
||||
Call::Assets(pallet_assets::Call::thaw { .. }) |
|
||||
Call::Assets(pallet_assets::Call::freeze_asset { .. }) |
|
||||
Call::Assets(pallet_assets::Call::thaw_asset { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::mint { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::burn { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::freeze { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::thaw { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::freeze_collection { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::thaw_collection { .. }) |
|
||||
Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
ProxyType::Collator => matches!(
|
||||
c,
|
||||
Call::CollatorSelection { .. } | Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_superset(&self, o: &Self) -> bool {
|
||||
match (self, o) {
|
||||
(x, y) if x == y => true,
|
||||
(ProxyType::Any, _) => true,
|
||||
(_, ProxyType::Any) => false,
|
||||
(ProxyType::Assets, ProxyType::AssetOwner) => true,
|
||||
(ProxyType::Assets, ProxyType::AssetManager) => true,
|
||||
(ProxyType::NonTransfer, ProxyType::Collator) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_proxy::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type Currency = Balances;
|
||||
type ProxyType = ProxyType;
|
||||
type ProxyDepositBase = ProxyDepositBase;
|
||||
type ProxyDepositFactor = ProxyDepositFactor;
|
||||
type MaxProxies = MaxProxies;
|
||||
type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
|
||||
type MaxPending = MaxPending;
|
||||
type CallHasher = BlakeTwo256;
|
||||
type AnnouncementDepositBase = AnnouncementDepositBase;
|
||||
type AnnouncementDepositFactor = AnnouncementDepositFactor;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
|
||||
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type DmpMessageHandler = DmpQueue;
|
||||
type ReservedDmpWeight = ReservedDmpWeight;
|
||||
type OutboundXcmpMessageSource = XcmpQueue;
|
||||
type XcmpMessageHandler = XcmpQueue;
|
||||
type ReservedXcmpWeight = ReservedXcmpWeight;
|
||||
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases;
|
||||
}
|
||||
|
||||
impl parachain_info::Config for Runtime {}
|
||||
|
||||
impl cumulus_pallet_aura_ext::Config for Runtime {}
|
||||
|
||||
impl cumulus_pallet_xcmp_queue::Config for Runtime {
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type ChannelInfo = ParachainSystem;
|
||||
type VersionWrapper = PolkadotXcm;
|
||||
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
||||
type ControllerOrigin = EitherOfDiverse<
|
||||
EnsureRoot<AccountId>,
|
||||
EnsureXcm<IsMajorityOfBody<KsmLocation, ExecutiveBody>>,
|
||||
>;
|
||||
type ControllerOriginConverter = xcm_config::XcmOriginToTransactDispatchOrigin;
|
||||
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
|
||||
type PriceForSiblingDelivery = ();
|
||||
}
|
||||
|
||||
impl cumulus_pallet_dmp_queue::Config for Runtime {
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Period: u32 = 6 * HOURS;
|
||||
pub const Offset: u32 = 0;
|
||||
pub const MaxAuthorities: u32 = 100_000;
|
||||
}
|
||||
|
||||
impl pallet_session::Config for Runtime {
|
||||
type Event = Event;
|
||||
type ValidatorId = <Self as frame_system::Config>::AccountId;
|
||||
// we don't have stash and controller, thus we don't need the convert as well.
|
||||
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
|
||||
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type SessionManager = CollatorSelection;
|
||||
// Essentially just Aura, but lets be pedantic.
|
||||
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
|
||||
type Keys = SessionKeys;
|
||||
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_aura::Config for Runtime {
|
||||
type AuthorityId = AuraId;
|
||||
type DisabledValidators = ();
|
||||
type MaxAuthorities = MaxAuthorities;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const PotId: PalletId = PalletId(*b"PotStake");
|
||||
pub const MaxCandidates: u32 = 1000;
|
||||
pub const MinCandidates: u32 = 5;
|
||||
pub const SessionLength: BlockNumber = 6 * HOURS;
|
||||
pub const MaxInvulnerables: u32 = 100;
|
||||
}
|
||||
|
||||
/// We allow root and the Relay Chain council to execute privileged collator selection operations.
|
||||
pub type CollatorSelectionUpdateOrigin =
|
||||
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<KsmLocation, ExecutiveBody>>>;
|
||||
|
||||
impl pallet_collator_selection::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type UpdateOrigin = CollatorSelectionUpdateOrigin;
|
||||
type PotId = PotId;
|
||||
type MaxCandidates = MaxCandidates;
|
||||
type MinCandidates = MinCandidates;
|
||||
type MaxInvulnerables = MaxInvulnerables;
|
||||
// should be a multiple of session or things will get inconsistent
|
||||
type KickThreshold = Period;
|
||||
type ValidatorId = <Self as frame_system::Config>::AccountId;
|
||||
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
|
||||
type ValidatorRegistration = Session;
|
||||
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_asset_tx_payment::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Fungibles = Assets;
|
||||
type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter<
|
||||
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
||||
AssetsToBlockAuthor<Runtime>,
|
||||
>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const CollectionDeposit: Balance = UNITS / 10; // 1 / 10 UNIT deposit to create asset class
|
||||
pub const ItemDeposit: Balance = UNITS / 1_000; // 1 / 1000 UNIT deposit to create asset instance
|
||||
pub const KeyLimit: u32 = 32; // Max 32 bytes per key
|
||||
pub const ValueLimit: u32 = 64; // Max 64 bytes per value
|
||||
pub const UniquesMetadataDepositBase: Balance = deposit(1, 129);
|
||||
pub const AttributeDepositBase: Balance = deposit(1, 0);
|
||||
pub const DepositPerByte: Balance = deposit(0, 1);
|
||||
pub const UniquesStringLimit: u32 = 128;
|
||||
}
|
||||
|
||||
impl pallet_uniques::Config for Runtime {
|
||||
type Event = Event;
|
||||
type CollectionId = u32;
|
||||
type ItemId = u32;
|
||||
type Currency = Balances;
|
||||
type ForceOrigin = AssetsForceOrigin;
|
||||
type CollectionDeposit = CollectionDeposit;
|
||||
type ItemDeposit = ItemDeposit;
|
||||
type MetadataDepositBase = UniquesMetadataDepositBase;
|
||||
type AttributeDepositBase = AttributeDepositBase;
|
||||
type DepositPerByte = DepositPerByte;
|
||||
type StringLimit = UniquesStringLimit;
|
||||
type KeyLimit = KeyLimit;
|
||||
type ValueLimit = ValueLimit;
|
||||
type WeightInfo = weights::pallet_uniques::WeightInfo<Runtime>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type Helper = ();
|
||||
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
||||
type Locker = ();
|
||||
}
|
||||
|
||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||
construct_runtime!(
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = opaque::Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
// System support stuff.
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{
|
||||
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
|
||||
} = 1,
|
||||
// RandomnessCollectiveFlip = 2 removed
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4,
|
||||
|
||||
// Monetary stuff.
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
|
||||
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>} = 11,
|
||||
AssetTxPayment: pallet_asset_tx_payment::{Pallet, Event<T>} = 12,
|
||||
|
||||
// Collator support. the order of these 5 are important and shall not change.
|
||||
Authorship: pallet_authorship::{Pallet, Call, Storage} = 20,
|
||||
CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event<T>, Config<T>} = 21,
|
||||
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 22,
|
||||
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 23,
|
||||
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24,
|
||||
|
||||
// XCM helpers.
|
||||
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
|
||||
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 31,
|
||||
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
|
||||
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,
|
||||
|
||||
// Handy utilities.
|
||||
Utility: pallet_utility::{Pallet, Call, Event} = 40,
|
||||
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 41,
|
||||
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 42,
|
||||
|
||||
// The main stage.
|
||||
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>} = 50,
|
||||
Uniques: pallet_uniques::{Pallet, Call, Storage, Event<T>} = 51,
|
||||
}
|
||||
);
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block type as expected by this runtime.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
/// A Block signed with a Justification
|
||||
pub type SignedBlock = generic::SignedBlock<Block>;
|
||||
/// BlockId type as expected by this runtime.
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
/// The SignedExtension to the basic transaction logic.
|
||||
pub type SignedExtra = (
|
||||
frame_system::CheckNonZeroSender<Runtime>,
|
||||
frame_system::CheckSpecVersion<Runtime>,
|
||||
frame_system::CheckTxVersion<Runtime>,
|
||||
frame_system::CheckGenesis<Runtime>,
|
||||
frame_system::CheckEra<Runtime>,
|
||||
frame_system::CheckNonce<Runtime>,
|
||||
frame_system::CheckWeight<Runtime>,
|
||||
pallet_asset_tx_payment::ChargeAssetTxPayment<Runtime>,
|
||||
);
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
|
||||
/// Extrinsic type that has already been checked.
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = frame_executive::Executive<
|
||||
Runtime,
|
||||
Block,
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPalletsWithSystem,
|
||||
(),
|
||||
>;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
#[macro_use]
|
||||
extern crate frame_benchmarking;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
mod benches {
|
||||
define_benchmarks!(
|
||||
[frame_system, SystemBench::<Runtime>]
|
||||
[pallet_assets, Assets]
|
||||
[pallet_balances, Balances]
|
||||
[pallet_multisig, Multisig]
|
||||
[pallet_proxy, Proxy]
|
||||
[pallet_session, SessionBench::<Runtime>]
|
||||
[pallet_uniques, Uniques]
|
||||
[pallet_utility, Utility]
|
||||
[pallet_timestamp, Timestamp]
|
||||
[pallet_collator_selection, CollatorSelection]
|
||||
[cumulus_pallet_xcmp_queue, XcmpQueue]
|
||||
);
|
||||
}
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
|
||||
fn slot_duration() -> sp_consensus_aura::SlotDuration {
|
||||
sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
|
||||
}
|
||||
|
||||
fn authorities() -> Vec<AuraId> {
|
||||
Aura::authorities().into_inner()
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
VERSION
|
||||
}
|
||||
|
||||
fn execute_block(block: Block) {
|
||||
Executive::execute_block(block)
|
||||
}
|
||||
|
||||
fn initialize_block(header: &<Block as BlockT>::Header) {
|
||||
Executive::initialize_block(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_api::Metadata<Block> for Runtime {
|
||||
fn metadata() -> OpaqueMetadata {
|
||||
OpaqueMetadata::new(Runtime::metadata().into())
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_block_builder::BlockBuilder<Block> for Runtime {
|
||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
|
||||
Executive::apply_extrinsic(extrinsic)
|
||||
}
|
||||
|
||||
fn finalize_block() -> <Block as BlockT>::Header {
|
||||
Executive::finalize_block()
|
||||
}
|
||||
|
||||
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
data.create_extrinsics()
|
||||
}
|
||||
|
||||
fn check_inherents(
|
||||
block: Block,
|
||||
data: sp_inherents::InherentData,
|
||||
) -> sp_inherents::CheckInherentsResult {
|
||||
data.check_extrinsics(&block)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
fn validate_transaction(
|
||||
source: TransactionSource,
|
||||
tx: <Block as BlockT>::Extrinsic,
|
||||
block_hash: <Block as BlockT>::Hash,
|
||||
) -> TransactionValidity {
|
||||
Executive::validate_transaction(source, tx, block_hash)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
|
||||
fn offchain_worker(header: &<Block as BlockT>::Header) {
|
||||
Executive::offchain_worker(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_session::SessionKeys<Block> for Runtime {
|
||||
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
|
||||
SessionKeys::generate(seed)
|
||||
}
|
||||
|
||||
fn decode_session_keys(
|
||||
encoded: Vec<u8>,
|
||||
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
|
||||
SessionKeys::decode_into_raw_public_keys(&encoded)
|
||||
}
|
||||
}
|
||||
|
||||
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
|
||||
fn account_nonce(account: AccountId) -> Index {
|
||||
System::account_nonce(account)
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
|
||||
fn query_info(
|
||||
uxt: <Block as BlockT>::Extrinsic,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_info(uxt, len)
|
||||
}
|
||||
fn query_fee_details(
|
||||
uxt: <Block as BlockT>::Extrinsic,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_fee_details(uxt, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade statemine.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block_no_check(block: Block) -> Weight {
|
||||
Executive::execute_block_no_check(block)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||
fn benchmark_metadata(extra: bool) -> (
|
||||
Vec<frame_benchmarking::BenchmarkList>,
|
||||
Vec<frame_support::traits::StorageInfo>,
|
||||
) {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkList};
|
||||
use frame_support::traits::StorageInfoTrait;
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
|
||||
let mut list = Vec::<BenchmarkList>::new();
|
||||
list_benchmarks!(list, extra);
|
||||
|
||||
let storage_info = AllPalletsWithSystem::storage_info();
|
||||
return (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_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
// Block Number
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
||||
// Total Issuance
|
||||
hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
|
||||
// Execution Phase
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
|
||||
// Event Count
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
|
||||
// System Events
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
|
||||
];
|
||||
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct CheckInherents;
|
||||
|
||||
impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
|
||||
fn check_inherents(
|
||||
block: &Block,
|
||||
relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
|
||||
) -> sp_inherents::CheckInherentsResult {
|
||||
let relay_chain_slot = relay_state_proof
|
||||
.read_slot()
|
||||
.expect("Could not read the relay chain slot from the proof");
|
||||
|
||||
let inherent_data =
|
||||
cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(
|
||||
relay_chain_slot,
|
||||
sp_std::time::Duration::from_secs(6),
|
||||
)
|
||||
.create_inherent_data()
|
||||
.expect("Could not create the timestamp inherent data");
|
||||
|
||||
inherent_data.check_extrinsics(block)
|
||||
}
|
||||
}
|
||||
|
||||
cumulus_pallet_parachain_system::register_validate_block! {
|
||||
Runtime = Runtime,
|
||||
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
|
||||
CheckInherents = CheckInherents,
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Importing a block with 0 Extrinsics.
|
||||
pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::BlockExecutionWeight::get();
|
||||
|
||||
// At least 100 µs.
|
||||
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||
// At most 50 ms.
|
||||
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `cumulus_pallet_xcmp_queue`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=cumulus_pallet_xcmp_queue
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `cumulus_pallet_xcmp_queue`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo<T> {
|
||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||
fn set_config_with_u32() -> Weight {
|
||||
(5_634_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||
fn set_config_with_weight() -> Weight {
|
||||
(5_559_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||
pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||
|
||||
// At least 10 µs.
|
||||
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||
// At most 1 ms.
|
||||
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `frame_system`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=frame_system
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `frame_system`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `b` is `[0, 3932160]`.
|
||||
fn remark(_b: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
}
|
||||
/// The range of component `b` is `[0, 3932160]`.
|
||||
fn remark_with_event(b: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
|
||||
}
|
||||
// Storage: System Digest (r:1 w:1)
|
||||
// Storage: unknown [0x3a686561707061676573] (r:0 w:1)
|
||||
fn set_heap_pages() -> Weight {
|
||||
(5_461_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Skipped Metadata (r:0 w:0)
|
||||
/// The range of component `i` is `[1, 1000]`.
|
||||
fn set_storage(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((622_000 as Weight).saturating_mul(i as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||
}
|
||||
// Storage: Skipped Metadata (r:0 w:0)
|
||||
/// The range of component `i` is `[1, 1000]`.
|
||||
fn kill_storage(i: u32, ) -> Weight {
|
||||
(351_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((513_000 as Weight).saturating_mul(i as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||
}
|
||||
// Storage: Skipped Metadata (r:0 w:0)
|
||||
/// The range of component `p` is `[1, 1000]`.
|
||||
fn kill_prefix(p: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((1_054_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
pub mod block_weights;
|
||||
pub mod cumulus_pallet_xcmp_queue;
|
||||
pub mod extrinsic_weights;
|
||||
pub mod frame_system;
|
||||
pub mod pallet_assets;
|
||||
pub mod pallet_balances;
|
||||
pub mod pallet_collator_selection;
|
||||
pub mod pallet_multisig;
|
||||
pub mod pallet_proxy;
|
||||
pub mod pallet_session;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_uniques;
|
||||
pub mod pallet_utility;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||
pub use paritydb_weights::constants::ParityDbWeight;
|
||||
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||
@@ -0,0 +1,231 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_assets`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_assets
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_assets`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn create() -> Weight {
|
||||
(26_670_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn force_create() -> Weight {
|
||||
(15_063_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:5002 w:5001)
|
||||
// Storage: System Account (r:5000 w:5000)
|
||||
// Storage: Assets Metadata (r:1 w:0)
|
||||
// Storage: Assets Approvals (r:501 w:500)
|
||||
/// The range of component `c` is `[0, 5000]`.
|
||||
/// The range of component `s` is `[0, 5000]`.
|
||||
/// The range of component `a` is `[0, 500]`.
|
||||
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 46_000
|
||||
.saturating_add((16_382_000 as Weight).saturating_mul(c as Weight))
|
||||
// Standard Error: 46_000
|
||||
.saturating_add((19_187_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 465_000
|
||||
.saturating_add((16_818_000 as Weight).saturating_mul(a as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(a as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn mint() -> Weight {
|
||||
(29_655_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn burn() -> Weight {
|
||||
(33_648_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(47_414_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_keep_alive() -> Weight {
|
||||
(39_871_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn force_transfer() -> Weight {
|
||||
(47_454_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn freeze() -> Weight {
|
||||
(20_827_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn thaw() -> Weight {
|
||||
(21_249_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn freeze_asset() -> Weight {
|
||||
(17_775_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn thaw_asset() -> Weight {
|
||||
(17_917_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Metadata (r:1 w:0)
|
||||
fn transfer_ownership() -> Weight {
|
||||
(18_724_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn set_team() -> Weight {
|
||||
(17_448_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
/// The range of component `n` is `[0, 50]`.
|
||||
/// The range of component `s` is `[0, 50]`.
|
||||
fn set_metadata(_n: u32, _s: u32, ) -> Weight {
|
||||
(31_859_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
fn clear_metadata() -> Weight {
|
||||
(31_293_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
/// The range of component `n` is `[0, 50]`.
|
||||
/// The range of component `s` is `[0, 50]`.
|
||||
fn force_set_metadata(_n: u32, _s: u32, ) -> Weight {
|
||||
(19_595_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
fn force_clear_metadata() -> Weight {
|
||||
(31_366_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn force_asset_status() -> Weight {
|
||||
(16_884_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
fn approve_transfer() -> Weight {
|
||||
(34_730_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_approved() -> Weight {
|
||||
(59_797_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
fn cancel_approval() -> Weight {
|
||||
(35_178_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
fn force_cancel_approval() -> Weight {
|
||||
(36_840_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_balances`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_balances
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_balances`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(41_804_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_keep_alive() -> Weight {
|
||||
(31_899_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn set_balance_creating() -> Weight {
|
||||
(20_638_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn set_balance_killing() -> Weight {
|
||||
(24_081_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
fn force_transfer() -> Weight {
|
||||
(41_357_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_all() -> Weight {
|
||||
(37_382_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn force_unreserve() -> Weight {
|
||||
(18_476_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_collator_selection`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_collator_selection
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_collator_selection`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Session NextKeys (r:1 w:0)
|
||||
// Storage: CollatorSelection Invulnerables (r:0 w:1)
|
||||
/// The range of component `b` is `[1, 100]`.
|
||||
fn set_invulnerables(b: u32, ) -> Weight {
|
||||
(8_196_000 as Weight)
|
||||
// Standard Error: 3_000
|
||||
.saturating_add((3_354_000 as Weight).saturating_mul(b as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection DesiredCandidates (r:0 w:1)
|
||||
fn set_desired_candidates() -> Weight {
|
||||
(9_141_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection CandidacyBond (r:0 w:1)
|
||||
fn set_candidacy_bond() -> Weight {
|
||||
(9_554_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection Candidates (r:1 w:1)
|
||||
// Storage: CollatorSelection DesiredCandidates (r:1 w:0)
|
||||
// Storage: CollatorSelection Invulnerables (r:1 w:0)
|
||||
// Storage: Session NextKeys (r:1 w:0)
|
||||
// Storage: CollatorSelection CandidacyBond (r:1 w:0)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
|
||||
/// The range of component `c` is `[1, 1000]`.
|
||||
fn register_as_candidate(c: u32, ) -> Weight {
|
||||
(55_660_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((103_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection Candidates (r:1 w:1)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
|
||||
/// The range of component `c` is `[6, 1000]`.
|
||||
fn leave_intent(c: u32, ) -> Weight {
|
||||
(56_380_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((113_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
// Storage: System BlockWeight (r:1 w:1)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
|
||||
fn note_author() -> Weight {
|
||||
(31_852_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection Candidates (r:1 w:1)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:1000 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
// Storage: CollatorSelection Invulnerables (r:1 w:0)
|
||||
// Storage: System BlockWeight (r:1 w:1)
|
||||
/// The range of component `r` is `[1, 1000]`.
|
||||
/// The range of component `c` is `[1, 1000]`.
|
||||
fn new_session(r: u32, c: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 2_076_000
|
||||
.saturating_add((10_780_000 as Weight).saturating_mul(r as Weight))
|
||||
// Standard Error: 2_076_000
|
||||
.saturating_add((55_238_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_multisig`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_multisig
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_multisig`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_threshold_1(z: u32, ) -> Weight {
|
||||
(18_001_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_create(s: u32, z: u32, ) -> Weight {
|
||||
(35_223_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((118_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_create_store(s: u32, z: u32, ) -> Weight {
|
||||
(39_275_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((92_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
/// The range of component `s` is `[3, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_approve(s: u32, z: u32, ) -> Weight {
|
||||
(24_703_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((96_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
/// The range of component `s` is `[3, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_approve_store(s: u32, z: u32, ) -> Weight {
|
||||
(38_375_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((100_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_complete(s: u32, z: u32, ) -> Weight {
|
||||
(46_964_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((143_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((3_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn approve_as_multi_create(s: u32, ) -> Weight {
|
||||
(34_450_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((117_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn approve_as_multi_approve(s: u32, ) -> Weight {
|
||||
(22_051_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((117_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn approve_as_multi_complete(s: u32, ) -> Weight {
|
||||
(69_763_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((162_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn cancel_as_multi(s: u32, ) -> Weight {
|
||||
(53_182_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((129_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_proxy`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_proxy
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_proxy`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Proxy Proxies (r:1 w:0)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn proxy(p: u32, ) -> Weight {
|
||||
(18_075_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((92_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:0)
|
||||
// Storage: Proxy Announcements (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `a` is `[0, 31]`.
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn proxy_announced(a: u32, p: u32, ) -> Weight {
|
||||
(35_722_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((180_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((85_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Proxy Announcements (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `a` is `[0, 31]`.
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn remove_announcement(a: u32, p: u32, ) -> Weight {
|
||||
(25_193_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((185_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((23_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Proxy Announcements (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `a` is `[0, 31]`.
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn reject_announcement(a: u32, p: u32, ) -> Weight {
|
||||
(25_123_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((190_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((21_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:0)
|
||||
// Storage: Proxy Announcements (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `a` is `[0, 31]`.
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn announce(a: u32, p: u32, ) -> Weight {
|
||||
(32_582_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((200_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((93_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn add_proxy(p: u32, ) -> Weight {
|
||||
(28_173_000 as Weight)
|
||||
// Standard Error: 3_000
|
||||
.saturating_add((112_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn remove_proxy(p: u32, ) -> Weight {
|
||||
(28_247_000 as Weight)
|
||||
// Standard Error: 3_000
|
||||
.saturating_add((118_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn remove_proxies(p: u32, ) -> Weight {
|
||||
(23_821_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((85_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn anonymous(p: u32, ) -> Weight {
|
||||
(31_472_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((21_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[0, 30]`.
|
||||
fn kill_anonymous(p: u32, ) -> Weight {
|
||||
(24_620_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((85_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_session`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_session
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_session`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Session NextKeys (r:1 w:1)
|
||||
// Storage: Session KeyOwner (r:1 w:1)
|
||||
fn set_keys() -> Weight {
|
||||
(16_555_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Session NextKeys (r:1 w:1)
|
||||
// Storage: Session KeyOwner (r:0 w:1)
|
||||
fn purge_keys() -> Weight {
|
||||
(13_554_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_timestamp`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_timestamp
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_timestamp`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_timestamp::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Timestamp Now (r:1 w:1)
|
||||
fn set() -> Weight {
|
||||
(6_818_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn on_finalize() -> Weight {
|
||||
(2_431_000 as Weight)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_uniques`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --pallet=pallet_uniques
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights/pallet_uniques.rs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_uniques`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_uniques::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn create() -> Weight {
|
||||
(28_358_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn force_create() -> Weight {
|
||||
(17_824_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques Asset (r:1 w:0)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
// Storage: Uniques Attribute (r:0 w:1000)
|
||||
// Storage: Uniques ClassMetadataOf (r:0 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:0 w:1000)
|
||||
// Storage: Uniques CollectionMaxSupply (r:0 w:1)
|
||||
// Storage: Uniques Account (r:0 w:20)
|
||||
/// The range of component `n` is `[0, 1000]`.
|
||||
/// The range of component `m` is `[0, 1000]`.
|
||||
/// The range of component `a` is `[0, 1000]`.
|
||||
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((10_592_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((1_658_000 as Weight).saturating_mul(m as Weight))
|
||||
// Standard Error: 17_000
|
||||
.saturating_add((1_593_000 as Weight).saturating_mul(a as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(m as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques CollectionMaxSupply (r:1 w:0)
|
||||
// Storage: Uniques Account (r:0 w:1)
|
||||
fn mint() -> Weight {
|
||||
(36_742_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Account (r:0 w:1)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn burn() -> Weight {
|
||||
(37_124_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Account (r:0 w:2)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(28_961_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques Asset (r:100 w:100)
|
||||
/// The range of component `i` is `[0, 5000]`.
|
||||
fn redeposit(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 15_000
|
||||
.saturating_add((12_880_000 as Weight).saturating_mul(i as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
fn freeze() -> Weight {
|
||||
(21_658_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
fn thaw() -> Weight {
|
||||
(21_980_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
fn freeze_collection() -> Weight {
|
||||
(17_123_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
fn thaw_collection() -> Weight {
|
||||
(17_398_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:2)
|
||||
fn transfer_ownership() -> Weight {
|
||||
(25_473_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
fn set_team() -> Weight {
|
||||
(17_970_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn force_item_status() -> Weight {
|
||||
(20_781_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
|
||||
// Storage: Uniques Attribute (r:1 w:1)
|
||||
fn set_attribute() -> Weight {
|
||||
(42_652_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
|
||||
// Storage: Uniques Attribute (r:1 w:1)
|
||||
fn clear_attribute() -> Weight {
|
||||
(41_166_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
|
||||
fn set_metadata() -> Weight {
|
||||
(35_471_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
|
||||
fn clear_metadata() -> Weight {
|
||||
(35_110_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassMetadataOf (r:1 w:1)
|
||||
fn set_collection_metadata() -> Weight {
|
||||
(33_536_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Done by hand to satisfy master branch
|
||||
// This will be regenerated for the next release
|
||||
fn try_increment_id() -> Weight {
|
||||
(20_000_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques ClassMetadataOf (r:1 w:1)
|
||||
fn clear_collection_metadata() -> Weight {
|
||||
(31_913_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
fn approve_transfer() -> Weight {
|
||||
(23_536_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
fn cancel_approval() -> Weight {
|
||||
(23_748_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
|
||||
fn set_accept_ownership() -> Weight {
|
||||
(20_712_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques CollectionMaxSupply (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
fn set_collection_max_supply() -> Weight {
|
||||
(20_245_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:0)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn set_price() -> Weight {
|
||||
(20_065_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques ItemPriceOf (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Account (r:0 w:2)
|
||||
fn buy_item() -> Weight {
|
||||
(40_638_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_utility`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemine-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_utility
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemine/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_utility`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_utility::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn batch(c: u32, ) -> Weight {
|
||||
(22_923_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((3_526_000 as Weight).saturating_mul(c as Weight))
|
||||
}
|
||||
fn as_derivative() -> Weight {
|
||||
(5_220_000 as Weight)
|
||||
}
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn batch_all(c: u32, ) -> Weight {
|
||||
(20_953_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((3_698_000 as Weight).saturating_mul(c as Weight))
|
||||
}
|
||||
fn dispatch_as() -> Weight {
|
||||
(12_087_000 as Weight)
|
||||
}
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn force_batch(c: u32, ) -> Weight {
|
||||
(10_076_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((3_546_000 as Weight).saturating_mul(c as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, RuntimeDbWeight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
||||
/// are available for brave runtime engineers who may want to try this out as default.
|
||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 8_000 * constants::WEIGHT_PER_NANOS,
|
||||
write: 50_000 * constants::WEIGHT_PER_NANOS,
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_db_weights {
|
||||
use super::constants::ParityDbWeight as W;
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that all weights exist and have sane values.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
// At least 1 µs.
|
||||
assert!(
|
||||
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||
"Read weight should be at least 1 µs."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||
"Write weight should be at least 1 µs."
|
||||
);
|
||||
// At most 1 ms.
|
||||
assert!(
|
||||
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||
"Read weight should be at most 1 ms."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||
"Write weight should be at most 1 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, RuntimeDbWeight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||
/// the runtime.
|
||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 25_000 * constants::WEIGHT_PER_NANOS,
|
||||
write: 100_000 * constants::WEIGHT_PER_NANOS,
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_db_weights {
|
||||
use super::constants::RocksDbWeight as W;
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that all weights exist and have sane values.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
// At least 1 µs.
|
||||
assert!(
|
||||
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||
"Read weight should be at least 1 µs."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||
"Write weight should be at least 1 µs."
|
||||
);
|
||||
// At most 1 ms.
|
||||
assert!(
|
||||
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||
"Read weight should be at most 1 ms."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||
"Write weight should be at most 1 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use super::{
|
||||
AccountId, AssetId, Assets, Authorship, Balance, Balances, Call, Event, Origin, ParachainInfo,
|
||||
ParachainSystem, PolkadotXcm, Runtime, WeightToFee, XcmpQueue,
|
||||
};
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
traits::{ConstU32, Everything, Nothing, PalletInfoAccess},
|
||||
weights::Weight,
|
||||
};
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
use parachains_common::{
|
||||
impls::ToStakingPot,
|
||||
xcm_config::{
|
||||
AssetFeeAsExistentialDepositMultiplier, DenyReserveTransferToRelayChain, DenyThenTry,
|
||||
},
|
||||
};
|
||||
use polkadot_parachain::primitives::Sibling;
|
||||
use sp_runtime::traits::ConvertInto;
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
|
||||
ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter,
|
||||
IsConcrete, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
};
|
||||
use xcm_executor::{traits::JustTry, XcmExecutor};
|
||||
|
||||
parameter_types! {
|
||||
pub const KsmLocation: MultiLocation = MultiLocation::parent();
|
||||
pub const RelayNetwork: NetworkId = NetworkId::Kusama;
|
||||
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));
|
||||
pub const Local: MultiLocation = Here.into_location();
|
||||
pub AssetsPalletLocation: MultiLocation =
|
||||
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
|
||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||
}
|
||||
|
||||
/// Type for specifying how a `MultiLocation` 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.
|
||||
pub type LocationToAccountId = (
|
||||
// The parent (Relay-chain) origin converts to the parent `AccountId`.
|
||||
ParentIsPreset<AccountId>,
|
||||
// Sibling parachain origins convert to AccountId via the `ParaId::into`.
|
||||
SiblingParachainConvertsVia<Sibling, AccountId>,
|
||||
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
|
||||
AccountId32Aliases<RelayNetwork, AccountId>,
|
||||
);
|
||||
|
||||
/// Means for transacting the native currency on this chain.
|
||||
pub type CurrencyTransactor = CurrencyAdapter<
|
||||
// Use this currency:
|
||||
Balances,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
IsConcrete<KsmLocation>,
|
||||
// Convert an XCM MultiLocation into a local account id:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We don't track any teleports of `Balances`.
|
||||
(),
|
||||
>;
|
||||
|
||||
/// Means for transacting assets besides the native currency on this chain.
|
||||
pub type FungiblesTransactor = FungiblesAdapter<
|
||||
// Use this fungibles implementation:
|
||||
Assets,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
ConvertedConcreteId<
|
||||
AssetId,
|
||||
Balance,
|
||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
||||
JustTry,
|
||||
>,
|
||||
// Convert an XCM MultiLocation into a local account id:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We only want to allow teleports of known assets. We use non-zero issuance as an indication
|
||||
// that this asset is known.
|
||||
parachains_common::impls::NonZeroIssuance<AccountId, Assets>,
|
||||
// The account to use for tracking teleports.
|
||||
CheckingAccount,
|
||||
>;
|
||||
/// Means for transacting assets on this chain.
|
||||
pub type AssetTransactors = (CurrencyTransactor, FungiblesTransactor);
|
||||
|
||||
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
|
||||
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
|
||||
/// biases the kind of local `Origin` it will become.
|
||||
pub type XcmOriginToTransactDispatchOrigin = (
|
||||
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
|
||||
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
|
||||
// foreign chains who want to have a local sovereign account on this chain which they control.
|
||||
SovereignSignedViaLocation<LocationToAccountId, Origin>,
|
||||
// Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when
|
||||
// recognised.
|
||||
RelayChainAsNative<RelayChainOrigin, Origin>,
|
||||
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
|
||||
// recognised.
|
||||
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
|
||||
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
|
||||
// transaction from the Root origin.
|
||||
ParentAsSuperuser<Origin>,
|
||||
// Native signed account converter; this just converts an `AccountId32` origin into a normal
|
||||
// `Origin::Signed` origin of the same 32-byte value.
|
||||
SignedAccountId32AsNative<RelayNetwork, Origin>,
|
||||
// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
|
||||
XcmPassthrough<Origin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
|
||||
pub UnitWeightCost: Weight = 1_000_000_000;
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
|
||||
}
|
||||
|
||||
match_types! {
|
||||
pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: Here } |
|
||||
MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) }
|
||||
};
|
||||
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: Here } |
|
||||
MultiLocation { parents: 1, interior: X1(_) }
|
||||
};
|
||||
}
|
||||
|
||||
pub type Barrier = DenyThenTry<
|
||||
DenyReserveTransferToRelayChain,
|
||||
(
|
||||
TakeWeightCredit,
|
||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||
// Parent and its exec plurality get free execution
|
||||
AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
|
||||
// Expected responses are OK.
|
||||
AllowKnownQueryResponses<PolkadotXcm>,
|
||||
// Subscriptions for version tracking are OK.
|
||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
||||
),
|
||||
>;
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl xcm_executor::Config for XcmConfig {
|
||||
type Call = Call;
|
||||
type XcmSender = XcmRouter;
|
||||
type AssetTransactor = AssetTransactors;
|
||||
type OriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||
// Statemine does not recognize a reserve location for any asset. This does not prevent
|
||||
// Statemine acting _as_ a reserve location for KSM and assets created under `pallet-assets`.
|
||||
// For KSM, users must use teleport where allowed (e.g. with the Relay Chain).
|
||||
type IsReserve = ();
|
||||
type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of KSM
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Barrier = Barrier;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type Trader = (
|
||||
UsingComponents<WeightToFee, KsmLocation, AccountId, Balances, ToStakingPot<Runtime>>,
|
||||
cumulus_primitives_utility::TakeFirstAssetTrader<
|
||||
AccountId,
|
||||
AssetFeeAsExistentialDepositMultiplier<
|
||||
Runtime,
|
||||
WeightToFee,
|
||||
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
||||
>,
|
||||
ConvertedConcreteAssetId<
|
||||
AssetId,
|
||||
Balance,
|
||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
||||
JustTry,
|
||||
>,
|
||||
Assets,
|
||||
cumulus_primitives_utility::XcmFeesTo32ByteAccount<
|
||||
FungiblesTransactor,
|
||||
AccountId,
|
||||
XcmAssetFeesReceiver,
|
||||
>,
|
||||
>,
|
||||
);
|
||||
type ResponseHandler = PolkadotXcm;
|
||||
type AssetTrap = PolkadotXcm;
|
||||
type AssetClaims = PolkadotXcm;
|
||||
type SubscriptionService = PolkadotXcm;
|
||||
type PalletInstancesInfo = ();
|
||||
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
|
||||
type AssetLocker = ();
|
||||
type AssetExchanger = ();
|
||||
type FeeManager = ();
|
||||
type MessageExporter = ();
|
||||
type UniversalAliases = Nothing;
|
||||
}
|
||||
|
||||
/// Converts a local signed origin into an XCM multilocation.
|
||||
/// Forms the basis for local origins sending/executing XCMs.
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
|
||||
|
||||
/// The means for routing XCM messages which are not for local execution into the right message
|
||||
/// queues.
|
||||
pub type XcmRouter = (
|
||||
// Two routers - use UMP to communicate with the relay chain:
|
||||
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm, ()>,
|
||||
// ..and XCMP to communicate with the sibling chains.
|
||||
XcmpQueue,
|
||||
);
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type Event = Event;
|
||||
// We want to disallow users sending (arbitrary) XCMs from this chain.
|
||||
type SendXcmOrigin = EnsureXcmOrigin<Origin, ()>;
|
||||
type XcmRouter = XcmRouter;
|
||||
// We support local origins dispatching XCM executions in principle...
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are allowed.
|
||||
type XcmExecuteFilter = Nothing;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
type Currency = Balances;
|
||||
type CurrencyMatcher = ();
|
||||
type TrustedLockers = ();
|
||||
type SovereignAccountOf = LocationToAccountId;
|
||||
type MaxLockers = ConstU32<8>;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_xcm::Config for Runtime {
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
use asset_test_utils::{ExtBuilder, RuntimeHelper};
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, traits::PalletInfo, weights::WeightToFee as WeightToFeeT,
|
||||
};
|
||||
use parachains_common::{AccountId, AuraId};
|
||||
pub use statemine_runtime::{
|
||||
constants::fee::WeightToFee, xcm_config::XcmConfig, Assets, Balances, ExistentialDeposit,
|
||||
Runtime, SessionKeys, System,
|
||||
};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_executor::traits::WeightTrader;
|
||||
pub const ALICE: [u8; 32] = [1u8; 32];
|
||||
|
||||
#[test]
|
||||
fn test_asset_xcm_trader() {
|
||||
ExtBuilder::<Runtime>::default()
|
||||
.with_collators(vec![AccountId::from(ALICE)])
|
||||
.with_session_keys(vec![(
|
||||
AccountId::from(ALICE),
|
||||
AccountId::from(ALICE),
|
||||
SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) },
|
||||
)])
|
||||
.build()
|
||||
.execute_with(|| {
|
||||
// We need root origin to create a sufficient asset
|
||||
// We set existential deposit to be identical to the one for Balances first
|
||||
assert_ok!(Assets::force_create(
|
||||
RuntimeHelper::<Runtime>::root_origin(),
|
||||
1,
|
||||
AccountId::from(ALICE).into(),
|
||||
true,
|
||||
ExistentialDeposit::get()
|
||||
));
|
||||
|
||||
// We first mint enough asset for the account to exist for assets
|
||||
assert_ok!(Assets::mint(
|
||||
RuntimeHelper::<Runtime>::origin_of(AccountId::from(ALICE)),
|
||||
1,
|
||||
AccountId::from(ALICE).into(),
|
||||
ExistentialDeposit::get()
|
||||
));
|
||||
|
||||
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
||||
|
||||
// Set Alice as block author, who will receive fees
|
||||
RuntimeHelper::<Runtime>::run_to_block(2, Some(AccountId::from(ALICE)));
|
||||
|
||||
// We are going to buy 4e9 weight
|
||||
let bought = 4_000_000_000u64;
|
||||
|
||||
// lets calculate amount needed
|
||||
let amount_needed = WeightToFee::weight_to_fee(&bought);
|
||||
|
||||
let asset_multilocation = MultiLocation::new(
|
||||
0,
|
||||
X2(
|
||||
PalletInstance(
|
||||
<Runtime as frame_system::Config>::PalletInfo::index::<Assets>().unwrap()
|
||||
as u8,
|
||||
),
|
||||
GeneralIndex(1),
|
||||
),
|
||||
);
|
||||
|
||||
let asset: MultiAsset = (asset_multilocation, amount_needed).into();
|
||||
|
||||
// Make sure buy_weight does not return an error
|
||||
assert_ok!(trader.buy_weight(bought, asset.into()));
|
||||
|
||||
// Drop trader
|
||||
drop(trader);
|
||||
|
||||
// Make sure author(Alice) has received the amount
|
||||
assert_eq!(
|
||||
Assets::balance(1, AccountId::from(ALICE)),
|
||||
ExistentialDeposit::get() + amount_needed
|
||||
);
|
||||
|
||||
// We also need to ensure the total supply increased
|
||||
assert_eq!(Assets::total_supply(1), ExistentialDeposit::get() + amount_needed);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_asset_xcm_trader_with_refund() {
|
||||
ExtBuilder::<Runtime>::default()
|
||||
.with_collators(vec![AccountId::from(ALICE)])
|
||||
.with_session_keys(vec![(
|
||||
AccountId::from(ALICE),
|
||||
AccountId::from(ALICE),
|
||||
SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) },
|
||||
)])
|
||||
.build()
|
||||
.execute_with(|| {
|
||||
// We need root origin to create a sufficient asset
|
||||
// We set existential deposit to be identical to the one for Balances first
|
||||
assert_ok!(Assets::force_create(
|
||||
RuntimeHelper::<Runtime>::root_origin(),
|
||||
1,
|
||||
AccountId::from(ALICE).into(),
|
||||
true,
|
||||
ExistentialDeposit::get()
|
||||
));
|
||||
|
||||
// We first mint enough asset for the account to exist for assets
|
||||
assert_ok!(Assets::mint(
|
||||
RuntimeHelper::<Runtime>::origin_of(AccountId::from(ALICE)),
|
||||
1,
|
||||
AccountId::from(ALICE).into(),
|
||||
ExistentialDeposit::get()
|
||||
));
|
||||
|
||||
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
||||
|
||||
// Set Alice as block author, who will receive fees
|
||||
RuntimeHelper::<Runtime>::run_to_block(2, Some(AccountId::from(ALICE)));
|
||||
|
||||
// We are going to buy 4e9 weight
|
||||
let bought = 4_000_000_000u64;
|
||||
|
||||
let asset_multilocation = MultiLocation::new(
|
||||
0,
|
||||
X2(
|
||||
PalletInstance(
|
||||
<Runtime as frame_system::Config>::PalletInfo::index::<Assets>().unwrap()
|
||||
as u8,
|
||||
),
|
||||
GeneralIndex(1),
|
||||
),
|
||||
);
|
||||
|
||||
// lets calculate amount needed
|
||||
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
||||
|
||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
||||
|
||||
// Make sure buy_weight does not return an error
|
||||
assert_ok!(trader.buy_weight(bought, asset.clone().into()));
|
||||
|
||||
// Make sure again buy_weight does return an error
|
||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::NotWithdrawable);
|
||||
|
||||
// We actually use half of the weight
|
||||
let weight_used = bought / 2;
|
||||
|
||||
// Make sure refurnd works.
|
||||
let amount_refunded = WeightToFee::weight_to_fee(&(bought - weight_used));
|
||||
|
||||
assert_eq!(
|
||||
trader.refund_weight(bought - weight_used),
|
||||
Some((asset_multilocation, amount_refunded).into())
|
||||
);
|
||||
|
||||
// Drop trader
|
||||
drop(trader);
|
||||
|
||||
// We only should have paid for half of the bought weight
|
||||
let fees_paid = WeightToFee::weight_to_fee(&weight_used);
|
||||
|
||||
assert_eq!(
|
||||
Assets::balance(1, AccountId::from(ALICE)),
|
||||
ExistentialDeposit::get() + fees_paid
|
||||
);
|
||||
|
||||
// We also need to ensure the total supply increased
|
||||
assert_eq!(Assets::total_supply(1), ExistentialDeposit::get() + fees_paid);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() {
|
||||
ExtBuilder::<Runtime>::default()
|
||||
.with_collators(vec![AccountId::from(ALICE)])
|
||||
.with_session_keys(vec![(
|
||||
AccountId::from(ALICE),
|
||||
AccountId::from(ALICE),
|
||||
SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) },
|
||||
)])
|
||||
.build()
|
||||
.execute_with(|| {
|
||||
// We need root origin to create a sufficient asset
|
||||
// We set existential deposit to be identical to the one for Balances first
|
||||
assert_ok!(Assets::force_create(
|
||||
RuntimeHelper::<Runtime>::root_origin(),
|
||||
1,
|
||||
AccountId::from(ALICE).into(),
|
||||
true,
|
||||
ExistentialDeposit::get()
|
||||
));
|
||||
|
||||
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
||||
|
||||
// Set Alice as block author, who will receive fees
|
||||
RuntimeHelper::<Runtime>::run_to_block(2, Some(AccountId::from(ALICE)));
|
||||
|
||||
// We are going to buy small amount
|
||||
let bought = 500_000_000u64;
|
||||
|
||||
let asset_multilocation = MultiLocation::new(
|
||||
0,
|
||||
X2(
|
||||
PalletInstance(
|
||||
<Runtime as frame_system::Config>::PalletInfo::index::<Assets>().unwrap()
|
||||
as u8,
|
||||
),
|
||||
GeneralIndex(1),
|
||||
),
|
||||
);
|
||||
|
||||
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
||||
|
||||
assert!(
|
||||
amount_bought < ExistentialDeposit::get(),
|
||||
"we are testing what happens when the amount does not exceed ED"
|
||||
);
|
||||
|
||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
||||
|
||||
// Buy weight should return an error
|
||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
||||
|
||||
// not credited since the ED is higher than this value
|
||||
assert_eq!(Assets::balance(1, AccountId::from(ALICE)), 0);
|
||||
|
||||
// We also need to ensure the total supply did not increase
|
||||
assert_eq!(Assets::total_supply(1), 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_that_buying_ed_refund_does_not_refund() {
|
||||
ExtBuilder::<Runtime>::default()
|
||||
.with_collators(vec![AccountId::from(ALICE)])
|
||||
.with_session_keys(vec![(
|
||||
AccountId::from(ALICE),
|
||||
AccountId::from(ALICE),
|
||||
SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) },
|
||||
)])
|
||||
.build()
|
||||
.execute_with(|| {
|
||||
// We need root origin to create a sufficient asset
|
||||
// We set existential deposit to be identical to the one for Balances first
|
||||
assert_ok!(Assets::force_create(
|
||||
RuntimeHelper::<Runtime>::root_origin(),
|
||||
1,
|
||||
AccountId::from(ALICE).into(),
|
||||
true,
|
||||
ExistentialDeposit::get()
|
||||
));
|
||||
|
||||
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
||||
|
||||
// Set Alice as block author, who will receive fees
|
||||
RuntimeHelper::<Runtime>::run_to_block(2, Some(AccountId::from(ALICE)));
|
||||
|
||||
// We are gonna buy ED
|
||||
let bought: u64 = ExistentialDeposit::get().try_into().unwrap();
|
||||
|
||||
let asset_multilocation = MultiLocation::new(
|
||||
0,
|
||||
X2(
|
||||
PalletInstance(
|
||||
<Runtime as frame_system::Config>::PalletInfo::index::<Assets>().unwrap()
|
||||
as u8,
|
||||
),
|
||||
GeneralIndex(1),
|
||||
),
|
||||
);
|
||||
|
||||
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
||||
|
||||
assert!(
|
||||
amount_bought < ExistentialDeposit::get(),
|
||||
"we are testing what happens when the amount does not exceed ED"
|
||||
);
|
||||
|
||||
// We know we will have to buy at least ED, so lets make sure first it will
|
||||
// fail with a payment of less than ED
|
||||
let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into();
|
||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
||||
|
||||
// Now lets buy ED at least
|
||||
let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into();
|
||||
|
||||
// Buy weight should work
|
||||
assert_ok!(trader.buy_weight(bought, asset.into()));
|
||||
|
||||
// Should return None. We have a specific check making sure we dont go below ED for
|
||||
// drop payment
|
||||
assert_eq!(trader.refund_weight(bought), None);
|
||||
|
||||
// Drop trader
|
||||
drop(trader);
|
||||
|
||||
// Make sure author(Alice) has received the amount
|
||||
assert_eq!(Assets::balance(1, AccountId::from(ALICE)), ExistentialDeposit::get());
|
||||
|
||||
// We also need to ensure the total supply increased
|
||||
assert_eq!(Assets::total_supply(1), ExistentialDeposit::get());
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
[package]
|
||||
name = "statemint-runtime"
|
||||
version = "1.0.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Statemint parachain runtime"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
smallvec = "1.9.0"
|
||||
|
||||
# Substrate
|
||||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
|
||||
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" }
|
||||
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-uniques = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-utility = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Polkadot
|
||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus
|
||||
cumulus-pallet-aura-ext = { path = "../../../../pallets/aura-ext", default-features = false }
|
||||
cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-features = false }
|
||||
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false }
|
||||
cumulus-pallet-session-benchmarking = { path = "../../../../pallets/session-benchmarking", default-features = false, version = "3.0.0" }
|
||||
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
|
||||
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false }
|
||||
cumulus-ping = { path = "../../../pallets/ping", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
|
||||
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
|
||||
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
|
||||
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
|
||||
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.4"
|
||||
asset-test-utils = { path = "../test-utils"}
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
runtime-benchmarks = [
|
||||
"hex-literal",
|
||||
"frame-benchmarking/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system-benchmarking",
|
||||
"frame-system/runtime-benchmarks",
|
||||
"pallet-assets/runtime-benchmarks",
|
||||
"pallet-balances/runtime-benchmarks",
|
||||
"pallet-multisig/runtime-benchmarks",
|
||||
"pallet-proxy/runtime-benchmarks",
|
||||
"pallet-timestamp/runtime-benchmarks",
|
||||
"pallet-uniques/runtime-benchmarks",
|
||||
"pallet-utility/runtime-benchmarks",
|
||||
"pallet-xcm/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||
"pallet-collator-selection/runtime-benchmarks",
|
||||
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-executive/try-runtime",
|
||||
"frame-try-runtime",
|
||||
]
|
||||
std = [
|
||||
"codec/std",
|
||||
"log/std",
|
||||
"scale-info/std",
|
||||
"serde",
|
||||
"frame-executive/std",
|
||||
"frame-support/std",
|
||||
"frame-system-rpc-runtime-api/std",
|
||||
"frame-system/std",
|
||||
"pallet-asset-tx-payment/std",
|
||||
"pallet-assets/std",
|
||||
"pallet-aura/std",
|
||||
"pallet-authorship/std",
|
||||
"pallet-balances/std",
|
||||
"pallet-multisig/std",
|
||||
"pallet-proxy/std",
|
||||
"pallet-session/std",
|
||||
"pallet-timestamp/std",
|
||||
"pallet-transaction-payment-rpc-runtime-api/std",
|
||||
"pallet-transaction-payment/std",
|
||||
"pallet-uniques/std",
|
||||
"pallet-utility/std",
|
||||
"pallet-xcm/std",
|
||||
"polkadot-core-primitives/std",
|
||||
"polkadot-parachain/std",
|
||||
"polkadot-runtime-common/std",
|
||||
"polkadot-runtime-constants/std",
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-consensus-aura/std",
|
||||
"sp-core/std",
|
||||
"sp-inherents/std",
|
||||
"sp-io/std",
|
||||
"sp-offchain/std",
|
||||
"sp-runtime/std",
|
||||
"sp-session/std",
|
||||
"sp-std/std",
|
||||
"sp-transaction-pool/std",
|
||||
"sp-version/std",
|
||||
"xcm-builder/std",
|
||||
"xcm-executor/std",
|
||||
"xcm/std",
|
||||
"cumulus-pallet-aura-ext/std",
|
||||
"cumulus-pallet-dmp-queue/std",
|
||||
"cumulus-pallet-parachain-system/std",
|
||||
"cumulus-pallet-xcm/std",
|
||||
"cumulus-pallet-xcmp-queue/std",
|
||||
"cumulus-ping/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"cumulus-primitives-timestamp/std",
|
||||
"cumulus-primitives-utility/std",
|
||||
"pallet-collator-selection/std",
|
||||
"parachain-info/std",
|
||||
"parachains-common/std",
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
use substrate_wasm_builder::WasmBuilder;
|
||||
|
||||
fn main() {
|
||||
WasmBuilder::new()
|
||||
.with_current_project()
|
||||
.export_heap_base()
|
||||
.import_memory()
|
||||
.build()
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod currency {
|
||||
use polkadot_core_primitives::Balance;
|
||||
use polkadot_runtime_constants as constants;
|
||||
|
||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain (v9010).
|
||||
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
|
||||
|
||||
pub const UNITS: Balance = constants::currency::UNITS;
|
||||
pub const DOLLARS: Balance = constants::currency::DOLLARS;
|
||||
pub const CENTS: Balance = constants::currency::CENTS;
|
||||
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
|
||||
|
||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||
// 1/100 of Polkadot v9010
|
||||
constants::currency::deposit(items, bytes) / 100
|
||||
}
|
||||
}
|
||||
|
||||
/// Fee-related.
|
||||
pub mod fee {
|
||||
use frame_support::weights::{
|
||||
constants::ExtrinsicBaseWeight, WeightToFeeCoefficient, WeightToFeeCoefficients,
|
||||
WeightToFeePolynomial,
|
||||
};
|
||||
use polkadot_core_primitives::Balance;
|
||||
use smallvec::smallvec;
|
||||
pub use sp_runtime::Perbill;
|
||||
|
||||
/// The block saturation level. Fees will be updates based on this value.
|
||||
pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);
|
||||
|
||||
/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
|
||||
/// node's balance type.
|
||||
///
|
||||
/// This should typically create a mapping between the following ranges:
|
||||
/// - [0, MAXIMUM_BLOCK_WEIGHT]
|
||||
/// - [Balance::min, Balance::max]
|
||||
///
|
||||
/// Yet, it can be used for any other sort of change to weight-fee. Some examples being:
|
||||
/// - Setting it to `0` will essentially disable the weight fee.
|
||||
/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged.
|
||||
pub struct WeightToFee;
|
||||
impl WeightToFeePolynomial for WeightToFee {
|
||||
type Balance = Balance;
|
||||
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
|
||||
// in Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
|
||||
// in Statemint, we map to 1/10 of that, or 1/100 CENT
|
||||
let p = super::currency::CENTS;
|
||||
let q = 100 * Balance::from(ExtrinsicBaseWeight::get());
|
||||
smallvec![WeightToFeeCoefficient {
|
||||
degree: 1,
|
||||
negative: false,
|
||||
coeff_frac: Perbill::from_rational(p % q, q),
|
||||
coeff_integer: p / q,
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,873 @@
|
||||
// Copyright (C) 2021-2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! # Statemint Runtime
|
||||
//!
|
||||
//! Statemint is a parachain that provides an interface to create, manage, and use assets. Assets
|
||||
//! may be fungible or non-fungible.
|
||||
//!
|
||||
//! ## Assets
|
||||
//!
|
||||
//! - Fungibles: Configuration of `pallet-assets`.
|
||||
//! - Non-Fungibles (NFTs): Configuration of `pallet-uniques`.
|
||||
//!
|
||||
//! ## Other Functionality
|
||||
//!
|
||||
//! ### Native Balances
|
||||
//!
|
||||
//! Statemint uses its parent DOT token as its native asset.
|
||||
//!
|
||||
//! ### Governance
|
||||
//!
|
||||
//! As a common good parachain, Statemint defers its governance (namely, its `Root` origin), to its
|
||||
//! Relay Chain parent, Polkadot.
|
||||
//!
|
||||
//! ### Collator Selection
|
||||
//!
|
||||
//! Statemint uses `pallet-collator-selection`, a simple first-come-first-served registration
|
||||
//! system where collators can reserve a small bond to join the block producer set. There is no
|
||||
//! slashing.
|
||||
//!
|
||||
//! ### XCM
|
||||
//!
|
||||
//! Because Statemint is fully under the control of the Relay Chain, it is meant to be a
|
||||
//! `TrustedTeleporter`. It can also serve as a reserve location to other parachains for DOT as well
|
||||
//! as other local assets.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
// Make the WASM binary available.
|
||||
#[cfg(feature = "std")]
|
||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
|
||||
pub mod constants;
|
||||
mod weights;
|
||||
pub mod xcm_config;
|
||||
|
||||
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
|
||||
use sp_api::impl_runtime_apis;
|
||||
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto},
|
||||
transaction_validity::{TransactionSource, TransactionValidity},
|
||||
ApplyExtrinsicResult,
|
||||
};
|
||||
|
||||
use sp_std::prelude::*;
|
||||
#[cfg(feature = "std")]
|
||||
use sp_version::NativeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use constants::{currency::*, fee::WeightToFee};
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{AsEnsureOriginWithArg, EitherOfDiverse, InstanceFilter},
|
||||
weights::{ConstantMultiplier, DispatchClass, Weight},
|
||||
PalletId, RuntimeDebug,
|
||||
};
|
||||
use frame_system::{
|
||||
limits::{BlockLength, BlockWeights},
|
||||
EnsureRoot, EnsureSigned,
|
||||
};
|
||||
pub use parachains_common as common;
|
||||
use parachains_common::{
|
||||
impls::{AssetsToBlockAuthor, DealWithFees},
|
||||
opaque, AccountId, AssetId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
||||
StatemintAuraId as AuraId, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT,
|
||||
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||
};
|
||||
use xcm_config::{DotLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sp_runtime::BuildStorage;
|
||||
|
||||
// Polkadot imports
|
||||
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
|
||||
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||
use xcm::latest::BodyId;
|
||||
use xcm_executor::XcmExecutor;
|
||||
|
||||
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||
|
||||
impl_opaque_keys! {
|
||||
pub struct SessionKeys {
|
||||
pub aura: Aura,
|
||||
}
|
||||
}
|
||||
|
||||
#[sp_version::runtime_version]
|
||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("statemint"),
|
||||
impl_name: create_runtime_str!("statemint"),
|
||||
authoring_version: 1,
|
||||
spec_version: 9230,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
transaction_version: 7,
|
||||
state_version: 0,
|
||||
};
|
||||
|
||||
/// The version information used to identify this runtime when compiled natively.
|
||||
#[cfg(feature = "std")]
|
||||
pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub RuntimeBlockLength: BlockLength =
|
||||
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
|
||||
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
|
||||
.base_block(BlockExecutionWeight::get())
|
||||
.for_class(DispatchClass::all(), |weights| {
|
||||
weights.base_extrinsic = ExtrinsicBaseWeight::get();
|
||||
})
|
||||
.for_class(DispatchClass::Normal, |weights| {
|
||||
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
|
||||
})
|
||||
.for_class(DispatchClass::Operational, |weights| {
|
||||
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
|
||||
// Operational transactions have some extra reserved space, so that they
|
||||
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
|
||||
weights.reserved = Some(
|
||||
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
|
||||
);
|
||||
})
|
||||
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
|
||||
.build_or_panic();
|
||||
pub const SS58Prefix: u8 = 0;
|
||||
}
|
||||
|
||||
// Configure FRAME pallets to include in runtime.
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type BlockWeights = RuntimeBlockWeights;
|
||||
type BlockLength = RuntimeBlockLength;
|
||||
type AccountId = AccountId;
|
||||
type Call = Call;
|
||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||
type Index = Index;
|
||||
type BlockNumber = BlockNumber;
|
||||
type Hash = Hash;
|
||||
type Hashing = BlakeTwo256;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type Origin = Origin;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type DbWeight = RocksDbWeight;
|
||||
type Version = Version;
|
||||
type PalletInfo = PalletInfo;
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type AccountData = pallet_balances::AccountData<Balance>;
|
||||
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
|
||||
type SS58Prefix = SS58Prefix;
|
||||
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||
}
|
||||
|
||||
impl pallet_timestamp::Config for Runtime {
|
||||
/// A timestamp: milliseconds since the unix epoch.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = ();
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const UncleGenerations: u32 = 0;
|
||||
}
|
||||
|
||||
impl pallet_authorship::Config for Runtime {
|
||||
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
|
||||
type UncleGenerations = UncleGenerations;
|
||||
type FilterUncle = ();
|
||||
type EventHandler = (CollatorSelection,);
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
pub const MaxLocks: u32 = 50;
|
||||
pub const MaxReserves: u32 = 50;
|
||||
}
|
||||
|
||||
impl pallet_balances::Config for Runtime {
|
||||
type MaxLocks = MaxLocks;
|
||||
/// The type for recording an account's balance.
|
||||
type Balance = Balance;
|
||||
/// The ubiquitous event type.
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
/// Relay Chain `TransactionByteFee` / 10
|
||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
||||
pub const OperationalFeeMultiplier: u8 = 5;
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnChargeTransaction =
|
||||
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
|
||||
type WeightToFee = WeightToFee;
|
||||
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
|
||||
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
|
||||
type OperationalFeeMultiplier = OperationalFeeMultiplier;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const AssetDeposit: Balance = 10 * UNITS; // 10 UNITS deposit to create fungible asset class
|
||||
pub const AssetAccountDeposit: Balance = deposit(1, 16);
|
||||
pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
pub const AssetsStringLimit: u32 = 50;
|
||||
/// Key = 32 bytes, Value = 36 bytes (32+1+1+1+1)
|
||||
// https://github.com/paritytech/substrate/blob/069917b/frame/assets/src/lib.rs#L257L271
|
||||
pub const MetadataDepositBase: Balance = deposit(1, 68);
|
||||
pub const MetadataDepositPerByte: Balance = deposit(0, 1);
|
||||
pub const ExecutiveBody: BodyId = BodyId::Executive;
|
||||
}
|
||||
|
||||
/// We allow root and the Relay Chain council to execute privileged asset operations.
|
||||
pub type AssetsForceOrigin =
|
||||
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<DotLocation, ExecutiveBody>>>;
|
||||
|
||||
impl pallet_assets::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Balance = Balance;
|
||||
type AssetId = AssetId;
|
||||
type Currency = Balances;
|
||||
type ForceOrigin = AssetsForceOrigin;
|
||||
type AssetDeposit = AssetDeposit;
|
||||
type MetadataDepositBase = MetadataDepositBase;
|
||||
type MetadataDepositPerByte = MetadataDepositPerByte;
|
||||
type ApprovalDeposit = ApprovalDeposit;
|
||||
type StringLimit = AssetsStringLimit;
|
||||
type Freezer = ();
|
||||
type Extra = ();
|
||||
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
|
||||
type AssetAccountDeposit = AssetAccountDeposit;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
|
||||
pub const DepositBase: Balance = deposit(1, 88);
|
||||
// Additional storage item size of 32 bytes.
|
||||
pub const DepositFactor: Balance = deposit(0, 32);
|
||||
pub const MaxSignatories: u16 = 100;
|
||||
}
|
||||
|
||||
impl pallet_multisig::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type Currency = Balances;
|
||||
type DepositBase = DepositBase;
|
||||
type DepositFactor = DepositFactor;
|
||||
type MaxSignatories = MaxSignatories;
|
||||
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_utility::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type PalletsOrigin = OriginCaller;
|
||||
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One storage item; key size 32, value size 8; .
|
||||
pub const ProxyDepositBase: Balance = deposit(1, 40);
|
||||
// Additional storage item size of 33 bytes.
|
||||
pub const ProxyDepositFactor: Balance = deposit(0, 33);
|
||||
pub const MaxProxies: u16 = 32;
|
||||
// One storage item; key size 32, value size 16
|
||||
pub const AnnouncementDepositBase: Balance = deposit(1, 48);
|
||||
pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
|
||||
pub const MaxPending: u16 = 32;
|
||||
}
|
||||
|
||||
/// The type used to represent the kinds of proxying allowed.
|
||||
#[derive(
|
||||
Copy,
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Encode,
|
||||
Decode,
|
||||
RuntimeDebug,
|
||||
MaxEncodedLen,
|
||||
scale_info::TypeInfo,
|
||||
)]
|
||||
pub enum ProxyType {
|
||||
/// Fully permissioned proxy. Can execute any call on behalf of _proxied_.
|
||||
Any,
|
||||
/// Can execute any call that does not transfer funds or assets.
|
||||
NonTransfer,
|
||||
/// Proxy with the ability to reject time-delay proxy announcements.
|
||||
CancelProxy,
|
||||
/// Assets proxy. Can execute any call from `assets`, **including asset transfers**.
|
||||
Assets,
|
||||
/// Owner proxy. Can execute calls related to asset ownership.
|
||||
AssetOwner,
|
||||
/// Asset manager. Can execute calls related to asset management.
|
||||
AssetManager,
|
||||
/// Collator selection proxy. Can execute calls related to collator selection mechanism.
|
||||
Collator,
|
||||
}
|
||||
impl Default for ProxyType {
|
||||
fn default() -> Self {
|
||||
Self::Any
|
||||
}
|
||||
}
|
||||
impl InstanceFilter<Call> for ProxyType {
|
||||
fn filter(&self, c: &Call) -> bool {
|
||||
match self {
|
||||
ProxyType::Any => true,
|
||||
ProxyType::NonTransfer =>
|
||||
!matches!(c, Call::Balances { .. } | Call::Assets { .. } | Call::Uniques { .. }),
|
||||
ProxyType::CancelProxy => matches!(
|
||||
c,
|
||||
Call::Proxy(pallet_proxy::Call::reject_announcement { .. }) |
|
||||
Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
ProxyType::Assets => {
|
||||
matches!(
|
||||
c,
|
||||
Call::Assets { .. } |
|
||||
Call::Utility { .. } | Call::Multisig { .. } |
|
||||
Call::Uniques { .. }
|
||||
)
|
||||
},
|
||||
ProxyType::AssetOwner => matches!(
|
||||
c,
|
||||
Call::Assets(pallet_assets::Call::create { .. }) |
|
||||
Call::Assets(pallet_assets::Call::destroy { .. }) |
|
||||
Call::Assets(pallet_assets::Call::transfer_ownership { .. }) |
|
||||
Call::Assets(pallet_assets::Call::set_team { .. }) |
|
||||
Call::Assets(pallet_assets::Call::set_metadata { .. }) |
|
||||
Call::Assets(pallet_assets::Call::clear_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::create { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::destroy { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::transfer_ownership { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_team { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_attribute { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_collection_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::clear_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::clear_attribute { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::clear_collection_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_collection_max_supply { .. }) |
|
||||
Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
ProxyType::AssetManager => matches!(
|
||||
c,
|
||||
Call::Assets(pallet_assets::Call::mint { .. }) |
|
||||
Call::Assets(pallet_assets::Call::burn { .. }) |
|
||||
Call::Assets(pallet_assets::Call::freeze { .. }) |
|
||||
Call::Assets(pallet_assets::Call::thaw { .. }) |
|
||||
Call::Assets(pallet_assets::Call::freeze_asset { .. }) |
|
||||
Call::Assets(pallet_assets::Call::thaw_asset { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::mint { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::burn { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::freeze { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::thaw { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::freeze_collection { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::thaw_collection { .. }) |
|
||||
Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
ProxyType::Collator => matches!(
|
||||
c,
|
||||
Call::CollatorSelection { .. } | Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_superset(&self, o: &Self) -> bool {
|
||||
match (self, o) {
|
||||
(x, y) if x == y => true,
|
||||
(ProxyType::Any, _) => true,
|
||||
(_, ProxyType::Any) => false,
|
||||
(ProxyType::Assets, ProxyType::AssetOwner) => true,
|
||||
(ProxyType::Assets, ProxyType::AssetManager) => true,
|
||||
(ProxyType::NonTransfer, ProxyType::Collator) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_proxy::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type Currency = Balances;
|
||||
type ProxyType = ProxyType;
|
||||
type ProxyDepositBase = ProxyDepositBase;
|
||||
type ProxyDepositFactor = ProxyDepositFactor;
|
||||
type MaxProxies = MaxProxies;
|
||||
type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
|
||||
type MaxPending = MaxPending;
|
||||
type CallHasher = BlakeTwo256;
|
||||
type AnnouncementDepositBase = AnnouncementDepositBase;
|
||||
type AnnouncementDepositFactor = AnnouncementDepositFactor;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
|
||||
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type DmpMessageHandler = DmpQueue;
|
||||
type ReservedDmpWeight = ReservedDmpWeight;
|
||||
type OutboundXcmpMessageSource = XcmpQueue;
|
||||
type XcmpMessageHandler = XcmpQueue;
|
||||
type ReservedXcmpWeight = ReservedXcmpWeight;
|
||||
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases;
|
||||
}
|
||||
|
||||
impl parachain_info::Config for Runtime {}
|
||||
|
||||
impl cumulus_pallet_aura_ext::Config for Runtime {}
|
||||
|
||||
impl cumulus_pallet_xcmp_queue::Config for Runtime {
|
||||
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type ChannelInfo = ParachainSystem;
|
||||
type VersionWrapper = PolkadotXcm;
|
||||
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
||||
type ControllerOrigin = EitherOfDiverse<
|
||||
EnsureRoot<AccountId>,
|
||||
EnsureXcm<IsMajorityOfBody<DotLocation, ExecutiveBody>>,
|
||||
>;
|
||||
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||
type PriceForSiblingDelivery = ();
|
||||
}
|
||||
|
||||
impl cumulus_pallet_dmp_queue::Config for Runtime {
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Period: u32 = 6 * HOURS;
|
||||
pub const Offset: u32 = 0;
|
||||
pub const MaxAuthorities: u32 = 100_000;
|
||||
}
|
||||
|
||||
impl pallet_session::Config for Runtime {
|
||||
type Event = Event;
|
||||
type ValidatorId = <Self as frame_system::Config>::AccountId;
|
||||
// we don't have stash and controller, thus we don't need the convert as well.
|
||||
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
|
||||
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type SessionManager = CollatorSelection;
|
||||
// Essentially just Aura, but lets be pedantic.
|
||||
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
|
||||
type Keys = SessionKeys;
|
||||
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_aura::Config for Runtime {
|
||||
type AuthorityId = AuraId;
|
||||
type DisabledValidators = ();
|
||||
type MaxAuthorities = MaxAuthorities;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const PotId: PalletId = PalletId(*b"PotStake");
|
||||
pub const MaxCandidates: u32 = 1000;
|
||||
pub const MinCandidates: u32 = 5;
|
||||
pub const SessionLength: BlockNumber = 6 * HOURS;
|
||||
pub const MaxInvulnerables: u32 = 100;
|
||||
}
|
||||
|
||||
/// We allow root and the Relay Chain council to execute privileged collator selection operations.
|
||||
pub type CollatorSelectionUpdateOrigin =
|
||||
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<DotLocation, ExecutiveBody>>>;
|
||||
|
||||
impl pallet_collator_selection::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type UpdateOrigin = CollatorSelectionUpdateOrigin;
|
||||
type PotId = PotId;
|
||||
type MaxCandidates = MaxCandidates;
|
||||
type MinCandidates = MinCandidates;
|
||||
type MaxInvulnerables = MaxInvulnerables;
|
||||
// should be a multiple of session or things will get inconsistent
|
||||
type KickThreshold = Period;
|
||||
type ValidatorId = <Self as frame_system::Config>::AccountId;
|
||||
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
|
||||
type ValidatorRegistration = Session;
|
||||
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_asset_tx_payment::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Fungibles = Assets;
|
||||
type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter<
|
||||
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
||||
AssetsToBlockAuthor<Runtime>,
|
||||
>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const CollectionDeposit: Balance = 10 * UNITS; // 10 UNIT deposit to create uniques class
|
||||
pub const ItemDeposit: Balance = UNITS / 100; // 1 / 100 UNIT deposit to create uniques instance
|
||||
pub const KeyLimit: u32 = 32; // Max 32 bytes per key
|
||||
pub const ValueLimit: u32 = 64; // Max 64 bytes per value
|
||||
pub const UniquesMetadataDepositBase: Balance = deposit(1, 129);
|
||||
pub const AttributeDepositBase: Balance = deposit(1, 0);
|
||||
pub const DepositPerByte: Balance = deposit(0, 1);
|
||||
pub const UniquesStringLimit: u32 = 128;
|
||||
}
|
||||
|
||||
impl pallet_uniques::Config for Runtime {
|
||||
type Event = Event;
|
||||
type CollectionId = u32;
|
||||
type ItemId = u32;
|
||||
type Currency = Balances;
|
||||
type ForceOrigin = AssetsForceOrigin;
|
||||
type CollectionDeposit = CollectionDeposit;
|
||||
type ItemDeposit = ItemDeposit;
|
||||
type MetadataDepositBase = UniquesMetadataDepositBase;
|
||||
type AttributeDepositBase = AttributeDepositBase;
|
||||
type DepositPerByte = DepositPerByte;
|
||||
type StringLimit = UniquesStringLimit;
|
||||
type KeyLimit = KeyLimit;
|
||||
type ValueLimit = ValueLimit;
|
||||
type WeightInfo = weights::pallet_uniques::WeightInfo<Runtime>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type Helper = ();
|
||||
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
||||
type Locker = ();
|
||||
}
|
||||
|
||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||
construct_runtime!(
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = opaque::Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
// System support stuff.
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{
|
||||
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
|
||||
} = 1,
|
||||
// RandomnessCollectiveFlip = 2 removed
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4,
|
||||
|
||||
// Monetary stuff.
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
|
||||
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>} = 11,
|
||||
AssetTxPayment: pallet_asset_tx_payment::{Pallet, Event<T>} = 12,
|
||||
|
||||
// Collator support. the order of these 5 are important and shall not change.
|
||||
Authorship: pallet_authorship::{Pallet, Call, Storage} = 20,
|
||||
CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event<T>, Config<T>} = 21,
|
||||
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 22,
|
||||
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 23,
|
||||
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24,
|
||||
|
||||
// XCM helpers.
|
||||
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
|
||||
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 31,
|
||||
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
|
||||
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,
|
||||
|
||||
// Handy utilities.
|
||||
Utility: pallet_utility::{Pallet, Call, Event} = 40,
|
||||
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 41,
|
||||
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 42,
|
||||
|
||||
// The main stage.
|
||||
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>} = 50,
|
||||
Uniques: pallet_uniques::{Pallet, Call, Storage, Event<T>} = 51,
|
||||
}
|
||||
);
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block type as expected by this runtime.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
/// A Block signed with a Justification
|
||||
pub type SignedBlock = generic::SignedBlock<Block>;
|
||||
/// BlockId type as expected by this runtime.
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
/// The SignedExtension to the basic transaction logic.
|
||||
pub type SignedExtra = (
|
||||
frame_system::CheckNonZeroSender<Runtime>,
|
||||
frame_system::CheckSpecVersion<Runtime>,
|
||||
frame_system::CheckTxVersion<Runtime>,
|
||||
frame_system::CheckGenesis<Runtime>,
|
||||
frame_system::CheckEra<Runtime>,
|
||||
frame_system::CheckNonce<Runtime>,
|
||||
frame_system::CheckWeight<Runtime>,
|
||||
pallet_asset_tx_payment::ChargeAssetTxPayment<Runtime>,
|
||||
);
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
|
||||
/// Extrinsic type that has already been checked.
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = frame_executive::Executive<
|
||||
Runtime,
|
||||
Block,
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPalletsWithSystem,
|
||||
>;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
#[macro_use]
|
||||
extern crate frame_benchmarking;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
mod benches {
|
||||
define_benchmarks!(
|
||||
[frame_system, SystemBench::<Runtime>]
|
||||
[pallet_assets, Assets]
|
||||
[pallet_balances, Balances]
|
||||
[pallet_multisig, Multisig]
|
||||
[pallet_proxy, Proxy]
|
||||
[pallet_session, SessionBench::<Runtime>]
|
||||
[pallet_uniques, Uniques]
|
||||
[pallet_utility, Utility]
|
||||
[pallet_timestamp, Timestamp]
|
||||
[pallet_collator_selection, CollatorSelection]
|
||||
[cumulus_pallet_xcmp_queue, XcmpQueue]
|
||||
);
|
||||
}
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
|
||||
fn slot_duration() -> sp_consensus_aura::SlotDuration {
|
||||
sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
|
||||
}
|
||||
|
||||
fn authorities() -> Vec<AuraId> {
|
||||
Aura::authorities().into_inner()
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
VERSION
|
||||
}
|
||||
|
||||
fn execute_block(block: Block) {
|
||||
Executive::execute_block(block)
|
||||
}
|
||||
|
||||
fn initialize_block(header: &<Block as BlockT>::Header) {
|
||||
Executive::initialize_block(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_api::Metadata<Block> for Runtime {
|
||||
fn metadata() -> OpaqueMetadata {
|
||||
OpaqueMetadata::new(Runtime::metadata().into())
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_block_builder::BlockBuilder<Block> for Runtime {
|
||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
|
||||
Executive::apply_extrinsic(extrinsic)
|
||||
}
|
||||
|
||||
fn finalize_block() -> <Block as BlockT>::Header {
|
||||
Executive::finalize_block()
|
||||
}
|
||||
|
||||
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
data.create_extrinsics()
|
||||
}
|
||||
|
||||
fn check_inherents(
|
||||
block: Block,
|
||||
data: sp_inherents::InherentData,
|
||||
) -> sp_inherents::CheckInherentsResult {
|
||||
data.check_extrinsics(&block)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
fn validate_transaction(
|
||||
source: TransactionSource,
|
||||
tx: <Block as BlockT>::Extrinsic,
|
||||
block_hash: <Block as BlockT>::Hash,
|
||||
) -> TransactionValidity {
|
||||
Executive::validate_transaction(source, tx, block_hash)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
|
||||
fn offchain_worker(header: &<Block as BlockT>::Header) {
|
||||
Executive::offchain_worker(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_session::SessionKeys<Block> for Runtime {
|
||||
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
|
||||
SessionKeys::generate(seed)
|
||||
}
|
||||
|
||||
fn decode_session_keys(
|
||||
encoded: Vec<u8>,
|
||||
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
|
||||
SessionKeys::decode_into_raw_public_keys(&encoded)
|
||||
}
|
||||
}
|
||||
|
||||
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
|
||||
fn account_nonce(account: AccountId) -> Index {
|
||||
System::account_nonce(account)
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
|
||||
fn query_info(
|
||||
uxt: <Block as BlockT>::Extrinsic,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_info(uxt, len)
|
||||
}
|
||||
fn query_fee_details(
|
||||
uxt: <Block as BlockT>::Extrinsic,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_fee_details(uxt, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade statemint.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block_no_check(block: Block) -> Weight {
|
||||
Executive::execute_block_no_check(block)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||
fn benchmark_metadata(extra: bool) -> (
|
||||
Vec<frame_benchmarking::BenchmarkList>,
|
||||
Vec<frame_support::traits::StorageInfo>,
|
||||
) {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkList};
|
||||
use frame_support::traits::StorageInfoTrait;
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
|
||||
let mut list = Vec::<BenchmarkList>::new();
|
||||
list_benchmarks!(list, extra);
|
||||
|
||||
let storage_info = AllPalletsWithSystem::storage_info();
|
||||
return (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_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
// Block Number
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
||||
// Total Issuance
|
||||
hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
|
||||
// Execution Phase
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
|
||||
// Event Count
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
|
||||
// System Events
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
|
||||
];
|
||||
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct CheckInherents;
|
||||
|
||||
impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
|
||||
fn check_inherents(
|
||||
block: &Block,
|
||||
relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
|
||||
) -> sp_inherents::CheckInherentsResult {
|
||||
let relay_chain_slot = relay_state_proof
|
||||
.read_slot()
|
||||
.expect("Could not read the relay chain slot from the proof");
|
||||
|
||||
let inherent_data =
|
||||
cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(
|
||||
relay_chain_slot,
|
||||
sp_std::time::Duration::from_secs(6),
|
||||
)
|
||||
.create_inherent_data()
|
||||
.expect("Could not create the timestamp inherent data");
|
||||
|
||||
inherent_data.check_extrinsics(block)
|
||||
}
|
||||
}
|
||||
|
||||
cumulus_pallet_parachain_system::register_validate_block! {
|
||||
Runtime = Runtime,
|
||||
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
|
||||
CheckInherents = CheckInherents,
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Importing a block with 0 Extrinsics.
|
||||
pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::BlockExecutionWeight::get();
|
||||
|
||||
// At least 100 µs.
|
||||
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||
// At most 50 ms.
|
||||
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `cumulus_pallet_xcmp_queue`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=cumulus_pallet_xcmp_queue
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `cumulus_pallet_xcmp_queue`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo<T> {
|
||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||
fn set_config_with_u32() -> Weight {
|
||||
(5_192_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||
fn set_config_with_weight() -> Weight {
|
||||
(5_363_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||
pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||
|
||||
// At least 10 µs.
|
||||
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||
// At most 1 ms.
|
||||
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `frame_system`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=frame_system
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `frame_system`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `b` is `[0, 3932160]`.
|
||||
fn remark(_b: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
}
|
||||
/// The range of component `b` is `[0, 3932160]`.
|
||||
fn remark_with_event(b: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
|
||||
}
|
||||
// Storage: System Digest (r:1 w:1)
|
||||
// Storage: unknown [0x3a686561707061676573] (r:0 w:1)
|
||||
fn set_heap_pages() -> Weight {
|
||||
(5_446_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Skipped Metadata (r:0 w:0)
|
||||
/// The range of component `i` is `[1, 1000]`.
|
||||
fn set_storage(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((626_000 as Weight).saturating_mul(i as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||
}
|
||||
// Storage: Skipped Metadata (r:0 w:0)
|
||||
/// The range of component `i` is `[1, 1000]`.
|
||||
fn kill_storage(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((515_000 as Weight).saturating_mul(i as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||
}
|
||||
// Storage: Skipped Metadata (r:0 w:0)
|
||||
/// The range of component `p` is `[1, 1000]`.
|
||||
fn kill_prefix(p: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((1_052_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
pub mod block_weights;
|
||||
pub mod cumulus_pallet_xcmp_queue;
|
||||
pub mod extrinsic_weights;
|
||||
pub mod frame_system;
|
||||
pub mod pallet_assets;
|
||||
pub mod pallet_balances;
|
||||
pub mod pallet_collator_selection;
|
||||
pub mod pallet_multisig;
|
||||
pub mod pallet_proxy;
|
||||
pub mod pallet_session;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_uniques;
|
||||
pub mod pallet_utility;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||
pub use paritydb_weights::constants::ParityDbWeight;
|
||||
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||
@@ -0,0 +1,237 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_assets`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_assets
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_assets`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn create() -> Weight {
|
||||
(26_226_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn force_create() -> Weight {
|
||||
(15_357_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:5002 w:5001)
|
||||
// Storage: System Account (r:5000 w:5000)
|
||||
// Storage: Assets Metadata (r:1 w:0)
|
||||
// Storage: Assets Approvals (r:501 w:500)
|
||||
/// The range of component `c` is `[0, 5000]`.
|
||||
/// The range of component `s` is `[0, 5000]`.
|
||||
/// The range of component `a` is `[0, 500]`.
|
||||
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 45_000
|
||||
.saturating_add((15_904_000 as Weight).saturating_mul(c as Weight))
|
||||
// Standard Error: 45_000
|
||||
.saturating_add((18_803_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 450_000
|
||||
.saturating_add((17_017_000 as Weight).saturating_mul(a as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(a as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn mint() -> Weight {
|
||||
(29_616_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn burn() -> Weight {
|
||||
(33_496_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(46_790_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_keep_alive() -> Weight {
|
||||
(39_769_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn force_transfer() -> Weight {
|
||||
(47_200_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn freeze() -> Weight {
|
||||
(20_873_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn thaw() -> Weight {
|
||||
(21_228_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn freeze_asset() -> Weight {
|
||||
(17_685_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn thaw_asset() -> Weight {
|
||||
(17_542_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Metadata (r:1 w:0)
|
||||
fn transfer_ownership() -> Weight {
|
||||
(18_639_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn set_team() -> Weight {
|
||||
(17_135_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
/// The range of component `n` is `[0, 50]`.
|
||||
/// The range of component `s` is `[0, 50]`.
|
||||
fn set_metadata(n: u32, s: u32, ) -> Weight {
|
||||
(31_324_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((3_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
fn clear_metadata() -> Weight {
|
||||
(31_340_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
/// The range of component `n` is `[0, 50]`.
|
||||
/// The range of component `s` is `[0, 50]`.
|
||||
fn force_set_metadata(_n: u32, s: u32, ) -> Weight {
|
||||
(18_756_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
fn force_clear_metadata() -> Weight {
|
||||
(31_427_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn force_asset_status() -> Weight {
|
||||
(16_930_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
fn approve_transfer() -> Weight {
|
||||
(34_492_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_approved() -> Weight {
|
||||
(60_098_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
fn cancel_approval() -> Weight {
|
||||
(35_630_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
fn force_cancel_approval() -> Weight {
|
||||
(37_399_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_balances`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_balances
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_balances`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(41_006_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_keep_alive() -> Weight {
|
||||
(31_329_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn set_balance_creating() -> Weight {
|
||||
(21_075_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn set_balance_killing() -> Weight {
|
||||
(24_413_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
fn force_transfer() -> Weight {
|
||||
(41_434_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_all() -> Weight {
|
||||
(37_653_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn force_unreserve() -> Weight {
|
||||
(18_701_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_collator_selection`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_collator_selection
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_collator_selection`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Session NextKeys (r:1 w:0)
|
||||
// Storage: CollatorSelection Invulnerables (r:0 w:1)
|
||||
/// The range of component `b` is `[1, 100]`.
|
||||
fn set_invulnerables(b: u32, ) -> Weight {
|
||||
(8_587_000 as Weight)
|
||||
// Standard Error: 3_000
|
||||
.saturating_add((3_304_000 as Weight).saturating_mul(b as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection DesiredCandidates (r:0 w:1)
|
||||
fn set_desired_candidates() -> Weight {
|
||||
(9_027_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection CandidacyBond (r:0 w:1)
|
||||
fn set_candidacy_bond() -> Weight {
|
||||
(9_244_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection Candidates (r:1 w:1)
|
||||
// Storage: CollatorSelection DesiredCandidates (r:1 w:0)
|
||||
// Storage: CollatorSelection Invulnerables (r:1 w:0)
|
||||
// Storage: Session NextKeys (r:1 w:0)
|
||||
// Storage: CollatorSelection CandidacyBond (r:1 w:0)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
|
||||
/// The range of component `c` is `[1, 1000]`.
|
||||
fn register_as_candidate(c: u32, ) -> Weight {
|
||||
(60_984_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((89_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection Candidates (r:1 w:1)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
|
||||
/// The range of component `c` is `[6, 1000]`.
|
||||
fn leave_intent(c: u32, ) -> Weight {
|
||||
(49_046_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((118_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
// Storage: System BlockWeight (r:1 w:1)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
|
||||
fn note_author() -> Weight {
|
||||
(32_269_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection Candidates (r:1 w:1)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:1000 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
// Storage: CollatorSelection Invulnerables (r:1 w:0)
|
||||
// Storage: System BlockWeight (r:1 w:1)
|
||||
/// The range of component `r` is `[1, 1000]`.
|
||||
/// The range of component `c` is `[1, 1000]`.
|
||||
fn new_session(r: u32, c: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_992_000
|
||||
.saturating_add((10_521_000 as Weight).saturating_mul(r as Weight))
|
||||
// Standard Error: 1_992_000
|
||||
.saturating_add((53_162_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_multisig`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_multisig
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_multisig`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_threshold_1(z: u32, ) -> Weight {
|
||||
(17_175_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_create(s: u32, z: u32, ) -> Weight {
|
||||
(35_937_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((97_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_create_store(s: u32, z: u32, ) -> Weight {
|
||||
(37_468_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((89_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
/// The range of component `s` is `[3, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_approve(s: u32, z: u32, ) -> Weight {
|
||||
(25_557_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((83_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
/// The range of component `s` is `[3, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_approve_store(s: u32, z: u32, ) -> Weight {
|
||||
(38_127_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((88_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_complete(s: u32, z: u32, ) -> Weight {
|
||||
(47_383_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((127_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((3_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn approve_as_multi_create(s: u32, ) -> Weight {
|
||||
(33_472_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((102_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn approve_as_multi_approve(s: u32, ) -> Weight {
|
||||
(21_612_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((119_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn approve_as_multi_complete(s: u32, ) -> Weight {
|
||||
(68_168_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((157_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn cancel_as_multi(s: u32, ) -> Weight {
|
||||
(52_748_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((117_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_proxy`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_proxy
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_proxy`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Proxy Proxies (r:1 w:0)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn proxy(p: u32, ) -> Weight {
|
||||
(17_582_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((77_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:0)
|
||||
// Storage: Proxy Announcements (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `a` is `[0, 31]`.
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn proxy_announced(a: u32, p: u32, ) -> Weight {
|
||||
(34_603_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((169_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((87_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Proxy Announcements (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `a` is `[0, 31]`.
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn remove_announcement(a: u32, p: u32, ) -> Weight {
|
||||
(24_496_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((179_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((25_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Proxy Announcements (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `a` is `[0, 31]`.
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn reject_announcement(a: u32, p: u32, ) -> Weight {
|
||||
(24_237_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((181_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((29_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:0)
|
||||
// Storage: Proxy Announcements (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `a` is `[0, 31]`.
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn announce(a: u32, p: u32, ) -> Weight {
|
||||
(32_065_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((166_000 as Weight).saturating_mul(a as Weight))
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((91_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn add_proxy(p: u32, ) -> Weight {
|
||||
(27_168_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((117_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn remove_proxy(p: u32, ) -> Weight {
|
||||
(27_233_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((121_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn remove_proxies(p: u32, ) -> Weight {
|
||||
(23_010_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((95_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[1, 31]`.
|
||||
fn anonymous(p: u32, ) -> Weight {
|
||||
(30_378_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((16_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Proxy Proxies (r:1 w:1)
|
||||
/// The range of component `p` is `[0, 30]`.
|
||||
fn kill_anonymous(p: u32, ) -> Weight {
|
||||
(23_977_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((76_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_session`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_session
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_session`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Session NextKeys (r:1 w:1)
|
||||
// Storage: Session KeyOwner (r:1 w:1)
|
||||
fn set_keys() -> Weight {
|
||||
(16_170_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Session NextKeys (r:1 w:1)
|
||||
// Storage: Session KeyOwner (r:0 w:1)
|
||||
fn purge_keys() -> Weight {
|
||||
(13_246_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_timestamp`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_timestamp
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_timestamp`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_timestamp::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Timestamp Now (r:1 w:1)
|
||||
fn set() -> Weight {
|
||||
(6_737_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn on_finalize() -> Weight {
|
||||
(2_329_000 as Weight)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_uniques`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --pallet=pallet_uniques
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights/pallet_uniques.rs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_uniques`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_uniques::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn create() -> Weight {
|
||||
(27_424_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques NextCollectionId (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn force_create() -> Weight {
|
||||
(17_098_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques Asset (r:1 w:0)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
// Storage: Uniques Attribute (r:0 w:1000)
|
||||
// Storage: Uniques ClassMetadataOf (r:0 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:0 w:1000)
|
||||
// Storage: Uniques CollectionMaxSupply (r:0 w:1)
|
||||
// Storage: Uniques Account (r:0 w:20)
|
||||
/// The range of component `n` is `[0, 1000]`.
|
||||
/// The range of component `m` is `[0, 1000]`.
|
||||
/// The range of component `a` is `[0, 1000]`.
|
||||
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 18_000
|
||||
.saturating_add((10_919_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 18_000
|
||||
.saturating_add((1_679_000 as Weight).saturating_mul(m as Weight))
|
||||
// Standard Error: 18_000
|
||||
.saturating_add((1_463_000 as Weight).saturating_mul(a as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(m as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques CollectionMaxSupply (r:1 w:0)
|
||||
// Storage: Uniques Account (r:0 w:1)
|
||||
fn mint() -> Weight {
|
||||
(36_329_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Account (r:0 w:1)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn burn() -> Weight {
|
||||
(36_746_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Account (r:0 w:2)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(28_916_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques Asset (r:100 w:100)
|
||||
/// The range of component `i` is `[0, 5000]`.
|
||||
fn redeposit(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 15_000
|
||||
.saturating_add((12_745_000 as Weight).saturating_mul(i as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
fn freeze() -> Weight {
|
||||
(21_813_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
fn thaw() -> Weight {
|
||||
(22_088_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
fn freeze_collection() -> Weight {
|
||||
(17_184_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
fn thaw_collection() -> Weight {
|
||||
(17_311_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:2)
|
||||
fn transfer_ownership() -> Weight {
|
||||
(25_174_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
fn set_team() -> Weight {
|
||||
(17_879_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassAccount (r:0 w:1)
|
||||
fn force_item_status() -> Weight {
|
||||
(20_491_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
|
||||
// Storage: Uniques Attribute (r:1 w:1)
|
||||
fn set_attribute() -> Weight {
|
||||
(42_444_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:0)
|
||||
// Storage: Uniques Attribute (r:1 w:1)
|
||||
fn clear_attribute() -> Weight {
|
||||
(41_217_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
|
||||
fn set_metadata() -> Weight {
|
||||
(34_559_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques InstanceMetadataOf (r:1 w:1)
|
||||
fn clear_metadata() -> Weight {
|
||||
(34_863_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:1)
|
||||
// Storage: Uniques ClassMetadataOf (r:1 w:1)
|
||||
fn set_collection_metadata() -> Weight {
|
||||
(33_199_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Done by hand to satisfy master branch
|
||||
// This will be regenerated for the next release
|
||||
fn try_increment_id() -> Weight {
|
||||
(20_000_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques ClassMetadataOf (r:1 w:1)
|
||||
fn clear_collection_metadata() -> Weight {
|
||||
(31_472_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
fn approve_transfer() -> Weight {
|
||||
(23_618_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
fn cancel_approval() -> Weight {
|
||||
(23_507_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques OwnershipAcceptance (r:1 w:1)
|
||||
fn set_accept_ownership() -> Weight {
|
||||
(21_120_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques CollectionMaxSupply (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
fn set_collection_max_supply() -> Weight {
|
||||
(20_664_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:0)
|
||||
// Storage: Uniques ItemPriceOf (r:0 w:1)
|
||||
fn set_price() -> Weight {
|
||||
(19_938_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Uniques Asset (r:1 w:1)
|
||||
// Storage: Uniques ItemPriceOf (r:1 w:1)
|
||||
// Storage: Uniques Class (r:1 w:0)
|
||||
// Storage: Uniques Account (r:0 w:2)
|
||||
fn buy_item() -> Weight {
|
||||
(39_254_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_utility`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=statemint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_utility
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/statemint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_utility`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_utility::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn batch(c: u32, ) -> Weight {
|
||||
(30_959_000 as Weight)
|
||||
// Standard Error: 6_000
|
||||
.saturating_add((3_220_000 as Weight).saturating_mul(c as Weight))
|
||||
}
|
||||
fn as_derivative() -> Weight {
|
||||
(4_732_000 as Weight)
|
||||
}
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn batch_all(c: u32, ) -> Weight {
|
||||
(16_465_000 as Weight)
|
||||
// Standard Error: 2_000
|
||||
.saturating_add((3_364_000 as Weight).saturating_mul(c as Weight))
|
||||
}
|
||||
fn dispatch_as() -> Weight {
|
||||
(11_903_000 as Weight)
|
||||
}
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn force_batch(c: u32, ) -> Weight {
|
||||
(22_621_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((3_147_000 as Weight).saturating_mul(c as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, RuntimeDbWeight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
||||
/// are available for brave runtime engineers who may want to try this out as default.
|
||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 8_000 * constants::WEIGHT_PER_NANOS,
|
||||
write: 50_000 * constants::WEIGHT_PER_NANOS,
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_db_weights {
|
||||
use super::constants::ParityDbWeight as W;
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that all weights exist and have sane values.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
// At least 1 µs.
|
||||
assert!(
|
||||
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||
"Read weight should be at least 1 µs."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||
"Write weight should be at least 1 µs."
|
||||
);
|
||||
// At most 1 ms.
|
||||
assert!(
|
||||
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||
"Read weight should be at most 1 ms."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||
"Write weight should be at most 1 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, RuntimeDbWeight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||
/// the runtime.
|
||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 25_000 * constants::WEIGHT_PER_NANOS,
|
||||
write: 100_000 * constants::WEIGHT_PER_NANOS,
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_db_weights {
|
||||
use super::constants::RocksDbWeight as W;
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that all weights exist and have sane values.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
// At least 1 µs.
|
||||
assert!(
|
||||
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||
"Read weight should be at least 1 µs."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||
"Write weight should be at least 1 µs."
|
||||
);
|
||||
// At most 1 ms.
|
||||
assert!(
|
||||
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||
"Read weight should be at most 1 ms."
|
||||
);
|
||||
assert!(
|
||||
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||
"Write weight should be at most 1 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use super::{
|
||||
AccountId, AssetId, Assets, Authorship, Balance, Balances, Call, Event, Origin, ParachainInfo,
|
||||
ParachainSystem, PolkadotXcm, Runtime, WeightToFee, XcmpQueue,
|
||||
};
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
traits::{ConstU32, Everything, Nothing, PalletInfoAccess},
|
||||
weights::Weight,
|
||||
};
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
use parachains_common::{
|
||||
impls::ToStakingPot,
|
||||
xcm_config::{DenyReserveTransferToRelayChain, DenyThenTry},
|
||||
};
|
||||
use polkadot_parachain::primitives::Sibling;
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
|
||||
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
|
||||
ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter,
|
||||
IsConcrete, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents,
|
||||
};
|
||||
use xcm_executor::{traits::JustTry, XcmExecutor};
|
||||
|
||||
parameter_types! {
|
||||
pub const DotLocation: MultiLocation = MultiLocation::parent();
|
||||
pub const RelayNetwork: NetworkId = NetworkId::Polkadot;
|
||||
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
pub const Local: MultiLocation = MultiLocation::here();
|
||||
pub AssetsPalletLocation: MultiLocation =
|
||||
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
|
||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||
}
|
||||
|
||||
/// Type for specifying how a `MultiLocation` 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.
|
||||
pub type LocationToAccountId = (
|
||||
// The parent (Relay-chain) origin converts to the parent `AccountId`.
|
||||
ParentIsPreset<AccountId>,
|
||||
// Sibling parachain origins convert to AccountId via the `ParaId::into`.
|
||||
SiblingParachainConvertsVia<Sibling, AccountId>,
|
||||
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
|
||||
AccountId32Aliases<RelayNetwork, AccountId>,
|
||||
);
|
||||
|
||||
/// Means for transacting the native currency on this chain.
|
||||
pub type CurrencyTransactor = CurrencyAdapter<
|
||||
// Use this currency:
|
||||
Balances,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
IsConcrete<DotLocation>,
|
||||
// Convert an XCM MultiLocation into a local account id:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We don't track any teleports of `Balances`.
|
||||
(),
|
||||
>;
|
||||
|
||||
/// Means for transacting assets besides the native currency on this chain.
|
||||
pub type FungiblesTransactor = FungiblesAdapter<
|
||||
// Use this fungibles implementation:
|
||||
Assets,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
ConvertedConcreteId<
|
||||
AssetId,
|
||||
Balance,
|
||||
AsPrefixedGeneralIndex<AssetsPalletLocation, AssetId, JustTry>,
|
||||
JustTry,
|
||||
>,
|
||||
// Convert an XCM MultiLocation into a local account id:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We only want to allow teleports of known assets. We use non-zero issuance as an indication
|
||||
// that this asset is known.
|
||||
parachains_common::impls::NonZeroIssuance<AccountId, Assets>,
|
||||
// The account to use for tracking teleports.
|
||||
CheckingAccount,
|
||||
>;
|
||||
/// Means for transacting assets on this chain.
|
||||
pub type AssetTransactors = (CurrencyTransactor, FungiblesTransactor);
|
||||
|
||||
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
|
||||
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
|
||||
/// biases the kind of local `Origin` it will become.
|
||||
pub type XcmOriginToTransactDispatchOrigin = (
|
||||
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
|
||||
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
|
||||
// foreign chains who want to have a local sovereign account on this chain which they control.
|
||||
SovereignSignedViaLocation<LocationToAccountId, Origin>,
|
||||
// Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when
|
||||
// recognised.
|
||||
RelayChainAsNative<RelayChainOrigin, Origin>,
|
||||
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
|
||||
// recognised.
|
||||
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
|
||||
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
|
||||
// transaction from the Root origin.
|
||||
ParentAsSuperuser<Origin>,
|
||||
// Native signed account converter; this just converts an `AccountId32` origin into a normal
|
||||
// `Origin::Signed` origin of the same 32-byte value.
|
||||
SignedAccountId32AsNative<RelayNetwork, Origin>,
|
||||
// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
|
||||
XcmPassthrough<Origin>,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
|
||||
pub UnitWeightCost: Weight = 1_000_000_000;
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
|
||||
}
|
||||
|
||||
match_types! {
|
||||
pub type ParentOrParentsExecutivePlurality: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: Here } |
|
||||
MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) }
|
||||
};
|
||||
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
|
||||
MultiLocation { parents: 1, interior: Here } |
|
||||
MultiLocation { parents: 1, interior: X1(_) }
|
||||
};
|
||||
}
|
||||
|
||||
pub type Barrier = DenyThenTry<
|
||||
DenyReserveTransferToRelayChain,
|
||||
(
|
||||
TakeWeightCredit,
|
||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||
// Parent and its exec plurality get free execution
|
||||
AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
|
||||
// Expected responses are OK.
|
||||
AllowKnownQueryResponses<PolkadotXcm>,
|
||||
// Subscriptions for version tracking are OK.
|
||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
||||
),
|
||||
>;
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl xcm_executor::Config for XcmConfig {
|
||||
type Call = Call;
|
||||
type XcmSender = XcmRouter;
|
||||
type AssetTransactor = AssetTransactors;
|
||||
type OriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||
// Statemint does not recognize a reserve location for any asset. This does not prevent
|
||||
// Statemint acting _as_ a reserve location for DOT and assets created under `pallet-assets`.
|
||||
// For DOT, users must use teleport where allowed (e.g. with the Relay Chain).
|
||||
type IsReserve = ();
|
||||
type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of DOT
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Barrier = Barrier;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type Trader =
|
||||
UsingComponents<WeightToFee, DotLocation, AccountId, Balances, ToStakingPot<Runtime>>;
|
||||
type ResponseHandler = PolkadotXcm;
|
||||
type AssetTrap = PolkadotXcm;
|
||||
type AssetClaims = PolkadotXcm;
|
||||
type SubscriptionService = PolkadotXcm;
|
||||
type PalletInstancesInfo = ();
|
||||
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
|
||||
type AssetLocker = ();
|
||||
type AssetExchanger = ();
|
||||
type FeeManager = ();
|
||||
type MessageExporter = ();
|
||||
type UniversalAliases = Nothing;
|
||||
}
|
||||
|
||||
/// Converts a local signed origin into an XCM multilocation.
|
||||
/// Forms the basis for local origins sending/executing XCMs.
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
|
||||
|
||||
/// The means for routing XCM messages which are not for local execution into the right message
|
||||
/// queues.
|
||||
pub type XcmRouter = (
|
||||
// Two routers - use UMP to communicate with the relay chain:
|
||||
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm, ()>,
|
||||
// ..and XCMP to communicate with the sibling chains.
|
||||
XcmpQueue,
|
||||
);
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type Event = Event;
|
||||
// We want to disallow users sending (arbitrary) XCMs from this chain.
|
||||
type SendXcmOrigin = EnsureXcmOrigin<Origin, ()>;
|
||||
type XcmRouter = XcmRouter;
|
||||
// We support local origins dispatching XCM executions in principle...
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
// ... but disallow generic XCM execution. As a result only teleports and reserve transfers are allowed.
|
||||
type XcmExecuteFilter = Nothing;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
type Currency = Balances;
|
||||
type CurrencyMatcher = ();
|
||||
type TrustedLockers = ();
|
||||
type SovereignAccountOf = LocationToAccountId;
|
||||
type MaxLockers = ConstU32<8>;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_xcm::Config for Runtime {
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
use asset_test_utils::{ExtBuilder, RuntimeHelper};
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, traits::PalletInfo, weights::WeightToFee as WeightToFeeT,
|
||||
};
|
||||
use parachains_common::{AccountId, StatemintAuraId as AuraId};
|
||||
pub use statemint_runtime::{
|
||||
constants::fee::WeightToFee, xcm_config::XcmConfig, Assets, Balances, ExistentialDeposit,
|
||||
Runtime, SessionKeys, System,
|
||||
};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_executor::traits::WeightTrader;
|
||||
pub const ALICE: [u8; 32] = [1u8; 32];
|
||||
|
||||
#[test]
|
||||
fn test_asset_xcm_trader_does_not_work_in_statemine() {
|
||||
ExtBuilder::<Runtime>::default()
|
||||
.with_collators(vec![AccountId::from(ALICE)])
|
||||
.with_session_keys(vec![(
|
||||
AccountId::from(ALICE),
|
||||
AccountId::from(ALICE),
|
||||
SessionKeys { aura: AuraId::from(sp_core::ed25519::Public::from_raw(ALICE)) },
|
||||
)])
|
||||
.build()
|
||||
.execute_with(|| {
|
||||
// We need root origin to create a sufficient asset
|
||||
// We set existential deposit to be identical to the one for Balances first
|
||||
assert_ok!(Assets::force_create(
|
||||
RuntimeHelper::<Runtime>::root_origin(),
|
||||
1,
|
||||
AccountId::from(ALICE).into(),
|
||||
true,
|
||||
ExistentialDeposit::get()
|
||||
));
|
||||
|
||||
let mut trader = <XcmConfig as xcm_executor::Config>::Trader::new();
|
||||
|
||||
// Set Alice as block author, who will receive fees
|
||||
RuntimeHelper::<Runtime>::run_to_block(2, Some(AccountId::from(ALICE)));
|
||||
|
||||
// We are going to buy 400e9 weight
|
||||
// Because of the ED being higher in statemine
|
||||
// and not to complicate things, we use a little
|
||||
// bit more of weight
|
||||
let bought = 400_000_000_000u64;
|
||||
|
||||
// lets calculate amount needed
|
||||
let amount_needed = WeightToFee::weight_to_fee(&bought);
|
||||
|
||||
let asset_multilocation = MultiLocation::new(
|
||||
0,
|
||||
X2(
|
||||
PalletInstance(
|
||||
<Runtime as frame_system::Config>::PalletInfo::index::<Assets>().unwrap()
|
||||
as u8,
|
||||
),
|
||||
GeneralIndex(1),
|
||||
),
|
||||
);
|
||||
|
||||
let asset: MultiAsset = (asset_multilocation, amount_needed).into();
|
||||
|
||||
// Buy weight should return an error, since asset trader not installed
|
||||
assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive);
|
||||
|
||||
// not credited since the ED is higher than this value
|
||||
assert_eq!(Assets::balance(1, AccountId::from(ALICE)), 0);
|
||||
|
||||
// We also need to ensure the total supply did not increase
|
||||
assert_eq!(Assets::total_supply(1), 0);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
[package]
|
||||
name = "asset-test-utils"
|
||||
version = "1.0.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Statemint parachain runtime"
|
||||
|
||||
[dependencies]
|
||||
|
||||
# Substrate
|
||||
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus
|
||||
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.4"
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"pallet-balances/std",
|
||||
"pallet-collator-selection/std",
|
||||
"pallet-session/std",
|
||||
"parachains-common/std",
|
||||
"sp-consensus-aura/std",
|
||||
"sp-io/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
]
|
||||
@@ -0,0 +1,134 @@
|
||||
use frame_support::traits::GenesisBuild;
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
use frame_support::traits::OriginTrait;
|
||||
use parachains_common::AccountId;
|
||||
use sp_consensus_aura::AURA_ENGINE_ID;
|
||||
use sp_core::Encode;
|
||||
use sp_runtime::{Digest, DigestItem};
|
||||
|
||||
pub type BalanceOf<Runtime> = <Runtime as pallet_balances::Config>::Balance;
|
||||
pub type AccountIdOf<Runtime> = <Runtime as frame_system::Config>::AccountId;
|
||||
pub type ValidatorIdOf<Runtime> = <Runtime as pallet_session::Config>::ValidatorId;
|
||||
pub type SessionKeysOf<Runtime> = <Runtime as pallet_session::Config>::Keys;
|
||||
|
||||
// Basic builder based on balances, collators and pallet_sessopm
|
||||
pub struct ExtBuilder<
|
||||
Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config,
|
||||
> {
|
||||
// endowed accounts with balances
|
||||
balances: Vec<(AccountIdOf<Runtime>, BalanceOf<Runtime>)>,
|
||||
// collators to test block prod
|
||||
collators: Vec<AccountIdOf<Runtime>>,
|
||||
// keys added to pallet session
|
||||
keys: Vec<(AccountIdOf<Runtime>, ValidatorIdOf<Runtime>, SessionKeysOf<Runtime>)>,
|
||||
_runtime: PhantomData<Runtime>,
|
||||
}
|
||||
|
||||
impl<Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config> Default
|
||||
for ExtBuilder<Runtime>
|
||||
{
|
||||
fn default() -> ExtBuilder<Runtime> {
|
||||
ExtBuilder { balances: vec![], collators: vec![], keys: vec![], _runtime: PhantomData }
|
||||
}
|
||||
}
|
||||
|
||||
impl<Runtime: frame_system::Config + pallet_balances::Config + pallet_session::Config>
|
||||
ExtBuilder<Runtime>
|
||||
{
|
||||
pub fn with_balances(
|
||||
mut self,
|
||||
balances: Vec<(AccountIdOf<Runtime>, BalanceOf<Runtime>)>,
|
||||
) -> Self {
|
||||
self.balances = balances;
|
||||
self
|
||||
}
|
||||
pub fn with_collators(mut self, collators: Vec<AccountIdOf<Runtime>>) -> Self {
|
||||
self.collators = collators;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_session_keys(
|
||||
mut self,
|
||||
keys: Vec<(AccountIdOf<Runtime>, ValidatorIdOf<Runtime>, SessionKeysOf<Runtime>)>,
|
||||
) -> Self {
|
||||
self.keys = keys;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(self) -> sp_io::TestExternalities
|
||||
where
|
||||
Runtime:
|
||||
pallet_collator_selection::Config + pallet_balances::Config + pallet_session::Config,
|
||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
||||
{
|
||||
let mut t = frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
|
||||
|
||||
pallet_balances::GenesisConfig::<Runtime> { balances: self.balances.into() }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
pallet_collator_selection::GenesisConfig::<Runtime> {
|
||||
invulnerables: self.collators.clone().into(),
|
||||
candidacy_bond: Default::default(),
|
||||
desired_candidates: Default::default(),
|
||||
}
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
pallet_session::GenesisConfig::<Runtime> { keys: self.keys }
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
|
||||
ext.execute_with(|| {
|
||||
frame_system::Pallet::<Runtime>::set_block_number(1u32.into());
|
||||
});
|
||||
|
||||
ext
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RuntimeHelper<Runtime>(PhantomData<Runtime>);
|
||||
/// Utility function that advances the chain to the desired block number.
|
||||
/// If an author is provided, that author information is injected to all the blocks in the meantime.
|
||||
impl<Runtime: frame_system::Config> RuntimeHelper<Runtime>
|
||||
where
|
||||
AccountIdOf<Runtime>:
|
||||
Into<<<Runtime as frame_system::Config>::Origin as OriginTrait>::AccountId>,
|
||||
{
|
||||
pub fn run_to_block(n: u32, author: Option<AccountId>) {
|
||||
while frame_system::Pallet::<Runtime>::block_number() < n.into() {
|
||||
// Set the new block number and author
|
||||
match author {
|
||||
Some(ref author) => {
|
||||
let pre_digest = Digest {
|
||||
logs: vec![DigestItem::PreRuntime(AURA_ENGINE_ID, author.encode())],
|
||||
};
|
||||
frame_system::Pallet::<Runtime>::reset_events();
|
||||
frame_system::Pallet::<Runtime>::initialize(
|
||||
&(frame_system::Pallet::<Runtime>::block_number() + 1u32.into()),
|
||||
&frame_system::Pallet::<Runtime>::parent_hash(),
|
||||
&pre_digest,
|
||||
);
|
||||
},
|
||||
None => {
|
||||
frame_system::Pallet::<Runtime>::set_block_number(
|
||||
frame_system::Pallet::<Runtime>::block_number() + 1u32.into(),
|
||||
);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn root_origin() -> <Runtime as frame_system::Config>::Origin {
|
||||
<Runtime as frame_system::Config>::Origin::root()
|
||||
}
|
||||
|
||||
pub fn origin_of(
|
||||
account_id: AccountIdOf<Runtime>,
|
||||
) -> <Runtime as frame_system::Config>::Origin {
|
||||
<Runtime as frame_system::Config>::Origin::signed(account_id.into())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
[package]
|
||||
name = "westmint-runtime"
|
||||
version = "1.0.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
description = "Westend variant of Statemint parachain runtime"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] }
|
||||
hex-literal = { version = "0.3.4", optional = true }
|
||||
log = { version = "0.4.17", default-features = false }
|
||||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.143", optional = true, features = ["derive"] }
|
||||
smallvec = "1.9.0"
|
||||
|
||||
# Substrate
|
||||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
|
||||
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" }
|
||||
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-uniques = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
pallet-utility = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Polkadot
|
||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
westend-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus
|
||||
cumulus-pallet-aura-ext = { path = "../../../../pallets/aura-ext", default-features = false }
|
||||
cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-features = false }
|
||||
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false }
|
||||
cumulus-pallet-session-benchmarking = {path = "../../../../pallets/session-benchmarking", default-features = false, version = "3.0.0"}
|
||||
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
|
||||
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false }
|
||||
cumulus-ping = { path = "../../../pallets/ping", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
|
||||
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
|
||||
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
|
||||
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
|
||||
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
hex-literal = "0.3.4"
|
||||
asset-test-utils = { path = "../test-utils"}
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
runtime-benchmarks = [
|
||||
"hex-literal",
|
||||
"frame-benchmarking/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system-benchmarking",
|
||||
"frame-system/runtime-benchmarks",
|
||||
"pallet-assets/runtime-benchmarks",
|
||||
"pallet-balances/runtime-benchmarks",
|
||||
"pallet-multisig/runtime-benchmarks",
|
||||
"pallet-proxy/runtime-benchmarks",
|
||||
"pallet-timestamp/runtime-benchmarks",
|
||||
"pallet-uniques/runtime-benchmarks",
|
||||
"pallet-utility/runtime-benchmarks",
|
||||
"pallet-xcm/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||
"pallet-collator-selection/runtime-benchmarks",
|
||||
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-executive/try-runtime",
|
||||
"frame-try-runtime",
|
||||
]
|
||||
std = [
|
||||
"codec/std",
|
||||
"log/std",
|
||||
"scale-info/std",
|
||||
"serde",
|
||||
"frame-executive/std",
|
||||
"frame-support/std",
|
||||
"frame-system-rpc-runtime-api/std",
|
||||
"frame-system/std",
|
||||
"pallet-asset-tx-payment/std",
|
||||
"pallet-assets/std",
|
||||
"pallet-aura/std",
|
||||
"pallet-authorship/std",
|
||||
"pallet-balances/std",
|
||||
"pallet-multisig/std",
|
||||
"pallet-proxy/std",
|
||||
"pallet-session/std",
|
||||
"pallet-timestamp/std",
|
||||
"pallet-transaction-payment-rpc-runtime-api/std",
|
||||
"pallet-transaction-payment/std",
|
||||
"pallet-uniques/std",
|
||||
"pallet-utility/std",
|
||||
"pallet-xcm/std",
|
||||
"polkadot-core-primitives/std",
|
||||
"polkadot-parachain/std",
|
||||
"polkadot-runtime-common/std",
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-consensus-aura/std",
|
||||
"sp-core/std",
|
||||
"sp-inherents/std",
|
||||
"sp-io/std",
|
||||
"sp-offchain/std",
|
||||
"sp-runtime/std",
|
||||
"sp-session/std",
|
||||
"sp-std/std",
|
||||
"sp-transaction-pool/std",
|
||||
"sp-version/std",
|
||||
"westend-runtime-constants/std",
|
||||
"xcm-builder/std",
|
||||
"xcm-executor/std",
|
||||
"xcm/std",
|
||||
"cumulus-pallet-aura-ext/std",
|
||||
"cumulus-pallet-dmp-queue/std",
|
||||
"cumulus-pallet-parachain-system/std",
|
||||
"cumulus-pallet-xcm/std",
|
||||
"cumulus-pallet-xcmp-queue/std",
|
||||
"cumulus-ping/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"cumulus-primitives-timestamp/std",
|
||||
"cumulus-primitives-utility/std",
|
||||
"pallet-collator-selection/std",
|
||||
"parachain-info/std",
|
||||
"parachains-common/std",
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
use substrate_wasm_builder::WasmBuilder;
|
||||
|
||||
fn main() {
|
||||
WasmBuilder::new()
|
||||
.with_current_project()
|
||||
.export_heap_base()
|
||||
.import_memory()
|
||||
.build()
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright (C) 2021 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod currency {
|
||||
use polkadot_core_primitives::Balance;
|
||||
use westend_runtime_constants as constants;
|
||||
|
||||
/// The existential deposit. Set to 1/10 of its parent Relay Chain.
|
||||
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
|
||||
|
||||
pub const UNITS: Balance = constants::currency::UNITS;
|
||||
pub const CENTS: Balance = constants::currency::CENTS;
|
||||
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
|
||||
pub const GRAND: Balance = constants::currency::GRAND;
|
||||
|
||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||
// 1/100 of Westend testnet
|
||||
constants::currency::deposit(items, bytes) / 100
|
||||
}
|
||||
}
|
||||
|
||||
/// Fee-related.
|
||||
pub mod fee {
|
||||
use frame_support::weights::{
|
||||
constants::ExtrinsicBaseWeight, WeightToFeeCoefficient, WeightToFeeCoefficients,
|
||||
WeightToFeePolynomial,
|
||||
};
|
||||
use polkadot_core_primitives::Balance;
|
||||
use smallvec::smallvec;
|
||||
pub use sp_runtime::Perbill;
|
||||
|
||||
/// The block saturation level. Fees will be updates based on this value.
|
||||
pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);
|
||||
|
||||
/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
|
||||
/// node's balance type.
|
||||
///
|
||||
/// This should typically create a mapping between the following ranges:
|
||||
/// - [0, MAXIMUM_BLOCK_WEIGHT]
|
||||
/// - [Balance::min, Balance::max]
|
||||
///
|
||||
/// Yet, it can be used for any other sort of change to weight-fee. Some examples being:
|
||||
/// - Setting it to `0` will essentially disable the weight fee.
|
||||
/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged.
|
||||
pub struct WeightToFee;
|
||||
impl WeightToFeePolynomial for WeightToFee {
|
||||
type Balance = Balance;
|
||||
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
|
||||
// in Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
|
||||
// in Statemint, we map to 1/10 of that, or 1/100 CENT
|
||||
let p = super::currency::CENTS;
|
||||
let q = 100 * Balance::from(ExtrinsicBaseWeight::get());
|
||||
smallvec![WeightToFeeCoefficient {
|
||||
degree: 1,
|
||||
negative: false,
|
||||
coeff_frac: Perbill::from_rational(p % q, q),
|
||||
coeff_integer: p / q,
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,834 @@
|
||||
// Copyright (C) 2021-2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! # Westmint Runtime
|
||||
//!
|
||||
//! Westmint is the testnet for Statemint.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
// Make the WASM binary available.
|
||||
#[cfg(feature = "std")]
|
||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
|
||||
pub mod constants;
|
||||
mod weights;
|
||||
pub mod xcm_config;
|
||||
|
||||
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
|
||||
use sp_api::impl_runtime_apis;
|
||||
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic, impl_opaque_keys,
|
||||
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto},
|
||||
transaction_validity::{TransactionSource, TransactionValidity},
|
||||
ApplyExtrinsicResult,
|
||||
};
|
||||
|
||||
use sp_std::prelude::*;
|
||||
#[cfg(feature = "std")]
|
||||
use sp_version::NativeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use constants::{currency::*, fee::WeightToFee};
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{AsEnsureOriginWithArg, InstanceFilter},
|
||||
weights::{ConstantMultiplier, DispatchClass, Weight},
|
||||
PalletId, RuntimeDebug,
|
||||
};
|
||||
use frame_system::{
|
||||
limits::{BlockLength, BlockWeights},
|
||||
EnsureRoot, EnsureSigned,
|
||||
};
|
||||
pub use parachains_common as common;
|
||||
use parachains_common::{
|
||||
impls::{AssetsToBlockAuthor, DealWithFees},
|
||||
opaque, AccountId, AssetId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
||||
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||
};
|
||||
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sp_runtime::BuildStorage;
|
||||
|
||||
// Polkadot imports
|
||||
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||
use xcm_executor::XcmExecutor;
|
||||
|
||||
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||
|
||||
impl_opaque_keys! {
|
||||
pub struct SessionKeys {
|
||||
pub aura: Aura,
|
||||
}
|
||||
}
|
||||
|
||||
#[sp_version::runtime_version]
|
||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("westmint"),
|
||||
impl_name: create_runtime_str!("westmint"),
|
||||
authoring_version: 1,
|
||||
spec_version: 9230,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
transaction_version: 7,
|
||||
state_version: 0,
|
||||
};
|
||||
|
||||
/// The version information used to identify this runtime when compiled natively.
|
||||
#[cfg(feature = "std")]
|
||||
pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub RuntimeBlockLength: BlockLength =
|
||||
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
|
||||
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
|
||||
.base_block(BlockExecutionWeight::get())
|
||||
.for_class(DispatchClass::all(), |weights| {
|
||||
weights.base_extrinsic = ExtrinsicBaseWeight::get();
|
||||
})
|
||||
.for_class(DispatchClass::Normal, |weights| {
|
||||
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
|
||||
})
|
||||
.for_class(DispatchClass::Operational, |weights| {
|
||||
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
|
||||
// Operational transactions have some extra reserved space, so that they
|
||||
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
|
||||
weights.reserved = Some(
|
||||
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
|
||||
);
|
||||
})
|
||||
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
|
||||
.build_or_panic();
|
||||
pub const SS58Prefix: u8 = 42;
|
||||
}
|
||||
|
||||
// Configure FRAME pallets to include in runtime.
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type BlockWeights = RuntimeBlockWeights;
|
||||
type BlockLength = RuntimeBlockLength;
|
||||
type AccountId = AccountId;
|
||||
type Call = Call;
|
||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||
type Index = Index;
|
||||
type BlockNumber = BlockNumber;
|
||||
type Hash = Hash;
|
||||
type Hashing = BlakeTwo256;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type Origin = Origin;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type DbWeight = RocksDbWeight;
|
||||
type Version = Version;
|
||||
type PalletInfo = PalletInfo;
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type AccountData = pallet_balances::AccountData<Balance>;
|
||||
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
|
||||
type SS58Prefix = SS58Prefix;
|
||||
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||
}
|
||||
|
||||
impl pallet_timestamp::Config for Runtime {
|
||||
/// A timestamp: milliseconds since the unix epoch.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = ();
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const UncleGenerations: u32 = 0;
|
||||
}
|
||||
|
||||
impl pallet_authorship::Config for Runtime {
|
||||
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
|
||||
type UncleGenerations = UncleGenerations;
|
||||
type FilterUncle = ();
|
||||
type EventHandler = (CollatorSelection,);
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
pub const MaxLocks: u32 = 50;
|
||||
pub const MaxReserves: u32 = 50;
|
||||
}
|
||||
|
||||
impl pallet_balances::Config for Runtime {
|
||||
type MaxLocks = MaxLocks;
|
||||
/// The type for recording an account's balance.
|
||||
type Balance = Balance;
|
||||
/// The ubiquitous event type.
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
/// Relay Chain `TransactionByteFee` / 10
|
||||
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
|
||||
pub const OperationalFeeMultiplier: u8 = 5;
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnChargeTransaction =
|
||||
pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees<Runtime>>;
|
||||
type WeightToFee = WeightToFee;
|
||||
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
|
||||
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
|
||||
type OperationalFeeMultiplier = OperationalFeeMultiplier;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const AssetDeposit: Balance = UNITS / 10; // 1 / 10 WND deposit to create asset
|
||||
pub const AssetAccountDeposit: Balance = deposit(1, 16);
|
||||
pub const ApprovalDeposit: Balance = EXISTENTIAL_DEPOSIT;
|
||||
pub const AssetsStringLimit: u32 = 50;
|
||||
/// Key = 32 bytes, Value = 36 bytes (32+1+1+1+1)
|
||||
// https://github.com/paritytech/substrate/blob/069917b/frame/assets/src/lib.rs#L257L271
|
||||
pub const MetadataDepositBase: Balance = deposit(1, 68);
|
||||
pub const MetadataDepositPerByte: Balance = deposit(0, 1);
|
||||
}
|
||||
|
||||
pub type AssetsForceOrigin = EnsureRoot<AccountId>;
|
||||
|
||||
impl pallet_assets::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Balance = Balance;
|
||||
type AssetId = AssetId;
|
||||
type Currency = Balances;
|
||||
type ForceOrigin = AssetsForceOrigin;
|
||||
type AssetDeposit = AssetDeposit;
|
||||
type MetadataDepositBase = MetadataDepositBase;
|
||||
type MetadataDepositPerByte = MetadataDepositPerByte;
|
||||
type ApprovalDeposit = ApprovalDeposit;
|
||||
type StringLimit = AssetsStringLimit;
|
||||
type Freezer = ();
|
||||
type Extra = ();
|
||||
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
|
||||
type AssetAccountDeposit = AssetAccountDeposit;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
|
||||
pub const DepositBase: Balance = deposit(1, 88);
|
||||
// Additional storage item size of 32 bytes.
|
||||
pub const DepositFactor: Balance = deposit(0, 32);
|
||||
pub const MaxSignatories: u16 = 100;
|
||||
}
|
||||
|
||||
impl pallet_multisig::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type Currency = Balances;
|
||||
type DepositBase = DepositBase;
|
||||
type DepositFactor = DepositFactor;
|
||||
type MaxSignatories = MaxSignatories;
|
||||
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_utility::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type PalletsOrigin = OriginCaller;
|
||||
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One storage item; key size 32, value size 8; .
|
||||
pub const ProxyDepositBase: Balance = deposit(1, 40);
|
||||
// Additional storage item size of 33 bytes.
|
||||
pub const ProxyDepositFactor: Balance = deposit(0, 33);
|
||||
pub const MaxProxies: u16 = 32;
|
||||
// One storage item; key size 32, value size 16
|
||||
pub const AnnouncementDepositBase: Balance = deposit(1, 48);
|
||||
pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
|
||||
pub const MaxPending: u16 = 32;
|
||||
}
|
||||
|
||||
/// The type used to represent the kinds of proxying allowed.
|
||||
#[derive(
|
||||
Copy,
|
||||
Clone,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Ord,
|
||||
PartialOrd,
|
||||
Encode,
|
||||
Decode,
|
||||
RuntimeDebug,
|
||||
MaxEncodedLen,
|
||||
scale_info::TypeInfo,
|
||||
)]
|
||||
pub enum ProxyType {
|
||||
/// Fully permissioned proxy. Can execute any call on behalf of _proxied_.
|
||||
Any,
|
||||
/// Can execute any call that does not transfer funds or assets.
|
||||
NonTransfer,
|
||||
/// Proxy with the ability to reject time-delay proxy announcements.
|
||||
CancelProxy,
|
||||
/// Assets proxy. Can execute any call from `assets`, **including asset transfers**.
|
||||
Assets,
|
||||
/// Owner proxy. Can execute calls related to asset ownership.
|
||||
AssetOwner,
|
||||
/// Asset manager. Can execute calls related to asset management.
|
||||
AssetManager,
|
||||
/// Collator selection proxy. Can execute calls related to collator selection mechanism.
|
||||
Collator,
|
||||
}
|
||||
impl Default for ProxyType {
|
||||
fn default() -> Self {
|
||||
Self::Any
|
||||
}
|
||||
}
|
||||
impl InstanceFilter<Call> for ProxyType {
|
||||
fn filter(&self, c: &Call) -> bool {
|
||||
match self {
|
||||
ProxyType::Any => true,
|
||||
ProxyType::NonTransfer =>
|
||||
!matches!(c, Call::Balances { .. } | Call::Assets { .. } | Call::Uniques { .. }),
|
||||
ProxyType::CancelProxy => matches!(
|
||||
c,
|
||||
Call::Proxy(pallet_proxy::Call::reject_announcement { .. }) |
|
||||
Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
ProxyType::Assets => {
|
||||
matches!(
|
||||
c,
|
||||
Call::Assets { .. } |
|
||||
Call::Utility { .. } | Call::Multisig { .. } |
|
||||
Call::Uniques { .. }
|
||||
)
|
||||
},
|
||||
ProxyType::AssetOwner => matches!(
|
||||
c,
|
||||
Call::Assets(pallet_assets::Call::create { .. }) |
|
||||
Call::Assets(pallet_assets::Call::destroy { .. }) |
|
||||
Call::Assets(pallet_assets::Call::transfer_ownership { .. }) |
|
||||
Call::Assets(pallet_assets::Call::set_team { .. }) |
|
||||
Call::Assets(pallet_assets::Call::set_metadata { .. }) |
|
||||
Call::Assets(pallet_assets::Call::clear_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::create { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::destroy { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::transfer_ownership { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_team { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_attribute { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_collection_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::clear_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::clear_attribute { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::clear_collection_metadata { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::set_collection_max_supply { .. }) |
|
||||
Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
ProxyType::AssetManager => matches!(
|
||||
c,
|
||||
Call::Assets(pallet_assets::Call::mint { .. }) |
|
||||
Call::Assets(pallet_assets::Call::burn { .. }) |
|
||||
Call::Assets(pallet_assets::Call::freeze { .. }) |
|
||||
Call::Assets(pallet_assets::Call::thaw { .. }) |
|
||||
Call::Assets(pallet_assets::Call::freeze_asset { .. }) |
|
||||
Call::Assets(pallet_assets::Call::thaw_asset { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::mint { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::burn { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::freeze { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::thaw { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::freeze_collection { .. }) |
|
||||
Call::Uniques(pallet_uniques::Call::thaw_collection { .. }) |
|
||||
Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
ProxyType::Collator => matches!(
|
||||
c,
|
||||
Call::CollatorSelection { .. } | Call::Utility { .. } | Call::Multisig { .. }
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
fn is_superset(&self, o: &Self) -> bool {
|
||||
match (self, o) {
|
||||
(x, y) if x == y => true,
|
||||
(ProxyType::Any, _) => true,
|
||||
(_, ProxyType::Any) => false,
|
||||
(ProxyType::Assets, ProxyType::AssetOwner) => true,
|
||||
(ProxyType::Assets, ProxyType::AssetManager) => true,
|
||||
(ProxyType::NonTransfer, ProxyType::Collator) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_proxy::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type Currency = Balances;
|
||||
type ProxyType = ProxyType;
|
||||
type ProxyDepositBase = ProxyDepositBase;
|
||||
type ProxyDepositFactor = ProxyDepositFactor;
|
||||
type MaxProxies = MaxProxies;
|
||||
type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
|
||||
type MaxPending = MaxPending;
|
||||
type CallHasher = BlakeTwo256;
|
||||
type AnnouncementDepositBase = AnnouncementDepositBase;
|
||||
type AnnouncementDepositFactor = AnnouncementDepositFactor;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
|
||||
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type Event = Event;
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type OutboundXcmpMessageSource = XcmpQueue;
|
||||
type DmpMessageHandler = DmpQueue;
|
||||
type ReservedDmpWeight = ReservedDmpWeight;
|
||||
type XcmpMessageHandler = XcmpQueue;
|
||||
type ReservedXcmpWeight = ReservedXcmpWeight;
|
||||
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases;
|
||||
}
|
||||
|
||||
impl parachain_info::Config for Runtime {}
|
||||
|
||||
impl cumulus_pallet_aura_ext::Config for Runtime {}
|
||||
|
||||
impl cumulus_pallet_xcmp_queue::Config for Runtime {
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type ChannelInfo = ParachainSystem;
|
||||
type VersionWrapper = PolkadotXcm;
|
||||
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
||||
type ControllerOrigin = EnsureRoot<AccountId>;
|
||||
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
|
||||
type PriceForSiblingDelivery = ();
|
||||
}
|
||||
|
||||
impl cumulus_pallet_dmp_queue::Config for Runtime {
|
||||
type Event = Event;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Period: u32 = 6 * HOURS;
|
||||
pub const Offset: u32 = 0;
|
||||
pub const MaxAuthorities: u32 = 100_000;
|
||||
}
|
||||
|
||||
impl pallet_session::Config for Runtime {
|
||||
type Event = Event;
|
||||
type ValidatorId = <Self as frame_system::Config>::AccountId;
|
||||
// we don't have stash and controller, thus we don't need the convert as well.
|
||||
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
|
||||
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type SessionManager = CollatorSelection;
|
||||
// Essentially just Aura, but lets be pedantic.
|
||||
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
|
||||
type Keys = SessionKeys;
|
||||
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_aura::Config for Runtime {
|
||||
type AuthorityId = AuraId;
|
||||
type DisabledValidators = ();
|
||||
type MaxAuthorities = MaxAuthorities;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const PotId: PalletId = PalletId(*b"PotStake");
|
||||
pub const MaxCandidates: u32 = 1000;
|
||||
pub const MinCandidates: u32 = 1;
|
||||
pub const SessionLength: BlockNumber = 6 * HOURS;
|
||||
pub const MaxInvulnerables: u32 = 100;
|
||||
}
|
||||
|
||||
pub type CollatorSelectionUpdateOrigin = EnsureRoot<AccountId>;
|
||||
|
||||
impl pallet_collator_selection::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type UpdateOrigin = CollatorSelectionUpdateOrigin;
|
||||
type PotId = PotId;
|
||||
type MaxCandidates = MaxCandidates;
|
||||
type MinCandidates = MinCandidates;
|
||||
type MaxInvulnerables = MaxInvulnerables;
|
||||
// should be a multiple of session or things will get inconsistent
|
||||
type KickThreshold = Period;
|
||||
type ValidatorId = <Self as frame_system::Config>::AccountId;
|
||||
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
|
||||
type ValidatorRegistration = Session;
|
||||
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl pallet_asset_tx_payment::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Fungibles = Assets;
|
||||
type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter<
|
||||
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
|
||||
AssetsToBlockAuthor<Runtime>,
|
||||
>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const CollectionDeposit: Balance = UNITS / 10; // 1 / 10 UNIT deposit to create asset class
|
||||
pub const ItemDeposit: Balance = UNITS / 1_000; // 1 / 1000 UNIT deposit to create asset instance
|
||||
pub const KeyLimit: u32 = 32; // Max 32 bytes per key
|
||||
pub const ValueLimit: u32 = 64; // Max 64 bytes per value
|
||||
pub const UniquesMetadataDepositBase: Balance = deposit(1, 129);
|
||||
pub const AttributeDepositBase: Balance = deposit(1, 0);
|
||||
pub const DepositPerByte: Balance = deposit(0, 1);
|
||||
pub const UniquesStringLimit: u32 = 128;
|
||||
}
|
||||
|
||||
impl pallet_uniques::Config for Runtime {
|
||||
type Event = Event;
|
||||
type CollectionId = u32;
|
||||
type ItemId = u32;
|
||||
type Currency = Balances;
|
||||
type ForceOrigin = AssetsForceOrigin;
|
||||
type CollectionDeposit = CollectionDeposit;
|
||||
type ItemDeposit = ItemDeposit;
|
||||
type MetadataDepositBase = UniquesMetadataDepositBase;
|
||||
type AttributeDepositBase = AttributeDepositBase;
|
||||
type DepositPerByte = DepositPerByte;
|
||||
type StringLimit = UniquesStringLimit;
|
||||
type KeyLimit = KeyLimit;
|
||||
type ValueLimit = ValueLimit;
|
||||
type WeightInfo = weights::pallet_uniques::WeightInfo<Runtime>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type Helper = ();
|
||||
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
|
||||
type Locker = ();
|
||||
}
|
||||
|
||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||
construct_runtime!(
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = opaque::Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
// System support stuff.
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{
|
||||
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
|
||||
} = 1,
|
||||
// RandomnessCollectiveFlip = 2 removed
|
||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4,
|
||||
|
||||
// Monetary stuff.
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 10,
|
||||
TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event<T>} = 11,
|
||||
AssetTxPayment: pallet_asset_tx_payment::{Pallet, Event<T>} = 12,
|
||||
|
||||
// Collator support. the order of these 5 are important and shall not change.
|
||||
Authorship: pallet_authorship::{Pallet, Call, Storage} = 20,
|
||||
CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event<T>, Config<T>} = 21,
|
||||
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 22,
|
||||
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 23,
|
||||
AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24,
|
||||
|
||||
// XCM helpers.
|
||||
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 30,
|
||||
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 31,
|
||||
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 32,
|
||||
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 33,
|
||||
|
||||
// Handy utilities.
|
||||
Utility: pallet_utility::{Pallet, Call, Event} = 40,
|
||||
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 41,
|
||||
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 42,
|
||||
|
||||
// The main stage.
|
||||
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>} = 50,
|
||||
Uniques: pallet_uniques::{Pallet, Call, Storage, Event<T>} = 51,
|
||||
}
|
||||
);
|
||||
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block type as expected by this runtime.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
/// A Block signed with a Justification
|
||||
pub type SignedBlock = generic::SignedBlock<Block>;
|
||||
/// BlockId type as expected by this runtime.
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
/// The SignedExtension to the basic transaction logic.
|
||||
pub type SignedExtra = (
|
||||
frame_system::CheckNonZeroSender<Runtime>,
|
||||
frame_system::CheckSpecVersion<Runtime>,
|
||||
frame_system::CheckTxVersion<Runtime>,
|
||||
frame_system::CheckGenesis<Runtime>,
|
||||
frame_system::CheckEra<Runtime>,
|
||||
frame_system::CheckNonce<Runtime>,
|
||||
frame_system::CheckWeight<Runtime>,
|
||||
pallet_asset_tx_payment::ChargeAssetTxPayment<Runtime>,
|
||||
);
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
|
||||
/// Extrinsic type that has already been checked.
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = frame_executive::Executive<
|
||||
Runtime,
|
||||
Block,
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPalletsWithSystem,
|
||||
(),
|
||||
>;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
#[macro_use]
|
||||
extern crate frame_benchmarking;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
mod benches {
|
||||
define_benchmarks!(
|
||||
[frame_system, SystemBench::<Runtime>]
|
||||
[pallet_assets, Assets]
|
||||
[pallet_balances, Balances]
|
||||
[pallet_multisig, Multisig]
|
||||
[pallet_proxy, Proxy]
|
||||
[pallet_session, SessionBench::<Runtime>]
|
||||
[pallet_uniques, Uniques]
|
||||
[pallet_utility, Utility]
|
||||
[pallet_timestamp, Timestamp]
|
||||
[pallet_collator_selection, CollatorSelection]
|
||||
[cumulus_pallet_xcmp_queue, XcmpQueue]
|
||||
);
|
||||
}
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
|
||||
fn slot_duration() -> sp_consensus_aura::SlotDuration {
|
||||
sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
|
||||
}
|
||||
|
||||
fn authorities() -> Vec<AuraId> {
|
||||
Aura::authorities().into_inner()
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
VERSION
|
||||
}
|
||||
|
||||
fn execute_block(block: Block) {
|
||||
Executive::execute_block(block)
|
||||
}
|
||||
|
||||
fn initialize_block(header: &<Block as BlockT>::Header) {
|
||||
Executive::initialize_block(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_api::Metadata<Block> for Runtime {
|
||||
fn metadata() -> OpaqueMetadata {
|
||||
OpaqueMetadata::new(Runtime::metadata().into())
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_block_builder::BlockBuilder<Block> for Runtime {
|
||||
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
|
||||
Executive::apply_extrinsic(extrinsic)
|
||||
}
|
||||
|
||||
fn finalize_block() -> <Block as BlockT>::Header {
|
||||
Executive::finalize_block()
|
||||
}
|
||||
|
||||
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
data.create_extrinsics()
|
||||
}
|
||||
|
||||
fn check_inherents(
|
||||
block: Block,
|
||||
data: sp_inherents::InherentData,
|
||||
) -> sp_inherents::CheckInherentsResult {
|
||||
data.check_extrinsics(&block)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
fn validate_transaction(
|
||||
source: TransactionSource,
|
||||
tx: <Block as BlockT>::Extrinsic,
|
||||
block_hash: <Block as BlockT>::Hash,
|
||||
) -> TransactionValidity {
|
||||
Executive::validate_transaction(source, tx, block_hash)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
|
||||
fn offchain_worker(header: &<Block as BlockT>::Header) {
|
||||
Executive::offchain_worker(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_session::SessionKeys<Block> for Runtime {
|
||||
fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
|
||||
SessionKeys::generate(seed)
|
||||
}
|
||||
|
||||
fn decode_session_keys(
|
||||
encoded: Vec<u8>,
|
||||
) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
|
||||
SessionKeys::decode_into_raw_public_keys(&encoded)
|
||||
}
|
||||
}
|
||||
|
||||
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
|
||||
fn account_nonce(account: AccountId) -> Index {
|
||||
System::account_nonce(account)
|
||||
}
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
|
||||
fn query_info(
|
||||
uxt: <Block as BlockT>::Extrinsic,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
|
||||
TransactionPayment::query_info(uxt, len)
|
||||
}
|
||||
fn query_fee_details(
|
||||
uxt: <Block as BlockT>::Extrinsic,
|
||||
len: u32,
|
||||
) -> pallet_transaction_payment::FeeDetails<Balance> {
|
||||
TransactionPayment::query_fee_details(uxt, len)
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "try-runtime")]
|
||||
impl frame_try_runtime::TryRuntime<Block> for Runtime {
|
||||
fn on_runtime_upgrade() -> (Weight, Weight) {
|
||||
log::info!("try-runtime::on_runtime_upgrade westmint.");
|
||||
let weight = Executive::try_runtime_upgrade().unwrap();
|
||||
(weight, RuntimeBlockWeights::get().max_block)
|
||||
}
|
||||
|
||||
fn execute_block_no_check(block: Block) -> Weight {
|
||||
Executive::execute_block_no_check(block)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||
fn benchmark_metadata(extra: bool) -> (
|
||||
Vec<frame_benchmarking::BenchmarkList>,
|
||||
Vec<frame_support::traits::StorageInfo>,
|
||||
) {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkList};
|
||||
use frame_support::traits::StorageInfoTrait;
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
|
||||
let mut list = Vec::<BenchmarkList>::new();
|
||||
list_benchmarks!(list, extra);
|
||||
|
||||
let storage_info = AllPalletsWithSystem::storage_info();
|
||||
return (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_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
|
||||
use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
|
||||
impl cumulus_pallet_session_benchmarking::Config for Runtime {}
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
// Block Number
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
|
||||
// Total Issuance
|
||||
hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
|
||||
// Execution Phase
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
|
||||
// Event Count
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
|
||||
// System Events
|
||||
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
|
||||
];
|
||||
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
add_benchmarks!(params, batches);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct CheckInherents;
|
||||
|
||||
impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
|
||||
fn check_inherents(
|
||||
block: &Block,
|
||||
relay_state_proof: &cumulus_pallet_parachain_system::RelayChainStateProof,
|
||||
) -> sp_inherents::CheckInherentsResult {
|
||||
let relay_chain_slot = relay_state_proof
|
||||
.read_slot()
|
||||
.expect("Could not read the relay chain slot from the proof");
|
||||
|
||||
let inherent_data =
|
||||
cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration(
|
||||
relay_chain_slot,
|
||||
sp_std::time::Duration::from_secs(6),
|
||||
)
|
||||
.create_inherent_data()
|
||||
.expect("Could not create the timestamp inherent data");
|
||||
|
||||
inherent_data.check_extrinsics(block)
|
||||
}
|
||||
}
|
||||
|
||||
cumulus_pallet_parachain_system::register_validate_block! {
|
||||
Runtime = Runtime,
|
||||
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
|
||||
CheckInherents = CheckInherents,
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Importing a block with 0 Extrinsics.
|
||||
pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::BlockExecutionWeight::get();
|
||||
|
||||
// At least 100 µs.
|
||||
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||
// At most 50 ms.
|
||||
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `cumulus_pallet_xcmp_queue`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=westmint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=cumulus_pallet_xcmp_queue
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/westmint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `cumulus_pallet_xcmp_queue`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo<T> {
|
||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||
fn set_config_with_u32() -> Weight {
|
||||
(5_463_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: XcmpQueue QueueConfig (r:1 w:1)
|
||||
fn set_config_with_weight() -> Weight {
|
||||
(5_221_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||
pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
/// Checks that the weight exists and is sane.
|
||||
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||
// you can delete it.
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||
|
||||
// At least 10 µs.
|
||||
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||
// At most 1 ms.
|
||||
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `frame_system`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=westmint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=frame_system
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/westmint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `frame_system`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `b` is `[0, 3932160]`.
|
||||
fn remark(_b: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
}
|
||||
/// The range of component `b` is `[0, 3932160]`.
|
||||
fn remark_with_event(b: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(b as Weight))
|
||||
}
|
||||
// Storage: System Digest (r:1 w:1)
|
||||
// Storage: unknown [0x3a686561707061676573] (r:0 w:1)
|
||||
fn set_heap_pages() -> Weight {
|
||||
(5_726_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Skipped Metadata (r:0 w:0)
|
||||
/// The range of component `i` is `[1, 1000]`.
|
||||
fn set_storage(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((616_000 as Weight).saturating_mul(i as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||
}
|
||||
// Storage: Skipped Metadata (r:0 w:0)
|
||||
/// The range of component `i` is `[1, 1000]`.
|
||||
fn kill_storage(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((519_000 as Weight).saturating_mul(i as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||
}
|
||||
// Storage: Skipped Metadata (r:0 w:0)
|
||||
/// The range of component `p` is `[1, 1000]`.
|
||||
fn kill_prefix(p: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((1_067_000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
pub mod block_weights;
|
||||
pub mod cumulus_pallet_xcmp_queue;
|
||||
pub mod extrinsic_weights;
|
||||
pub mod frame_system;
|
||||
pub mod pallet_assets;
|
||||
pub mod pallet_balances;
|
||||
pub mod pallet_collator_selection;
|
||||
pub mod pallet_multisig;
|
||||
pub mod pallet_proxy;
|
||||
pub mod pallet_session;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_uniques;
|
||||
pub mod pallet_utility;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||
pub use paritydb_weights::constants::ParityDbWeight;
|
||||
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||
@@ -0,0 +1,235 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_assets`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=westmint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_assets
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/westmint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_assets`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn create() -> Weight {
|
||||
(25_905_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn force_create() -> Weight {
|
||||
(14_977_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:5002 w:5001)
|
||||
// Storage: System Account (r:5000 w:5000)
|
||||
// Storage: Assets Metadata (r:1 w:0)
|
||||
// Storage: Assets Approvals (r:501 w:500)
|
||||
/// The range of component `c` is `[0, 5000]`.
|
||||
/// The range of component `s` is `[0, 5000]`.
|
||||
/// The range of component `a` is `[0, 500]`.
|
||||
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 46_000
|
||||
.saturating_add((16_133_000 as Weight).saturating_mul(c as Weight))
|
||||
// Standard Error: 46_000
|
||||
.saturating_add((18_915_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 464_000
|
||||
.saturating_add((16_795_000 as Weight).saturating_mul(a as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(a as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn mint() -> Weight {
|
||||
(29_903_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn burn() -> Weight {
|
||||
(34_384_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(48_218_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_keep_alive() -> Weight {
|
||||
(40_558_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn force_transfer() -> Weight {
|
||||
(48_330_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn freeze() -> Weight {
|
||||
(21_218_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Account (r:1 w:1)
|
||||
fn thaw() -> Weight {
|
||||
(21_227_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn freeze_asset() -> Weight {
|
||||
(17_906_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn thaw_asset() -> Weight {
|
||||
(17_669_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Metadata (r:1 w:0)
|
||||
fn transfer_ownership() -> Weight {
|
||||
(18_756_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn set_team() -> Weight {
|
||||
(17_203_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
/// The range of component `n` is `[0, 50]`.
|
||||
/// The range of component `s` is `[0, 50]`.
|
||||
fn set_metadata(_n: u32, s: u32, ) -> Weight {
|
||||
(31_757_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((3_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
fn clear_metadata() -> Weight {
|
||||
(31_669_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
/// The range of component `n` is `[0, 50]`.
|
||||
/// The range of component `s` is `[0, 50]`.
|
||||
fn force_set_metadata(_n: u32, s: u32, ) -> Weight {
|
||||
(18_566_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:0)
|
||||
// Storage: Assets Metadata (r:1 w:1)
|
||||
fn force_clear_metadata() -> Weight {
|
||||
(31_467_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
fn force_asset_status() -> Weight {
|
||||
(16_275_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
fn approve_transfer() -> Weight {
|
||||
(34_436_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Account (r:2 w:2)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_approved() -> Weight {
|
||||
(60_445_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
fn cancel_approval() -> Weight {
|
||||
(35_819_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Assets Asset (r:1 w:1)
|
||||
// Storage: Assets Approvals (r:1 w:1)
|
||||
fn force_cancel_approval() -> Weight {
|
||||
(36_535_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_balances`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=westmint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_balances
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/westmint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_balances`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer() -> Weight {
|
||||
(40_330_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_keep_alive() -> Weight {
|
||||
(30_938_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn set_balance_creating() -> Weight {
|
||||
(20_284_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn set_balance_killing() -> Weight {
|
||||
(24_018_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
fn force_transfer() -> Weight {
|
||||
(40_970_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn transfer_all() -> Weight {
|
||||
(36_243_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:1 w:1)
|
||||
fn force_unreserve() -> Weight {
|
||||
(18_374_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_collator_selection`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=westmint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_collator_selection
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/westmint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_collator_selection`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightInfo<T> {
|
||||
// Storage: Session NextKeys (r:1 w:0)
|
||||
// Storage: CollatorSelection Invulnerables (r:0 w:1)
|
||||
/// The range of component `b` is `[1, 100]`.
|
||||
fn set_invulnerables(b: u32, ) -> Weight {
|
||||
(6_669_000 as Weight)
|
||||
// Standard Error: 3_000
|
||||
.saturating_add((3_218_000 as Weight).saturating_mul(b as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection DesiredCandidates (r:0 w:1)
|
||||
fn set_desired_candidates() -> Weight {
|
||||
(8_348_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection CandidacyBond (r:0 w:1)
|
||||
fn set_candidacy_bond() -> Weight {
|
||||
(8_592_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection Candidates (r:1 w:1)
|
||||
// Storage: CollatorSelection DesiredCandidates (r:1 w:0)
|
||||
// Storage: CollatorSelection Invulnerables (r:1 w:0)
|
||||
// Storage: Session NextKeys (r:1 w:0)
|
||||
// Storage: CollatorSelection CandidacyBond (r:1 w:0)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
|
||||
/// The range of component `c` is `[1, 1000]`.
|
||||
fn register_as_candidate(c: u32, ) -> Weight {
|
||||
(55_542_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((92_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection Candidates (r:1 w:1)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
|
||||
/// The range of component `c` is `[2, 1000]`.
|
||||
fn leave_intent(c: u32, ) -> Weight {
|
||||
(52_080_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((109_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: System Account (r:2 w:2)
|
||||
// Storage: System BlockWeight (r:1 w:1)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:0 w:1)
|
||||
fn note_author() -> Weight {
|
||||
(31_546_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
// Storage: CollatorSelection Candidates (r:1 w:1)
|
||||
// Storage: CollatorSelection LastAuthoredBlock (r:1000 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
// Storage: CollatorSelection Invulnerables (r:1 w:0)
|
||||
// Storage: System BlockWeight (r:1 w:1)
|
||||
/// The range of component `r` is `[1, 1000]`.
|
||||
/// The range of component `c` is `[1, 1000]`.
|
||||
fn new_session(r: u32, c: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 1_895_000
|
||||
.saturating_add((9_941_000 as Weight).saturating_mul(r as Weight))
|
||||
// Standard Error: 1_895_000
|
||||
.saturating_add((50_628_000 as Weight).saturating_mul(c as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_multisig`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2022-08-09, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./artifacts/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --chain=westmint-dev
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_multisig
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/westmint/src/weights
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_multisig`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_threshold_1(z: u32, ) -> Weight {
|
||||
(17_854_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_create(s: u32, z: u32, ) -> Weight {
|
||||
(36_613_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((96_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_create_store(s: u32, z: u32, ) -> Weight {
|
||||
(40_039_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((72_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
/// The range of component `s` is `[3, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_approve(s: u32, z: u32, ) -> Weight {
|
||||
(26_059_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((82_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((1_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
/// The range of component `s` is `[3, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_approve_store(s: u32, z: u32, ) -> Weight {
|
||||
(38_292_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((90_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
/// The range of component `z` is `[0, 10000]`.
|
||||
fn as_multi_complete(s: u32, z: u32, ) -> Weight {
|
||||
(47_468_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((129_000 as Weight).saturating_mul(s as Weight))
|
||||
// Standard Error: 0
|
||||
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn approve_as_multi_create(s: u32, ) -> Weight {
|
||||
(33_492_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((110_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:0)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn approve_as_multi_approve(s: u32, ) -> Weight {
|
||||
(22_147_000 as Weight)
|
||||
// Standard Error: 0
|
||||
.saturating_add((113_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
// Storage: System Account (r:1 w:1)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn approve_as_multi_complete(s: u32, ) -> Weight {
|
||||
(66_106_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((161_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
// Storage: Multisig Multisigs (r:1 w:1)
|
||||
// Storage: Multisig Calls (r:1 w:1)
|
||||
/// The range of component `s` is `[2, 100]`.
|
||||
fn cancel_as_multi(s: u32, ) -> Weight {
|
||||
(52_566_000 as Weight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((117_000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user