Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0ad1976
parachains-runtime: Less cloning! (#6896)
bkchr Mar 16, 2023
0c2b037
update weights (#6897)
coderobe Mar 17, 2023
f209f5b
[Companion #13615] Keystore overhaul (#6892)
davxy Mar 17, 2023
b98c74c
Parachains should charge for proof size weight (#2326)
ggwpez Mar 17, 2023
a87983a
Bump serde from 1.0.152 to 1.0.156 (#2329)
dependabot[bot] Mar 19, 2023
1337a78
Improve build times by disabling wasm-builder in `no_std` (#2308)
bkchr Mar 20, 2023
776273b
Deprecate Currency: Companion for #12951 (#6780)
gavofyork Mar 20, 2023
706531e
tweak some pattern matches to address a new clippy warning
Mar 16, 2023
c453469
Deprecate Currency: Companion for #12951 (#2334)
gavofyork Mar 20, 2023
4464c05
Companion for substrate #13312: Rename `Deterministic` to `Enforce` (…
athei Mar 20, 2023
29bab97
NFTs 2.0 on Statemine (#2314)
jsidorenko Mar 21, 2023
9343daf
Introduce Fellowship into Collectives (#2186)
muharem Mar 21, 2023
5a77e8e
introduce new well known key (#6915)
slumber Mar 21, 2023
13fd619
Introduce OpenGov into Polkadot (#6701)
gavofyork Mar 21, 2023
3488d48
kusama: enable dispute slashes (#5974)
ordian Mar 21, 2023
d849af1
runtime/inclusion: fix availability_threshold (#6931)
ordian Mar 21, 2023
e351fe9
Vstam1/xcm admin origin (#6928)
vstam1 Mar 23, 2023
27b3dcf
XCM ExportMessage benchmark support (#6923)
acatangiu Mar 23, 2023
e4d2d76
Companion for polkadot#6928 (#2356)
vstam1 Mar 23, 2023
3c1b442
XCM V2 weight template (#2344)
ggwpez Mar 23, 2023
313c1e9
Add Support for Foreign Assets (#2133)
joepetrowski Mar 23, 2023
7d97cbc
Bump parity-scale-codec to v 3.4.0 (#6945)
tdimitrov Mar 23, 2023
7a8e110
Co #13637: Remove Weight::without_{ref_time, proof_size} (#2346)
ggwpez Mar 24, 2023
5677d96
inherent disputes: remove per block initializer and disputes timeout …
sandreim Mar 24, 2023
2f8ca72
Nomination Pools migration v5: RewardPool fix (#6957)
Mar 27, 2023
df55753
Proxy for Nomination Pools (#6846)
Ank4n Mar 27, 2023
0f29517
Bump scale-info from 2.3.1 to 2.4.0 (#2386)
dependabot[bot] Mar 28, 2023
9836fdc
Histogram support in runtime metrics (#6935)
tdimitrov Mar 28, 2023
ed62577
configuration: backport async backing parameters from the feature bra…
slumber Mar 28, 2023
3786ce3
Revert "Remove test-runtime"
ggwpez Mar 29, 2023
11e1884
Revert "Move Cumulus to root folder"
ggwpez Mar 29, 2023
644f0fc
Revert "Move Polkadot to root folder"
ggwpez Mar 29, 2023
7dbc5d7
Sync up Polkadot 21298c8a0f
ggwpez Mar 29, 2023
db82a46
Move Polkadot to root folder
ggwpez Mar 29, 2023
da71f03
Sync up Cumulus 559f3caa2b
ggwpez Mar 29, 2023
c20d627
Move Cumulus to root folder
ggwpez Mar 29, 2023
91db8df
Remove test-runtime
ggwpez Mar 22, 2023
a2febda
Fix intra-workspace deps
ggwpez Mar 29, 2023
2cd17e4
Update dependencies
ggwpez 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
887 changes: 543 additions & 344 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion relay/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition.workspace = true
[dependencies]
impl-trait-for-tuples = "0.2.2"
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "3.4.0", default-features = false, features = ["derive"] }
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion relay/common/slot_range_helper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition.workspace = true
[dependencies]
paste = "1.0"
enumn = "0.1.5"
parity-scale-codec = { version = "3.3.0", default-features = false, features = ["derive"] }
parity-scale-codec = { version = "3.4.0", default-features = false, features = ["derive"] }
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

Expand Down
4 changes: 4 additions & 0 deletions relay/common/src/assigned_slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,10 @@ mod tests {
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

impl parachains_configuration::Config for Test {
Expand Down
52 changes: 29 additions & 23 deletions relay/common/src/auctions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ mod tests {
assert_noop, assert_ok, assert_storage_noop,
dispatch::DispatchError::BadOrigin,
ord_parameter_types, parameter_types,
traits::{EitherOfDiverse, OnFinalize, OnInitialize},
traits::{ConstU32, EitherOfDiverse, OnFinalize, OnInitialize},
};
use frame_system::{EnsureRoot, EnsureSignedBy};
use pallet_balances;
Expand Down Expand Up @@ -748,6 +748,10 @@ mod tests {
type MaxLocks = ();
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Debug)]
Expand Down Expand Up @@ -1412,41 +1416,42 @@ mod tests {
let para_2 = ParaId::from(2_u32);

// Make a bid and reserve a balance
assert_ok!(Auctions::bid(RuntimeOrigin::signed(1), para_1, 1, 1, 4, 10));
assert_eq!(Balances::reserved_balance(1), 10);
assert_eq!(ReservedAmounts::<Test>::get((1, para_1)), Some(10));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(1), para_1, 1, 1, 4, 9));
assert_eq!(Balances::reserved_balance(1), 9);
assert_eq!(ReservedAmounts::<Test>::get((1, para_1)), Some(9));
assert_eq!(Balances::reserved_balance(2), 0);
assert_eq!(ReservedAmounts::<Test>::get((2, para_2)), None);

// Bigger bid, reserves new balance and returns funds
assert_ok!(Auctions::bid(RuntimeOrigin::signed(2), para_2, 1, 1, 4, 20));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(2), para_2, 1, 1, 4, 19));
assert_eq!(Balances::reserved_balance(1), 0);
assert_eq!(ReservedAmounts::<Test>::get((1, para_1)), None);
assert_eq!(Balances::reserved_balance(2), 20);
assert_eq!(ReservedAmounts::<Test>::get((2, para_2)), Some(20));
assert_eq!(Balances::reserved_balance(2), 19);
assert_eq!(ReservedAmounts::<Test>::get((2, para_2)), Some(19));
});
}

#[test]
fn initialize_winners_in_ending_period_works() {
new_test_ext().execute_with(|| {
assert_eq!(<Test as pallet_balances::Config>::ExistentialDeposit::get(), 1);
run_to_block(1);
assert_ok!(Auctions::new_auction(RuntimeOrigin::signed(6), 9, 1));
let para_1 = ParaId::from(1_u32);
let para_2 = ParaId::from(2_u32);
let para_3 = ParaId::from(3_u32);

// Make bids
assert_ok!(Auctions::bid(RuntimeOrigin::signed(1), para_1, 1, 1, 4, 10));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(2), para_2, 1, 3, 4, 20));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(1), para_1, 1, 1, 4, 9));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(2), para_2, 1, 3, 4, 19));

assert_eq!(
Auctions::auction_status(System::block_number()),
AuctionStatus::<u32>::StartingPeriod
);
let mut winning = [None; SlotRange::SLOT_RANGE_COUNT];
winning[SlotRange::ZeroThree as u8 as usize] = Some((1, para_1, 10));
winning[SlotRange::TwoThree as u8 as usize] = Some((2, para_2, 20));
winning[SlotRange::ZeroThree as u8 as usize] = Some((1, para_1, 9));
winning[SlotRange::TwoThree as u8 as usize] = Some((2, para_2, 19));
assert_eq!(Auctions::winning(0), Some(winning));

run_to_block(9);
Expand All @@ -1468,14 +1473,14 @@ mod tests {
AuctionStatus::<u32>::EndingPeriod(1, 0)
);
assert_eq!(Auctions::winning(1), Some(winning));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(3), para_3, 1, 3, 4, 30));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(3), para_3, 1, 3, 4, 29));

run_to_block(12);
assert_eq!(
Auctions::auction_status(System::block_number()),
AuctionStatus::<u32>::EndingPeriod(2, 0)
);
winning[SlotRange::TwoThree as u8 as usize] = Some((3, para_3, 30));
winning[SlotRange::TwoThree as u8 as usize] = Some((3, para_3, 29));
assert_eq!(Auctions::winning(2), Some(winning));
});
}
Expand Down Expand Up @@ -1542,6 +1547,7 @@ mod tests {
#[test]
fn less_winning_samples_work() {
new_test_ext().execute_with(|| {
assert_eq!(<Test as pallet_balances::Config>::ExistentialDeposit::get(), 1);
EndingPeriod::set(30);
SampleLength::set(10);

Expand All @@ -1552,16 +1558,16 @@ mod tests {
let para_3 = ParaId::from(3_u32);

// Make bids
assert_ok!(Auctions::bid(RuntimeOrigin::signed(1), para_1, 1, 11, 14, 10));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(2), para_2, 1, 13, 14, 20));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(1), para_1, 1, 11, 14, 9));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(2), para_2, 1, 13, 14, 19));

assert_eq!(
Auctions::auction_status(System::block_number()),
AuctionStatus::<u32>::StartingPeriod
);
let mut winning = [None; SlotRange::SLOT_RANGE_COUNT];
winning[SlotRange::ZeroThree as u8 as usize] = Some((1, para_1, 10));
winning[SlotRange::TwoThree as u8 as usize] = Some((2, para_2, 20));
winning[SlotRange::ZeroThree as u8 as usize] = Some((1, para_1, 9));
winning[SlotRange::TwoThree as u8 as usize] = Some((2, para_2, 19));
assert_eq!(Auctions::winning(0), Some(winning));

run_to_block(9);
Expand All @@ -1578,8 +1584,8 @@ mod tests {
assert_eq!(Auctions::winning(0), Some(winning));

// New bids update the current winning
assert_ok!(Auctions::bid(RuntimeOrigin::signed(3), para_3, 1, 14, 14, 30));
winning[SlotRange::ThreeThree as u8 as usize] = Some((3, para_3, 30));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(3), para_3, 1, 14, 14, 29));
winning[SlotRange::ThreeThree as u8 as usize] = Some((3, para_3, 29));
assert_eq!(Auctions::winning(0), Some(winning));

run_to_block(20);
Expand All @@ -1590,8 +1596,8 @@ mod tests {
assert_eq!(Auctions::winning(1), Some(winning));
run_to_block(25);
// Overbid mid sample
assert_ok!(Auctions::bid(RuntimeOrigin::signed(3), para_3, 1, 13, 14, 30));
winning[SlotRange::TwoThree as u8 as usize] = Some((3, para_3, 30));
assert_ok!(Auctions::bid(RuntimeOrigin::signed(3), para_3, 1, 13, 14, 29));
winning[SlotRange::TwoThree as u8 as usize] = Some((3, para_3, 29));
assert_eq!(Auctions::winning(1), Some(winning));

run_to_block(30);
Expand All @@ -1611,8 +1617,8 @@ mod tests {
assert_eq!(
leases(),
vec![
((3.into(), 13), LeaseData { leaser: 3, amount: 30 }),
((3.into(), 14), LeaseData { leaser: 3, amount: 30 }),
((3.into(), 13), LeaseData { leaser: 3, amount: 29 }),
((3.into(), 14), LeaseData { leaser: 3, amount: 29 }),
]
);
});
Expand Down
13 changes: 9 additions & 4 deletions relay/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,14 @@ mod tests {
assert_err, assert_noop, assert_ok,
dispatch::{DispatchError::BadOrigin, GetDispatchInfo, Pays},
ord_parameter_types, parameter_types,
traits::{ExistenceRequirement, GenesisBuild, WithdrawReasons},
traits::{ConstU32, ExistenceRequirement, GenesisBuild, WithdrawReasons},
};
use pallet_balances;
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, Identity, IdentityLookup},
transaction_validity::TransactionLongevity,
TokenError,
};

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
Expand Down Expand Up @@ -786,6 +787,10 @@ mod tests {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

parameter_types! {
Expand Down Expand Up @@ -1206,7 +1211,7 @@ mod tests {
180,
ExistenceRequirement::AllowDeath
),
pallet_balances::Error::<Test, _>::LiquidityRestrictions,
TokenError::Frozen,
);
});
}
Expand Down Expand Up @@ -1294,15 +1299,15 @@ mod tests {
#[test]
fn claiming_while_vested_doesnt_work() {
new_test_ext().execute_with(|| {
CurrencyOf::<Test>::make_free_balance_be(&69, total_claims());
assert_eq!(Balances::free_balance(69), total_claims());
// A user is already vested
assert_ok!(<Test as Config>::VestingSchedule::add_vesting_schedule(
&69,
total_claims(),
100,
10
));
CurrencyOf::<Test>::make_free_balance_be(&69, total_claims());
assert_eq!(Balances::free_balance(69), total_claims());
assert_ok!(Claims::mint_claim(
RuntimeOrigin::root(),
eth(&bob()),
Expand Down
22 changes: 15 additions & 7 deletions relay/common/src/crowdloan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ pub mod pallet {

let deposit = T::SubmissionDeposit::get();

frame_system::Pallet::<T>::inc_providers(&Self::fund_account_id(fund_index));
CurrencyOf::<T>::reserve(&depositor, deposit)?;

Funds::<T>::insert(
Expand Down Expand Up @@ -575,6 +576,7 @@ pub mod pallet {
// can take care of that.
debug_assert!(Self::contribution_iterator(fund.fund_index).count().is_zero());

frame_system::Pallet::<T>::dec_providers(&Self::fund_account_id(fund.fund_index))?;
CurrencyOf::<T>::unreserve(&fund.depositor, fund.deposit);
Funds::<T>::remove(index);
Self::deposit_event(Event::<T>::Dissolved { para_id: index });
Expand Down Expand Up @@ -861,7 +863,7 @@ mod tests {

use frame_support::{
assert_noop, assert_ok, parameter_types,
traits::{OnFinalize, OnInitialize},
traits::{ConstU32, OnFinalize, OnInitialize},
};
use primitives::Id as ParaId;
use sp_core::H256;
Expand All @@ -874,7 +876,7 @@ mod tests {
traits::{AuctionStatus, OnSwap},
};
use ::test_helpers::{dummy_head_data, dummy_validation_code};
use sp_keystore::{testing::KeyStore, KeystoreExt};
use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup, TrailingZeroInput},
Expand Down Expand Up @@ -943,6 +945,10 @@ mod tests {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

#[derive(Copy, Clone, Eq, PartialEq, Debug)]
Expand Down Expand Up @@ -987,9 +993,10 @@ mod tests {
let fund = Funds::<Test>::get(para).unwrap();
let account_id = Crowdloan::fund_account_id(fund.fund_index);
if winner {
let ed = <Test as pallet_balances::Config>::ExistentialDeposit::get();
let free_balance = Balances::free_balance(&account_id);
Balances::reserve(&account_id, free_balance)
.expect("should be able to reserve free balance");
Balances::reserve(&account_id, free_balance - ed)
.expect("should be able to reserve free balance minus ED");
} else {
let reserved_balance = Balances::reserved_balance(&account_id);
Balances::unreserve(&account_id, reserved_balance);
Expand Down Expand Up @@ -1109,7 +1116,7 @@ mod tests {
}
.assimilate_storage(&mut t)
.unwrap();
let keystore = KeyStore::new();
let keystore = MemoryKeystore::new();
let mut t: sp_io::TestExternalities = t.into();
t.register_extension(KeystoreExt(Arc::new(keystore)));
t
Expand Down Expand Up @@ -1613,7 +1620,7 @@ mod tests {
let account_id = Crowdloan::fund_account_id(index);

// user sends the crowdloan funds trying to make an accounting error
assert_ok!(Balances::transfer(RuntimeOrigin::signed(1), account_id, 10));
assert_ok!(Balances::transfer_allow_death(RuntimeOrigin::signed(1), account_id, 10));

// overfunded now
assert_eq!(Balances::free_balance(&account_id), 110);
Expand Down Expand Up @@ -1782,6 +1789,7 @@ mod tests {
#[test]
fn withdraw_from_finished_works() {
new_test_ext().execute_with(|| {
assert_eq!(<Test as pallet_balances::Config>::ExistentialDeposit::get(), 1);
let para = new_para();
let index = NextFundIndex::<Test>::get();
let account_id = Crowdloan::fund_account_id(index);
Expand All @@ -1793,7 +1801,7 @@ mod tests {
assert_ok!(Crowdloan::contribute(RuntimeOrigin::signed(2), para, 100, None));
assert_ok!(Crowdloan::contribute(RuntimeOrigin::signed(3), para, 50, None));
// simulate the reserving of para's funds. this actually happens in the Slots pallet.
assert_ok!(Balances::reserve(&account_id, 150));
assert_ok!(Balances::reserve(&account_id, 149));

run_to_block(19);
assert_noop!(
Expand Down
14 changes: 11 additions & 3 deletions relay/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,15 @@ pub fn era_payout(
mod tests {
use super::*;
use frame_support::{
dispatch::DispatchClass, parameter_types, traits::FindAuthor, weights::Weight, PalletId,
dispatch::DispatchClass,
parameter_types,
traits::{ConstU32, FindAuthor},
weights::Weight,
PalletId,
};
use frame_system::limits;
use primitives::AccountId;
use sp_core::H256;
use sp_core::{ConstU64, H256};
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
Expand Down Expand Up @@ -176,12 +180,16 @@ mod tests {
type Balance = u64;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ();
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
type HoldIdentifier = ();
type FreezeIdentifier = ();
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<1>;
}

parameter_types! {
Expand Down
Loading