Skip to content

Commit

Permalink
Merge branch 'main' into developer
Browse files Browse the repository at this point in the history
  • Loading branch information
chungquantin authored Aug 15, 2024
2 parents d96b93e + a9de17d commit edde558
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 44 deletions.
8 changes: 2 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,8 @@ substrate-wasm-builder = "20.0.0"
substrate-build-script-utils = "11.0.0"

# Local
pop-runtime-devnet = { path = "runtime/devnet", default-features = true, features = [
"experimental",
] } # default-features=true required for `-p pop-node` builds
pop-runtime-testnet = { path = "runtime/testnet", default-features = true, features = [
"experimental",
] } # default-features=true required for `-p pop-node` builds
pop-runtime-devnet = { path = "runtime/devnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-testnet = { path = "runtime/testnet", default-features = true } # default-features=true required for `-p pop-node` builds
pop-runtime-common = { path = "runtime/common", default-features = false }
pop-primitives = { path = "./primitives", default-features = false }

Expand Down
6 changes: 3 additions & 3 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub type Nonce = u32;
/// up by `pallet_aura` to implement `fn slot_duration()`.
///
/// Change this to adjust the block time.
pub const MILLISECS_PER_BLOCK: u64 = 12000;
pub const MILLISECS_PER_BLOCK: u64 = 6000;

// NOTE: Currently it is not possible to change the slot duration after the chain has started.
// Attempting to do so will brick block production.
Expand All @@ -42,7 +42,7 @@ pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);

/// We allow for 2 seconds of compute with a 6-second average block.
pub const MAXIMUM_BLOCK_WEIGHT: Weight =
Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), MAX_POV_SIZE as u64);
Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), MAX_POV_SIZE as u64);

// Unit = the base number of indivisible units for balances
pub const UNIT: Balance = 10_000_000_000; // 10 decimals
Expand All @@ -60,7 +60,7 @@ pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT;
// Async backing
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3;

/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
Expand Down
4 changes: 1 addition & 3 deletions runtime/devnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,4 @@ try-runtime = [
"parachain-info/try-runtime",
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
]

experimental = ["pallet-aura/experimental"]
]
25 changes: 5 additions & 20 deletions runtime/devnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

mod extensions;
mod weights;
// Public due to integration tests crate.
pub mod config;
mod extensions;
mod weights;

use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
Expand Down Expand Up @@ -54,8 +54,9 @@ use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
pub use pop_runtime_common::{
deposit, AuraId, Balance, BlockNumber, Hash, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
BLOCK_PROCESSING_VELOCITY, EXISTENTIAL_DEPOSIT, MICROUNIT, MILLIUNIT, NORMAL_DISPATCH_RATIO,
RELAY_CHAIN_SLOT_DURATION_MILLIS, UNIT,
BLOCK_PROCESSING_VELOCITY, DAYS, EXISTENTIAL_DEPOSIT, HOURS, MAXIMUM_BLOCK_WEIGHT, MICROUNIT,
MILLIUNIT, MINUTES, NORMAL_DISPATCH_RATIO, RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION,
UNINCLUDED_SEGMENT_CAPACITY, UNIT,
};
pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill};

Expand Down Expand Up @@ -295,10 +296,7 @@ impl pallet_timestamp::Config for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
#[cfg(feature = "experimental")]
type MinimumPeriod = ConstU64<0>;
#[cfg(not(feature = "experimental"))]
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
type WeightInfo = ();
}

Expand Down Expand Up @@ -355,18 +353,6 @@ parameter_types! {
pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
}

// Async backing
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
pop_runtime_common::MAX_POV_SIZE as u64,
);
const MILLISECS_PER_BLOCK: u64 = 6_000;
const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3;
const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
const HOURS: BlockNumber = MINUTES * 60;
const DAYS: BlockNumber = HOURS * 24;

type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
Runtime,
RELAY_CHAIN_SLOT_DURATION_MILLIS,
Expand Down Expand Up @@ -455,7 +441,6 @@ impl pallet_aura::Config for Runtime {
type DisabledValidators = ();
type MaxAuthorities = ConstU32<100_000>;
type AllowMultipleBlocksPerSlot = ConstBool<true>;
#[cfg(feature = "experimental")]
type SlotDuration = ConstU64<SLOT_DURATION>;

Check failure on line 444 in runtime/devnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

type `SlotDuration` is not a member of trait `pallet_aura::Config`

error[E0437]: type `SlotDuration` is not a member of trait `pallet_aura::Config` --> runtime/devnet/src/lib.rs:444:2 | 444 | type SlotDuration = ConstU64<SLOT_DURATION>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `pallet_aura::Config`
}

Expand Down
4 changes: 1 addition & 3 deletions runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,4 @@ try-runtime = [
"parachain-info/try-runtime",
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
]

experimental = ["pallet-aura/experimental"]
]
14 changes: 5 additions & 9 deletions runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
pub use pop_runtime_common::{
deposit, AuraId, Balance, BlockNumber, Hash, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
BLOCK_PROCESSING_VELOCITY, DAYS, EXISTENTIAL_DEPOSIT, HOURS, MAXIMUM_BLOCK_WEIGHT, MICROUNIT,
MILLISECS_PER_BLOCK, MILLIUNIT, MINUTES, NORMAL_DISPATCH_RATIO,
RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION, UNINCLUDED_SEGMENT_CAPACITY, UNIT,
MILLIUNIT, MINUTES, NORMAL_DISPATCH_RATIO, RELAY_CHAIN_SLOT_DURATION_MILLIS, SLOT_DURATION,
UNINCLUDED_SEGMENT_CAPACITY, UNIT,
};
pub use sp_runtime::{ExtrinsicInclusionMode, MultiAddress, Perbill, Permill};

Expand Down Expand Up @@ -299,7 +299,7 @@ impl pallet_timestamp::Config for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
type MinimumPeriod = ConstU64<0>;
type WeightInfo = ();
}

Expand Down Expand Up @@ -443,12 +443,8 @@ impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = ConstU32<100_000>;
type AllowMultipleBlocksPerSlot = ConstBool<false>;
// Note: SlotDuration potentially enabled here due to devnet runtime and Rust's feature
// unification, requiring the setting of a backwards compatible value.
// See https://github.com/paritytech/polkadot-sdk/blob/09df373db9cd5dfed82c5cdb0736d417d54249e6/substrate/frame/aura/src/lib.rs#L262
#[cfg(feature = "experimental")]
type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Runtime>;
type AllowMultipleBlocksPerSlot = ConstBool<true>;
type SlotDuration = ConstU64<SLOT_DURATION>;

Check failure on line 447 in runtime/testnet/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

type `SlotDuration` is not a member of trait `pallet_aura::Config`

error[E0437]: type `SlotDuration` is not a member of trait `pallet_aura::Config` --> runtime/testnet/src/lib.rs:447:2 | 447 | type SlotDuration = ConstU64<SLOT_DURATION>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `pallet_aura::Config`
}

parameter_types! {
Expand Down

0 comments on commit edde558

Please sign in to comment.