-
Notifications
You must be signed in to change notification settings - Fork 286
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
Conversation
tokens/src/lib.rs
Outdated
@@ -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"); |
There was a problem hiding this comment.
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
tokens/src/mock.rs
Outdated
@@ -207,6 +207,7 @@ parameter_type_with_key! { | |||
|
|||
parameter_types! { | |||
pub DustAccount: AccountId = PalletId(*b"orml/dst").into_account(); | |||
pub MaxLocks: u32 = 100_000; |
There was a problem hiding this comment.
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
No description provided.