diff --git a/pallets/vtoken-voting/src/benchmarking.rs b/pallets/vtoken-voting/src/benchmarking.rs index a8eda54e3..bb8f0f6ed 100644 --- a/pallets/vtoken-voting/src/benchmarking.rs +++ b/pallets/vtoken-voting/src/benchmarking.rs @@ -87,7 +87,7 @@ mod benchmarks { response.clone(), )?; } - let votes = match VotingFor::::get(vtoken, &caller) { + let votes = match VotingForV2::::get(vtoken, &caller) { Voting::Casting(Casting { votes, .. }) => votes, _ => return Err("Votes are not direct".into()), }; @@ -97,7 +97,7 @@ mod benchmarks { Pallet::::vote(RawOrigin::Signed(caller.clone()), vtoken, poll_index, vote); assert_matches!( - VotingFor::::get(vtoken, &caller), + VotingForV2::::get(vtoken, &caller), Voting::Casting(Casting { votes, .. }) if votes.len() == (r + 1) as usize ); @@ -124,7 +124,7 @@ mod benchmarks { response.clone(), )?; } - let votes = match VotingFor::::get(vtoken, &caller) { + let votes = match VotingForV2::::get(vtoken, &caller) { Voting::Casting(Casting { votes, .. }) => votes, _ => return Err("Votes are not direct".into()), }; @@ -136,7 +136,7 @@ mod benchmarks { Pallet::::vote(RawOrigin::Signed(caller.clone()), vtoken, poll_index, new_vote); assert_matches!( - VotingFor::::get(vtoken, &caller), + VotingForV2::::get(vtoken, &caller), Voting::Casting(Casting { votes, .. }) if votes.len() == r as usize ); diff --git a/pallets/vtoken-voting/src/tests/kusama_common_test.rs b/pallets/vtoken-voting/src/tests/kusama_common_test.rs index 9c8e7c571..2518ab06d 100644 --- a/pallets/vtoken-voting/src/tests/kusama_common_test.rs +++ b/pallets/vtoken-voting/src/tests/kusama_common_test.rs @@ -248,7 +248,7 @@ fn ensure_balance_after_unlock() { assert_ok!(VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, poll_index)); assert_eq!(usable_balance(vtoken, &ALICE), 0); assert_eq!(Tokens::accounts(&ALICE, vtoken).frozen, 10); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); }); } } @@ -299,7 +299,7 @@ fn ensure_comprehensive_balance_after_unlock() { assert_ok!(VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, poll_index)); assert_eq!(usable_balance(vtoken, &ALICE), 8); assert_eq!(Tokens::accounts(&ALICE, vtoken).frozen, 2); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 2); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 2); assert_ok!(VtokenVoting::vote( RuntimeOrigin::signed(ALICE), @@ -311,7 +311,7 @@ fn ensure_comprehensive_balance_after_unlock() { assert_eq!(usable_balance(vtoken, &ALICE), 0); assert_eq!(Tokens::accounts(&ALICE, vtoken).frozen, 10); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); }); } } @@ -431,12 +431,12 @@ fn lock_amalgamation_valid_with_multiple_removed_votes() { VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, 0), Error::::NoPermissionYet ); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); assert_eq!(usable_balance(vtoken, &ALICE), 0); RelaychainDataProvider::set_block_number(11); assert_ok!(VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, 0)); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); assert_eq!(usable_balance(vtoken, &ALICE), 0); assert_eq!( ClassLocksFor::::get(&ALICE), @@ -1188,7 +1188,7 @@ fn on_idle_works() { let mut actual_count = 0; for poll_index in 0..50 { let relay_block_number = poll_index as BlockNumber; - if ReferendumTimeout::::get( + if ReferendumTimeoutV2::::get( vtoken, relay_block_number + UndecidingTimeout::::get(vtoken).unwrap(), ) diff --git a/pallets/vtoken-voting/src/tests/polkadot_common_test.rs b/pallets/vtoken-voting/src/tests/polkadot_common_test.rs index f82cb3e90..4bde3a789 100644 --- a/pallets/vtoken-voting/src/tests/polkadot_common_test.rs +++ b/pallets/vtoken-voting/src/tests/polkadot_common_test.rs @@ -248,7 +248,7 @@ fn ensure_balance_after_unlock() { assert_ok!(VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, poll_index)); assert_eq!(usable_balance(vtoken, &ALICE), 0); assert_eq!(Tokens::accounts(&ALICE, vtoken).frozen, 10); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); }); } } @@ -299,7 +299,7 @@ fn ensure_comprehensive_balance_after_unlock() { assert_ok!(VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, poll_index)); assert_eq!(usable_balance(vtoken, &ALICE), 8); assert_eq!(Tokens::accounts(&ALICE, vtoken).frozen, 2); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 2); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 2); assert_ok!(VtokenVoting::vote( RuntimeOrigin::signed(ALICE), @@ -311,7 +311,7 @@ fn ensure_comprehensive_balance_after_unlock() { assert_eq!(usable_balance(vtoken, &ALICE), 0); assert_eq!(Tokens::accounts(&ALICE, vtoken).frozen, 10); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); }); } } @@ -431,12 +431,12 @@ fn lock_amalgamation_valid_with_multiple_removed_votes() { VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, 0), Error::::NoPermissionYet ); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); assert_eq!(usable_balance(vtoken, &ALICE), 0); RelaychainDataProvider::set_block_number(11); assert_ok!(VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, 0)); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); assert_eq!(usable_balance(vtoken, &ALICE), 0); assert_eq!( ClassLocksFor::::get(&ALICE), @@ -1188,7 +1188,7 @@ fn on_idle_works() { let mut actual_count = 0; for poll_index in 0..50 { let relay_block_number = poll_index as BlockNumber; - if ReferendumTimeout::::get( + if ReferendumTimeoutV2::::get( vtoken, relay_block_number + UndecidingTimeout::::get(vtoken).unwrap(), ) diff --git a/pallets/vtoken-voting/src/tests/vbnc_test.rs b/pallets/vtoken-voting/src/tests/vbnc_test.rs index 7e2966242..94b8eaf30 100644 --- a/pallets/vtoken-voting/src/tests/vbnc_test.rs +++ b/pallets/vtoken-voting/src/tests/vbnc_test.rs @@ -225,7 +225,7 @@ fn ensure_balance_after_unlock() { assert_ok!(VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, poll_index)); assert_eq!(usable_balance(vtoken, &ALICE), 0); assert_eq!(Tokens::accounts(&ALICE, vtoken).frozen, 10); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); }); } } @@ -273,7 +273,7 @@ fn ensure_comprehensive_balance_after_unlock() { assert_ok!(VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, poll_index)); assert_eq!(usable_balance(vtoken, &ALICE), 8); assert_eq!(Tokens::accounts(&ALICE, vtoken).frozen, 2); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 2); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 2); assert_ok!(VtokenVoting::vote( RuntimeOrigin::signed(ALICE), @@ -284,7 +284,7 @@ fn ensure_comprehensive_balance_after_unlock() { assert_eq!(usable_balance(vtoken, &ALICE), 0); assert_eq!(Tokens::accounts(&ALICE, vtoken).frozen, 10); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); }); } } @@ -397,12 +397,12 @@ fn lock_amalgamation_valid_with_multiple_removed_votes() { VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, 0), Error::::NoPermissionYet ); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); assert_eq!(usable_balance(vtoken, &ALICE), 0); System::set_block_number(11); assert_ok!(VtokenVoting::unlock(RuntimeOrigin::signed(ALICE), vtoken, 0)); - assert_eq!(VotingFor::::get(vtoken, &ALICE).locked_balance(), 10); + assert_eq!(VotingForV2::::get(vtoken, &ALICE).locked_balance(), 10); assert_eq!(usable_balance(vtoken, &ALICE), 0); assert_eq!( ClassLocksFor::::get(&ALICE),