Skip to content

Converted Vec storage to BoundedVec#487

Merged
brettkolodny merged 7 commits into
masterfrom
bounded-tokens
May 15, 2021
Merged

Converted Vec storage to BoundedVec#487
brettkolodny merged 7 commits into
masterfrom
bounded-tokens

Conversation

@brettkolodny
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread tokens/src/lib.rs Outdated
} 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
Copy Markdown
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

Comment thread tokens/src/mock.rs Outdated

parameter_types! {
pub DustAccount: AccountId = PalletId(*b"orml/dst").into_account();
pub MaxLocks: u32 = 100_000;
Copy link
Copy Markdown
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

Comment thread tokens/src/lib.rs Outdated
@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.

2 participants