v3::Junction supports small (32-byte max) "vecs". (#6716)

* v3::Junction supports small (32-byte max) "vecs".

* Formatting

* Add test
This commit is contained in:
Gavin Wood
2023-02-14 13:31:27 +00:00
committed by GitHub
parent 91bb2ae3d0
commit 9c35763017
2 changed files with 72 additions and 6 deletions
+3 -3
View File
@@ -92,11 +92,11 @@ impl TryFrom<NewJunction> for Junction {
Self::AccountKey20 { network: network.try_into()?, key },
PalletInstance(index) => Self::PalletInstance(index),
GeneralIndex(id) => Self::GeneralIndex(id),
GeneralKey(key) => Self::GeneralKey(
key[..]
GeneralKey { length, data } => Self::GeneralKey(
data[0..data.len().min(length as usize)]
.to_vec()
.try_into()
.expect("array is of size 32 and so will never be out of bounds; qed"),
.expect("key is bounded to 32 and so will never be out of bounds; qed"),
),
OnlyChild => Self::OnlyChild,
Plurality { id, part } => Self::Plurality { id: id.into(), part: part.into() },