Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
aa391c9
replacing dependencies
gianfra-t Jul 30, 2024
b883bc6
dependencies upgrades
gianfra-t Jul 30, 2024
1b22e66
restructure imports for update, relevant modifications of chain exten…
gianfra-t Jul 31, 2024
7a7a37d
reorder dependencies and types for pallets staking, tokens and allowance
gianfra-t Jul 31, 2024
2ab8195
update fixes for asset registry, runtime common
gianfra-t Jul 31, 2024
5187366
amplitude 1.1.0 changes
gianfra-t Jul 31, 2024
f7083ed
updating foucoco, pendulum runtimes
gianfra-t Aug 1, 2024
2a877c2
benchmark fixes for common
gianfra-t Aug 1, 2024
ce6a0af
fixes for runtimes with runtime benchmarks
gianfra-t Aug 5, 2024
fa9124c
node modifications for upgrade
gianfra-t Aug 5, 2024
afa2445
WIP fixing integration tests
gianfra-t Aug 6, 2024
bed37c5
fixed missing default features
gianfra-t Aug 7, 2024
fda5880
WIP fixing std issue
gianfra-t Aug 7, 2024
5ec2769
modification toml pendulum, orml-currencies, amplitude
gianfra-t Aug 7, 2024
34937d3
use serde, log with default features = false
gianfra-t Aug 8, 2024
b394ea5
remove std conditionals on pallets
gianfra-t Aug 8, 2024
c2411a1
fix foucoco default features declaration
gianfra-t Aug 8, 2024
3a1f47a
add trait to sibling currency id
gianfra-t Aug 8, 2024
af01ba6
remove unnecessary trait ConvertMultilocation
gianfra-t Aug 8, 2024
4bbd6b6
remove unnecessary trait ConvertMultilocation in integration tests si…
gianfra-t Aug 8, 2024
8613e59
use start_relay_chain_tasks in node
gianfra-t Aug 8, 2024
9639e19
modifications .toml integration tests
gianfra-t Aug 8, 2024
ad33520
WIP testing comprehensive patch
gianfra-t Aug 12, 2024
f844e6b
fix for integration tests dependencies
gianfra-t Aug 16, 2024
ef2b22f
remove deps of polkadot fellows runtime, solve integration test parac…
gianfra-t Aug 16, 2024
9c0a4bc
adding pallets to sibling chain
gianfra-t Aug 19, 2024
9514f40
compile sibling tests with emulator macros, fixing tests
gianfra-t Aug 19, 2024
b25abc0
fix all pen tests
gianfra-t Aug 19, 2024
b6f121f
fixing amplitude test
gianfra-t Aug 19, 2024
ab11b6f
integration tests stable
gianfra-t Aug 20, 2024
1bd8047
cleanup, solving features issue with pallet parachain system
gianfra-t Aug 20, 2024
00b5a9f
remove .txt files
gianfra-t Aug 21, 2024
4be1e9a
define storage version bump for bounties, staking
gianfra-t Aug 22, 2024
cc7d374
fix pallets mock runtimes
gianfra-t Aug 22, 2024
487b765
add patch to solve missing vrfs dependency and compile with newer nig…
gianfra-t Aug 22, 2024
1f266db
temporary remove flag
gianfra-t Aug 22, 2024
a342d92
allow deprecated flag
gianfra-t Aug 23, 2024
1606c9f
warnings and comment requests
gianfra-t Aug 26, 2024
9a0526a
more unused imports removal
gianfra-t Aug 26, 2024
5be0728
clippy fixes
gianfra-t Aug 26, 2024
2ce46a8
set inherent data provider closure to default
gianfra-t Aug 26, 2024
ccdcca9
add missing flag for eventual try-runtime command
gianfra-t Aug 26, 2024
e03041e
format nightly for latest changes
gianfra-t Aug 27, 2024
6a3f685
Revert "format nightly for latest changes"
gianfra-t Aug 27, 2024
44bbd06
generate weights for dia-oracle pallet
gianfra-t Aug 28, 2024
27dc016
use temporary spacewalk version with dia-oracle fix
gianfra-t Aug 29, 2024
2248cb3
re-introduce non local definition flag for clippy
gianfra-t Aug 29, 2024
57af166
use previous spacewalk revision
gianfra-t Aug 29, 2024
0dfa214
remove temporary dia-oracle fix branch
gianfra-t Aug 29, 2024
a8712ab
remove temp stellar sdk patch
gianfra-t Aug 29, 2024
f51fa62
Readme modification, nightly version used
gianfra-t Sep 3, 2024
422f4c2
clean comments and address review improvements
gianfra-t Sep 3, 2024
07db076
remove unused dependencies and imports
gianfra-t Sep 3, 2024
7f7d823
run fmt nightly
gianfra-t Sep 3, 2024
7f9d96d
move const outside macro definition
gianfra-t Sep 3, 2024
e37f5b2
fix bandersnatch parch url
gianfra-t Sep 10, 2024
79012a1
add benchmarkings (those not failed), modify config to use default we…
gianfra-t Sep 11, 2024
82ec7d3
Revert "add benchmarkings (those not failed), modify config to use de…
gianfra-t Sep 11, 2024
1d49c52
fix benchmark for orml-tokens-management, add benchmark helper script…
gianfra-t Sep 11, 2024
d186500
fix definition of weights in runtimes
gianfra-t Sep 11, 2024
96ba3db
run redeem benchmark after fix for ED
gianfra-t Sep 16, 2024
4e6924c
replace spacewalk rev latest
gianfra-t Sep 17, 2024
a6aecdf
use default values for pallet contracts
gianfra-t Sep 18, 2024
17aef86
Update pallets/vesting-manager/Cargo.toml
gianfra-t Sep 18, 2024
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
fix pallets mock runtimes
  • Loading branch information
gianfra-t committed Aug 22, 2024
commit cc7d3743c21fd742e8a668ac5fb2b9eb4428f26b
30 changes: 12 additions & 18 deletions pallets/orml-currencies-allowance-extension/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,26 @@ use orml_currencies::BasicCurrencyAdapter;
use orml_traits::parameter_type_with_key;
use sp_core::H256;
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
BuildStorage
};
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;

// Configure a mock runtime to test the pallet.
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Tokens: orml_tokens::{Pallet, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Event<T>},
Currencies: orml_currencies::{Pallet, Call},
TokenAllowance: token_allowance::{Pallet, Storage, Call, Event<T>},
pub enum Test {
System: frame_system,
Tokens: orml_tokens,
Balances: pallet_balances,
Currencies: orml_currencies,
TokenAllowance: token_allowance,
}
);

pub type AccountId = u64;
pub type Balance = u128;
pub type BlockNumber = u64;
pub type Index = u64;
pub type Nonce = u64;
pub type Amount = i64;
pub type CurrencyId = u64;

Expand All @@ -40,19 +35,18 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}
impl frame_system::Config for Test {
type Block = Block;
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = Index;
type BlockNumber = BlockNumber;
type Nonce = Nonce;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = TestEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
Expand Down Expand Up @@ -128,7 +122,7 @@ impl pallet_balances::Config for Test {
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ConstU32<1>;
type HoldIdentifier = RuntimeHoldReason;
type RuntimeHoldReason = RuntimeHoldReason;
}

impl orml_currencies::Config for Test {
Expand All @@ -148,7 +142,7 @@ pub struct ExtBuilder;

impl ExtBuilder {
pub fn build() -> sp_io::TestExternalities {
let storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let storage = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();

sp_io::TestExternalities::from(storage)
}
Expand Down
30 changes: 12 additions & 18 deletions pallets/orml-tokens-management-extension/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,34 @@ use crate::{
CurrencyIdCheck,
};
use frame_support::{
pallet_prelude::GenesisBuild,
parameter_types,
traits::{ConstU32, Everything},
};
use orml_currencies::BasicCurrencyAdapter;
use orml_traits::parameter_type_with_key;
use sp_core::{ConstU128, H256};
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
BuildStorage
};
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;

// Configure a mock runtime to test the pallet.
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
pub enum Test
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Tokens: orml_tokens::{Pallet, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Event<T>},
Currencies: orml_currencies::{Pallet, Call},
TokensExtension: orml_tokens_management_extension::{Pallet, Storage, Call, Event<T>},
System: frame_system,
Tokens: orml_tokens,
Balances: pallet_balances,
Currencies: orml_currencies,
TokensExtension: orml_tokens_management_extension,
}
);

pub type AccountId = u64;
pub type Balance = u128;
pub type BlockNumber = u64;
pub type Index = u64;
pub type Nonce = u64;
pub type Amount = i64;
pub type CurrencyId = u64;

Expand All @@ -44,19 +39,18 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}
impl frame_system::Config for Test {
type Block = Block;
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = Index;
type BlockNumber = BlockNumber;
type Nonce = Nonce;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = TestEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
Expand Down Expand Up @@ -131,7 +125,7 @@ impl pallet_balances::Config for Test {
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ConstU32<1>;
type HoldIdentifier = RuntimeHoldReason;
type RuntimeHoldReason = RuntimeHoldReason;
}

impl orml_currencies::Config for Test {
Expand Down Expand Up @@ -173,7 +167,7 @@ pub struct ExtBuilder;

impl ExtBuilder {
pub fn build() -> sp_io::TestExternalities {
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let mut storage = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();

let native_currency_id = GetNativeCurrencyId::get();

Expand Down
36 changes: 16 additions & 20 deletions pallets/parachain-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ use super::*;
use crate::{self as stake, types::NegativeImbalanceOf};
use frame_support::{
assert_ok, construct_runtime, parameter_types,
traits::{Currency, GenesisBuild, OnFinalize, OnInitialize, OnUnbalanced},
traits::{Currency, OnFinalize, OnInitialize, OnUnbalanced},
};
use pallet_authorship::EventHandler;
use sp_consensus_aura::sr25519::AuthorityId;
use sp_core::H256;
use sp_runtime::{
impl_opaque_keys,
testing::{Header, UintAuthorityId},
testing::UintAuthorityId,
traits::{BlakeTwo256, ConstU32, ConvertInto, IdentityLookup, OpaqueKeys},
Perbill, Perquintill,
BuildStorage
};
use sp_std::fmt::Debug;

pub(crate) type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
pub(crate) type Block = frame_system::mocking::MockBlock<Test>;
pub(crate) type Balance = u128;
pub(crate) type AccountId = u64;
Expand All @@ -50,17 +50,14 @@ pub(crate) const TREASURY_ACC: AccountId = u64::MAX;

// Configure a mock runtime to test the pallet.
construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
pub enum Test
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
Aura: pallet_aura::{Pallet, Storage},
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
StakePallet: stake::{Pallet, Call, Storage, Config<T>, Event<T>},
Authorship: pallet_authorship::{Pallet, Storage},
System: frame_system,
Balances: pallet_balances,
Aura: pallet_aura,
Session: pallet_session,
StakePallet: stake,
Authorship: pallet_authorship,
}
);

Expand All @@ -72,17 +69,16 @@ parameter_types! {
}

impl frame_system::Config for Test {
type Block = Block;
type BaseCallFilter = frame_support::traits::Everything;
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type BlockNumber = BlockNumber;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
Expand Down Expand Up @@ -114,13 +110,14 @@ impl pallet_balances::Config for Test {
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ConstU32<1>;
type HoldIdentifier = RuntimeHoldReason;
type RuntimeHoldReason = RuntimeHoldReason;
}

impl pallet_aura::Config for Test {
type AuthorityId = AuthorityId;
type DisabledValidators = ();
type MaxAuthorities = MaxCollatorCandidates;
type AllowMultipleBlocksPerSlot = ();
}

impl pallet_authorship::Config for Test {
Expand Down Expand Up @@ -177,7 +174,7 @@ impl Config for Test {
type NetworkRewardBeneficiary = ToBeneficiary;
type CollatorRewardRateDecay = CollatorRewardRateDecay;
type WeightInfo = ();
const BLOCKS_PER_YEAR: Self::BlockNumber = 5 * 60 * 24 * 36525 / 100;
const BLOCKS_PER_YEAR: BlockNumber = 5 * 60 * 24 * 36525 / 100;
}

impl_opaque_keys! {
Expand Down Expand Up @@ -294,8 +291,7 @@ impl ExtBuilder {
}

pub(crate) fn build(self) -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::default()
.build_storage::<Test>()
let mut t = frame_system::GenesisConfig::<Test>::default().build_storage()
.expect("Frame system builds valid default genesis config");

pallet_balances::GenesisConfig::<Test> { balances: self.balances.clone() }
Expand Down
34 changes: 12 additions & 22 deletions pallets/treasury-buyout-extension/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,37 @@ use crate::{
self as treasury_buyout_extension, default_weights::SubstrateWeight, Config, PriceGetter,
};
use frame_support::{
pallet_prelude::GenesisBuild,
parameter_types,
traits::{ConstU32, Everything},
};
use orml_currencies::BasicCurrencyAdapter;
use orml_traits::parameter_type_with_key;
use sp_arithmetic::{FixedPointNumber, FixedU128, Permill};
use sp_core::H256;
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup, One, Zero},
DispatchError,
};
use sp_runtime::{traits::{BlakeTwo256, IdentityLookup, One, Zero}, DispatchError, BuildStorage};
use sp_std::fmt::Debug;
use spacewalk_primitives::DecimalsLookup;

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;

pub const UNIT: Balance = 1_000_000_000_000;

// Configure a mock runtime to test the pallet.
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
pub enum Test
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Tokens: orml_tokens::{Pallet, Storage, Config<T>, Event<T>},
Balances: pallet_balances::{Pallet, Call, Storage, Event<T>},
Currencies: orml_currencies::{Pallet, Call},
TreasuryBuyoutExtension: treasury_buyout_extension::{Pallet, Storage, Call, Event<T>},
System: frame_system,
Tokens: orml_tokens,
Balances: pallet_balances,
Currencies: orml_currencies,
TreasuryBuyoutExtension: treasury_buyout_extension,
}
);

pub type AccountId = u64;
pub type Balance = u128;
pub type BlockNumber = u64;
pub type Index = u64;
pub type Nonce = u64;
pub type Amount = i64;
pub type CurrencyId = u64;

Expand All @@ -53,19 +44,18 @@ parameter_types! {
pub type TestEvent = RuntimeEvent;

impl frame_system::Config for Test {
type Block = Block;
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = Index;
type BlockNumber = BlockNumber;
type Nonce = Nonce;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = TestEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
Expand Down Expand Up @@ -144,7 +134,7 @@ impl pallet_balances::Config for Test {
type FreezeIdentifier = ();
type MaxFreezes = ();
type MaxHolds = ConstU32<1>;
type HoldIdentifier = RuntimeHoldReason;
type RuntimeHoldReason = RuntimeHoldReason;
}

impl orml_currencies::Config for Test {
Expand Down Expand Up @@ -227,7 +217,7 @@ pub struct ExtBuilder;

impl ExtBuilder {
pub fn build() -> sp_io::TestExternalities {
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
let mut storage = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();

let dot_currency_id = RelayChainCurrencyId::get();

Expand Down
2 changes: 1 addition & 1 deletion pallets/treasury-buyout-extension/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn get_free_balance(currency_id: CurrencyIdOf<Test>, account: &AccountId) -> Bal
<orml_currencies::Pallet<Test> as MultiCurrency<AccountId>>::free_balance(currency_id, account)
}

fn run_to_block(new_block: <Test as frame_system::Config>::BlockNumber) {
fn run_to_block(new_block: BlockNumber) {
frame_system::Pallet::<Test>::set_block_number(new_block);
}

Expand Down