Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shiden: enable async backing #1376

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions runtime/shiden/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ pallet-inflation = { workspace = true }
pallet-price-aggregator = { workspace = true }
pallet-xc-asset-config = { workspace = true }
pallet-xcm = { workspace = true }
vesting-mbm = { workspace = true }

dapp-staking-runtime-api = { workspace = true }

Expand Down Expand Up @@ -243,6 +244,7 @@ std = [
"pallet-xcm-benchmarks?/std",
"precompile-utils/std",
"scale-info/std",
"vesting-mbm/std",
]
runtime-benchmarks = [
"log",
Expand Down Expand Up @@ -294,6 +296,7 @@ runtime-benchmarks = [
"pallet-message-queue/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"orml-oracle/runtime-benchmarks",
"vesting-mbm/runtime-benchmarks",
]
try-runtime = [
"astar-primitives/try-runtime",
Expand Down Expand Up @@ -341,6 +344,7 @@ try-runtime = [
"pallet-chain-extension-assets/try-runtime",
"polkadot-runtime-common/try-runtime",
"sp-runtime/try-runtime",
"vesting-mbm/try-runtime",
]
evm-tracing = [
"moonbeam-evm-tracer",
Expand Down
39 changes: 22 additions & 17 deletions runtime/shiden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub const fn contracts_deposit(items: u32, bytes: u32) -> Balance {
}

/// Change this to adjust the block time.
pub const MILLISECS_PER_BLOCK: u64 = 12000;
pub const MILLISECS_PER_BLOCK: u64 = 6000;
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;

// Time is measured by number of blocks.
Expand All @@ -150,7 +150,7 @@ pub const DAYS: BlockNumber = HOURS * 24;

/// 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.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
Expand Down Expand Up @@ -205,9 +205,9 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used
/// by Operational extrinsics.
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 seconds of compute with a 6 second average block time.
/// We allow for 2 seconds of compute with a 6 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
polkadot_primitives::MAX_POV_SIZE as u64,
);

Expand Down Expand Up @@ -300,15 +300,10 @@ impl frame_system::Config for Runtime {
type PostTransactions = ();
}

parameter_types! {
pub const MinimumPeriod: u64 = MILLISECS_PER_BLOCK / 2;
}

impl pallet_timestamp::Config for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
type OnTimestampSet = Aura;
type MinimumPeriod = ConstU64<0>;
type WeightInfo = pallet_timestamp::weights::SubstrateWeight<Runtime>;
}

Expand Down Expand Up @@ -538,7 +533,7 @@ impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type DisabledValidators = ();
type MaxAuthorities = ConstU32<250>;
type AllowMultipleBlocksPerSlot = ConstBool<false>;
type AllowMultipleBlocksPerSlot = ConstBool<true>;
type SlotDuration = ConstU64<SLOT_DURATION>;
}

Expand Down Expand Up @@ -907,8 +902,8 @@ parameter_types! {
/// max_gas_limit = max_tx_ref_time / WEIGHT_PER_GAS = max_pov_size * gas_limit_pov_size_ratio
/// gas_limit_pov_size_ratio = ceil((max_tx_ref_time / WEIGHT_PER_GAS) / max_pov_size)
///
/// Equals 4 for values used by Shiden runtime.
pub const GasLimitPovSizeRatio: u64 = 4;
/// Equals 16 for values used by Shiden runtime.
pub const GasLimitPovSizeRatio: u64 = 16;
}

impl pallet_evm::Config for Runtime {
Expand Down Expand Up @@ -1106,7 +1101,7 @@ impl pallet_proxy::Config for Runtime {
parameter_types! {
pub const NativeCurrencyId: CurrencyId = CurrencyId::SDN;
// Aggregate values for one day.
pub const AggregationDuration: BlockNumber = 7200;
pub const AggregationDuration: BlockNumber = DAYS;
}

impl pallet_price_aggregator::Config for Runtime {
Expand Down Expand Up @@ -1199,7 +1194,13 @@ parameter_types! {
impl pallet_migrations::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
#[cfg(not(feature = "runtime-benchmarks"))]
type Migrations = ();
type Migrations = (
pallet_dapp_staking::migration::LazyMigration<
Runtime,
pallet_dapp_staking::weights::SubstrateWeight<Runtime>,
>,
vesting_mbm::LazyMigration<Runtime, vesting_mbm::weights::SubstrateWeight<Runtime>>,
);
// Benchmarks need mocked migrations to guarantee that they succeed.
#[cfg(feature = "runtime-benchmarks")]
type Migrations = pallet_migrations::mock_helpers::MockedMigrations;
Expand Down Expand Up @@ -1338,7 +1339,11 @@ parameter_types! {
pub type Migrations = (Unreleased, Permanent);

/// Unreleased migrations. Add new ones here:
pub type Unreleased = (cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,);
pub type Unreleased = (
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
pallet_dapp_staking::migration::AdjustEraMigration<Runtime>,
pallet_inflation::migration::AdjustBlockRewardMigration<Runtime>,
);

/// Migrations/checks that do not need to be versioned and can run on every upgrade.
pub type Permanent = (pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,);
Expand Down
Loading