mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-10 08:47:32 +00:00
frame/beefy: add privileged call to reset BEEFY consensus (#1534)
We want to be able to (re)set BEEFY genesis in order to (re)start BEEFY consensus on chains which didn't run it since genesis. This commit adds privileged helper call to (re)set BEEFY genesis to some block in the future. Signed-off-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
@@ -791,3 +791,25 @@ fn valid_equivocation_reports_dont_pay_fees() {
|
||||
assert_eq!(post_info.pays_fee, Pays::Yes);
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn set_new_genesis_works() {
|
||||
let authorities = test_authorities();
|
||||
|
||||
new_test_ext_raw_authorities(authorities).execute_with(|| {
|
||||
start_era(1);
|
||||
|
||||
let new_genesis_delay = 10u64;
|
||||
// the call for setting new genesis should work
|
||||
assert_ok!(Beefy::set_new_genesis(RuntimeOrigin::root(), new_genesis_delay,));
|
||||
let expected = System::block_number() + new_genesis_delay;
|
||||
// verify new genesis was set
|
||||
assert_eq!(Beefy::genesis_block(), Some(expected));
|
||||
|
||||
// setting delay < 1 should fail
|
||||
assert_err!(
|
||||
Beefy::set_new_genesis(RuntimeOrigin::root(), 0u64,),
|
||||
Error::<Test>::InvalidConfiguration,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user