Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
82f9339
allow and test staking-async xcm messages to be splitted
kianenigma May 5, 2025
2d0f7be
Update substrate/frame/staking-async/runtimes/parachain/src/staking.rs
kianenigma May 5, 2025
6da3b99
Update substrate/frame/staking-async/runtimes/parachain/src/staking.rs
kianenigma May 5, 2025
03ace80
Apply suggestions from code review
kianenigma May 5, 2025
35b8e05
Merge branch 'master' of github.com:paritytech/polkadot-sdk into kiz-…
kianenigma May 5, 2025
ee701f5
fmt
kianenigma May 5, 2025
669ef3e
Update from github-actions[bot] running command 'prdoc --bump minor'
github-actions[bot] May 5, 2025
88096fd
small fixes, waiting for 8409 to be merged
kianenigma May 5, 2025
cca3008
Merge branch 'master' of github.com:paritytech/polkadot-sdk into kiz-…
kianenigma May 14, 2025
b82ea6c
make paged solution unbounded -- but not tested yet with ZN, it shoul…
kianenigma May 14, 2025
9c1c6f4
ErasClaimedRewards -> ClaimedRewards
kianenigma May 20, 2025
d5de81c
fix epmb solution duplicate issue + add remote mining apparatus to epm
kianenigma May 20, 2025
1e98f35
Master.into()
kianenigma May 20, 2025
641015f
feature-gate it
kianenigma May 20, 2025
1c24d17
fix test ordering
kianenigma May 21, 2025
10a0869
fmt
kianenigma May 21, 2025
d70ba72
refactor XCM stuff
kianenigma May 22, 2025
6a682fc
Master.into()
kianenigma May 22, 2025
971b9e9
add Justfile
kianenigma May 22, 2025
8b79b0a
clippy
kianenigma May 22, 2025
1325913
taplo
kianenigma May 22, 2025
f9f7995
make names be like westend
kianenigma May 27, 2025
75c7dae
Update prdoc/pr_8422.prdoc
kianenigma May 29, 2025
11aa855
Update prdoc/pr_8422.prdoc
kianenigma May 29, 2025
35683a9
small improvement in chunk_size
kianenigma May 29, 2025
d54db21
Merge branch 'master' of github.com:paritytech/polkadot-sdk into kiz-…
kianenigma May 29, 2025
d2b84df
fmt
kianenigma May 29, 2025
3451ade
Merge branch 'kiz-staking-async-xcm-weight' of github.com:paritytech/…
kianenigma May 29, 2025
c3d0a8f
zepter
kianenigma May 29, 2025
3d2e865
fix prdoc
kianenigma May 29, 2025
9ab18e7
taplo
kianenigma May 29, 2025
c161aeb
staking-async: rename relay and parachain version runtimes
sigurpol May 30, 2025
caf5024
rename SessionsPerEra back
kianenigma May 30, 2025
0c266f6
prdoc
kianenigma May 30, 2025
83586c9
Merge branch 'master' of github.com:paritytech/polkadot-sdk into kiz-…
kianenigma May 30, 2025
0ea8d91
taplo
kianenigma May 30, 2025
e9ed85d
fmt
kianenigma May 30, 2025
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
9 changes: 9 additions & 0 deletions cumulus/pallets/parachain-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,15 @@ impl<T: Config> UpwardMessageSender for Pallet<T> {
fn send_upward_message(message: UpwardMessage) -> Result<(u32, XcmHash), MessageSendError> {
Self::send_upward_message(message)
}

fn check_size(size: usize) -> Result<(), ()> {
let cfg = HostConfiguration::<T>::get().ok_or(())?;
if size > cfg.max_upward_message_size as usize {
Err(())
} else {
Ok(())
}
}
}

impl<T: Config> InspectMessageQueues for Pallet<T> {
Expand Down
8 changes: 8 additions & 0 deletions cumulus/primitives/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,19 @@ pub trait UpwardMessageSender {
/// be dispatched or an error if the message cannot be sent.
/// return the hash of the message sent
fn send_upward_message(msg: UpwardMessage) -> Result<(u32, XcmHash), MessageSendError>;

/// Check whether the message size is acceptable for the channel.
fn check_size(size: usize) -> Result<(), ()>;
}

impl UpwardMessageSender for () {
fn send_upward_message(_msg: UpwardMessage) -> Result<(u32, XcmHash), MessageSendError> {
Err(MessageSendError::NoChannel)
}

fn check_size(_size: usize) -> Result<(), ()> {
Err(())
}
}

/// The status of a channel.
Expand Down
3 changes: 3 additions & 0 deletions cumulus/primitives/utility/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ where
.map_err(|()| SendError::ExceedsMaxMessageSize)?;
let data = versioned_xcm.encode();

// check if the `UpwardsMessageSender` may also complain about the size
T::check_size(data.len()).map_err(|_| SendError::ExceedsMaxMessageSize)?;

Ok((data, price))
} else {
// Anything else is unhandled. This includes a message that is not meant for us.
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/staking-async/ah-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ pub mod pallet {
report: rc_client::ValidatorSetReport<T::AccountId>,
) -> DispatchResult {
// Ensure the origin is one of Root or whatever is representing AssetHub.
log!(info, "Received new validator set report {:?}", report);
log!(debug, "Received new validator set report {}", report);
T::AssetHubOrigin::ensure_origin_or_root(origin)?;

// Check the operating mode.
Expand Down
6 changes: 3 additions & 3 deletions substrate/frame/staking-async/ahm-test/src/ah/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ impl multi_block::signed::Config for Runtime {
parameter_types! {
pub static BondingDuration: u32 = 3;
pub static SlashDeferredDuration: u32 = 2;
pub static SessionsPerEra: u32 = 6;
pub static PlanningEraOffset: u32 = 1;
pub static RelaySessionsPerEra: u32 = 6;
pub static PlanningEraOffset: u32 = 2;
}

impl pallet_staking_async::Config for Runtime {
Expand All @@ -326,7 +326,7 @@ impl pallet_staking_async::Config for Runtime {

type AdminOrigin = EnsureRoot<AccountId>;
type BondingDuration = BondingDuration;
type SessionsPerEra = SessionsPerEra;
type RelaySessionsPerEra = RelaySessionsPerEra;
type PlanningEraOffset = PlanningEraOffset;

type Currency = Balances;
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/staking-async/ahm-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ mod tests {
rc::roll_until_matches(
|| {
pallet_session::CurrentIndex::<rc::Runtime>::get() ==
current_session + ah::SessionsPerEra::get() + 1
current_session + ah::RelaySessionsPerEra::get() + 1
},
true,
);
Expand Down
54 changes: 48 additions & 6 deletions substrate/frame/staking-async/rc-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub trait SendToRelayChain {
fn validator_set(report: ValidatorSetReport<Self::AccountId>);
}

#[derive(Encode, Decode, DecodeWithMemTracking, Debug, Clone, PartialEq, TypeInfo)]
#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, TypeInfo)]
/// A report about a new validator set. This is sent from AH -> RC.
pub struct ValidatorSetReport<AccountId> {
/// The new validator set.
Expand All @@ -174,6 +174,28 @@ pub struct ValidatorSetReport<AccountId> {
pub leftover: bool,
}

impl<AccountId: core::fmt::Debug> core::fmt::Debug for ValidatorSetReport<AccountId> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("ValidatorSetReport")
.field("new_validator_set", &self.new_validator_set)
.field("id", &self.id)
.field("prune_up_to", &self.prune_up_to)
.field("leftover", &self.leftover)
.finish()
}
}

impl<AccountId> core::fmt::Display for ValidatorSetReport<AccountId> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("ValidatorSetReport")
.field("new_validator_set", &self.new_validator_set.len())
.field("id", &self.id)
.field("prune_up_to", &self.prune_up_to)
.field("leftover", &self.leftover)
.finish()
}
}

impl<AccountId> ValidatorSetReport<AccountId> {
/// A new instance of self that is terminal. This is useful when we want to send everything in
/// one go.
Expand All @@ -196,7 +218,7 @@ impl<AccountId> ValidatorSetReport<AccountId> {
Ok(self)
}

/// Split self into `count` number of pieces.
/// Split self into chunks of `chunk_size` element.
pub fn split(self, chunk_size: usize) -> Vec<Self>
where
AccountId: Clone,
Expand All @@ -213,9 +235,7 @@ impl<AccountId> ValidatorSetReport<AccountId> {
}
}

#[derive(
Encode, Decode, DecodeWithMemTracking, Debug, Clone, PartialEq, TypeInfo, MaxEncodedLen,
)]
#[derive(Encode, Decode, DecodeWithMemTracking, Clone, PartialEq, TypeInfo, MaxEncodedLen)]
/// The information that is sent from RC -> AH on session end.
pub struct SessionReport<AccountId> {
/// The session that is ending.
Expand Down Expand Up @@ -246,6 +266,28 @@ pub struct SessionReport<AccountId> {
pub leftover: bool,
}

impl<AccountId: core::fmt::Debug> core::fmt::Debug for SessionReport<AccountId> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("SessionReport")
.field("end_index", &self.end_index)
.field("validator_points", &self.validator_points)
.field("activation_timestamp", &self.activation_timestamp)
.field("leftover", &self.leftover)
.finish()
}
}

impl<AccountId> core::fmt::Display for SessionReport<AccountId> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("SessionReport")
.field("end_index", &self.end_index)
.field("validator_points", &self.validator_points.len())
.field("activation_timestamp", &self.activation_timestamp)
.field("leftover", &self.leftover)
.finish()
}
}

impl<AccountId> SessionReport<AccountId> {
/// A new instance of self that is terminal. This is useful when we want to send everything in
/// one go.
Expand Down Expand Up @@ -435,7 +477,7 @@ pub mod pallet {
origin: OriginFor<T>,
report: SessionReport<T::AccountId>,
) -> DispatchResult {
log!(info, "Received session report: {:?}", report);
log!(debug, "Received session report: {}", report);
T::RelayChainOrigin::ensure_origin_or_root(origin)?;

match LastSessionReportEndingIndex::<T>::get() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ RUST_LOG=${LOG} ../../../../../target/release/chain-spec-builder \
--runtime ../../../../../target/release/wbuild/pallet-staking-async-parachain-runtime/pallet_staking_async_parachain_runtime.compact.compressed.wasm \
--relay-chain rococo-local \
--para-id 1100 \
named-preset dot_size
# named-preset ksm_size
# named-preset development
# change this as per your needs ^^^
named-preset ksm_size
# change this as per your needs ^^^ options: development / dot_size / ksm_size
mv ./chain_spec.json ./parachain.json

echo "✅ creating rc chain specs"
Expand Down
26 changes: 11 additions & 15 deletions substrate/frame/staking-async/runtimes/parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ extern crate alloc;

use alloc::{vec, vec::Vec};
use assets_common::{
foreign_creators::ForeignCreators,
local_and_foreign_assets::{LocalFromLeft, TargetFromLeft},
matching::{FromNetwork, FromSiblingParachain},
AssetIdForPoolAssets, AssetIdForPoolAssetsConvert, AssetIdForTrustBackedAssetsConvert,
};
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
Expand Down Expand Up @@ -74,8 +76,11 @@ use parachains_common::{
BlockNumber, CollectionId, Hash, Header, ItemId, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
NORMAL_DISPATCH_RATIO,
};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
use sp_runtime::{
generic, impl_opaque_keys,
traits::{AccountIdConversion, BlakeTwo256, Block as BlockT, ConvertInto, Verify},
Expand All @@ -88,25 +93,16 @@ use sp_version::RuntimeVersion;
use testnet_parachains_constants::westend::{
consensus::*, currency::*, fee::WeightToFee, snowbridge::EthereumNetwork, time::*,
};
use xcm_config::{
ForeignAssetsConvertedConcreteId, LocationToAccountId, PoolAssetsConvertedConcreteId,
PoolAssetsPalletLocation, TrustBackedAssetsConvertedConcreteId,
TrustBackedAssetsPalletLocation, WestendLocation, XcmOriginToTransactDispatchOrigin,
};

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;

use assets_common::{
foreign_creators::ForeignCreators,
matching::{FromNetwork, FromSiblingParachain},
};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
use xcm::{
latest::prelude::AssetId,
prelude::{VersionedAsset, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm},
};
use xcm_config::{
ForeignAssetsConvertedConcreteId, LocationToAccountId, PoolAssetsConvertedConcreteId,
PoolAssetsPalletLocation, TrustBackedAssetsConvertedConcreteId,
TrustBackedAssetsPalletLocation, WestendLocation, XcmOriginToTransactDispatchOrigin,
};

#[cfg(feature = "runtime-benchmarks")]
use frame_support::traits::PalletInfoAccess;
Expand Down Expand Up @@ -137,7 +133,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: alloc::borrow::Cow::Borrowed("asset-hub-next"),
impl_name: alloc::borrow::Cow::Borrowed("asset-hub-next"),
authoring_version: 1,
spec_version: 1_017_007,
spec_version: 1_000_000,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 16,
Expand Down
Loading
Loading