From 5416a746094e9f4187d86b2d5da104d45e97a50b Mon Sep 17 00:00:00 2001 From: ron Date: Fri, 22 Dec 2023 11:15:53 +0800 Subject: [PATCH 1/4] Refactoring with fast-runtime --- .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 5 ++--- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 12 ++++++++---- cumulus/polkadot-parachain/Cargo.toml | 9 +++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 5b6ebc5d6a67..7f9d7c273a67 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -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", @@ -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/fast-runtime", ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 4f1c4c6e23f4..2e6382468e8b 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -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")] @@ -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 { @@ -586,10 +588,9 @@ 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 { @@ -609,7 +610,10 @@ parameter_types! { epoch: 162304, }, }; - 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 { diff --git a/cumulus/polkadot-parachain/Cargo.toml b/cumulus/polkadot-parachain/Cargo.toml index dd17ccebaf15..19e6f733201f 100644 --- a/cumulus/polkadot-parachain/Cargo.toml +++ b/cumulus/polkadot-parachain/Cargo.toml @@ -118,13 +118,10 @@ tokio = { version = "1.32.0", features = ["macros", "parking_lot", "time"] } wait-timeout = "0.2" [features] -default = [ - "beacon-spec-mainnet", -] +default = [] runtime-benchmarks = [ "asset-hub-rococo-runtime/runtime-benchmarks", "asset-hub-westend-runtime/runtime-benchmarks", - "beacon-spec-mainnet", "bridge-hub-rococo-runtime/runtime-benchmarks", "bridge-hub-westend-runtime/runtime-benchmarks", "collectives-westend-runtime/runtime-benchmarks", @@ -164,6 +161,6 @@ try-runtime = [ "shell-runtime/try-runtime", "sp-runtime/try-runtime", ] -beacon-spec-mainnet = [ - "bridge-hub-rococo-runtime/beacon-spec-mainnet", +fast-runtime = [ + "bridge-hub-rococo-runtime/fast-runtime", ] From 5773355d75968002e8bd6dbb42cd24247a2e93f3 Mon Sep 17 00:00:00 2001 From: ron Date: Fri, 22 Dec 2023 13:34:10 +0800 Subject: [PATCH 2/4] Fix ForkVersions for sepolia --- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 2e6382468e8b..c461998888bd 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -594,20 +594,20 @@ parameter_types! { 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, }, }; } From 30dba3dd6a1e8e2b8125bbc47123e426decd90d5 Mon Sep 17 00:00:00 2001 From: ron Date: Fri, 22 Dec 2023 18:06:30 +0800 Subject: [PATCH 3/4] beacon-spec-minimal --- .../runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml | 2 +- .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 7f9d7c273a67..f664017b0e5e 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -299,7 +299,7 @@ try-runtime = [ experimental = ["pallet-aura/experimental"] fast-runtime = [ - "snowbridge-ethereum-beacon-client/fast-runtime", + "snowbridge-ethereum-beacon-client/beacon-spec-minimal", ] # A feature that should be enabled when the runtime should be built for on-chain diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index c461998888bd..b06d5b872752 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -568,7 +568,7 @@ impl snowbridge_outbound_queue::Config for Runtime { type Channels = EthereumSystem; } -#[cfg(feature = "fast-runtime")] +#[cfg(feature = "beacon-spec-minimal")] parameter_types! { pub const ChainForkVersions: ForkVersions = ForkVersions { genesis: Fork { @@ -590,7 +590,7 @@ parameter_types! { }; } -#[cfg(not(feature = "fast-runtime"))] +#[cfg(not(feature = "beacon-spec-minimal"))] parameter_types! { pub const ChainForkVersions: ForkVersions = ForkVersions { genesis: Fork { From 6cdb750bc6d35de998fe15b45a14cf5ecc7c8b62 Mon Sep 17 00:00:00 2001 From: ron Date: Fri, 22 Dec 2023 19:19:20 +0800 Subject: [PATCH 4/4] Use fast-runtime in BH --- .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index b06d5b872752..c461998888bd 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -568,7 +568,7 @@ impl snowbridge_outbound_queue::Config for Runtime { type Channels = EthereumSystem; } -#[cfg(feature = "beacon-spec-minimal")] +#[cfg(feature = "fast-runtime")] parameter_types! { pub const ChainForkVersions: ForkVersions = ForkVersions { genesis: Fork { @@ -590,7 +590,7 @@ parameter_types! { }; } -#[cfg(not(feature = "beacon-spec-minimal"))] +#[cfg(not(feature = "fast-runtime"))] parameter_types! { pub const ChainForkVersions: ForkVersions = ForkVersions { genesis: Fork {