diff --git a/CHANGELOG.md b/CHANGELOG.md index de936eda79..6d6753b216 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ` 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)) diff --git a/integration-tests/emulated/helpers/src/lib.rs b/integration-tests/emulated/helpers/src/lib.rs index b2f0359ca7..2790e6485d 100644 --- a/integration-tests/emulated/helpers/src/lib.rs +++ b/integration-tests/emulated/helpers/src/lib.rs @@ -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 @@ -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 diff --git a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs index 1618c6c52b..bb76134bba 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-kusama/src/tests/xcm_fee_estimation.rs @@ -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 diff --git a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs index 38049c4ceb..be694aea5a 100644 --- a/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs +++ b/integration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/xcm_fee_estimation.rs @@ -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 diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs index 1c054e0ae6..22f3772359 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/tests/teleport.rs @@ -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, }; diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 8f3b28a165..2a050cfad9 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -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, @@ -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; - - fn filter(who: &Self::AccountId) -> bool { + // TODO: this will come back later (stable25XY) + // type Filter = pallet_nomination_pools::AllPoolMembers; + fn filter(who: &AccountId) -> bool { pallet_nomination_pools::AllPoolMembers::::contains(who) } } @@ -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 = >::NegativeImbalance; pub struct TreasuryBurnHandler; @@ -1706,6 +1707,8 @@ impl pallet_nomination_pools::Config for Runtime { type PalletId = PoolsPalletId; type MaxPointsToBalance = MaxPointsToBalance; type AdminOrigin = EitherOf, StakingAdmin>; + // TODO: this will come back later (stable25XY) + // type Filter = pallet_staking::AllStakers; } parameter_types! { @@ -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, XcmDryRunApiError> { XcmPallet::dry_run_call::(origin, call, result_xcms_version) } @@ -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::::Restricted` + pallet_delegated_staking::Error::::AlreadyStaking + ); + + // And the pooled staker cannot solo-stake. + assert_noop!( + pallet_staking::Pallet::::bond( + RuntimeOrigin::signed(pooled_staker), + stake, + pallet_staking::RewardDestination::Stash, + ), + // Note: with sdk stable2503 onwards, this error would be + // `pallet_staking::Error::::Restricted`. + pallet_staking::Error::::BoundNotMet + ); + }); + } +} + #[cfg(all(test, feature = "try-runtime"))] mod remote_tests { use super::*; diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index e0311b8bd2..6704cd214e 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -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; - - fn filter(who: &Self::AccountId) -> bool { + // TODO: this will come back later (stable25XY) + // type Filter = pallet_nomination_pools::AllPoolMembers; + fn filter(who: &AccountId) -> bool { pallet_nomination_pools::AllPoolMembers::::contains(who) } } @@ -1463,6 +1464,8 @@ impl pallet_nomination_pools::Config for Runtime { type MaxPointsToBalance = MaxPointsToBalance; type WeightInfo = weights::pallet_nomination_pools::WeightInfo; type AdminOrigin = EitherOf, StakingAdmin>; + // TODO: this will come back later (stable25XY) + // type Filter = pallet_staking::AllStakers; } parameter_types! { @@ -2596,7 +2599,11 @@ sp_api::impl_runtime_apis! { } impl xcm_runtime_apis::dry_run::DryRunApi for Runtime { - fn dry_run_call(origin: OriginCaller, call: RuntimeCall, result_xcms_version: XcmVersion) -> Result, XcmDryRunApiError> { + fn dry_run_call( + origin: OriginCaller, + call: RuntimeCall, + result_xcms_version: XcmVersion, + ) -> Result, XcmDryRunApiError> { XcmPallet::dry_run_call::(origin, call, result_xcms_version) } @@ -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::::Restricted` + pallet_delegated_staking::Error::::AlreadyStaking + ); + + // And the pooled staker cannot solo-stake. + assert_noop!( + pallet_staking::Pallet::::bond( + RuntimeOrigin::signed(pooled_staker), + stake, + pallet_staking::RewardDestination::Stash, + ), + // Note: with sdk stable2503 onwards, this error would be + // `pallet_staking::Error::::Restricted`. + pallet_staking::Error::::BoundNotMet + ); + }); + } +} + #[cfg(all(test, feature = "try-runtime"))] mod remote_tests { use super::*; diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index 8a8c744fd9..2fa4538b03 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -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, @@ -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, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) } diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index 74b1f8b0ea..6ed2ee82bf 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -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, @@ -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 { @@ -1681,7 +1680,7 @@ impl_runtime_apis! { fn dry_run_call( origin: OriginCaller, call: RuntimeCall, - result_xcms_version: XcmVersion + result_xcms_version: XcmVersion, ) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) } diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs index 2b0f1b4606..1acbe2cbe5 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -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, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) } diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_ethereum_config.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_ethereum_config.rs index 6a233bc08a..3c24e247c1 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_ethereum_config.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/bridge_to_ethereum_config.rs @@ -148,7 +148,7 @@ parameter_types! { }, electra: Fork { version: [5, 0, 0, 0], // 0x05000000 - epoch: 500000, + epoch: 5000000, // TODO: Clara - 500000 vs 5000000? } }; } diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index f7afa62e42..824e761b44 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -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, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) } diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index 4fa57afd34..48e0b6c263 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -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, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) } diff --git a/system-parachains/coretime/coretime-kusama/src/lib.rs b/system-parachains/coretime/coretime-kusama/src/lib.rs index acc1c63f4b..8d6e0edd91 100644 --- a/system-parachains/coretime/coretime-kusama/src/lib.rs +++ b/system-parachains/coretime/coretime-kusama/src/lib.rs @@ -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, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) } diff --git a/system-parachains/coretime/coretime-polkadot/src/lib.rs b/system-parachains/coretime/coretime-polkadot/src/lib.rs index b1107f4ab9..ccc6b29a20 100644 --- a/system-parachains/coretime/coretime-polkadot/src/lib.rs +++ b/system-parachains/coretime/coretime-polkadot/src/lib.rs @@ -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, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) } diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index dec201c0ee..a6beeefe64 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -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}, @@ -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, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) } diff --git a/system-parachains/people/people-kusama/src/lib.rs b/system-parachains/people/people-kusama/src/lib.rs index f2beae334e..8a725a35b2 100644 --- a/system-parachains/people/people-kusama/src/lib.rs +++ b/system-parachains/people/people-kusama/src/lib.rs @@ -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, @@ -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, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) } diff --git a/system-parachains/people/people-polkadot/src/lib.rs b/system-parachains/people/people-polkadot/src/lib.rs index d910e4de98..5bf0f72b99 100644 --- a/system-parachains/people/people-polkadot/src/lib.rs +++ b/system-parachains/people/people-polkadot/src/lib.rs @@ -74,7 +74,7 @@ use system_parachains_constants::polkadot::{consensus::*, currency::*, fee::Weig 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, @@ -946,7 +946,7 @@ impl_runtime_apis! { fn dry_run_call( origin: OriginCaller, call: RuntimeCall, - result_xcms_version: xcm::prelude::XcmVersion, + result_xcms_version: XcmVersion ) -> Result, XcmDryRunApiError> { PolkadotXcm::dry_run_call::(origin, call, result_xcms_version) }