diff --git a/Cargo.lock b/Cargo.lock index f246a978fd2e8..b3b5a22c69cc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -275,9 +275,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" diff --git a/substrate/frame/referenda/src/lib.rs b/substrate/frame/referenda/src/lib.rs index 6c053dfb95e6e..c2f11d83737b2 100644 --- a/substrate/frame/referenda/src/lib.rs +++ b/substrate/frame/referenda/src/lib.rs @@ -628,7 +628,10 @@ pub mod pallet { ensure_root(origin)?; let now = frame_system::Pallet::::block_number(); - let mut status = Self::ensure_ongoing(index)?; + let mut status = match ReferendumInfoFor::::get(index) { + Some(ReferendumInfo::Ongoing(status)) => Ok(status), + _ => Err(Error::::NotOngoing), + }?; // This is our wake-up, so we can disregard the alarm. status.alarm = None; let (info, dirty, branch) = Self::service_referendum(now, index, status); @@ -762,7 +765,7 @@ impl, I: 'static> Polling for Pallet { .clone() .deciding .map(|d| d.confirming.map(|x| now >= x).unwrap_or(false)) - .unwrap(); + .unwrap_or(false); if is_finalizing { return f(PollStatus::None); } @@ -791,7 +794,7 @@ impl, I: 'static> Polling for Pallet { .clone() .deciding .map(|d| d.confirming.map(|x| now >= x).unwrap_or(false)) - .unwrap(); + .unwrap_or(false); if is_finalizing { return f(PollStatus::None); } diff --git a/substrate/frame/referenda/src/tests.rs b/substrate/frame/referenda/src/tests.rs index 66ad2eae2d64c..bb9ffe4a0dc9b 100644 --- a/substrate/frame/referenda/src/tests.rs +++ b/substrate/frame/referenda/src/tests.rs @@ -58,14 +58,14 @@ fn basic_happy_path_works() { run_to(7); assert_eq!(confirming_until(0), 9); run_to(10); - // #8: Should be confirmed & ended. + // #10: Should confirm via auction. assert_eq!(approved_since(0), 10); assert_ok!(Referenda::refund_decision_deposit(RuntimeOrigin::signed(2), 0)); run_to(13); - // #9: Should not yet be enacted. + // #13: Should not yet be enacted. assert_eq!(Balances::free_balance(&42), 0); run_to(14); - // #10: Proposal should be executed. + // #14: Proposal should be executed. assert_eq!(Balances::free_balance(&42), 1); }); }