grandpa: allow noting that the set has stalled (#6725)

* grandpa: remove unused methods to convert digest

* grandpa: add root extrinsic for scheduling forced change

* grandpa: add benchmark for schedule_forced_change

* grandpa: don't take authority weight in schedule_forced_change

* grandpa: add const for default forced change delay

* grandpa: adjust weights after benchmark on ref hardware

* grandpa: fix cleanup of forced changes on standard change application

* grandpa: replace schedule_forced_change with note_stalled

* grandpa: always trigger a session change when the set is stalled

* grandpa: fix bug on set id mutation after failed scheduled change

* grandpa: take delay as parameter in note_stalled

* grandpa: fix tests

* grandpa: fix cleanup of forced changes

* grandpa: add test for forced changes cleanup

* grandpa: add test for session rotation set id

* grandpa: add test for scheduling of forced changes on new session
This commit is contained in:
André Silva
2020-07-24 22:02:12 +01:00
committed by GitHub
parent 15679360fd
commit 2ec131142b
5 changed files with 304 additions and 87 deletions
+12 -1
View File
@@ -19,8 +19,9 @@
#![cfg_attr(not(feature = "std"), no_std)]
use super::*;
use super::{*, Module as Grandpa};
use frame_benchmarking::benchmarks;
use frame_system::RawOrigin;
use sp_core::H256;
benchmarks! {
@@ -62,6 +63,15 @@ benchmarks! {
} verify {
assert!(sp_finality_grandpa::check_equivocation_proof(equivocation_proof2));
}
note_stalled {
let delay = 1000.into();
let best_finalized_block_number = 1.into();
}: _(RawOrigin::Root, delay, best_finalized_block_number)
verify {
assert!(Grandpa::<T>::stalled().is_some());
}
}
#[cfg(test)]
@@ -74,6 +84,7 @@ mod tests {
fn test_benchmarks() {
new_test_ext(vec![(1, 1), (2, 1), (3, 1)]).execute_with(|| {
assert_ok!(test_benchmark_check_equivocation_proof::<Test>());
assert_ok!(test_benchmark_note_stalled::<Test>());
})
}