Skip to content

Commit

Permalink
Fast runtime (#89)
Browse files Browse the repository at this point in the history
* Refactoring with fast-runtime

* Fix ForkVersions for sepolia

* beacon-spec-minimal

* Use fast-runtime in BH
  • Loading branch information
yrong authored and claravanstaden committed Dec 22, 2023
1 parent b62df69 commit 471f495
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ std = [
]

runtime-benchmarks = [
"beacon-spec-mainnet",
"bridge-hub-common/runtime-benchmarks",
"bridge-runtime-common/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
Expand Down Expand Up @@ -299,8 +298,8 @@ try-runtime = [
]

experimental = ["pallet-aura/experimental"]
beacon-spec-mainnet = [
"snowbridge-ethereum-beacon-client/beacon-spec-mainnet",
fast-runtime = [
"snowbridge-ethereum-beacon-client/beacon-spec-minimal",
]

# A feature that should be enabled when the runtime should be built for on-chain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ use parachains_common::{
HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};

use polkadot_runtime_common::prod_or_fast;

#[cfg(feature = "runtime-benchmarks")]
use crate::xcm_config::benchmark_helpers::DoNothingRouter;
#[cfg(feature = "runtime-benchmarks")]
Expand Down Expand Up @@ -566,7 +568,7 @@ impl snowbridge_outbound_queue::Config for Runtime {
type Channels = EthereumSystem;
}

#[cfg(not(feature = "beacon-spec-mainnet"))]
#[cfg(feature = "fast-runtime")]
parameter_types! {
pub const ChainForkVersions: ForkVersions = ForkVersions {
genesis: Fork {
Expand All @@ -586,30 +588,32 @@ parameter_types! {
epoch: 0,
},
};
pub const MaxExecutionHeadersToKeep:u32 = 1000;
}

#[cfg(feature = "beacon-spec-mainnet")]
#[cfg(not(feature = "fast-runtime"))]
parameter_types! {
pub const ChainForkVersions: ForkVersions = ForkVersions {
genesis: Fork {
version: [0, 0, 16, 32], // 0x00001020
version: [144, 0, 0, 111], // 0x90000069
epoch: 0,
},
altair: Fork {
version: [1, 0, 16, 32], // 0x01001020
epoch: 36660,
version: [144, 0, 0, 112], // 0x90000070
epoch: 50,
},
bellatrix: Fork {
version: [2, 0, 16, 32], // 0x02001020
epoch: 112260,
version: [144, 0, 0, 113], // 0x90000071
epoch: 100,
},
capella: Fork {
version: [3, 0, 16, 32], // 0x03001020
epoch: 162304,
version: [144, 0, 0, 114], // 0x90000072
epoch: 56832,
},
};
pub const MaxExecutionHeadersToKeep:u32 = 8192 * 2;
}

parameter_types! {
pub const MaxExecutionHeadersToKeep: u32 = prod_or_fast!(8192 * 2, 1000);
}

impl snowbridge_ethereum_beacon_client::Config for Runtime {
Expand Down
3 changes: 3 additions & 0 deletions cumulus/polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,6 @@ try-runtime = [
"shell-runtime/try-runtime",
"sp-runtime/try-runtime",
]
fast-runtime = [
"bridge-hub-rococo-runtime/fast-runtime",
]

0 comments on commit 471f495

Please sign in to comment.