mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 09:47:56 +00:00
Try-state for Referenda pallet (#13949)
* Try-state for Referenda pallet * fix & more tests * checking more stuff * remove log * two more tests * Update frame/referenda/src/lib.rs Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> * fixes * new check * merge fixes * fix warning * remove check * Update frame/referenda/src/lib.rs Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com> * separate into multiple functions * clean up * unnecessary return value specified * fix * Update frame/referenda/src/lib.rs * fmt * remove import * fmt * fix CI * Update frame/referenda/src/lib.rs Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> * last fixes * :P * fmt --------- Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com> Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
This commit is contained in:
@@ -199,10 +199,11 @@ pub mod test {
|
||||
|
||||
#[test]
|
||||
fn migration_v0_to_v1_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
// create and insert into the storage an ongoing referendum v0.
|
||||
let status_v0 = create_status_v0();
|
||||
let ongoing_v0 = v0::ReferendumInfoOf::<T, ()>::Ongoing(status_v0.clone());
|
||||
ReferendumCount::<T, ()>::mutate(|x| x.saturating_inc());
|
||||
v0::ReferendumInfoFor::<T, ()>::insert(2, ongoing_v0);
|
||||
// create and insert into the storage an approved referendum v0.
|
||||
let approved_v0 = v0::ReferendumInfoOf::<T, ()>::Approved(
|
||||
@@ -210,6 +211,7 @@ pub mod test {
|
||||
Deposit { who: 1, amount: 10 },
|
||||
Some(Deposit { who: 2, amount: 20 }),
|
||||
);
|
||||
ReferendumCount::<T, ()>::mutate(|x| x.saturating_inc());
|
||||
v0::ReferendumInfoFor::<T, ()>::insert(5, approved_v0);
|
||||
// run migration from v0 to v1.
|
||||
v1::MigrateV0ToV1::<T, ()>::on_runtime_upgrade();
|
||||
|
||||
Reference in New Issue
Block a user