Skip to content

Commit

Permalink
fixed set_operational in GRANDPA pallet (paritytech#1226)
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik authored and serban300 committed Apr 10, 2024
1 parent 9953d17 commit 0ed0748
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bridges/modules/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ pub mod pallet {
operational: bool,
) -> DispatchResultWithPostInfo {
ensure_owner_or_root::<T, I>(origin)?;
<IsHalted<T, I>>::put(operational);
<IsHalted<T, I>>::put(!operational);

if operational {
log::info!(target: "runtime::bridge-grandpa", "Resuming pallet operations.");
Expand Down Expand Up @@ -804,9 +804,13 @@ mod tests {
#[test]
fn pallet_rejects_transactions_if_halted() {
run_test(|| {
<IsHalted<TestRuntime>>::put(true);
initialize_substrate_bridge();

assert_ok!(Pallet::<TestRuntime>::set_operational(Origin::root(), false));
assert_noop!(submit_finality_proof(1), Error::<TestRuntime>::Halted);

assert_noop!(submit_finality_proof(1), Error::<TestRuntime>::Halted,);
assert_ok!(Pallet::<TestRuntime>::set_operational(Origin::root(), true));
assert_ok!(submit_finality_proof(1));
})
}

Expand Down

0 comments on commit 0ed0748

Please sign in to comment.