-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Ensure data size of identity pallet is bounded #9168
Conversation
| display: Data::Raw(b"ten".to_vec()), | ||
| legal: Data::Raw(b"The Right Ordinal Ten, Esq.".to_vec()), | ||
| display: Data::Raw(b"ten".to_vec().try_into().unwrap()), | ||
| legal: Data::Raw(b"The Right Ordinal Ten, Esq.".to_vec().try_into().unwrap()), |
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.
🤣
| fn setting_subaccounts_should_work() { | ||
| new_test_ext().execute_with(|| { | ||
| let mut subs = vec![(20, Data::Raw(vec![40; 1]))]; | ||
| let mut subs = vec![(20, Data::Raw(vec![40; 1].try_into().unwrap()))]; |
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.
I'm seeing a lot of changes with this pattern. Maybe a test-scoped function like
fn one_raw_data<S>(n: u8) -> Data {
Data::Raw(vec![n; 1].try_into().unwrap())
}would be convenient?
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.
the other alternative is to turn the other side into vec, or by creating an implementation of PartialEq of boundedvec and vec?
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.
Implementing PartialEq actually makes a lot more sense, I'll do that instead.
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.
Ok, this actually doesn't work, because the problem isn't so much that PartialEq wasn't implemented between Vec and BoundedVec, it's that Data::Raw accepts a BoundedVec instead of a Vec as its inner struct.
| } | ||
|
|
||
| /// Exactly the same semantics as [`Vec::get_mut`]. | ||
| pub fn get_mut<I: SliceIndex<[T]>>( |
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.
👍
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.
There should also be the same addition to the weakly_bounded_vec definition
e309366 to
be9954b
Compare
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.
needs change below
shawntabrizi
left a comment
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.
verify first, write last rule is not enforced
|
bot merge |
|
Trying merge. |
Part of paritytech/polkadot-sdk#323.