mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
Remove extra commas made redundent after rustfmt (#9404)
* Remove extra commas made redundent after rustfmt
This commit is contained in:
@@ -289,7 +289,7 @@ pub mod pallet {
|
||||
proof: Vec<u8>,
|
||||
action: T::SwapAction,
|
||||
) -> DispatchResult {
|
||||
ensure!(proof.len() <= T::ProofLimit::get() as usize, Error::<T>::ProofTooLarge,);
|
||||
ensure!(proof.len() <= T::ProofLimit::get() as usize, Error::<T>::ProofTooLarge);
|
||||
|
||||
let target = ensure_signed(origin)?;
|
||||
let hashed_proof = blake2_256(&proof);
|
||||
@@ -322,7 +322,7 @@ pub mod pallet {
|
||||
let source = ensure_signed(origin)?;
|
||||
|
||||
let swap = PendingSwaps::<T>::get(&target, hashed_proof).ok_or(Error::<T>::NotExist)?;
|
||||
ensure!(swap.source == source, Error::<T>::SourceMismatch,);
|
||||
ensure!(swap.source == source, Error::<T>::SourceMismatch);
|
||||
ensure!(
|
||||
frame_system::Pallet::<T>::block_number() >= swap.end_block,
|
||||
Error::<T>::DurationNotPassed,
|
||||
|
||||
@@ -323,7 +323,7 @@ fn can_fetch_current_and_next_epoch_data() {
|
||||
});
|
||||
|
||||
// genesis authorities should be used for the first and second epoch
|
||||
assert_eq!(Babe::current_epoch().authorities, Babe::next_epoch().authorities,);
|
||||
assert_eq!(Babe::current_epoch().authorities, Babe::next_epoch().authorities);
|
||||
// 1 era = 3 epochs
|
||||
// 1 epoch = 3 slots
|
||||
// Eras start from 0.
|
||||
|
||||
@@ -211,4 +211,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Bounties, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Bounties, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -635,4 +635,4 @@ benchmarks_instance! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Collective, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Collective, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -2468,7 +2468,7 @@ mod tests {
|
||||
let forbidden_call = Call::Balances(BalanceCall::transfer(CHARLIE, 22));
|
||||
|
||||
// simple cases: direct call
|
||||
assert_err!(ctx.ext.call_runtime(forbidden_call.clone()), BadOrigin,);
|
||||
assert_err!(ctx.ext.call_runtime(forbidden_call.clone()), BadOrigin);
|
||||
|
||||
// as part of a patch: return is OK (but it interrupted the batch)
|
||||
assert_ok!(ctx.ext.call_runtime(Call::Utility(UtilCall::batch(vec![
|
||||
|
||||
@@ -639,7 +639,7 @@ fn storage_size() {
|
||||
let addr = Contracts::contract_address(&ALICE, &code_hash, &[]);
|
||||
let bob_contract = ContractInfoOf::<Test>::get(&addr).unwrap().get_alive().unwrap();
|
||||
assert_eq!(bob_contract.storage_size, 4);
|
||||
assert_eq!(bob_contract.pair_count, 1,);
|
||||
assert_eq!(bob_contract.pair_count, 1);
|
||||
|
||||
assert_ok!(Contracts::call(
|
||||
Origin::signed(ALICE),
|
||||
@@ -650,7 +650,7 @@ fn storage_size() {
|
||||
));
|
||||
let bob_contract = ContractInfoOf::<Test>::get(&addr).unwrap().get_alive().unwrap();
|
||||
assert_eq!(bob_contract.storage_size, 4 + 4);
|
||||
assert_eq!(bob_contract.pair_count, 2,);
|
||||
assert_eq!(bob_contract.pair_count, 2);
|
||||
|
||||
assert_ok!(Contracts::call(
|
||||
Origin::signed(ALICE),
|
||||
@@ -661,7 +661,7 @@ fn storage_size() {
|
||||
));
|
||||
let bob_contract = ContractInfoOf::<Test>::get(&addr).unwrap().get_alive().unwrap();
|
||||
assert_eq!(bob_contract.storage_size, 4);
|
||||
assert_eq!(bob_contract.pair_count, 1,);
|
||||
assert_eq!(bob_contract.pair_count, 1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -682,8 +682,8 @@ fn empty_kv_pairs() {
|
||||
let addr = Contracts::contract_address(&ALICE, &code_hash, &[]);
|
||||
let bob_contract = ContractInfoOf::<Test>::get(&addr).unwrap().get_alive().unwrap();
|
||||
|
||||
assert_eq!(bob_contract.storage_size, 0,);
|
||||
assert_eq!(bob_contract.pair_count, 1,);
|
||||
assert_eq!(bob_contract.storage_size, 0);
|
||||
assert_eq!(bob_contract.pair_count, 1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -993,7 +993,7 @@ fn removals(trigger_call: impl Fn(AccountIdOf<Test>) -> bool) {
|
||||
ContractInfoOf::<Test>::get(&addr).unwrap().get_alive().unwrap().rent_allowance,
|
||||
allowance,
|
||||
);
|
||||
assert_eq!(Balances::free_balance(&addr), balance,);
|
||||
assert_eq!(Balances::free_balance(&addr), balance);
|
||||
|
||||
// Make contract have exactly the subsistence threshold
|
||||
Balances::make_free_balance_be(&addr, subsistence_threshold);
|
||||
@@ -1357,14 +1357,14 @@ fn restoration(
|
||||
assert_eq!(django_contract.storage_size, 8);
|
||||
assert_eq!(django_contract.trie_id, django_trie_id);
|
||||
assert_eq!(django_contract.deduct_block, System::block_number());
|
||||
assert_eq!(Storage::<Test>::read(&django_trie_id, &delta_key), Some(vec![40, 0, 0, 0]),);
|
||||
assert_eq!(Storage::<Test>::read(&django_trie_id, &delta_key), Some(vec![40, 0, 0, 0]));
|
||||
match (test_different_storage, test_restore_to_with_dirty_storage, test_code_evicted) {
|
||||
(true, false, false) => {
|
||||
assert_err_ignore_postinfo!(result, Error::<Test>::InvalidTombstone,);
|
||||
assert_err_ignore_postinfo!(result, Error::<Test>::InvalidTombstone);
|
||||
assert_eq!(System::events(), vec![]);
|
||||
},
|
||||
(_, true, false) => {
|
||||
assert_err_ignore_postinfo!(result, Error::<Test>::InvalidContractOrigin,);
|
||||
assert_err_ignore_postinfo!(result, Error::<Test>::InvalidContractOrigin);
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
vec![
|
||||
@@ -1428,7 +1428,7 @@ fn restoration(
|
||||
);
|
||||
},
|
||||
(false, false, true) => {
|
||||
assert_err_ignore_postinfo!(result, Error::<Test>::CodeNotFound,);
|
||||
assert_err_ignore_postinfo!(result, Error::<Test>::CodeNotFound);
|
||||
assert_refcount!(set_rent_code_hash, 0);
|
||||
assert_eq!(System::events(), vec![]);
|
||||
},
|
||||
@@ -1576,7 +1576,7 @@ fn cannot_self_destruct_through_draning() {
|
||||
|
||||
// Call BOB which makes it send all funds to the zero address
|
||||
// The contract code asserts that the correct error value is returned.
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr, 0, GAS_LIMIT, vec![],));
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr, 0, GAS_LIMIT, vec![]));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2155,7 +2155,7 @@ fn lazy_removal_works() {
|
||||
child::put(trie, &[99], &42);
|
||||
|
||||
// Terminate the contract
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr.clone(), 0, GAS_LIMIT, vec![],));
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr.clone(), 0, GAS_LIMIT, vec![]));
|
||||
|
||||
// Contract info should be gone
|
||||
assert!(!<ContractInfoOf::<Test>>::contains_key(&addr));
|
||||
@@ -2209,7 +2209,7 @@ fn lazy_removal_partial_remove_works() {
|
||||
<ContractInfoOf<Test>>::insert(&addr, ContractInfo::Alive(info.clone()));
|
||||
|
||||
// Terminate the contract
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr.clone(), 0, GAS_LIMIT, vec![],));
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr.clone(), 0, GAS_LIMIT, vec![]));
|
||||
|
||||
// Contract info should be gone
|
||||
assert!(!<ContractInfoOf::<Test>>::contains_key(&addr));
|
||||
@@ -2286,7 +2286,7 @@ fn lazy_removal_does_no_run_on_full_block() {
|
||||
<ContractInfoOf<Test>>::insert(&addr, ContractInfo::Alive(info.clone()));
|
||||
|
||||
// Terminate the contract
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr.clone(), 0, GAS_LIMIT, vec![],));
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr.clone(), 0, GAS_LIMIT, vec![]));
|
||||
|
||||
// Contract info should be gone
|
||||
assert!(!<ContractInfoOf::<Test>>::contains_key(&addr));
|
||||
@@ -2359,7 +2359,7 @@ fn lazy_removal_does_not_use_all_weight() {
|
||||
<ContractInfoOf<Test>>::insert(&addr, ContractInfo::Alive(info.clone()));
|
||||
|
||||
// Terminate the contract
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr.clone(), 0, GAS_LIMIT, vec![],));
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr.clone(), 0, GAS_LIMIT, vec![]));
|
||||
|
||||
// Contract info should be gone
|
||||
assert!(!<ContractInfoOf::<Test>>::contains_key(&addr));
|
||||
@@ -2543,7 +2543,7 @@ fn refcounter() {
|
||||
let addr2 = Contracts::contract_address(&ALICE, &code_hash, &[2]);
|
||||
|
||||
// Terminating one contract should decrement the refcount
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr0, 0, GAS_LIMIT, vec![],));
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr0, 0, GAS_LIMIT, vec![]));
|
||||
assert_refcount!(code_hash, 2);
|
||||
|
||||
// make remaining contracts eligible for eviction
|
||||
@@ -2657,7 +2657,7 @@ fn debug_message_logging_disabled() {
|
||||
let result = Contracts::bare_call(ALICE, addr.clone(), 0, GAS_LIMIT, vec![], false);
|
||||
assert_matches!(result.result, Ok(_));
|
||||
// the dispatchables always run without debugging
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr, 0, GAS_LIMIT, vec![],));
|
||||
assert_ok!(Contracts::call(Origin::signed(ALICE), addr, 0, GAS_LIMIT, vec![]));
|
||||
assert!(result.debug_message.is_empty());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn macro_gen_signature() {
|
||||
assert_eq!(gen_signature!((i32)), FunctionType::new(vec![ValueType::I32], vec![]),);
|
||||
assert_eq!(gen_signature!((i32)), FunctionType::new(vec![ValueType::I32], vec![]));
|
||||
|
||||
assert_eq!(
|
||||
gen_signature!( (i32, u32) -> u32 ),
|
||||
|
||||
@@ -507,7 +507,7 @@ mod tests {
|
||||
#[test]
|
||||
fn contract_transfer() {
|
||||
let mut mock_ext = MockExt::default();
|
||||
assert_ok!(execute(CODE_TRANSFER, vec![], &mut mock_ext,));
|
||||
assert_ok!(execute(CODE_TRANSFER, vec![], &mut mock_ext));
|
||||
|
||||
assert_eq!(&mock_ext.transfers, &[TransferEntry { to: ALICE, value: 153 }]);
|
||||
}
|
||||
@@ -561,7 +561,7 @@ mod tests {
|
||||
#[test]
|
||||
fn contract_call() {
|
||||
let mut mock_ext = MockExt::default();
|
||||
assert_ok!(execute(CODE_CALL, vec![], &mut mock_ext,));
|
||||
assert_ok!(execute(CODE_CALL, vec![], &mut mock_ext));
|
||||
|
||||
assert_eq!(
|
||||
&mock_ext.calls,
|
||||
@@ -787,7 +787,7 @@ mod tests {
|
||||
#[test]
|
||||
fn contract_instantiate() {
|
||||
let mut mock_ext = MockExt::default();
|
||||
assert_ok!(execute(CODE_INSTANTIATE, vec![], &mut mock_ext,));
|
||||
assert_ok!(execute(CODE_INSTANTIATE, vec![], &mut mock_ext));
|
||||
|
||||
assert_matches!(
|
||||
&mock_ext.instantiates[..],
|
||||
@@ -884,7 +884,7 @@ mod tests {
|
||||
#[test]
|
||||
fn contract_call_limited_gas() {
|
||||
let mut mock_ext = MockExt::default();
|
||||
assert_ok!(execute(&CODE_TRANSFER_LIMITED_GAS, vec![], &mut mock_ext,));
|
||||
assert_ok!(execute(&CODE_TRANSFER_LIMITED_GAS, vec![], &mut mock_ext));
|
||||
|
||||
assert_eq!(
|
||||
&mock_ext.calls,
|
||||
@@ -1014,7 +1014,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn caller() {
|
||||
assert_ok!(execute(CODE_CALLER, vec![], MockExt::default(),));
|
||||
assert_ok!(execute(CODE_CALLER, vec![], MockExt::default()));
|
||||
}
|
||||
|
||||
/// calls `seal_address` and compares the result with the constant 69.
|
||||
@@ -1062,7 +1062,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn address() {
|
||||
assert_ok!(execute(CODE_ADDRESS, vec![], MockExt::default(),));
|
||||
assert_ok!(execute(CODE_ADDRESS, vec![], MockExt::default()));
|
||||
}
|
||||
|
||||
const CODE_BALANCE: &str = r#"
|
||||
@@ -1108,7 +1108,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn balance() {
|
||||
assert_ok!(execute(CODE_BALANCE, vec![], MockExt::default(),));
|
||||
assert_ok!(execute(CODE_BALANCE, vec![], MockExt::default()));
|
||||
}
|
||||
|
||||
const CODE_GAS_PRICE: &str = r#"
|
||||
@@ -1154,7 +1154,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn gas_price() {
|
||||
assert_ok!(execute(CODE_GAS_PRICE, vec![], MockExt::default(),));
|
||||
assert_ok!(execute(CODE_GAS_PRICE, vec![], MockExt::default()));
|
||||
}
|
||||
|
||||
const CODE_GAS_LEFT: &str = r#"
|
||||
@@ -1252,7 +1252,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn value_transferred() {
|
||||
assert_ok!(execute(CODE_VALUE_TRANSFERRED, vec![], MockExt::default(),));
|
||||
assert_ok!(execute(CODE_VALUE_TRANSFERRED, vec![], MockExt::default()));
|
||||
}
|
||||
|
||||
const CODE_RETURN_FROM_START_FN: &str = r#"
|
||||
@@ -1332,7 +1332,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn now() {
|
||||
assert_ok!(execute(CODE_TIMESTAMP_NOW, vec![], MockExt::default(),));
|
||||
assert_ok!(execute(CODE_TIMESTAMP_NOW, vec![], MockExt::default()));
|
||||
}
|
||||
|
||||
const CODE_MINIMUM_BALANCE: &str = r#"
|
||||
@@ -1377,7 +1377,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn minimum_balance() {
|
||||
assert_ok!(execute(CODE_MINIMUM_BALANCE, vec![], MockExt::default(),));
|
||||
assert_ok!(execute(CODE_MINIMUM_BALANCE, vec![], MockExt::default()));
|
||||
}
|
||||
|
||||
const CODE_TOMBSTONE_DEPOSIT: &str = r#"
|
||||
@@ -1422,7 +1422,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn tombstone_deposit() {
|
||||
assert_ok!(execute(CODE_TOMBSTONE_DEPOSIT, vec![], MockExt::default(),));
|
||||
assert_ok!(execute(CODE_TOMBSTONE_DEPOSIT, vec![], MockExt::default()));
|
||||
}
|
||||
|
||||
const CODE_RANDOM: &str = r#"
|
||||
@@ -1596,7 +1596,7 @@ mod tests {
|
||||
#[test]
|
||||
fn deposit_event() {
|
||||
let mut mock_ext = MockExt::default();
|
||||
assert_ok!(execute(CODE_DEPOSIT_EVENT, vec![], &mut mock_ext,));
|
||||
assert_ok!(execute(CODE_DEPOSIT_EVENT, vec![], &mut mock_ext));
|
||||
|
||||
assert_eq!(
|
||||
mock_ext.events,
|
||||
@@ -2033,7 +2033,7 @@ mod tests {
|
||||
let call = Call::System(frame_system::Call::remark(b"Hello World".to_vec()));
|
||||
let mut ext = MockExt::default();
|
||||
let result = execute(CODE_CALL_RUNTIME, call.encode(), &mut ext).unwrap();
|
||||
assert_eq!(*ext.runtime_calls.borrow(), vec![call],);
|
||||
assert_eq!(*ext.runtime_calls.borrow(), vec![call]);
|
||||
// 0 = ReturnCode::Success
|
||||
assert_eq!(u32::from_le_bytes(result.data.0.try_into().unwrap()), 0);
|
||||
}
|
||||
@@ -2050,6 +2050,6 @@ mod tests {
|
||||
origin: ErrorOrigin::Caller,
|
||||
})
|
||||
);
|
||||
assert_eq!(*ext.runtime_calls.borrow(), vec![],);
|
||||
assert_eq!(*ext.runtime_calls.borrow(), vec![]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -778,4 +778,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Democracy, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Democracy, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -374,7 +374,7 @@ pub mod pallet {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
let actual_count = <Candidates<T>>::decode_len().unwrap_or(0);
|
||||
ensure!(actual_count as u32 <= candidate_count, Error::<T>::InvalidWitnessData,);
|
||||
ensure!(actual_count as u32 <= candidate_count, Error::<T>::InvalidWitnessData);
|
||||
|
||||
let index = Self::is_candidate(&who).err().ok_or(Error::<T>::DuplicatedCandidate)?;
|
||||
|
||||
@@ -1677,7 +1677,7 @@ mod tests {
|
||||
assert_eq!(candidate_ids(), Vec::<u64>::new());
|
||||
assert_ok!(submit_candidacy(Origin::signed(1)));
|
||||
assert_eq!(candidate_ids(), vec![1]);
|
||||
assert_noop!(submit_candidacy(Origin::signed(1)), Error::<Test>::DuplicatedCandidate,);
|
||||
assert_noop!(submit_candidacy(Origin::signed(1)), Error::<Test>::DuplicatedCandidate);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1695,7 +1695,7 @@ mod tests {
|
||||
assert!(Elections::runners_up().is_empty());
|
||||
assert!(candidate_ids().is_empty());
|
||||
|
||||
assert_noop!(submit_candidacy(Origin::signed(5)), Error::<Test>::MemberSubmit,);
|
||||
assert_noop!(submit_candidacy(Origin::signed(5)), Error::<Test>::MemberSubmit);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1715,7 +1715,7 @@ mod tests {
|
||||
assert_eq!(members_ids(), vec![4, 5]);
|
||||
assert_eq!(runners_up_ids(), vec![3]);
|
||||
|
||||
assert_noop!(submit_candidacy(Origin::signed(3)), Error::<Test>::RunnerUpSubmit,);
|
||||
assert_noop!(submit_candidacy(Origin::signed(3)), Error::<Test>::RunnerUpSubmit);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1850,7 +1850,7 @@ mod tests {
|
||||
#[test]
|
||||
fn cannot_vote_for_no_candidate() {
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
assert_noop!(vote(Origin::signed(2), vec![], 20), Error::<Test>::NoVotes,);
|
||||
assert_noop!(vote(Origin::signed(2), vec![], 20), Error::<Test>::NoVotes);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2004,7 +2004,7 @@ mod tests {
|
||||
assert_ok!(submit_candidacy(Origin::signed(5)));
|
||||
assert_ok!(submit_candidacy(Origin::signed(4)));
|
||||
|
||||
assert_noop!(vote(Origin::signed(2), vec![4], 1), Error::<Test>::LowBalance,);
|
||||
assert_noop!(vote(Origin::signed(2), vec![4], 1), Error::<Test>::LowBalance);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -694,7 +694,7 @@ pub mod pallet {
|
||||
#[pallet::compact] index: VoteIndex,
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
ensure!(!total.is_zero(), Error::<T>::ZeroDeposit,);
|
||||
ensure!(!total.is_zero(), Error::<T>::ZeroDeposit);
|
||||
|
||||
let candidate = T::Lookup::lookup(candidate)?;
|
||||
ensure!(index == Self::vote_index(), Error::<T>::InvalidVoteIndex);
|
||||
@@ -711,7 +711,7 @@ pub mod pallet {
|
||||
ensure!(total > leaderboard[0].0, Error::<T>::UnworthyCandidate);
|
||||
|
||||
if let Some(p) = Self::members().iter().position(|&(ref c, _)| c == &candidate) {
|
||||
ensure!(p < expiring.len(), Error::<T>::DuplicatedCandidate,);
|
||||
ensure!(p < expiring.len(), Error::<T>::DuplicatedCandidate);
|
||||
}
|
||||
|
||||
let voters = Self::all_voters();
|
||||
@@ -916,12 +916,12 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
ensure!(!Self::presentation_active(), Error::<T>::ApprovalPresentation);
|
||||
ensure!(index == Self::vote_index(), Error::<T>::InvalidVoteIndex);
|
||||
ensure!(!candidates_len.is_zero(), Error::<T>::ZeroCandidates,);
|
||||
ensure!(!candidates_len.is_zero(), Error::<T>::ZeroCandidates);
|
||||
// Prevent a vote from voters that provide a list of votes that exceeds the candidates
|
||||
// length since otherwise an attacker may be able to submit a very long list of `votes` that
|
||||
// far exceeds the amount of candidates and waste more computation than a reasonable voting
|
||||
// bond would cover.
|
||||
ensure!(candidates_len >= votes.len(), Error::<T>::TooManyVotes,);
|
||||
ensure!(candidates_len >= votes.len(), Error::<T>::TooManyVotes);
|
||||
ensure!(value >= T::MinimumVotingLock::get(), Error::<T>::InsufficientLockedValue);
|
||||
|
||||
// Amount to be locked up.
|
||||
|
||||
@@ -133,4 +133,4 @@ benchmarks! {
|
||||
}: { Gilt::<T>::pursue_target(q) }
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Gilt, crate::mock::new_test_ext(), crate::mock::Test,);
|
||||
impl_benchmark_test_suite!(Gilt, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
|
||||
@@ -234,7 +234,7 @@ fn schedule_pause_only_when_live() {
|
||||
Grandpa::schedule_pause(1).unwrap();
|
||||
|
||||
// we've switched to the pending pause state
|
||||
assert_eq!(Grandpa::state(), StoredState::PendingPause { scheduled_at: 1u64, delay: 1 },);
|
||||
assert_eq!(Grandpa::state(), StoredState::PendingPause { scheduled_at: 1u64, delay: 1 });
|
||||
|
||||
Grandpa::on_finalize(1);
|
||||
let _ = System::finalize();
|
||||
@@ -248,7 +248,7 @@ fn schedule_pause_only_when_live() {
|
||||
let _ = System::finalize();
|
||||
|
||||
// after finalizing block 2 the set should have switched to paused state
|
||||
assert_eq!(Grandpa::state(), StoredState::Paused,);
|
||||
assert_eq!(Grandpa::state(), StoredState::Paused);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -260,14 +260,14 @@ fn schedule_resume_only_when_paused() {
|
||||
// the set is currently live, resuming it is an error
|
||||
assert_noop!(Grandpa::schedule_resume(1), Error::<Test>::ResumeFailed);
|
||||
|
||||
assert_eq!(Grandpa::state(), StoredState::Live,);
|
||||
assert_eq!(Grandpa::state(), StoredState::Live);
|
||||
|
||||
// we schedule a pause to be applied instantly
|
||||
Grandpa::schedule_pause(0).unwrap();
|
||||
Grandpa::on_finalize(1);
|
||||
let _ = System::finalize();
|
||||
|
||||
assert_eq!(Grandpa::state(), StoredState::Paused,);
|
||||
assert_eq!(Grandpa::state(), StoredState::Paused);
|
||||
|
||||
// we schedule the set to go back live in 2 blocks
|
||||
initialize_block(2, Default::default());
|
||||
@@ -284,7 +284,7 @@ fn schedule_resume_only_when_paused() {
|
||||
let _ = System::finalize();
|
||||
|
||||
// it should be live at block 4
|
||||
assert_eq!(Grandpa::state(), StoredState::Live,);
|
||||
assert_eq!(Grandpa::state(), StoredState::Live);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -413,4 +413,4 @@ benchmarks! {
|
||||
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Identity, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Identity, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -96,4 +96,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(ImOnline, crate::mock::new_test_ext(), crate::mock::Runtime,);
|
||||
impl_benchmark_test_suite!(ImOnline, crate::mock::new_test_ext(), crate::mock::Runtime);
|
||||
|
||||
@@ -37,7 +37,7 @@ use sp_runtime::{
|
||||
#[test]
|
||||
fn test_unresponsiveness_slash_fraction() {
|
||||
// A single case of unresponsiveness is not slashed.
|
||||
assert_eq!(UnresponsivenessOffence::<()>::slash_fraction(1, 50), Perbill::zero(),);
|
||||
assert_eq!(UnresponsivenessOffence::<()>::slash_fraction(1, 50), Perbill::zero());
|
||||
|
||||
assert_eq!(
|
||||
UnresponsivenessOffence::<()>::slash_fraction(5, 50),
|
||||
@@ -435,7 +435,7 @@ fn should_handle_non_linear_session_progress() {
|
||||
// if we don't have valid results for the current session progres then
|
||||
// we'll fallback to `HeartbeatAfter` and only heartbeat on block 5.
|
||||
MOCK_CURRENT_SESSION_PROGRESS.with(|p| *p.borrow_mut() = Some(None));
|
||||
assert_eq!(ImOnline::send_heartbeats(2).err(), Some(OffchainErr::TooEarly),);
|
||||
assert_eq!(ImOnline::send_heartbeats(2).err(), Some(OffchainErr::TooEarly));
|
||||
|
||||
MOCK_CURRENT_SESSION_PROGRESS.with(|p| *p.borrow_mut() = Some(None));
|
||||
assert!(ImOnline::send_heartbeats(5).ok().is_some());
|
||||
@@ -463,7 +463,7 @@ fn test_does_not_heartbeat_early_in_the_session() {
|
||||
// heartbeating after 10% of the session has elapsed.
|
||||
MOCK_CURRENT_SESSION_PROGRESS
|
||||
.with(|p| *p.borrow_mut() = Some(Some(Permill::from_float(0.05))));
|
||||
assert_eq!(ImOnline::send_heartbeats(2).err(), Some(OffchainErr::TooEarly),);
|
||||
assert_eq!(ImOnline::send_heartbeats(2).err(), Some(OffchainErr::TooEarly));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ fn test_probability_of_heartbeating_increases_with_session_progress() {
|
||||
|
||||
let assert_too_early = |progress, random| {
|
||||
set_test(progress, random);
|
||||
assert_eq!(ImOnline::send_heartbeats(2).err(), Some(OffchainErr::TooEarly),);
|
||||
assert_eq!(ImOnline::send_heartbeats(2).err(), Some(OffchainErr::TooEarly));
|
||||
};
|
||||
|
||||
let assert_heartbeat_ok = |progress, random| {
|
||||
|
||||
@@ -93,4 +93,4 @@ benchmarks! {
|
||||
// TODO in another PR: lookup and unlookup trait weights (not critical)
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Indices, crate::mock::new_test_ext(), crate::mock::Test,);
|
||||
impl_benchmark_test_suite!(Indices, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
|
||||
@@ -170,4 +170,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Lottery, crate::mock::new_test_ext(), crate::mock::Test,);
|
||||
impl_benchmark_test_suite!(Lottery, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
|
||||
@@ -177,7 +177,7 @@ fn buy_ticket_works_as_simple_passthrough() {
|
||||
);
|
||||
|
||||
let bad_origin_call = Box::new(Call::Balances(BalancesCall::force_transfer(0, 0, 0)));
|
||||
assert_noop!(Lottery::buy_ticket(Origin::signed(1), bad_origin_call), BadOrigin,);
|
||||
assert_noop!(Lottery::buy_ticket(Origin::signed(1), bad_origin_call), BadOrigin);
|
||||
|
||||
// User can call other txs, but doesn't get a ticket
|
||||
let remark_call = Box::new(Call::System(SystemCall::remark(b"hello, world!".to_vec())));
|
||||
|
||||
@@ -459,7 +459,7 @@ mod benchmark {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Membership, crate::tests::new_bench_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Membership, crate::tests::new_bench_ext(), crate::tests::Test);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -569,7 +569,7 @@ mod tests {
|
||||
let opaque = cases.iter().map(OpaqueLeaf::from_leaf).collect::<Vec<_>>();
|
||||
|
||||
// then
|
||||
assert_eq!(encoded_compact, opaque,);
|
||||
assert_eq!(encoded_compact, opaque);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -37,4 +37,4 @@ benchmarks_instance_pallet! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::mock::Test,);
|
||||
impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::mock::Test);
|
||||
|
||||
@@ -121,6 +121,6 @@ mod tests {
|
||||
actual_sizes.push(mmr.size());
|
||||
})
|
||||
}
|
||||
assert_eq!(sizes[1..], actual_sizes[..],);
|
||||
assert_eq!(sizes[1..], actual_sizes[..]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,4 +296,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Multisig, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Multisig, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -401,4 +401,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test,);
|
||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
|
||||
@@ -247,4 +247,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Proxy, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Proxy, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -141,4 +141,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Scheduler, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Scheduler, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -162,4 +162,4 @@ fn check_membership_proof_setup<T: Config>(
|
||||
(key, Historical::<T>::prove(key).unwrap())
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test, extra = false,);
|
||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test, extra = false);
|
||||
|
||||
@@ -293,7 +293,7 @@ fn periodic_session_works() {
|
||||
// 1/10 of progress.
|
||||
assert!(P::should_end_session(3u64));
|
||||
assert_eq!(P::estimate_next_session_rotation(3u64).0.unwrap(), 3);
|
||||
assert_eq!(P::estimate_current_session_progress(3u64).0.unwrap(), Permill::from_percent(10),);
|
||||
assert_eq!(P::estimate_current_session_progress(3u64).0.unwrap(), Permill::from_percent(10));
|
||||
|
||||
for i in (1u64..10).map(|i| 3 + i) {
|
||||
assert!(!P::should_end_session(i));
|
||||
|
||||
@@ -1569,7 +1569,7 @@ pub mod pallet {
|
||||
) -> DispatchResult {
|
||||
let controller = ensure_signed(origin)?;
|
||||
let mut ledger = Self::ledger(&controller).ok_or(Error::<T>::NotController)?;
|
||||
ensure!(ledger.unlocking.len() < MAX_UNLOCKING_CHUNKS, Error::<T>::NoMoreChunks,);
|
||||
ensure!(ledger.unlocking.len() < MAX_UNLOCKING_CHUNKS, Error::<T>::NoMoreChunks);
|
||||
|
||||
let mut value = value.min(ledger.active);
|
||||
|
||||
|
||||
@@ -593,7 +593,7 @@ pub(crate) fn current_era() -> EraIndex {
|
||||
pub(crate) fn bond_validator(stash: AccountId, ctrl: AccountId, val: Balance) {
|
||||
let _ = Balances::make_free_balance_be(&stash, val);
|
||||
let _ = Balances::make_free_balance_be(&ctrl, val);
|
||||
assert_ok!(Staking::bond(Origin::signed(stash), ctrl, val, RewardDestination::Controller,));
|
||||
assert_ok!(Staking::bond(Origin::signed(stash), ctrl, val, RewardDestination::Controller));
|
||||
assert_ok!(Staking::validate(Origin::signed(ctrl), ValidatorPrefs::default()));
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ pub(crate) fn bond_nominator(
|
||||
) {
|
||||
let _ = Balances::make_free_balance_be(&stash, val);
|
||||
let _ = Balances::make_free_balance_be(&ctrl, val);
|
||||
assert_ok!(Staking::bond(Origin::signed(stash), ctrl, val, RewardDestination::Controller,));
|
||||
assert_ok!(Staking::bond(Origin::signed(stash), ctrl, val, RewardDestination::Controller));
|
||||
assert_ok!(Staking::nominate(Origin::signed(ctrl), target));
|
||||
}
|
||||
|
||||
|
||||
@@ -259,13 +259,13 @@ fn rewards_should_work() {
|
||||
init_balance_10 + part_for_10 * total_payout_0 * 2 / 3,
|
||||
2,
|
||||
);
|
||||
assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2,);
|
||||
assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2);
|
||||
assert_eq_error_rate!(
|
||||
Balances::total_balance(&20),
|
||||
init_balance_20 + part_for_20 * total_payout_0 * 1 / 3,
|
||||
2,
|
||||
);
|
||||
assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2,);
|
||||
assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2);
|
||||
assert_eq_error_rate!(
|
||||
Balances::total_balance(&100),
|
||||
init_balance_100 +
|
||||
@@ -297,13 +297,13 @@ fn rewards_should_work() {
|
||||
init_balance_10 + part_for_10 * (total_payout_0 * 2 / 3 + total_payout_1),
|
||||
2,
|
||||
);
|
||||
assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2,);
|
||||
assert_eq_error_rate!(Balances::total_balance(&11), init_balance_11, 2);
|
||||
assert_eq_error_rate!(
|
||||
Balances::total_balance(&20),
|
||||
init_balance_20 + part_for_20 * total_payout_0 * 1 / 3,
|
||||
2,
|
||||
);
|
||||
assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2,);
|
||||
assert_eq_error_rate!(Balances::total_balance(&21), init_balance_21, 2);
|
||||
assert_eq_error_rate!(
|
||||
Balances::total_balance(&100),
|
||||
init_balance_100 +
|
||||
@@ -468,7 +468,7 @@ fn no_candidate_emergency_condition() {
|
||||
|
||||
// try trigger new era
|
||||
mock::run_to_block(20);
|
||||
assert_eq!(*staking_events().last().unwrap(), Event::StakingElectionFailed,);
|
||||
assert_eq!(*staking_events().last().unwrap(), Event::StakingElectionFailed);
|
||||
// No new era is created
|
||||
assert_eq!(current_era, CurrentEra::<Test>::get());
|
||||
|
||||
@@ -607,7 +607,7 @@ fn nominators_also_get_slashed_pro_rata() {
|
||||
let slash_percent = Perbill::from_percent(5);
|
||||
let initial_exposure = Staking::eras_stakers(active_era(), 11);
|
||||
// 101 is a nominator for 11
|
||||
assert_eq!(initial_exposure.others.first().unwrap().who, 101,);
|
||||
assert_eq!(initial_exposure.others.first().unwrap().who, 101);
|
||||
|
||||
// staked values;
|
||||
let nominator_stake = Staking::ledger(100).unwrap().active;
|
||||
@@ -639,8 +639,8 @@ fn nominators_also_get_slashed_pro_rata() {
|
||||
assert!(nominator_share > 0);
|
||||
|
||||
// both stakes must have been decreased pro-rata.
|
||||
assert_eq!(Staking::ledger(100).unwrap().active, nominator_stake - nominator_share,);
|
||||
assert_eq!(Staking::ledger(10).unwrap().active, validator_stake - validator_share,);
|
||||
assert_eq!(Staking::ledger(100).unwrap().active, nominator_stake - nominator_share);
|
||||
assert_eq!(Staking::ledger(10).unwrap().active, validator_stake - validator_share);
|
||||
assert_eq!(
|
||||
balances(&101).0, // free balance
|
||||
nominator_balance - nominator_share,
|
||||
@@ -905,7 +905,7 @@ fn cannot_reserve_staked_balance() {
|
||||
// Confirm account 11 (via controller 10) is totally staked
|
||||
assert_eq!(Staking::eras_stakers(Staking::active_era().unwrap().index, 11).own, 1000);
|
||||
// Confirm account 11 cannot reserve as a result
|
||||
assert_noop!(Balances::reserve(&11, 1), BalancesError::<Test, _>::LiquidityRestrictions,);
|
||||
assert_noop!(Balances::reserve(&11, 1), BalancesError::<Test, _>::LiquidityRestrictions);
|
||||
|
||||
// Give account 11 extra free balance
|
||||
let _ = Balances::make_free_balance_be(&11, 10000);
|
||||
@@ -1312,7 +1312,7 @@ fn rebond_works() {
|
||||
assert_eq!(Staking::active_era().unwrap().index, 2);
|
||||
|
||||
// Try to rebond some funds. We get an error since no fund is unbonded.
|
||||
assert_noop!(Staking::rebond(Origin::signed(10), 500), Error::<Test>::NoUnlockChunk,);
|
||||
assert_noop!(Staking::rebond(Origin::signed(10), 500), Error::<Test>::NoUnlockChunk);
|
||||
|
||||
// Unbond almost all of the funds in stash.
|
||||
Staking::unbond(Origin::signed(10), 900).unwrap();
|
||||
@@ -2606,9 +2606,9 @@ fn slashing_nominators_by_span_max() {
|
||||
|
||||
let get_span = |account| <Staking as crate::Store>::SlashingSpans::get(&account).unwrap();
|
||||
|
||||
assert_eq!(get_span(11).iter().collect::<Vec<_>>(), expected_spans,);
|
||||
assert_eq!(get_span(11).iter().collect::<Vec<_>>(), expected_spans);
|
||||
|
||||
assert_eq!(get_span(101).iter().collect::<Vec<_>>(), expected_spans,);
|
||||
assert_eq!(get_span(101).iter().collect::<Vec<_>>(), expected_spans);
|
||||
|
||||
// second slash: higher era, higher value, same span.
|
||||
on_offence_in_era(
|
||||
@@ -3724,7 +3724,7 @@ fn cannot_rebond_to_lower_than_ed() {
|
||||
);
|
||||
|
||||
// now bond a wee bit more
|
||||
assert_noop!(Staking::rebond(Origin::signed(20), 5), Error::<Test>::InsufficientBond,);
|
||||
assert_noop!(Staking::rebond(Origin::signed(20), 5), Error::<Test>::InsufficientBond);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ fn get_module_instance(
|
||||
(None, None, None) => Ok(None),
|
||||
(Some(instance), None, _) => Err(syn::Error::new(
|
||||
instance.span(),
|
||||
format!("Expect instantiable trait bound for instance: {}. {}", instance, right_syntax,),
|
||||
format!("Expect instantiable trait bound for instance: {}. {}", instance, right_syntax),
|
||||
)),
|
||||
(None, Some(instantiable), _) => Err(syn::Error::new(
|
||||
instantiable.span(),
|
||||
|
||||
@@ -532,7 +532,7 @@ mod test_iterators {
|
||||
vec![(3, 3), (0, 0), (2, 2), (1, 1)],
|
||||
);
|
||||
|
||||
assert_eq!(DoubleMap::iter_values().collect::<Vec<_>>(), vec![3, 0, 2, 1],);
|
||||
assert_eq!(DoubleMap::iter_values().collect::<Vec<_>>(), vec![3, 0, 2, 1]);
|
||||
|
||||
assert_eq!(
|
||||
DoubleMap::drain().collect::<Vec<_>>(),
|
||||
@@ -559,9 +559,9 @@ mod test_iterators {
|
||||
vec![(1, 1), (2, 2), (0, 0), (3, 3)],
|
||||
);
|
||||
|
||||
assert_eq!(DoubleMap::iter_key_prefix(k1).collect::<Vec<_>>(), vec![1, 2, 0, 3],);
|
||||
assert_eq!(DoubleMap::iter_key_prefix(k1).collect::<Vec<_>>(), vec![1, 2, 0, 3]);
|
||||
|
||||
assert_eq!(DoubleMap::iter_prefix_values(k1).collect::<Vec<_>>(), vec![1, 2, 0, 3],);
|
||||
assert_eq!(DoubleMap::iter_prefix_values(k1).collect::<Vec<_>>(), vec![1, 2, 0, 3]);
|
||||
|
||||
assert_eq!(
|
||||
DoubleMap::drain_prefix(k1).collect::<Vec<_>>(),
|
||||
|
||||
@@ -495,9 +495,9 @@ mod test_iterators {
|
||||
vec![((3, 3), 3), ((0, 0), 0), ((2, 2), 2), ((1, 1), 1)],
|
||||
);
|
||||
|
||||
assert_eq!(NMap::iter_keys().collect::<Vec<_>>(), vec![(3, 3), (0, 0), (2, 2), (1, 1)],);
|
||||
assert_eq!(NMap::iter_keys().collect::<Vec<_>>(), vec![(3, 3), (0, 0), (2, 2), (1, 1)]);
|
||||
|
||||
assert_eq!(NMap::iter_values().collect::<Vec<_>>(), vec![3, 0, 2, 1],);
|
||||
assert_eq!(NMap::iter_values().collect::<Vec<_>>(), vec![3, 0, 2, 1]);
|
||||
|
||||
assert_eq!(
|
||||
NMap::drain().collect::<Vec<_>>(),
|
||||
@@ -524,9 +524,9 @@ mod test_iterators {
|
||||
vec![(1, 1), (2, 2), (0, 0), (3, 3)],
|
||||
);
|
||||
|
||||
assert_eq!(NMap::iter_key_prefix((k1,)).collect::<Vec<_>>(), vec![1, 2, 0, 3],);
|
||||
assert_eq!(NMap::iter_key_prefix((k1,)).collect::<Vec<_>>(), vec![1, 2, 0, 3]);
|
||||
|
||||
assert_eq!(NMap::iter_prefix_values((k1,)).collect::<Vec<_>>(), vec![1, 2, 0, 3],);
|
||||
assert_eq!(NMap::iter_prefix_values((k1,)).collect::<Vec<_>>(), vec![1, 2, 0, 3]);
|
||||
|
||||
assert_eq!(
|
||||
NMap::drain_prefix((k1,)).collect::<Vec<_>>(),
|
||||
|
||||
@@ -1030,7 +1030,7 @@ pub trait StoragePrefixedMap<Value: FullCodec> {
|
||||
None => unhashed::kill(&previous_key),
|
||||
},
|
||||
None => {
|
||||
log::error!("old key failed to decode at {:?}", previous_key,);
|
||||
log::error!("old key failed to decode at {:?}", previous_key);
|
||||
continue
|
||||
},
|
||||
}
|
||||
|
||||
@@ -25,5 +25,5 @@ fn ensure_that_current_pallet_version_is_correct() {
|
||||
patch: env!("CARGO_PKG_VERSION_PATCH").parse().unwrap(),
|
||||
};
|
||||
|
||||
assert_eq!(expected, crate_to_pallet_version!(),)
|
||||
assert_eq!(expected, crate_to_pallet_version!())
|
||||
}
|
||||
|
||||
@@ -153,8 +153,8 @@ fn test_enum() {
|
||||
TestEnum::VariantUnnamed(0, 0, 0, Default::default())
|
||||
);
|
||||
|
||||
assert_eq!(Enum2::<Runtime>::default(), Enum2::<Runtime>::VariantNamed { a: 0, b: 0, c: 0 },);
|
||||
assert_eq!(Enum3::<Runtime>::default(), Enum3::<Runtime>::VariantUnit,);
|
||||
assert_eq!(Enum2::<Runtime>::default(), Enum2::<Runtime>::VariantNamed { a: 0, b: 0, c: 0 });
|
||||
assert_eq!(Enum3::<Runtime>::default(), Enum3::<Runtime>::VariantUnit);
|
||||
|
||||
assert!(variant_0 != variant_0_bis);
|
||||
assert!(variant_1 != variant_1_bis);
|
||||
@@ -184,6 +184,6 @@ fn test_enum() {
|
||||
format!("{:?}", variant_1),
|
||||
String::from("Enum::VariantNamed { a: 1, b: 2, c: 3, phantom: PhantomData }"),
|
||||
);
|
||||
assert_eq!(format!("{:?}", variant_2), String::from("Enum::VariantUnit"),);
|
||||
assert_eq!(format!("{:?}", variant_3), String::from("Enum::VariantUnit2"),);
|
||||
assert_eq!(format!("{:?}", variant_2), String::from("Enum::VariantUnit"));
|
||||
assert_eq!(format!("{:?}", variant_3), String::from("Enum::VariantUnit2"));
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ fn call_expand() {
|
||||
DispatchInfo { weight: 3, class: DispatchClass::Normal, pays_fee: Pays::Yes }
|
||||
);
|
||||
assert_eq!(call_foo.get_call_name(), "foo");
|
||||
assert_eq!(pallet::Call::<Runtime>::get_call_names(), &["foo", "foo_transactional"],);
|
||||
assert_eq!(pallet::Call::<Runtime>::get_call_names(), &["foo", "foo_transactional"]);
|
||||
|
||||
let call_foo = pallet::Call::<Runtime, pallet::Instance1>::foo(3);
|
||||
assert_eq!(
|
||||
|
||||
@@ -139,4 +139,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test,);
|
||||
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
|
||||
@@ -606,7 +606,7 @@ mod tests {
|
||||
assert_eq!(BlockWeight::<Test>::get().total(), info.weight + 256);
|
||||
|
||||
assert_ok!(CheckWeight::<Test>::post_dispatch(pre, &info, &post_info, len, &Ok(())));
|
||||
assert_eq!(BlockWeight::<Test>::get().total(), post_info.actual_weight.unwrap() + 256,);
|
||||
assert_eq!(BlockWeight::<Test>::get().total(), post_info.actual_weight.unwrap() + 256);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -314,9 +314,9 @@ fn deposit_event_topics() {
|
||||
|
||||
// Check that the topic-events mapping reflects the deposited topics.
|
||||
// Note that these are indexes of the events.
|
||||
assert_eq!(System::event_topics(&topics[0]), vec![(BLOCK_NUMBER, 0), (BLOCK_NUMBER, 1)],);
|
||||
assert_eq!(System::event_topics(&topics[1]), vec![(BLOCK_NUMBER, 0), (BLOCK_NUMBER, 2)],);
|
||||
assert_eq!(System::event_topics(&topics[2]), vec![(BLOCK_NUMBER, 0)],);
|
||||
assert_eq!(System::event_topics(&topics[0]), vec![(BLOCK_NUMBER, 0), (BLOCK_NUMBER, 1)]);
|
||||
assert_eq!(System::event_topics(&topics[1]), vec![(BLOCK_NUMBER, 0), (BLOCK_NUMBER, 2)]);
|
||||
assert_eq!(System::event_topics(&topics[2]), vec![(BLOCK_NUMBER, 0)]);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -343,12 +343,12 @@ fn prunes_block_hash_mappings() {
|
||||
|
||||
// first 5 block hashes are pruned
|
||||
for n in 0..5 {
|
||||
assert_eq!(System::block_hash(n), H256::zero(),);
|
||||
assert_eq!(System::block_hash(n), H256::zero());
|
||||
}
|
||||
|
||||
// the remaining 10 are kept
|
||||
for n in 5..15 {
|
||||
assert_eq!(System::block_hash(n), [n as u8; 32].into(),);
|
||||
assert_eq!(System::block_hash(n), [n as u8; 32].into());
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -57,4 +57,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Timestamp, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Timestamp, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -192,4 +192,4 @@ benchmarks! {
|
||||
}: _(RawOrigin::Root, hash)
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(TipsMod, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(TipsMod, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -314,7 +314,7 @@ fn slash_tip_works() {
|
||||
assert_eq!(last_event(), RawEvent::NewTip(h));
|
||||
|
||||
// can't remove from any origin
|
||||
assert_noop!(TipsModTestInst::slash_tip(Origin::signed(0), h.clone()), BadOrigin,);
|
||||
assert_noop!(TipsModTestInst::slash_tip(Origin::signed(0), h.clone()), BadOrigin);
|
||||
|
||||
// can remove from root.
|
||||
assert_ok!(TipsModTestInst::slash_tip(Origin::root(), h.clone()));
|
||||
|
||||
@@ -145,4 +145,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(TransactionStorage, crate::mock::new_test_ext(), crate::mock::Test,);
|
||||
impl_benchmark_test_suite!(TransactionStorage, crate::mock::new_test_ext(), crate::mock::Test);
|
||||
|
||||
@@ -96,4 +96,4 @@ benchmarks_instance_pallet! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Treasury, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Treasury, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
@@ -65,4 +65,4 @@ benchmarks! {
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::Test,);
|
||||
impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::Test);
|
||||
|
||||
Reference in New Issue
Block a user