Skip to content

Commit 4ec6e3a

Browse files
committed
feat(system-parachains/coretime): Configure Coretime Kusama
- `XcmFeeToAccount` -> `SendXcmFeeToAccount` - add possibility to inject non-authorities session-keys in genesis (SDK #5078) - Coretime auto-renew (SDK #4424) - Mock Weights
1 parent 161bfaf commit 4ec6e3a

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

integration-tests/emulated/chains/parachains/coretime/coretime-kusama/src/genesis.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ pub fn genesis() -> Storage {
5151
)
5252
})
5353
.collect(),
54+
// TODO: Any keys to add here?
55+
non_authority_keys: vec![],
5456
},
5557
polkadot_xcm: coretime_kusama_runtime::PolkadotXcmConfig {
5658
safe_xcm_version: Some(SAFE_XCM_VERSION),

system-parachains/coretime/coretime-kusama/src/coretime.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ use frame_support::{
2929
};
3030
use frame_system::Pallet as System;
3131
use kusama_runtime_constants::{system_parachain::coretime, time::DAYS as RELAY_DAYS};
32-
use pallet_broker::{CoreAssignment, CoreIndex, CoretimeInterface, PartsOf57600, RCBlockNumberOf};
32+
use pallet_broker::{
33+
CoreAssignment, CoreIndex, CoretimeInterface, PartsOf57600, RCBlockNumberOf, TaskId,
34+
};
3335
use parachains_common::{AccountId, Balance};
34-
use sp_runtime::traits::AccountIdConversion;
36+
use sp_runtime::traits::{AccountIdConversion, MaybeConvert};
3537
use xcm::latest::prelude::*;
36-
use xcm_executor::traits::TransactAsset;
38+
use xcm_config::LocationToAccountId;
39+
use xcm_executor::traits::{ConvertLocation, TransactAsset};
3740

3841
/// A type containing the encoding of the coretime pallet in the Relay chain runtime. Used to
3942
/// construct any remote calls. The codec index must correspond to the index of `Coretime` in the
@@ -320,6 +323,15 @@ parameter_types! {
320323
pub const BrokerPalletId: PalletId = PalletId(*b"py/broke");
321324
}
322325

326+
pub struct SovereignAccountOf;
327+
impl MaybeConvert<TaskId, AccountId> for SovereignAccountOf {
328+
fn maybe_convert(id: TaskId) -> Option<AccountId> {
329+
// Currently all tasks are parachains
330+
let location = Location::new(1, [Parachain(id)]);
331+
LocationToAccountId::convert_location(&location)
332+
}
333+
}
334+
323335
impl pallet_broker::Config for Runtime {
324336
type RuntimeEvent = RuntimeEvent;
325337
type Currency = Balances;
@@ -332,5 +344,9 @@ impl pallet_broker::Config for Runtime {
332344
type WeightInfo = weights::pallet_broker::WeightInfo<Runtime>;
333345
type PalletId = BrokerPalletId;
334346
type AdminOrigin = EnsureRoot<AccountId>;
347+
type SovereignAccountOf = SovereignAccountOf;
348+
// Roughly 1.5 years with a period of 28 days(~ish)
349+
// TODO: @szegoo, can you help checking this value?
350+
type MaxAutoRenewals = ConstU32<20>;
335351
type PriceAdapter = pallet_broker::CenterTargetPrice<Balance>;
336352
}

system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ fn coretime_kusama_genesis(
5858
)
5959
})
6060
.collect(),
61+
// TODO: Any keys to add here?
62+
non_authority_keys: vec![],
6163
},
6264
"polkadotXcm": {
6365
"safeXcmVersion": Some(SAFE_XCM_VERSION),

system-parachains/coretime/coretime-kusama/src/weights/pallet_broker.rs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

system-parachains/coretime/coretime-kusama/src/xcm_config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ use xcm_builder::{
3939
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain,
4040
DenyThenTry, DescribeAllTerminal, DescribeFamily, DescribeTerminus, EnsureXcmOrigin,
4141
FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete,
42-
NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
42+
NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount,
4343
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
4444
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
4545
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
46-
XcmFeeManagerFromComponents, XcmFeeToAccount,
46+
XcmFeeManagerFromComponents,
4747
};
4848
use xcm_executor::{traits::ConvertLocation, XcmExecutor};
4949

@@ -221,7 +221,7 @@ impl xcm_executor::Config for XcmConfig {
221221
type AssetExchanger = ();
222222
type FeeManager = XcmFeeManagerFromComponents<
223223
WaivedLocations,
224-
XcmFeeToAccount<Self::AssetTransactor, AccountId, RelayTreasuryPalletAccount>,
224+
SendXcmFeeToAccount<Self::AssetTransactor, RelayTreasuryPalletAccount>,
225225
>;
226226
type MessageExporter = ();
227227
type UniversalAliases = Nothing;

0 commit comments

Comments
 (0)