Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Short epoch from ENV (#170)
Browse files Browse the repository at this point in the history
* Short epoch

* allow bridge hub assets

---------

Co-authored-by: Alistair Singh <[email protected]>
  • Loading branch information
yrong and alistair-singh authored Aug 29, 2024
1 parent df4bad7 commit dfee885
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions cumulus/parachains/runtimes/testing/penpal/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ pub const ASSET_HUB_ID: u32 = 1000;
parameter_types! {
/// The location that this chain recognizes as the Relay network's Asset Hub.
pub SystemAssetHubLocation: Location = Location::new(1, [Parachain(ASSET_HUB_ID)]);
/// Bridged Assets Prefx
pub BridgedAssetPrefix: Location = Location::new(2, Here);
// the Relay Chain's Asset Hub's Assets pallet index
pub SystemAssetHubAssetsPalletLocation: Location =
Location::new(1, [Parachain(ASSET_HUB_ID), PalletInstance(ASSETS_PALLET_ID)]);
Expand Down Expand Up @@ -308,6 +310,7 @@ pub type TrustedReserves = (
AssetsFrom<SystemAssetHubLocation>,
NativeAssetFrom<SystemAssetHubLocation>,
AssetPrefixFrom<CustomizableAssetFromSystemAssetHub, SystemAssetHubLocation>,
AssetPrefixFrom<BridgedAssetPrefix, SystemAssetHubLocation>,
);
pub type TrustedTeleporters =
(AssetFromChain<LocalTeleportableToAssetHub, SystemAssetHubLocation>,);
Expand Down
6 changes: 5 additions & 1 deletion polkadot/runtime/westend/constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ pub mod time {

pub const MILLISECS_PER_BLOCK: Moment = 6000;
pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;
pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(1 * HOURS, 1 * MINUTES);

frame_support::parameter_types! {
pub EpochDurationInSlots: BlockNumber =
prod_or_fast!(1 * HOURS, 2 * MINUTES, "EPOCH_DURATION");
}

// These time units are defined in number of blocks.
pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
Expand Down
13 changes: 7 additions & 6 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,13 @@ impl pallet_preimage::Config for Runtime {
}

parameter_types! {
pub const EpochDuration: u64 = prod_or_fast!(
EPOCH_DURATION_IN_SLOTS as u64,
2 * MINUTES as u64
pub EpochDuration: u64 = prod_or_fast!(
EpochDurationInSlots::get() as u64,
2 * MINUTES as u64,
"EPOCH_DURATION"
);
pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
pub const ReportLongevity: u64 =
pub ReportLongevity: u64 =
BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get();
}

Expand Down Expand Up @@ -544,11 +545,11 @@ impl Get<u32> for MaybeSignedPhase {
parameter_types! {
// phase durations. 1/4 of the last session for each.
pub SignedPhase: u32 = prod_or_fast!(
EPOCH_DURATION_IN_SLOTS / 4,
EpochDurationInSlots::get() / 4,
(1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2)
);
pub UnsignedPhase: u32 = prod_or_fast!(
EPOCH_DURATION_IN_SLOTS / 4,
EpochDurationInSlots::get() / 4,
(1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2)
);

Expand Down

0 comments on commit dfee885

Please sign in to comment.