Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Changed

- Apply patch for stable2409-6 ([polkadot-fellows/runtimes/pull/623](https://github.com/polkadot-fellows/runtimes/pull/623))
- Disable MBM migrations for all runtimes for check-migrations CI ([polkadot-fellows/runtimes/pull/590](https://github.com/polkadot-fellows/runtimes/pull/590))
- chain-spec-generator supports conditional building (`--no-default-features --features <runtime>` or `--no-default-features --features all-runtimes` or
`--no-default-features --features all-polkadot` or `--no-default-features --features all-kusama`)([polkadot-fellows/runtimes/pull/637](https://github.com/polkadot-fellows/runtimes/pull/637))
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/emulated/helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ macro_rules! test_relay_is_trusted_teleporter {
type OriginCaller = <$sender_relay as Chain>::OriginCaller;

let origin = OriginCaller::system(RawOrigin::Signed(sender.clone()));
let result = Runtime::dry_run_call(origin, call.clone(), 5).unwrap();
let result = Runtime::dry_run_call(origin, call.clone(), xcm::prelude::XCM_VERSION).unwrap();
// We filter the result to get only the messages we are interested in.
let (destination_to_query, messages_to_query) = &result
.forwarded_xcms
Expand Down Expand Up @@ -206,7 +206,7 @@ macro_rules! test_parachain_is_trusted_teleporter_for_relay {
type OriginCaller = <$sender_para as Chain>::OriginCaller;

let origin = OriginCaller::system(RawOrigin::Signed(sender.clone()));
let result = Runtime::dry_run_call(origin, call.clone(), 5).unwrap();
let result = Runtime::dry_run_call(origin, call.clone(), xcm::prelude::XCM_VERSION).unwrap();
// We filter the result to get only the messages we are interested in.
let (destination_to_query, messages_to_query) = &result
.forwarded_xcms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn multi_hop_works() {

let call = transfer_assets_para_to_para_through_ah_call(test.clone());
let origin = OriginCaller::system(RawOrigin::Signed(sender.clone()));
let result = Runtime::dry_run_call(origin, call, 5).unwrap();
let result = Runtime::dry_run_call(origin, call, xcm::prelude::XCM_VERSION).unwrap();
// We filter the result to get only the messages we are interested in.
let (destination_to_query, messages_to_query) = &result
.forwarded_xcms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn multi_hop_works() {

let call = transfer_assets_para_to_para_through_ah_call(test.clone());
let origin = OriginCaller::system(RawOrigin::Signed(sender.clone()));
let result = Runtime::dry_run_call(origin, call, 5).unwrap();
let result = Runtime::dry_run_call(origin, call, xcm::prelude::XCM_VERSION).unwrap();
// We filter the result to get only the messages we are interested in.
let (destination_to_query, messages_to_query) = &result
.forwarded_xcms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use integration_tests_helpers::{
test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter,
};
use xcm_runtime_apis::{
dry_run::runtime_decl_for_dry_run_api::DryRunApi,
dry_run::runtime_decl_for_dry_run_api::DryRunApiV2,
fees::runtime_decl_for_xcm_payment_api::XcmPaymentApiV1,
};

Expand Down
70 changes: 63 additions & 7 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ use frame_support::{
traits::{
fungible::HoldConsideration,
tokens::{imbalance::ResolveTo, UnityOrOuterConversion},
ConstU32, ConstU8, EitherOf, EitherOfDiverse, Everything, FromContains, InstanceFilter,
KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError,
StorageMapShim, WithdrawReasons,
ConstU32, ConstU8, Contains, EitherOf, EitherOfDiverse, Everything, FromContains,
InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage,
ProcessMessageError, StorageMapShim, WithdrawReasons,
},
weights::{ConstantMultiplier, WeightMeter, WeightToFee as _},
PalletId,
Expand Down Expand Up @@ -838,8 +838,9 @@ impl pallet_staking::Config for Runtime {
type EventListeners = (NominationPools, DelegatedStaking);
type DisablingStrategy = pallet_staking::UpToLimitDisablingStrategy;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;

fn filter(who: &Self::AccountId) -> bool {
// TODO: this will come back later (stable25XY)
// type Filter = pallet_nomination_pools::AllPoolMembers<Runtime>;
fn filter(who: &AccountId) -> bool {
pallet_nomination_pools::AllPoolMembers::<Runtime>::contains(who)
}
}
Expand Down Expand Up @@ -876,7 +877,7 @@ parameter_types! {
pub const MaxPeerInHeartbeats: u32 = 10_000;
}

use frame_support::traits::{Contains, Currency, OnUnbalanced};
use frame_support::traits::{Currency, OnUnbalanced};

pub type BalancesNegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;
pub struct TreasuryBurnHandler;
Expand Down Expand Up @@ -1706,6 +1707,8 @@ impl pallet_nomination_pools::Config for Runtime {
type PalletId = PoolsPalletId;
type MaxPointsToBalance = MaxPointsToBalance;
type AdminOrigin = EitherOf<EnsureRoot<AccountId>, StakingAdmin>;
// TODO: this will come back later (stable25XY)
// type Filter = pallet_staking::AllStakers<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -2785,7 +2788,7 @@ sp_api::impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: XcmVersion
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
XcmPallet::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down Expand Up @@ -3085,6 +3088,59 @@ mod multiplier_tests {
}
}

#[cfg(test)]
mod staking_tests {
use super::*;
use frame_support::{assert_noop, assert_ok, traits::fungible::Mutate};

#[test]
fn accounts_cannot_dual_stake() {
let mut ext = sp_io::TestExternalities::new_empty();
ext.execute_with(|| {
let stake = ExistentialDeposit::get() * 10;
// Given a solo staker
let solo_staker = AccountId::from([1u8; 32]);
Balances::set_balance(&solo_staker, 3 * stake);
assert_ok!(Staking::bond(
RuntimeOrigin::signed(solo_staker.clone()),
stake,
pallet_staking::RewardDestination::Stash
));

// And a pooled staker
let pooled_staker = AccountId::from([2u8; 32]);
Balances::set_balance(&pooled_staker, 3 * stake);
assert_ok!(NominationPools::create(
RuntimeOrigin::signed(pooled_staker.clone()),
stake,
pooled_staker.clone().into(),
pooled_staker.clone().into(),
pooled_staker.clone().into()
));

// Then the solo staker cannot join a pool.
assert_noop!(
NominationPools::join(RuntimeOrigin::signed(solo_staker), stake, 1),
// Note: with sdk stable2503 onwards, this error would be
// `pallet_nomination_pools::Error::<Runtime>::Restricted`
pallet_delegated_staking::Error::<Runtime>::AlreadyStaking
);

// And the pooled staker cannot solo-stake.
assert_noop!(
pallet_staking::Pallet::<Runtime>::bond(
RuntimeOrigin::signed(pooled_staker),
stake,
pallet_staking::RewardDestination::Stash,
),
// Note: with sdk stable2503 onwards, this error would be
// `pallet_staking::Error::<Runtime>::Restricted`.
pallet_staking::Error::<Runtime>::BoundNotMet
);
});
}
}

#[cfg(all(test, feature = "try-runtime"))]
mod remote_tests {
use super::*;
Expand Down
65 changes: 62 additions & 3 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,9 @@ impl pallet_staking::Config for Runtime {
type EventListeners = (NominationPools, DelegatedStaking);
type DisablingStrategy = pallet_staking::UpToLimitDisablingStrategy;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;

fn filter(who: &Self::AccountId) -> bool {
// TODO: this will come back later (stable25XY)
// type Filter = pallet_nomination_pools::AllPoolMembers<Runtime>;
fn filter(who: &AccountId) -> bool {
pallet_nomination_pools::AllPoolMembers::<Runtime>::contains(who)
}
}
Expand Down Expand Up @@ -1463,6 +1464,8 @@ impl pallet_nomination_pools::Config for Runtime {
type MaxPointsToBalance = MaxPointsToBalance;
type WeightInfo = weights::pallet_nomination_pools::WeightInfo<Self>;
type AdminOrigin = EitherOf<EnsureRoot<AccountId>, StakingAdmin>;
// TODO: this will come back later (stable25XY)
// type Filter = pallet_staking::AllStakers<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -2596,7 +2599,11 @@ sp_api::impl_runtime_apis! {
}

impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
fn dry_run_call(origin: OriginCaller, call: RuntimeCall, result_xcms_version: XcmVersion) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
XcmPallet::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}

Expand Down Expand Up @@ -3140,6 +3147,58 @@ mod multiplier_tests {
}
}

#[cfg(test)]
mod staking_tests {
use super::*;
use frame_support::{assert_noop, assert_ok, traits::fungible::Mutate};
#[test]
fn accounts_cannot_dual_stake() {
let mut ext = sp_io::TestExternalities::new_empty();
ext.execute_with(|| {
let stake = ExistentialDeposit::get() * 10;
// Given a solo staker
let solo_staker = AccountId::from([1u8; 32]);
Balances::set_balance(&solo_staker, 3 * stake);
assert_ok!(Staking::bond(
RuntimeOrigin::signed(solo_staker.clone()),
stake,
pallet_staking::RewardDestination::Stash
));

// And a pooled staker
let pooled_staker = AccountId::from([2u8; 32]);
Balances::set_balance(&pooled_staker, 3 * stake);
assert_ok!(NominationPools::create(
RuntimeOrigin::signed(pooled_staker.clone()),
stake,
pooled_staker.clone().into(),
pooled_staker.clone().into(),
pooled_staker.clone().into()
));

// Then the solo staker cannot join a pool.
assert_noop!(
NominationPools::join(RuntimeOrigin::signed(solo_staker), stake, 1),
// Note: with sdk stable2503 onwards, this error would be
// `pallet_nomination_pools::Error::<Runtime>::Restricted`
pallet_delegated_staking::Error::<Runtime>::AlreadyStaking
);

// And the pooled staker cannot solo-stake.
assert_noop!(
pallet_staking::Pallet::<Runtime>::bond(
RuntimeOrigin::signed(pooled_staker),
stake,
pallet_staking::RewardDestination::Stash,
),
// Note: with sdk stable2503 onwards, this error would be
// `pallet_staking::Error::<Runtime>::Restricted`.
pallet_staking::Error::<Runtime>::BoundNotMet
);
});
}
}

#[cfg(all(test, feature = "try-runtime"))]
mod remote_tests {
use super::*;
Expand Down
4 changes: 2 additions & 2 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ use system_parachains_constants::{
};
use xcm::{
latest::prelude::{AssetId, BodyId},
VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
Version as XcmVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_config::{
FellowshipLocation, ForeignAssetsConvertedConcreteId, ForeignCreatorsSovereignAccountOf,
Expand Down Expand Up @@ -1741,7 +1741,7 @@ impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: xcm::prelude::XcmVersion,
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down
5 changes: 2 additions & 3 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ use system_parachains_constants::{
};
use xcm::{
latest::prelude::{AssetId, BodyId},
VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
Version as XcmVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_config::{
DotLocation, DotLocationV4, FellowshipLocation, ForeignAssetsConvertedConcreteId,
Expand All @@ -141,7 +141,6 @@ pub use sp_runtime::BuildStorage;
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
use xcm::prelude::XcmVersion;

impl_opaque_keys! {
pub struct SessionKeys {
Expand Down Expand Up @@ -1681,7 +1680,7 @@ impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: XcmVersion
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down
2 changes: 1 addition & 1 deletion system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: xcm::prelude::XcmVersion,
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ parameter_types! {
},
electra: Fork {
version: [5, 0, 0, 0], // 0x05000000
epoch: 500000,
epoch: 5000000, // TODO: Clara - 500000 vs 5000000?
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: xcm::prelude::XcmVersion,
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: xcm::prelude::XcmVersion,
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down
2 changes: 1 addition & 1 deletion system-parachains/coretime/coretime-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: xcm::prelude::XcmVersion,
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down
2 changes: 1 addition & 1 deletion system-parachains/coretime/coretime-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: xcm::prelude::XcmVersion,
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down
4 changes: 2 additions & 2 deletions system-parachains/encointer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ use system_parachains_constants::kusama::{consensus::*, currency::*, fee::Weight
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
use xcm::{
latest::prelude::{AssetId as XcmAssetId, BodyId},
VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
Version as XcmVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_runtime_apis::{
dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
Expand Down Expand Up @@ -1216,7 +1216,7 @@ impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: xcm::prelude::XcmVersion,
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down
4 changes: 2 additions & 2 deletions system-parachains/people/people-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ use system_parachains_constants::kusama::{
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
use xcm::{
latest::prelude::{AssetId, BodyId},
VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
Version as XcmVersion, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_config::{
FellowshipLocation, GovernanceLocation, PriceForSiblingParachainDelivery, StakingPot,
Expand Down Expand Up @@ -986,7 +986,7 @@ impl_runtime_apis! {
fn dry_run_call(
origin: OriginCaller,
call: RuntimeCall,
result_xcms_version: xcm::prelude::XcmVersion,
result_xcms_version: XcmVersion,
) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
}
Expand Down
Loading
Loading