From 5beeb9b4d60cf2fe578e11ce178032b5d48bc65e Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Wed, 24 Nov 2021 14:13:27 +0300 Subject: [PATCH] fixed set_operational in GRANDPA pallet (#1226) --- bridges/modules/grandpa/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bridges/modules/grandpa/src/lib.rs b/bridges/modules/grandpa/src/lib.rs index 279e23404a05..4e57a45292d3 100644 --- a/bridges/modules/grandpa/src/lib.rs +++ b/bridges/modules/grandpa/src/lib.rs @@ -239,7 +239,7 @@ pub mod pallet { operational: bool, ) -> DispatchResultWithPostInfo { ensure_owner_or_root::(origin)?; - >::put(operational); + >::put(!operational); if operational { log::info!(target: "runtime::bridge-grandpa", "Resuming pallet operations."); @@ -804,9 +804,13 @@ mod tests { #[test] fn pallet_rejects_transactions_if_halted() { run_test(|| { - >::put(true); + initialize_substrate_bridge(); + + assert_ok!(Pallet::::set_operational(Origin::root(), false)); + assert_noop!(submit_finality_proof(1), Error::::Halted); - assert_noop!(submit_finality_proof(1), Error::::Halted,); + assert_ok!(Pallet::::set_operational(Origin::root(), true)); + assert_ok!(submit_finality_proof(1)); }) }