Skip to content

Commit

Permalink
Update polkadot v1.6.0 (#2704)
Browse files Browse the repository at this point in the history
* runtime checks

* acala service check

* merge code

* make check

* mroe fix

* make check-tests

* update evm-tests

* more fix

* fix tests

* fix tests

* update evm-tests

* fix try-runtime

* /bench runtime karura *

* /bench runtime acala *

* update weight for pallet-xcm

---------

Co-authored-by: zjb0807 <[email protected]>
Co-authored-by: Acala Github Action Bot <[email protected]>
  • Loading branch information
3 people authored Feb 22, 2024
1 parent 949882e commit 83025da
Show file tree
Hide file tree
Showing 124 changed files with 3,824 additions and 4,654 deletions.
1,873 changes: 1,110 additions & 763 deletions Cargo.lock

Large diffs are not rendered by default.

254 changes: 129 additions & 125 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ecosystem-modules/stable-asset
2 changes: 1 addition & 1 deletion evm-tests
26 changes: 4 additions & 22 deletions modules/aggregated-dex/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@

use super::*;
use frame_support::{
match_types, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, Everything, Nothing},
derive_impl, match_types, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, Nothing},
PalletId,
};
use frame_system::EnsureSignedBy;
pub use module_support::{ExchangeRate, RebasedStableAsset};
use orml_tokens::ConvertBalance;
pub use orml_traits::{parameter_type_with_key, MultiCurrency};
use primitives::{Amount, TokenSymbol, TradingPair};
use sp_runtime::{testing::H256, traits::IdentityLookup, AccountId32, ArithmeticError, BuildStorage, FixedPointNumber};
use sp_runtime::{traits::IdentityLookup, AccountId32, ArithmeticError, BuildStorage, FixedPointNumber};

pub type AccountId = AccountId32;

Expand All @@ -46,30 +46,12 @@ pub const DOT: CurrencyId = CurrencyId::Token(TokenSymbol::DOT);
pub const LDOT: CurrencyId = CurrencyId::Token(TokenSymbol::LDOT);
pub const STABLE_ASSET: CurrencyId = CurrencyId::StableAssetPoolToken(0);

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type DbWeight = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

parameter_type_with_key! {
Expand Down
24 changes: 3 additions & 21 deletions modules/asset-registry/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

use crate as asset_registry;
use frame_support::{
assert_ok, construct_runtime, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, Everything},
assert_ok, construct_runtime, derive_impl, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64},
};
use frame_system::EnsureSignedBy;
use module_support::{mocks::MockAddressMapping, AddressMapping};
Expand All @@ -34,30 +34,12 @@ use sp_core::{H160, H256, U256};
use sp_runtime::BuildStorage;
use std::str::FromStr;

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type BaseCallFilter = Everything;
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = sp_runtime::testing::H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

impl pallet_balances::Config for Runtime {
Expand Down
25 changes: 3 additions & 22 deletions modules/auction-manager/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@

use super::*;
use frame_support::{
construct_runtime, ord_parameter_types, parameter_types,
traits::{ConstU32, ConstU64, Everything, Nothing},
construct_runtime, derive_impl, ord_parameter_types, parameter_types,
traits::{ConstU32, ConstU64, Nothing},
PalletId,
};
use frame_system::EnsureSignedBy;
pub use module_support::Price;
use module_support::{mocks::MockStableAsset, SpecificJointsSwap};
use orml_traits::parameter_type_with_key;
use primitives::{TokenSymbol, TradingPair};
use sp_core::H256;
use sp_runtime::{
testing::{Header, TestXt},
traits::{AccountIdConversion, IdentityLookup, One as OneT},
Expand All @@ -55,30 +54,12 @@ mod auction_manager {
pub use super::super::*;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = ();
type BaseCallFilter = Everything;
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

parameter_type_with_key! {
Expand Down
26 changes: 4 additions & 22 deletions modules/cdp-engine/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

use super::*;
use frame_support::{
construct_runtime, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, Everything, Nothing},
construct_runtime, derive_impl, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, Nothing},
PalletId,
};
use frame_system::EnsureSignedBy;
use module_support::{mocks::MockStableAsset, AuctionManager, EmergencyShutdown, SpecificJointsSwap};
use orml_traits::parameter_type_with_key;
use primitives::{evm::convert_decimals_to_evm, DexShare, Moment, ReserveIdentifier, TokenSymbol, TradingPair};
use sp_core::{crypto::AccountId32, H256};
use sp_core::crypto::AccountId32;
use sp_runtime::{
testing::TestXt,
traits::{AccountIdConversion, IdentityLookup, One as OneT},
Expand All @@ -57,30 +57,12 @@ mod cdp_engine {
pub use super::super::*;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = ();
type BaseCallFilter = Everything;
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

parameter_type_with_key! {
Expand Down
25 changes: 3 additions & 22 deletions modules/cdp-treasury/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

use super::*;
use frame_support::{
construct_runtime, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, EitherOfDiverse, Everything, Nothing},
construct_runtime, derive_impl, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, EitherOfDiverse, Nothing},
};
use frame_system::{EnsureRoot, EnsureSignedBy};
use module_support::SpecificJointsSwap;
Expand All @@ -33,7 +33,6 @@ use nutsfinance_stable_asset::{
};
use orml_traits::parameter_type_with_key;
use primitives::{DexShare, TokenSymbol, TradingPair};
use sp_core::H256;
use sp_runtime::{traits::IdentityLookup, BuildStorage};
use sp_std::cell::RefCell;

Expand All @@ -57,30 +56,12 @@ mod cdp_treasury {
pub use super::super::*;
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = ();
type BaseCallFilter = Everything;
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

parameter_type_with_key! {
Expand Down
2 changes: 1 addition & 1 deletion modules/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ pub mod pallet {

pub fn do_register_candidate(who: &T::AccountId, deposit: BalanceOf<T>) -> Result<usize, DispatchError> {
// ensure we are below limit.
let length = <Candidates<T>>::decode_len().unwrap_or_default();
let length = <Candidates<T>>::decode_non_dedup_len().unwrap_or_default();
ensure!(
(length as u32) < Self::desired_candidates(),
Error::<T>::MaxCandidatesExceeded
Expand Down
27 changes: 4 additions & 23 deletions modules/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@
use super::*;
use crate as collator_selection;
use frame_support::{
ord_parameter_types, parameter_types,
traits::{ConstU16, ConstU32, ConstU64, Everything, FindAuthor},
derive_impl, ord_parameter_types, parameter_types,
traits::{ConstU32, ConstU64, FindAuthor},
PalletId,
};
use frame_system::EnsureSignedBy;
use primitives::ReserveIdentifier;
use sp_core::H256;
use sp_runtime::{
testing::UintAuthorityId,
traits::{BlakeTwo256, ConstBool, IdentityLookup, OpaqueKeys},
traits::{ConstBool, IdentityLookup, OpaqueKeys},
BuildStorage, Permill, RuntimeAppPublic,
};

Expand All @@ -47,30 +46,12 @@ frame_support::construct_runtime!(
}
);

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ConstU16<42>;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

impl pallet_balances::Config for Test {
Expand Down
25 changes: 4 additions & 21 deletions modules/currencies/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use super::*;
pub use crate as currencies;

use frame_support::{
assert_ok, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, Everything, Nothing},
assert_ok, derive_impl, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, ConstU64, Nothing},
PalletId,
};
use frame_system::EnsureSignedBy;
Expand All @@ -47,30 +47,13 @@ pub const EVE: AccountId = AccountId32::new([8u8; 32]);
pub const FERDIE: AccountId = AccountId32::new([9u8; 32]);

pub type AccountId = AccountId32;

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Hash = H256;
type Hashing = sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type BlockWeights = ();
type BlockLength = ();
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type DbWeight = ();
type BaseCallFilter = Everything;
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
}

type Balance = u128;
Expand Down
Loading

0 comments on commit 83025da

Please sign in to comment.