Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update toolchain version to nightly 1.59 #339

Merged
merged 4 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pallets/attestation/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ pub(crate) mod runtime {
}

impl ExtBuilder {
#[must_use]
pub fn with_delegation_hierarchies(
mut self,
delegation_hierarchies: DelegationHierarchyInitialization<Test>,
Expand All @@ -299,21 +300,25 @@ pub(crate) mod runtime {
self
}

#[must_use]
pub fn with_delegations(mut self, delegations: Vec<(TestDelegationNodeId, DelegationNode<Test>)>) -> Self {
self.delegations = delegations;
self
}

#[must_use]
pub fn with_ctypes(mut self, ctypes: Vec<(TestCtypeHash, CtypeCreatorOf<Test>)>) -> Self {
self.ctypes = ctypes;
self
}

#[must_use]
pub fn with_balances(mut self, balances: Vec<(AccountIdOf<Test>, BalanceOf<Test>)>) -> Self {
self.balances = balances;
self
}

#[must_use]
pub fn with_attestations(mut self, attestations: Vec<(TestClaimHash, AttestationDetails<Test>)>) -> Self {
self.attestations = attestations;
self
Expand Down
4 changes: 4 additions & 0 deletions pallets/delegation/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ pub mod runtime {
}

impl ExtBuilder {
#[must_use]
pub fn with_delegation_hierarchies(
mut self,
delegation_hierarchies: DelegationHierarchyInitialization<Test>,
Expand All @@ -420,16 +421,19 @@ pub mod runtime {
self
}

#[must_use]
pub fn with_balances(mut self, balances: Vec<(AccountIdOf<Test>, BalanceOf<Test>)>) -> Self {
self.balances = balances;
self
}

#[must_use]
pub fn with_ctypes(mut self, ctypes: Vec<(TestCtypeHash, SubjectId)>) -> Self {
self.ctypes = ctypes;
self
}

#[must_use]
pub fn with_delegations(mut self, delegations: Vec<(TestDelegationNodeId, DelegationNode<Test>)>) -> Self {
self.delegations_stored = delegations;
self
Expand Down
5 changes: 2 additions & 3 deletions pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ pub mod pallet {
ensure!(amount >= T::MinDelegatorStake::get(), Error::<T>::NomStakeBelowMin);

// cannot be a collator candidate and delegator with same AccountId
ensure!(!Self::is_active_candidate(&acc).is_some(), Error::<T>::CandidateExists);
ensure!(Self::is_active_candidate(&acc).is_none(), Error::<T>::CandidateExists);
ensure!(
Unstaking::<T>::get(&acc).len().saturated_into::<u32>() < T::MaxUnstakeRequests::get(),
Error::<T>::CannotJoinBeforeUnlocking
Expand Down Expand Up @@ -2139,8 +2139,7 @@ pub mod pallet {
) -> Option<(BalanceOf<T>, BalanceOf<T>)> {
top_candidates
.get(index)
.map(|stake| CandidatePool::<T>::get(&stake.owner))
.flatten()
.and_then(|stake| CandidatePool::<T>::get(&stake.owner))
// SAFETY: the total is always more than the stake
.map(|state| (state.stake, state.total - state.stake))
}
Expand Down
4 changes: 2 additions & 2 deletions pallets/parachain-staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ fn execute_leave_candidates_with_delay() {
*collator
));
assert!(StakePallet::candidate_pool(&collator).is_none());
assert!(!StakePallet::is_active_candidate(collator).is_some());
assert!(StakePallet::is_active_candidate(collator).is_none());
assert_eq!(StakePallet::unstaking(collator).len(), 1);
}
assert_eq!(CandidatePool::<Test>::count(), 5, "Five collators left.");
Expand All @@ -906,7 +906,7 @@ fn execute_leave_candidates_with_delay() {
collator
));
assert!(StakePallet::candidate_pool(&collator).is_none());
assert!(!StakePallet::is_active_candidate(&collator).is_some());
assert!(StakePallet::is_active_candidate(&collator).is_none());
assert_eq!(StakePallet::unstaking(collator).len(), 1);
}
assert_eq!(CandidatePool::<Test>::count(), 2, "3 collators left.");
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2021-11-08"
channel = "nightly-2022-01-08"
targets = [ "wasm32-unknown-unknown" ]