Update scale-info and parity-scale-codec requirements (#462)

* Update scale-info and parity-scale-codec requirements

* Update CHANGELOG

* Update frame-metadata

* Update bitvec

* Fix test

* Update bitvec event decoding

* More bitvec updates

* Update substrate primitives dependencies

* Fix up bitvec errors and decode error

* Fix up bitvec errors

* Update polkadot codegen
This commit is contained in:
Andrew Jones
2022-03-01 16:36:38 +00:00
committed by GitHub
parent 13347362d5
commit 11f24d78f7
12 changed files with 216 additions and 172 deletions
+13 -13
View File
@@ -189,16 +189,16 @@ pub fn decode_and_consume_type(
// used lines up in terms of the number of bytes it will take to encode/decode it.
match bit_store_def {
TypeDef::Primitive(TypeDefPrimitive::U8) => {
consume_type::<BitVec<Lsb0, u8>>(input)
consume_type::<BitVec<u8, Lsb0>>(input)
}
TypeDef::Primitive(TypeDefPrimitive::U16) => {
consume_type::<BitVec<Lsb0, u16>>(input)
consume_type::<BitVec<u16, Lsb0>>(input)
}
TypeDef::Primitive(TypeDefPrimitive::U32) => {
consume_type::<BitVec<Lsb0, u32>>(input)
consume_type::<BitVec<u32, Lsb0>>(input)
}
TypeDef::Primitive(TypeDefPrimitive::U64) => {
consume_type::<BitVec<Lsb0, u64>>(input)
consume_type::<BitVec<u64, Lsb0>>(input)
}
store => {
return Err(EventsDecodingError::InvalidBitSequenceType(format!(
@@ -272,31 +272,31 @@ mod tests {
use bitvec::order::Msb0;
decode_and_consume_type_consumes_all_bytes(
bitvec::bitvec![Lsb0, u8; 0, 1, 1, 0, 1],
bitvec::bitvec![u8, Lsb0; 0, 1, 1, 0, 1],
);
decode_and_consume_type_consumes_all_bytes(
bitvec::bitvec![Msb0, u8; 0, 1, 1, 0, 1, 0, 1, 0, 0],
bitvec::bitvec![u8, Msb0; 0, 1, 1, 0, 1, 0, 1, 0, 0],
);
decode_and_consume_type_consumes_all_bytes(
bitvec::bitvec![Lsb0, u16; 0, 1, 1, 0, 1],
bitvec::bitvec![u16, Lsb0; 0, 1, 1, 0, 1],
);
decode_and_consume_type_consumes_all_bytes(
bitvec::bitvec![Msb0, u16; 0, 1, 1, 0, 1, 0, 1, 0, 0],
bitvec::bitvec![u16, Msb0; 0, 1, 1, 0, 1, 0, 1, 0, 0],
);
decode_and_consume_type_consumes_all_bytes(
bitvec::bitvec![Lsb0, u32; 0, 1, 1, 0, 1],
bitvec::bitvec![u32, Lsb0; 0, 1, 1, 0, 1],
);
decode_and_consume_type_consumes_all_bytes(
bitvec::bitvec![Msb0, u32; 0, 1, 1, 0, 1, 0, 1, 0, 0],
bitvec::bitvec![u32, Msb0; 0, 1, 1, 0, 1, 0, 1, 0, 0],
);
decode_and_consume_type_consumes_all_bytes(
bitvec::bitvec![Lsb0, u64; 0, 1, 1, 0, 1],
bitvec::bitvec![u64, Lsb0; 0, 1, 1, 0, 1],
);
decode_and_consume_type_consumes_all_bytes(
bitvec::bitvec![Msb0, u64; 0, 1, 1, 0, 1, 0, 1, 0, 0],
bitvec::bitvec![u64, Msb0; 0, 1, 1, 0, 1, 0, 1, 0, 0],
);
}
@@ -434,7 +434,7 @@ mod tests {
});
decode_and_consume_type_consumes_all_bytes(CompositeV3 {
id: 10,
extra: bitvec::bitvec![Lsb0, u8; 0, 1, 1, 0, 1],
extra: bitvec::bitvec![u8, Lsb0; 0, 1, 1, 0, 1],
});
decode_and_consume_type_consumes_all_bytes(CompositeV3 {
id: 10,
+1 -1
View File
@@ -195,7 +195,7 @@ impl<T: Decode> WrapperKeepOpaque<T> {
///
/// Returns `None` if the decoding failed.
pub fn try_decode(&self) -> Option<T> {
T::decode_all(&self.data[..]).ok()
T::decode_all(&mut &self.data[..]).ok()
}
/// Returns the length of the encoded `T`.