Skip to content

Commit 168aaef

Browse files
timorltimorl
authored andcommitted
Fixing broken compatibility (#828)
* Generate raw chainspecs in script * Make compatibility work again Co-authored-by: timorl <[email protected]>
1 parent 933510e commit 168aaef

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

finality-aleph/src/abft/current.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
};
1818

1919
/// Version of the current abft
20-
pub const VERSION: u32 = 2;
20+
pub const VERSION: u16 = 2;
2121

2222
pub fn run_member<
2323
B: Block,

finality-aleph/src/abft/legacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
};
1818

1919
/// Version of the legacy abft
20-
pub const VERSION: u32 = 1;
20+
pub const VERSION: u16 = 1;
2121

2222
pub fn run_member<
2323
B: Block,

finality-aleph/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use sp_runtime::traits::{BlakeTwo256, Block, Header};
2020
use tokio::time::Duration;
2121

2222
use crate::{
23-
abft::{CurrentNetworkData, LegacyNetworkData},
23+
abft::{CurrentNetworkData, LegacyNetworkData, CURRENT_VERSION, LEGACY_VERSION},
2424
aggregation::{CurrentRmcNetworkData, LegacyRmcNetworkData},
2525
network::{data::split::Split, protocol_name},
2626
session::{
@@ -95,11 +95,11 @@ pub type LegacySplitData<B> = Split<LegacyNetworkData<B>, LegacyRmcNetworkData<B
9595
pub type CurrentSplitData<B> = Split<CurrentNetworkData<B>, CurrentRmcNetworkData<B>>;
9696

9797
impl<B: Block> Versioned for LegacyNetworkData<B> {
98-
const VERSION: Version = Version(0);
98+
const VERSION: Version = Version(LEGACY_VERSION);
9999
}
100100

101101
impl<B: Block> Versioned for CurrentNetworkData<B> {
102-
const VERSION: Version = Version(1);
102+
const VERSION: Version = Version(CURRENT_VERSION);
103103
}
104104

105105
/// The main purpose of this data type is to enable a seamless transition between protocol versions at the Network level. It

finality-aleph/src/party/manager/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,13 @@ where
348348
info!(target: "aleph-party", "Running session with legacy-only AlephBFT version.");
349349
self.legacy_subtasks(params)
350350
}
351-
Ok(version) if version == CURRENT_VERSION => {
351+
// The `as`es here should be removed, but this would require a pallet migration and I
352+
// am lazy.
353+
Ok(version) if version == CURRENT_VERSION as u32 => {
352354
info!(target: "aleph-party", "Running session with AlephBFT version {}, which is current.", version);
353355
self.current_subtasks(params)
354356
}
355-
Ok(version) if version == LEGACY_VERSION => {
357+
Ok(version) if version == LEGACY_VERSION as u32 => {
356358
info!(target: "aleph-party", "Running session with AlephBFT version {}, which is legacy.", version);
357359
self.legacy_subtasks(params)
358360
}

pallets/aleph/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use sp_std::prelude::*;
3737
/// The current storage version.
3838
const STORAGE_VERSION: StorageVersion = StorageVersion::new(2);
3939

40-
const DEFAULT_FINALITY_VERSION: Version = 2;
40+
const DEFAULT_FINALITY_VERSION: Version = 1;
4141

4242
#[frame_support::pallet]
4343
pub mod pallet {

scripts/run_nodes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ validator_ids_string="${validator_ids[*]}"
5252
validator_ids_string="${validator_ids_string//${IFS:0:1}/,}"
5353

5454
echo "Bootstrapping chain for nodes 0..$((N_VALIDATORS - 1))"
55-
./target/release/aleph-node bootstrap-chain --base-path "$BASE_PATH" --account-ids "$validator_ids_string" --chain-type local > "$BASE_PATH/chainspec.json"
55+
./target/release/aleph-node bootstrap-chain --raw --base-path "$BASE_PATH" --account-ids "$validator_ids_string" --chain-type local > "$BASE_PATH/chainspec.json"
5656

5757
for i in $(seq "$N_VALIDATORS" "$(( N_VALIDATORS + N_NON_VALIDATORS - 1 ))"); do
5858
echo "Bootstrapping node $i"

0 commit comments

Comments
 (0)