diff --git a/integration-tests/emulated/chains/parachains/coretime/coretime-polkadot/src/genesis.rs b/integration-tests/emulated/chains/parachains/coretime/coretime-polkadot/src/genesis.rs index f043761bb8..e55ed5190b 100644 --- a/integration-tests/emulated/chains/parachains/coretime/coretime-polkadot/src/genesis.rs +++ b/integration-tests/emulated/chains/parachains/coretime/coretime-polkadot/src/genesis.rs @@ -52,6 +52,8 @@ pub fn genesis() -> Storage { ) }) .collect(), + // TODO: Any keys to add here? + non_authority_keys: vec![], }, polkadot_xcm: coretime_polkadot_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), diff --git a/system-parachains/coretime/coretime-polkadot/src/coretime.rs b/system-parachains/coretime/coretime-polkadot/src/coretime.rs index f7f81c8a3d..ed22bc1423 100644 --- a/system-parachains/coretime/coretime-polkadot/src/coretime.rs +++ b/system-parachains/coretime/coretime-polkadot/src/coretime.rs @@ -28,12 +28,15 @@ use frame_support::{ weights::constants::{WEIGHT_PROOF_SIZE_PER_KB, WEIGHT_REF_TIME_PER_MICROS}, }; use frame_system::Pallet as System; -use pallet_broker::{CoreAssignment, CoreIndex, CoretimeInterface, PartsOf57600, RCBlockNumberOf}; +use pallet_broker::{ + CoreAssignment, CoreIndex, CoretimeInterface, PartsOf57600, RCBlockNumberOf, TaskId, +}; use parachains_common::{AccountId, Balance}; use polkadot_runtime_constants::{system_parachain::coretime, time::DAYS as RELAY_DAYS}; -use sp_runtime::traits::AccountIdConversion; +use sp_runtime::traits::{AccountIdConversion, MaybeConvert}; use xcm::latest::prelude::*; -use xcm_executor::traits::TransactAsset; +use xcm_config::LocationToAccountId; +use xcm_executor::traits::{ConvertLocation, TransactAsset}; /// A type containing the encoding of the coretime pallet in the Relay chain runtime. Used to /// construct any remote calls. The codec index must correspond to the index of `Coretime` in the @@ -323,6 +326,15 @@ parameter_types! { pub const BrokerPalletId: PalletId = PalletId(*b"py/broke"); } +pub struct SovereignAccountOf; +impl MaybeConvert for SovereignAccountOf { + fn maybe_convert(id: TaskId) -> Option { + // Currently all tasks are parachains + let location = Location::new(1, [Parachain(id)]); + LocationToAccountId::convert_location(&location) + } +} + impl pallet_broker::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = Balances; @@ -335,5 +347,9 @@ impl pallet_broker::Config for Runtime { type WeightInfo = weights::pallet_broker::WeightInfo; type PalletId = BrokerPalletId; type AdminOrigin = EnsureRoot; + type SovereignAccountOf = SovereignAccountOf; + // Roughly 1.5 years with a period of 28 days(~ish) + // TODO: @szegoo, can you help checking this value? + type MaxAutoRenewals = ConstU32<20>; type PriceAdapter = pallet_broker::CenterTargetPrice; } diff --git a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs index 38f3aceed7..1ec05a65cf 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -58,6 +58,8 @@ fn coretime_polkadot_genesis( ) }) .collect(), + // TODO: Any keys to add here? + non_authority_keys: vec![], }, "polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION), diff --git a/system-parachains/coretime/coretime-polkadot/src/weights/pallet_broker.rs b/system-parachains/coretime/coretime-polkadot/src/weights/pallet_broker.rs index 8c7402ac13..ec7e841c65 100644 --- a/system-parachains/coretime/coretime-polkadot/src/weights/pallet_broker.rs +++ b/system-parachains/coretime/coretime-polkadot/src/weights/pallet_broker.rs @@ -553,4 +553,16 @@ impl pallet_broker::WeightInfo for WeightInfo { .saturating_add(Weight::from_parts(0, 3593)) .saturating_add(T::DbWeight::get().reads(1)) } + fn enable_auto_renew() -> Weight { + Weight::from_parts(0, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn disable_auto_renew() -> Weight { + Weight::from_parts(0, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } } diff --git a/system-parachains/coretime/coretime-polkadot/src/xcm_config.rs b/system-parachains/coretime/coretime-polkadot/src/xcm_config.rs index e3b46d0d41..234b77de36 100644 --- a/system-parachains/coretime/coretime-polkadot/src/xcm_config.rs +++ b/system-parachains/coretime/coretime-polkadot/src/xcm_config.rs @@ -40,11 +40,11 @@ use xcm_builder::{ AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain, DenyThenTry, DescribeAllTerminal, DescribeFamily, DescribeTerminus, EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, HashedDescription, IsConcrete, - NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, + NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, - XcmFeeManagerFromComponents, XcmFeeToAccount, + XcmFeeManagerFromComponents, }; use xcm_executor::{traits::ConvertLocation, XcmExecutor}; @@ -244,7 +244,7 @@ impl xcm_executor::Config for XcmConfig { type AssetExchanger = (); type FeeManager = XcmFeeManagerFromComponents< WaivedLocations, - XcmFeeToAccount, + SendXcmFeeToAccount, >; type MessageExporter = (); type UniversalAliases = Nothing;