mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-25 09:25:46 +00:00
* Some renames
* Fix
* Fix build for new APIs
* Remove diener
* Fixes
* Fixes
* Fix integration tests
* Fixes
* fix nis issuance
* Update Cargo.toml
* Polkadot doesn't have freezes/holds yet
* No networks use freezes/holds
* update lockfile for {"substrate"}
* Fix tests
There are more failing tests; just starting with the easy ones.
Reserved balance does not count towards ED anymore, therefore reducing
all the reserves by ED (1).
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
* Fixes for Polkadot pallets
* Fix parachains benchmarks
* Update Substrate
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: parity-processbot <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -20,7 +20,7 @@ use crate::{fungible as xcm_balances_benchmark, mock::*};
|
||||
use frame_benchmarking::BenchmarkError;
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{Everything, Nothing},
|
||||
traits::{ConstU32, Everything, Nothing},
|
||||
weights::Weight,
|
||||
};
|
||||
use sp_core::H256;
|
||||
@@ -77,7 +77,7 @@ impl frame_system::Config for Test {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -94,6 +94,10 @@ impl pallet_balances::Config for Test {
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
type HoldIdentifier = ();
|
||||
type FreezeIdentifier = ();
|
||||
type MaxHolds = ConstU32<0>;
|
||||
type MaxFreezes = ConstU32<0>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use codec::Encode;
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{Everything, Nothing},
|
||||
traits::{ConstU32, Everything, Nothing},
|
||||
weights::Weight,
|
||||
};
|
||||
use polkadot_parachain::primitives::Id as ParaId;
|
||||
@@ -242,6 +242,10 @@ impl pallet_balances::Config for Test {
|
||||
type WeightInfo = ();
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type HoldIdentifier = ();
|
||||
type FreezeIdentifier = ();
|
||||
type MaxHolds = ConstU32<0>;
|
||||
type MaxFreezes = ConstU32<0>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -16,7 +16,12 @@
|
||||
|
||||
//! Adapters to work with `frame_support::traits::tokens::fungibles` through XCM.
|
||||
|
||||
use frame_support::traits::{tokens::fungibles, Contains, Get};
|
||||
use frame_support::traits::{
|
||||
tokens::{
|
||||
fungibles, Fortitude::Polite, Precision::Exact, Preservation::Preserve, Provenance::Minted,
|
||||
},
|
||||
Contains, Get,
|
||||
};
|
||||
use sp_std::{marker::PhantomData, prelude::*, result};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_executor::traits::{Convert, Error as MatchError, MatchesFungibles, TransactAsset};
|
||||
@@ -26,7 +31,7 @@ pub struct FungiblesTransferAdapter<Assets, Matcher, AccountIdConverter, Account
|
||||
PhantomData<(Assets, Matcher, AccountIdConverter, AccountId)>,
|
||||
);
|
||||
impl<
|
||||
Assets: fungibles::Transfer<AccountId>,
|
||||
Assets: fungibles::Mutate<AccountId>,
|
||||
Matcher: MatchesFungibles<Assets::AssetId, Assets::Balance>,
|
||||
AccountIdConverter: Convert<MultiLocation, AccountId>,
|
||||
AccountId: Clone, // can't get away without it since Currency is generic over it.
|
||||
@@ -49,7 +54,7 @@ impl<
|
||||
.map_err(|()| MatchError::AccountIdConversionFailed)?;
|
||||
let dest = AccountIdConverter::convert_ref(to)
|
||||
.map_err(|()| MatchError::AccountIdConversionFailed)?;
|
||||
Assets::transfer(asset_id, &source, &dest, amount, true)
|
||||
Assets::transfer(asset_id, &source, &dest, amount, Preserve)
|
||||
.map_err(|e| XcmError::FailedToTransactAsset(e.into()))?;
|
||||
Ok(what.clone().into())
|
||||
}
|
||||
@@ -153,14 +158,14 @@ impl<
|
||||
{
|
||||
fn can_accrue_checked(asset_id: Assets::AssetId, amount: Assets::Balance) -> XcmResult {
|
||||
let checking_account = CheckingAccount::get();
|
||||
Assets::can_deposit(asset_id, &checking_account, amount, true)
|
||||
Assets::can_deposit(asset_id, &checking_account, amount, Minted)
|
||||
.into_result()
|
||||
.map_err(|_| XcmError::NotDepositable)
|
||||
}
|
||||
fn can_reduce_checked(asset_id: Assets::AssetId, amount: Assets::Balance) -> XcmResult {
|
||||
let checking_account = CheckingAccount::get();
|
||||
Assets::can_withdraw(asset_id, &checking_account, amount)
|
||||
.into_result()
|
||||
.into_result(false)
|
||||
.map_err(|_| XcmError::NotWithdrawable)
|
||||
.map(|_| ())
|
||||
}
|
||||
@@ -171,7 +176,7 @@ impl<
|
||||
}
|
||||
fn reduce_checked(asset_id: Assets::AssetId, amount: Assets::Balance) {
|
||||
let checking_account = CheckingAccount::get();
|
||||
let ok = Assets::burn_from(asset_id, &checking_account, amount).is_ok();
|
||||
let ok = Assets::burn_from(asset_id, &checking_account, amount, Exact, Polite).is_ok();
|
||||
debug_assert!(ok, "`can_reduce_checked` must have returned `true` immediately prior; qed");
|
||||
}
|
||||
}
|
||||
@@ -280,7 +285,8 @@ impl<
|
||||
let who = AccountIdConverter::convert_ref(who)
|
||||
.map_err(|()| MatchError::AccountIdConversionFailed)?;
|
||||
Assets::mint_into(asset_id, &who, amount)
|
||||
.map_err(|e| XcmError::FailedToTransactAsset(e.into()))
|
||||
.map_err(|e| XcmError::FailedToTransactAsset(e.into()))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn withdraw_asset(
|
||||
@@ -297,7 +303,7 @@ impl<
|
||||
let (asset_id, amount) = Matcher::matches_fungibles(what)?;
|
||||
let who = AccountIdConverter::convert_ref(who)
|
||||
.map_err(|()| MatchError::AccountIdConversionFailed)?;
|
||||
Assets::burn_from(asset_id, &who, amount)
|
||||
Assets::burn_from(asset_id, &who, amount, Exact, Polite)
|
||||
.map_err(|e| XcmError::FailedToTransactAsset(e.into()))?;
|
||||
Ok(what.clone().into())
|
||||
}
|
||||
@@ -312,7 +318,7 @@ pub struct FungiblesAdapter<
|
||||
CheckingAccount,
|
||||
>(PhantomData<(Assets, Matcher, AccountIdConverter, AccountId, CheckAsset, CheckingAccount)>);
|
||||
impl<
|
||||
Assets: fungibles::Mutate<AccountId> + fungibles::Transfer<AccountId>,
|
||||
Assets: fungibles::Mutate<AccountId>,
|
||||
Matcher: MatchesFungibles<Assets::AssetId, Assets::Balance>,
|
||||
AccountIdConverter: Convert<MultiLocation, AccountId>,
|
||||
AccountId: Clone, // can't get away without it since Currency is generic over it.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{Everything, Nothing},
|
||||
traits::{ConstU32, Everything, Nothing},
|
||||
weights::Weight,
|
||||
};
|
||||
use parity_scale_codec::Encode;
|
||||
@@ -116,6 +116,10 @@ impl pallet_balances::Config for Runtime {
|
||||
type WeightInfo = ();
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type HoldIdentifier = ();
|
||||
type FreezeIdentifier = ();
|
||||
type MaxHolds = ConstU32<0>;
|
||||
type MaxFreezes = ConstU32<0>;
|
||||
}
|
||||
|
||||
impl shared::Config for Runtime {}
|
||||
|
||||
@@ -22,7 +22,7 @@ use frame_support::{
|
||||
traits::{EnsureOrigin, EnsureOriginWithArg, Everything, EverythingBut, Nothing},
|
||||
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_core::{ConstU32, H256};
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{Hash, IdentityLookup},
|
||||
@@ -85,7 +85,7 @@ impl frame_system::Config for Runtime {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -104,6 +104,10 @@ impl pallet_balances::Config for Runtime {
|
||||
type WeightInfo = ();
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type HoldIdentifier = ();
|
||||
type FreezeIdentifier = ();
|
||||
type MaxHolds = ConstU32<0>;
|
||||
type MaxFreezes = ConstU32<0>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
@@ -130,9 +134,9 @@ impl pallet_uniques::Config for Runtime {
|
||||
type MetadataDepositBase = frame_support::traits::ConstU128<1_000>;
|
||||
type AttributeDepositBase = frame_support::traits::ConstU128<1_000>;
|
||||
type DepositPerByte = frame_support::traits::ConstU128<1>;
|
||||
type StringLimit = frame_support::traits::ConstU32<64>;
|
||||
type KeyLimit = frame_support::traits::ConstU32<64>;
|
||||
type ValueLimit = frame_support::traits::ConstU32<128>;
|
||||
type StringLimit = ConstU32<64>;
|
||||
type KeyLimit = ConstU32<64>;
|
||||
type ValueLimit = ConstU32<128>;
|
||||
type Locker = ();
|
||||
type WeightInfo = ();
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
@@ -416,7 +420,7 @@ impl pallet_xcm::Config for Runtime {
|
||||
type CurrencyMatcher = ();
|
||||
type TrustedLockers = ();
|
||||
type SovereignAccountOf = LocationToAccountId;
|
||||
type MaxLockers = frame_support::traits::ConstU32<8>;
|
||||
type MaxLockers = ConstU32<8>;
|
||||
type WeightInfo = pallet_xcm::TestWeightInfo;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type ReachableDest = ReachableDest;
|
||||
|
||||
@@ -21,7 +21,7 @@ use frame_support::{
|
||||
traits::{AsEnsureOriginWithArg, Everything, Nothing},
|
||||
weights::Weight,
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_core::{ConstU32, H256};
|
||||
use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32};
|
||||
|
||||
use polkadot_parachain::primitives::Id as ParaId;
|
||||
@@ -67,7 +67,7 @@ impl frame_system::Config for Runtime {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -86,6 +86,10 @@ impl pallet_balances::Config for Runtime {
|
||||
type WeightInfo = ();
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type HoldIdentifier = ();
|
||||
type FreezeIdentifier = ();
|
||||
type MaxHolds = ConstU32<0>;
|
||||
type MaxFreezes = ConstU32<0>;
|
||||
}
|
||||
|
||||
impl pallet_uniques::Config for Runtime {
|
||||
@@ -100,9 +104,9 @@ impl pallet_uniques::Config for Runtime {
|
||||
type MetadataDepositBase = frame_support::traits::ConstU128<1_000>;
|
||||
type AttributeDepositBase = frame_support::traits::ConstU128<1_000>;
|
||||
type DepositPerByte = frame_support::traits::ConstU128<1>;
|
||||
type StringLimit = frame_support::traits::ConstU32<64>;
|
||||
type KeyLimit = frame_support::traits::ConstU32<64>;
|
||||
type ValueLimit = frame_support::traits::ConstU32<128>;
|
||||
type StringLimit = ConstU32<64>;
|
||||
type KeyLimit = ConstU32<64>;
|
||||
type ValueLimit = ConstU32<128>;
|
||||
type Locker = ();
|
||||
type WeightInfo = ();
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
@@ -213,7 +217,7 @@ impl pallet_xcm::Config for Runtime {
|
||||
type CurrencyMatcher = IsConcrete<TokenLocation>;
|
||||
type TrustedLockers = ();
|
||||
type SovereignAccountOf = LocationToAccountId;
|
||||
type MaxLockers = frame_support::traits::ConstU32<8>;
|
||||
type MaxLockers = ConstU32<8>;
|
||||
type WeightInfo = pallet_xcm::TestWeightInfo;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type ReachableDest = ReachableDest;
|
||||
|
||||
@@ -22,7 +22,7 @@ use frame_support::{
|
||||
traits::{Everything, Nothing},
|
||||
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_core::{ConstU32, H256};
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{Hash, IdentityLookup},
|
||||
@@ -94,6 +94,10 @@ impl pallet_balances::Config for Runtime {
|
||||
type WeightInfo = ();
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type HoldIdentifier = ();
|
||||
type FreezeIdentifier = ();
|
||||
type MaxHolds = ConstU32<0>;
|
||||
type MaxFreezes = ConstU32<0>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -21,7 +21,7 @@ use frame_support::{
|
||||
traits::{Everything, Nothing},
|
||||
weights::Weight,
|
||||
};
|
||||
use sp_core::H256;
|
||||
use sp_core::{ConstU32, H256};
|
||||
use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32};
|
||||
|
||||
use polkadot_parachain::primitives::Id as ParaId;
|
||||
@@ -66,7 +66,7 @@ impl frame_system::Config for Runtime {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -85,6 +85,10 @@ impl pallet_balances::Config for Runtime {
|
||||
type WeightInfo = ();
|
||||
type MaxReserves = MaxReserves;
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type HoldIdentifier = ();
|
||||
type FreezeIdentifier = ();
|
||||
type MaxHolds = ConstU32<0>;
|
||||
type MaxFreezes = ConstU32<0>;
|
||||
}
|
||||
|
||||
impl shared::Config for Runtime {}
|
||||
@@ -177,7 +181,7 @@ impl pallet_xcm::Config for Runtime {
|
||||
type CurrencyMatcher = ();
|
||||
type TrustedLockers = ();
|
||||
type SovereignAccountOf = SovereignAccountOf;
|
||||
type MaxLockers = frame_support::traits::ConstU32<8>;
|
||||
type MaxLockers = ConstU32<8>;
|
||||
type WeightInfo = pallet_xcm::TestWeightInfo;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type ReachableDest = ReachableDest;
|
||||
|
||||
Reference in New Issue
Block a user