Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
afe92fd
Update dependencies
ntn-x2 Feb 24, 2023
2538942
Update node side
ntn-x2 Feb 24, 2023
c585f30
Peregrine runtime compiling
ntn-x2 Feb 24, 2023
bc1da7a
Spiritnet runtime compiling
ntn-x2 Feb 24, 2023
b427a6d
Everything compiling
ntn-x2 Feb 24, 2023
d865e0f
All fixes
ntn-x2 Feb 24, 2023
0cd10f7
Compiles
ntn-x2 Feb 24, 2023
8a43ba1
Last fixes
ntn-x2 Feb 24, 2023
23ac524
More
ntn-x2 Feb 24, 2023
71732cc
fmt
ntn-x2 Feb 24, 2023
bb58447
Add pallet-xcm to runtime bench script
ntn-x2 Feb 24, 2023
f5bc271
Clippy
ntn-x2 Feb 27, 2023
a266edc
New pallet skeleton
ntn-x2 Feb 27, 2023
12b4fc9
First iteration
ntn-x2 Feb 27, 2023
39f5696
Test setup
ntn-x2 Feb 28, 2023
fb69836
Before switching to the Parity example
ntn-x2 Feb 28, 2023
6e6c59a
Integrate Parity example
ntn-x2 Feb 28, 2023
11d6fcf
Parity example refactoring in progress
ntn-x2 Feb 28, 2023
a3b9236
Test setup refactoring complete
ntn-x2 Mar 1, 2023
ff76493
Test environment compiling successfully
ntn-x2 Mar 1, 2023
7fc85c6
Messages going from parachain A to parachain B
ntn-x2 Mar 1, 2023
873c2d9
Transact works! Must add WithdrawAsset instruction first
ntn-x2 Mar 2, 2023
708f249
E2e flow works
ntn-x2 Mar 3, 2023
e0fe62a
More progress on the receiver side
ntn-x2 Mar 3, 2023
7760d02
Compiling
ntn-x2 Mar 3, 2023
53c04b7
IT WORKS
ntn-x2 Mar 3, 2023
10faad2
Working again
ntn-x2 Mar 3, 2023
6c0518b
Add support for additional details
ntn-x2 Mar 3, 2023
8646bbc
Add error handling
ntn-x2 Mar 3, 2023
b2b0d72
Change Transact origin to be the parachain itself
ntn-x2 Mar 6, 2023
b7bd163
Refactoring complete
ntn-x2 Mar 6, 2023
77e7b61
All working again
ntn-x2 Mar 6, 2023
c0bf753
Better refactoring
ntn-x2 Mar 6, 2023
845cf6b
Fix some features
ntn-x2 Mar 6, 2023
e8591b3
Merge commit '4eb94ef8e66343af651942653f25b939cfbf044e' into aa/dip-t…
ntn-x2 Mar 6, 2023
bef19d9
Fix compilation mess
ntn-x2 Mar 6, 2023
3c08a7d
Fix dip-receiver feature
ntn-x2 Mar 6, 2023
b3bf93f
Template node compiling
ntn-x2 Mar 8, 2023
cc4e907
Setup for local rococo 0.9.38
ntn-x2 Mar 8, 2023
17e5517
Minor runtime fixes WIP
ntn-x2 Mar 10, 2023
2bdd304
Add Parity feature flag fix
ntn-x2 Mar 10, 2023
fdc3981
Merge commit '2bdd304e09a3fe3ec1bb92e1d7b99cbe516232bb' into aa/dip-t…
ntn-x2 Mar 10, 2023
f31c2fc
Temporary fixes
ntn-x2 Mar 10, 2023
f825b95
More demo fixes
ntn-x2 Mar 10, 2023
a32f292
Fixes pt. 2
ntn-x2 Mar 10, 2023
b5fd68f
More fixess
ntn-x2 Mar 10, 2023
a7a022d
WORKING
ntn-x2 Mar 13, 2023
9609da4
Remove debug prints
ntn-x2 Mar 13, 2023
831c874
Revert test change
ntn-x2 Mar 13, 2023
4d2385c
Clean up dip-sender pallet
ntn-x2 Mar 14, 2023
6695380
Refactor dip-receiver
ntn-x2 Mar 14, 2023
97f8289
Rename dip pallets
ntn-x2 Mar 14, 2023
12ab8ee
Refactor dip-support
ntn-x2 Mar 14, 2023
09c0f5f
Refactor dip-sender and dip-receiver pallets
ntn-x2 Mar 14, 2023
89c6e0a
Merge commit '3f67a3192e75e181e1bf366748eb1b3e22bde18e' into aa/dip-t…
ntn-x2 Mar 14, 2023
6b44010
More refactoring
ntn-x2 Mar 14, 2023
fd2e1e9
Mid refactoring dip-sender template runtime
ntn-x2 Mar 14, 2023
9c83152
Complete refactor for dip-sender runtime template
ntn-x2 Mar 14, 2023
d02475b
receiver runtime template refactor
ntn-x2 Mar 15, 2023
9be02a9
One more refactoring complete
ntn-x2 Mar 15, 2023
9606829
XCM integration tests refactored
ntn-x2 Mar 15, 2023
4e704be
Almost there
ntn-x2 Mar 15, 2023
d45ed6f
Template nodes compiling
ntn-x2 Mar 15, 2023
c40af4d
Remove unused deps
ntn-x2 Mar 15, 2023
e9b49c4
Last fixes
ntn-x2 Mar 15, 2023
3fc04ce
Merge commit 'c6d5e7e9a08cef8697dfe37dd96dd5633a639c1d' into aa/dip-t…
ntn-x2 Mar 15, 2023
dd03b0c
Feature fixed
ntn-x2 Mar 15, 2023
2097d27
Add XCM pallet to template runtimes
ntn-x2 Mar 16, 2023
22ffcc9
Merge commit '7234aee203bc488b7e4bef7cc9cf69bfb1ba3ea4' into aa/dip-t…
ntn-x2 Mar 28, 2023
41d5538
Merge commit 'df9cef8e473a0512c17954baa6e2363ce8c65231' into aa/dip-t…
ntn-x2 Mar 28, 2023
4d8f14d
Remove unnecessary code duplication
ntn-x2 Mar 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Peregrine runtime compiling
  • Loading branch information
ntn-x2 committed Feb 24, 2023
commit c585f30955ced82b7e178bbf1e31e4494f14a8f5
4 changes: 0 additions & 4 deletions pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2493,10 +2493,6 @@ pub mod pallet {
DispatchClass::Mandatory,
);
}

fn note_uncle(_author: T::AccountId, _age: T::BlockNumber) {
// we too are not caring.
}
}

impl<T: Config> pallet_session::SessionManager<T::AccountId> for Pallet<T> {
Expand Down
2 changes: 1 addition & 1 deletion runtimes/common/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 seconds of compute with a 12 second average block time.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND)
.saturating_div(2)
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
.set_proof_size(cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64);

pub const INFLATION_CONFIG: (Perquintill, Perquintill, Perquintill, Perquintill) = (
// max collator staking rate
Expand Down
47 changes: 14 additions & 33 deletions runtimes/common/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@
use core::marker::PhantomData;
use frame_support::{log, match_types, parameter_types};
use polkadot_parachain::primitives::Sibling;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowUnpaidExecutionFrom, CurrencyAdapter, IsConcrete, ParentIsPreset,
SiblingParachainConvertsVia,
};
use xcm::latest::{prelude::*, Weight};
use xcm_builder::{AccountId32Aliases, CurrencyAdapter, IsConcrete, ParentIsPreset, SiblingParachainConvertsVia};
use xcm_executor::traits::ShouldExecute;

use crate::AccountId;

parameter_types! {
// One XCM operation is 1_000_000_000 weight, almost certainly a conservative estimate.
pub UnitWeightCost: u64 = 1_000_000_000;
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
}

match_types! {
Expand All @@ -54,41 +52,25 @@ where
{
fn should_execute<Call>(
origin: &MultiLocation,
message: &mut Xcm<Call>,
max_weight: u64,
weight_credit: &mut u64,
instructions: &mut [Instruction<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)
Deny::should_execute(origin, instructions, max_weight, weight_credit)?;
Allow::should_execute(origin, instructions, max_weight, weight_credit)
}
}

/// Explicitly deny ReserveTransfer to the relay chain. Allow calls from the
/// relay chain governance.
pub type XcmBarrier = DenyThenTry<
DenyReserveTransferToRelayChain,
(
// We don't allow anything from any sibling chain, therefore the following is not included here:
// * TakeWeightCredit
// * AllowTopLevelPaidExecutionFrom<Everything>

// We allow everything from the relay chain if it was sent by the relay chain legislative (i.e., democracy
// vote). Since the relaychain doesn't own KILTs and missing fees shouldn't prevent calls from the relaychain
// legislative, we allow unpaid execution.
AllowUnpaidExecutionFrom<ParentLegislative>,
),
>;

/// Reserved funds to the relay chain can't return. See https://github.com/paritytech/polkadot/issues/5233
pub struct DenyReserveTransferToRelayChain;
impl ShouldExecute for DenyReserveTransferToRelayChain {
fn should_execute<Call>(
origin: &MultiLocation,
message: &mut Xcm<Call>,
_max_weight: u64,
_weight_credit: &mut u64,
instructions: &mut [Instruction<Call>],
_max_weight: Weight,
_weight_credit: &mut Weight,
) -> Result<(), ()> {
if message.0.iter().any(|inst| {
if instructions.iter().any(|inst| {
matches!(
inst,
InitiateReserveWithdraw {
Expand Down Expand Up @@ -122,8 +104,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
parents: 1,
interior: Here
}
) && message
.0
) && instructions
.iter()
.any(|inst| matches!(inst, ReserveAssetDeposited { .. }))
{
Expand Down
23 changes: 17 additions & 6 deletions runtimes/peregrine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_version: 11000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 5,
transaction_version: 6,
state_version: 0,
};

Expand Down Expand Up @@ -259,6 +259,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ControllerOrigin = EnsureRoot<AccountId>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = cumulus_pallet_xcmp_queue::weights::SubstrateWeight<Self>;
type PriceForSiblingDelivery = ();
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
Expand All @@ -284,8 +285,6 @@ parameter_types! {

impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
type UncleGenerations = UncleGenerations;
type FilterUncle = ();
type EventHandler = ParachainStaking;
}

Expand Down Expand Up @@ -742,7 +741,6 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
ProxyType::NonTransfer => matches!(
c,
RuntimeCall::Attestation(..)
| RuntimeCall::Authorship(..)
// Excludes `Balances`
| RuntimeCall::Council(..)
| RuntimeCall::Ctype(..)
Expand Down Expand Up @@ -787,7 +785,6 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
| attestation::Call::change_deposit_owner { .. }
| attestation::Call::update_deposit { .. }
)
| RuntimeCall::Authorship(..)
// Excludes `Balances`
| RuntimeCall::Council(..)
| RuntimeCall::Ctype(..)
Expand Down Expand Up @@ -936,7 +933,7 @@ construct_runtime! {
Aura: pallet_aura = 23,
Session: pallet_session = 22,
ParachainStaking: parachain_staking = 21,
Authorship: pallet_authorship::{Pallet, Call, Storage} = 20,
Authorship: pallet_authorship::{Pallet, Storage} = 20,
AuraExt: cumulus_pallet_aura_ext = 24,

// Governance stuff
Expand Down Expand Up @@ -1159,6 +1156,13 @@ impl_runtime_apis! {
fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> pallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}

fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
}

impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
Expand All @@ -1176,6 +1180,13 @@ impl_runtime_apis! {
) -> pallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_call_fee_details(call, len)
}

fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
}

impl sp_block_builder::BlockBuilder<Block> for Runtime {
Expand Down
1 change: 1 addition & 0 deletions runtimes/peregrine/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ pub mod pallet_treasury;
pub mod pallet_utility;
pub mod pallet_vesting;
pub mod pallet_web3_names;
pub mod pallet_xcm;
pub mod parachain_staking;
pub mod public_credentials;
174 changes: 174 additions & 0 deletions runtimes/peregrine/src/weights/pallet_xcm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
// 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_xcm`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm3`, 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:
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
// benchmark
// pallet
// --steps=50
// --repeat=20
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
// --pallet=pallet_xcm
// --chain=statemine-dev
// --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_xcm`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
fn send() -> Weight {
// Minimum execution time: 26_577 nanoseconds.
Weight::from_ref_time(27_239_000)
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: ParachainInfo ParachainId (r:1 w:0)
fn teleport_assets() -> Weight {
// Minimum execution time: 32_703 nanoseconds.
Weight::from_ref_time(33_200_000)
.saturating_add(T::DbWeight::get().reads(1))
}
// Storage: ParachainInfo ParachainId (r:1 w:0)
fn reserve_transfer_assets() -> Weight {
// Minimum execution time: 25_142 nanoseconds.
Weight::from_ref_time(25_808_000)
.saturating_add(T::DbWeight::get().reads(1))
}
// Storage: Benchmark Override (r:0 w:0)
fn execute() -> Weight {
// Minimum execution time: 18_446_744_073_709_551 nanoseconds.
Weight::from_ref_time(18_446_744_073_709_551_000)
}
// Storage: PolkadotXcm SupportedVersion (r:0 w:1)
fn force_xcm_version() -> Weight {
// Minimum execution time: 15_036 nanoseconds.
Weight::from_ref_time(15_456_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: PolkadotXcm SafeXcmVersion (r:0 w:1)
fn force_default_xcm_version() -> Weight {
// Minimum execution time: 4_404 nanoseconds.
Weight::from_ref_time(4_598_000)
.saturating_add(T::DbWeight::get().writes(1))
}
// Storage: PolkadotXcm VersionNotifiers (r:1 w:1)
// Storage: PolkadotXcm QueryCounter (r:1 w:1)
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
// Storage: PolkadotXcm Queries (r:0 w:1)
fn force_subscribe_version_notify() -> Weight {
// Minimum execution time: 30_942 nanoseconds.
Weight::from_ref_time(31_608_000)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5))
}
// Storage: PolkadotXcm VersionNotifiers (r:1 w:1)
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
// Storage: PolkadotXcm Queries (r:0 w:1)
fn force_unsubscribe_version_notify() -> Weight {
// Minimum execution time: 32_327 nanoseconds.
Weight::from_ref_time(32_698_000)
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4))
}
// Storage: PolkadotXcm SupportedVersion (r:4 w:2)
fn migrate_supported_version() -> Weight {
// Minimum execution time: 13_522 nanoseconds.
Weight::from_ref_time(13_862_000)
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: PolkadotXcm VersionNotifiers (r:4 w:2)
fn migrate_version_notifiers() -> Weight {
// Minimum execution time: 13_621 nanoseconds.
Weight::from_ref_time(14_028_000)
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0)
fn already_notified_target() -> Weight {
// Minimum execution time: 15_511 nanoseconds.
Weight::from_ref_time(15_825_000)
.saturating_add(T::DbWeight::get().reads(5))
}
// Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1)
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
fn notify_current_targets() -> Weight {
// Minimum execution time: 27_062 nanoseconds.
Weight::from_ref_time(27_514_000)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
}
// Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0)
fn notify_target_migration_fail() -> Weight {
// Minimum execution time: 7_062 nanoseconds.
Weight::from_ref_time(7_325_000)
.saturating_add(T::DbWeight::get().reads(3))
}
// Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2)
fn migrate_version_notify_targets() -> Weight {
// Minimum execution time: 14_362 nanoseconds.
Weight::from_ref_time(14_724_000)
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2)
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
fn migrate_and_notify_old_targets() -> Weight {
// Minimum execution time: 32_435 nanoseconds.
Weight::from_ref_time(33_042_000)
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(4))
}
}
Loading