mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 10:05:48 +00:00
sc-consensus-beefy: graceful support for pallet-beefy reset (#14217)
BEEFY consensus can be restarted by resetting "genesisBlock" in pallet-beefy, but we don't want to also reset authority set IDs so that they are uniquely identified across the entire chain history regardless of how many times BEEFY consensus has been reset/restarted. This is why the client now also accepts initial authority_set_id != 0. BEEFY client now detects pallet-beefy reset/reinit and errors-out and asks for a restart. BEEFY client persisted state should be discarded on client restarts following pallet-beefy reset/reinit. End result is BEEFY client/voter can now completely reinitialize using "new" on-chain info following pallet-beefy reset/reinit, discarding old state. Fixes #14203 Fixes #14204 Signed-off-by: acatangiu <adrian@parity.io>
This commit is contained in:
@@ -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 = 3;
|
||||
const CURRENT_VERSION: u32 = 4;
|
||||
|
||||
pub(crate) fn write_current_version<BE: AuxStore>(backend: &BE) -> ClientResult<()> {
|
||||
info!(target: LOG_TARGET, "🥩 write aux schema version {:?}", CURRENT_VERSION);
|
||||
@@ -63,8 +63,8 @@ where
|
||||
|
||||
match version {
|
||||
None => (),
|
||||
Some(1) | Some(2) => (), // versions 1 & 2 are obsolete and should be simply ignored
|
||||
Some(3) => return load_decode::<_, PersistedState<B>>(backend, WORKER_STATE_KEY),
|
||||
Some(1) | Some(2) | Some(3) => (), // versions 1, 2 & 3 are obsolete and should be ignored
|
||||
Some(4) => return load_decode::<_, PersistedState<B>>(backend, WORKER_STATE_KEY),
|
||||
other =>
|
||||
return Err(ClientError::Backend(format!("Unsupported BEEFY DB version: {:?}", other))),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user