Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
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
Next Next commit
Merge branch 'master' of github.com:paritytech/substrate into beefy-d…
…etect-equivocations
  • Loading branch information
acatangiu committed Feb 3, 2023
commit 6b6aa7201e5fa8ffc4331afc0181baacc3efdc5f
11 changes: 6 additions & 5 deletions client/beefy/src/aux_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use sp_runtime::traits::Block as BlockT;
const VERSION_KEY: &[u8] = b"beefy_auxschema_version";
const WORKER_STATE_KEY: &[u8] = b"beefy_voter_state";

const CURRENT_VERSION: u32 = 2;
const CURRENT_VERSION: u32 = 3;

pub(crate) fn write_current_version<BE: AuxStore>(backend: &BE) -> ClientResult<()> {
info!(target: LOG_TARGET, "🥩 write aux schema version {:?}", CURRENT_VERSION);
Expand Down Expand Up @@ -63,8 +63,9 @@ where

match version {
None => (),
Some(1) => return v1::migrate_from_version1::<B, _>(backend),
Some(2) => return load_decode::<_, PersistedState<B>>(backend, WORKER_STATE_KEY),
Some(1) => (), // version 1 is totally obsolete and should be simply ignored
Some(2) => return v2::migrate_from_version2::<B, _>(backend),
Some(3) => return load_decode::<_, PersistedState<B>>(backend, WORKER_STATE_KEY),
other =>
return Err(ClientError::Backend(format!("Unsupported BEEFY DB version: {:?}", other))),
}
Expand All @@ -73,7 +74,7 @@ where
Ok(None)
}

mod v1 {
mod v2 {
use super::*;
use crate::{round::RoundTracker, worker::PersistedState, Rounds};
use beefy_primitives::{
Expand Down Expand Up @@ -167,7 +168,7 @@ mod v1 {
}
}

pub(super) fn migrate_from_version1<B: BlockT, BE>(
pub(super) fn migrate_from_version2<B: BlockT, BE>(
backend: &BE,
) -> ClientResult<Option<PersistedState<B>>>
where
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.