From e4dbbf705aa36e02d9c1809f9239e8077ec51b56 Mon Sep 17 00:00:00 2001 From: timorl Date: Fri, 23 Dec 2022 10:28:27 +0100 Subject: [PATCH 1/2] Generate raw chainspecs in script --- scripts/run_nodes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run_nodes.sh b/scripts/run_nodes.sh index ac3e9d94f0..3367deefb7 100755 --- a/scripts/run_nodes.sh +++ b/scripts/run_nodes.sh @@ -52,7 +52,7 @@ validator_ids_string="${validator_ids[*]}" validator_ids_string="${validator_ids_string//${IFS:0:1}/,}" echo "Bootstrapping chain for nodes 0..$((N_VALIDATORS - 1))" -./target/release/aleph-node bootstrap-chain --base-path "$BASE_PATH" --account-ids "$validator_ids_string" --chain-type local > "$BASE_PATH/chainspec.json" +./target/release/aleph-node bootstrap-chain --raw --base-path "$BASE_PATH" --account-ids "$validator_ids_string" --chain-type local > "$BASE_PATH/chainspec.json" for i in $(seq "$N_VALIDATORS" "$(( N_VALIDATORS + N_NON_VALIDATORS - 1 ))"); do echo "Bootstrapping node $i" From d41a06e6c5aff57bec2181e806b12e218374a5ca Mon Sep 17 00:00:00 2001 From: timorl Date: Fri, 23 Dec 2022 11:05:10 +0100 Subject: [PATCH 2/2] Make compatibility work again --- finality-aleph/src/abft/current.rs | 2 +- finality-aleph/src/abft/legacy.rs | 2 +- finality-aleph/src/lib.rs | 6 +++--- finality-aleph/src/party/manager/mod.rs | 6 ++++-- pallets/aleph/src/lib.rs | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/finality-aleph/src/abft/current.rs b/finality-aleph/src/abft/current.rs index c02c8af54a..c2302b877f 100644 --- a/finality-aleph/src/abft/current.rs +++ b/finality-aleph/src/abft/current.rs @@ -17,7 +17,7 @@ use crate::{ }; /// Version of the current abft -pub const VERSION: u32 = 2; +pub const VERSION: u16 = 2; pub fn run_member< B: Block, diff --git a/finality-aleph/src/abft/legacy.rs b/finality-aleph/src/abft/legacy.rs index af3208bc42..b03e68e7b1 100644 --- a/finality-aleph/src/abft/legacy.rs +++ b/finality-aleph/src/abft/legacy.rs @@ -17,7 +17,7 @@ use crate::{ }; /// Version of the legacy abft -pub const VERSION: u32 = 1; +pub const VERSION: u16 = 1; pub fn run_member< B: Block, diff --git a/finality-aleph/src/lib.rs b/finality-aleph/src/lib.rs index 4793919d65..62c630282f 100644 --- a/finality-aleph/src/lib.rs +++ b/finality-aleph/src/lib.rs @@ -20,7 +20,7 @@ use sp_runtime::traits::{BlakeTwo256, Block, Header}; use tokio::time::Duration; use crate::{ - abft::{CurrentNetworkData, LegacyNetworkData}, + abft::{CurrentNetworkData, LegacyNetworkData, CURRENT_VERSION, LEGACY_VERSION}, aggregation::{CurrentRmcNetworkData, LegacyRmcNetworkData}, network::{data::split::Split, protocol_name}, session::{ @@ -95,11 +95,11 @@ pub type LegacySplitData = Split, LegacyRmcNetworkData = Split, CurrentRmcNetworkData>; impl Versioned for LegacyNetworkData { - const VERSION: Version = Version(0); + const VERSION: Version = Version(LEGACY_VERSION); } impl Versioned for CurrentNetworkData { - const VERSION: Version = Version(1); + const VERSION: Version = Version(CURRENT_VERSION); } /// The main purpose of this data type is to enable a seamless transition between protocol versions at the Network level. It diff --git a/finality-aleph/src/party/manager/mod.rs b/finality-aleph/src/party/manager/mod.rs index 933cc42dce..20d39c662e 100644 --- a/finality-aleph/src/party/manager/mod.rs +++ b/finality-aleph/src/party/manager/mod.rs @@ -348,11 +348,13 @@ where info!(target: "aleph-party", "Running session with legacy-only AlephBFT version."); self.legacy_subtasks(params) } - Ok(version) if version == CURRENT_VERSION => { + // The `as`es here should be removed, but this would require a pallet migration and I + // am lazy. + Ok(version) if version == CURRENT_VERSION as u32 => { info!(target: "aleph-party", "Running session with AlephBFT version {}, which is current.", version); self.current_subtasks(params) } - Ok(version) if version == LEGACY_VERSION => { + Ok(version) if version == LEGACY_VERSION as u32 => { info!(target: "aleph-party", "Running session with AlephBFT version {}, which is legacy.", version); self.legacy_subtasks(params) } diff --git a/pallets/aleph/src/lib.rs b/pallets/aleph/src/lib.rs index cbe54bfe38..93ef3b2c5a 100644 --- a/pallets/aleph/src/lib.rs +++ b/pallets/aleph/src/lib.rs @@ -37,7 +37,7 @@ use sp_std::prelude::*; /// The current storage version. const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); -const DEFAULT_FINALITY_VERSION: Version = 2; +const DEFAULT_FINALITY_VERSION: Version = 1; #[frame_support::pallet] pub mod pallet {