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

Converted Vec storage to BoundedVec #487

Merged
merged 7 commits into from
May 15, 2021
Merged

Converted Vec storage to BoundedVec #487

merged 7 commits into from
May 15, 2021

Conversation

brettkolodny
Copy link
Contributor

No description provided.

@@ -444,7 +446,9 @@ impl<T: Config> Pallet<T> {
frame_system::Pallet::<T>::dec_consumers(who);
}
} else {
<Locks<T>>::insert(who, currency_id, locks);
let bounded_locks: BoundedVec<BalanceLock<T::Balance>, T::MaxLocks> =
locks.to_vec().try_into().expect("Too many locked balances");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only use expect for things that can never fail. should modify the method signature to make it return DispatchResult instead

@@ -207,6 +207,7 @@ parameter_type_with_key! {

parameter_types! {
pub DustAccount: AccountId = PalletId(*b"orml/dst").into_account();
pub MaxLocks: u32 = 100_000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mark this small and write test to check behavior when exceed the limit

tokens/src/lib.rs Outdated Show resolved Hide resolved
@brettkolodny brettkolodny marked this pull request as ready for review May 14, 2021 14:27
@brettkolodny brettkolodny merged commit 8825fe4 into master May 15, 2021
@brettkolodny brettkolodny deleted the bounded-tokens branch May 15, 2021 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants