Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Make compatibility work again
  • Loading branch information
timorl committed Dec 23, 2022
commit d41a06e6c5aff57bec2181e806b12e218374a5ca
2 changes: 1 addition & 1 deletion finality-aleph/src/abft/current.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion finality-aleph/src/abft/legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions finality-aleph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -95,11 +95,11 @@ pub type LegacySplitData<B> = Split<LegacyNetworkData<B>, LegacyRmcNetworkData<B
pub type CurrentSplitData<B> = Split<CurrentNetworkData<B>, CurrentRmcNetworkData<B>>;

impl<B: Block> Versioned for LegacyNetworkData<B> {
const VERSION: Version = Version(0);
const VERSION: Version = Version(LEGACY_VERSION);
}

impl<B: Block> Versioned for CurrentNetworkData<B> {
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
Expand Down
6 changes: 4 additions & 2 deletions finality-aleph/src/party/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/aleph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down