From 0ed0748ee57c181a026a28ff3569254c4be6ab0e 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 279e23404a059..4e57a45292d3a 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)); }) }