Update parity-scale-codec to 2.0 (#7994)

* update cargo.toml

* use 2.0 in mmmr
This commit is contained in:
Guillaume Thiolliere
2021-01-29 13:22:45 +01:00
committed by GitHub
parent bea4a6524d
commit f48296e9ad
179 changed files with 316 additions and 383 deletions
@@ -107,13 +107,13 @@ impl Era {
}
impl Encode for Era {
fn encode_to<T: Output>(&self, output: &mut T) {
fn encode_to<T: Output + ?Sized>(&self, output: &mut T) {
match self {
Era::Immortal => output.push_byte(0),
Era::Mortal(period, phase) => {
let quantize_factor = (*period as u64 >> 12).max(1);
let encoded = (period.trailing_zeros() - 1).max(1).min(15) as u16 | ((phase / quantize_factor) << 4) as u16;
output.push(&encoded);
encoded.encode_to(output);
}
}
}
@@ -106,12 +106,12 @@ impl<Number, Hash> Encode for Header<Number, Hash> where
Hash: HashT,
Hash::Output: Encode,
{
fn encode_to<T: Output>(&self, dest: &mut T) {
dest.push(&self.parent_hash);
dest.push(&<<<Number as HasCompact>::Type as EncodeAsRef<_>>::RefType>::from(&self.number));
dest.push(&self.state_root);
dest.push(&self.extrinsics_root);
dest.push(&self.digest);
fn encode_to<T: Output + ?Sized>(&self, dest: &mut T) {
self.parent_hash.encode_to(dest);
<<<Number as HasCompact>::Type as EncodeAsRef<_>>::RefType>::from(&self.number).encode_to(dest);
self.state_root.encode_to(dest);
self.extrinsics_root.encode_to(dest);
self.digest.encode_to(dest);
}
}