BABE's revert procedure (#11022)

* First rough draft for BABE revert

* Proper babe revert test

* Cleanup

* Test trivial cleanup

* Fix to make clippy happy

* Check polkadot companion

* Check cumulus companion

* Remove babe's blocks weight on revert

* Handle "empty" blockchain edge case

* Run companions

* Simplify the filter predicate

* Saturating sub is not required

* Run pipeline

* Run pipeline again...
This commit is contained in:
Davide Galassi
2022-03-24 09:51:55 +01:00
committed by GitHub
parent 208be86934
commit c534e00ffc
7 changed files with 314 additions and 22 deletions
+7 -1
View File
@@ -168,7 +168,13 @@ pub fn run() -> Result<()> {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
let PartialComponents { client, task_manager, backend, .. } = new_partial(&config)?;
Ok((cmd.run(client, backend), task_manager))
let revert_aux = Box::new(|client, backend, blocks| {
sc_consensus_babe::revert(client, backend, blocks)?;
// TODO: grandpa revert
Ok(())
});
Ok((cmd.run(client, backend, Some(revert_aux)), task_manager))
})
},
#[cfg(feature = "try-runtime")]