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()), |
| 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.
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.
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.
Implementing PartialEq actually makes a lot more sense, I'll do that instead.
There was a problem hiding this comment.
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.
There should also be the same addition to the weakly_bounded_vec definition
e309366 to
be9954b
Compare
shawntabrizi
left a comment
There was a problem hiding this comment.
verify first, write last rule is not enforced
|
bot merge |
|
Trying merge. |
Part of paritytech/polkadot-sdk#323.