mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 19:41:05 +00:00
Update to parity-scale-codec (#3232)
* WIP: update codec * WIP * compiling * WIP * rename parity-scale-codec to codec * WIP * fix * remove old comments * use published crates * fix expected error msg * bump version * fmt and fix * remove old comment * fix wrong decoding impl * implement encode like for structures * undo removal of old pending changes * trailingzeroinput * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com> * update codec * fmt * version is 1.0.0 * show more error * fmt
This commit is contained in:
committed by
Bastian Köcher
parent
a0d442333f
commit
4ed67e03a4
@@ -7,7 +7,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
serde = { version = "1.0", optional = true }
|
||||
safe-mix = { version = "1.0", default-features = false}
|
||||
parity-codec = { version = "4.1.1", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
|
||||
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
|
||||
srml-support = { path = "../support", default-features = false }
|
||||
@@ -26,7 +26,7 @@ historical = ["substrate-trie"]
|
||||
std = [
|
||||
"serde",
|
||||
"safe-mix/std",
|
||||
"parity-codec/std",
|
||||
"codec/std",
|
||||
"rstd/std",
|
||||
"srml-support/std",
|
||||
"sr-primitives/std",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//! Afterwards, the proofs can be fed to a consensus module when reporting misbehavior.
|
||||
|
||||
use rstd::prelude::*;
|
||||
use parity_codec::{Encode, Decode};
|
||||
use codec::{Encode, Decode};
|
||||
use sr_primitives::KeyTypeId;
|
||||
use sr_primitives::traits::{Convert, OpaqueKeys, Hash as HashT};
|
||||
use srml_support::{
|
||||
@@ -235,13 +235,13 @@ impl<T: Trait> ProvingTrie<T> {
|
||||
let val_idx = (key_id, key_data).using_encoded(|s| {
|
||||
trie.get_with(s, &mut recorder)
|
||||
.ok()?
|
||||
.and_then(|raw| u32::decode(&mut &*raw))
|
||||
.and_then(|raw| u32::decode(&mut &*raw).ok())
|
||||
})?;
|
||||
|
||||
val_idx.using_encoded(|s| {
|
||||
trie.get_with(s, &mut recorder)
|
||||
.ok()?
|
||||
.and_then(|raw| <IdentificationTuple<T>>::decode(&mut &*raw))
|
||||
.and_then(|raw| <IdentificationTuple<T>>::decode(&mut &*raw).ok())
|
||||
})?;
|
||||
|
||||
Some(recorder.drain().into_iter().map(|r| r.data).collect())
|
||||
@@ -258,11 +258,11 @@ impl<T: Trait> ProvingTrie<T> {
|
||||
let trie = TrieDB::new(&self.db, &self.root).ok()?;
|
||||
let val_idx = (key_id, key_data).using_encoded(|s| trie.get(s))
|
||||
.ok()?
|
||||
.and_then(|raw| u32::decode(&mut &*raw))?;
|
||||
.and_then(|raw| u32::decode(&mut &*raw).ok())?;
|
||||
|
||||
val_idx.using_encoded(|s| trie.get(s))
|
||||
.ok()?
|
||||
.and_then(|raw| <IdentificationTuple<T>>::decode(&mut &*raw))
|
||||
.and_then(|raw| <IdentificationTuple<T>>::decode(&mut &*raw).ok())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use rstd::{prelude::*, marker::PhantomData, ops::{Sub, Rem}};
|
||||
use parity_codec::Decode;
|
||||
use codec::Decode;
|
||||
use sr_primitives::KeyTypeId;
|
||||
use sr_primitives::weights::SimpleDispatchInfo;
|
||||
use sr_primitives::traits::{Convert, Zero, Member, OpaqueKeys, TypedKey};
|
||||
|
||||
Reference in New Issue
Block a user