mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 19:15:41 +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
@@ -6,7 +6,7 @@ description = "Aura consensus algorithm for substrate"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
parity-codec = "4.1.1"
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0" }
|
||||
primitives = { package = "substrate-primitives", path = "../../primitives" }
|
||||
runtime_support = { package = "srml-support", path = "../../../srml/support" }
|
||||
runtime_version = { package = "sr-version", path = "../../sr-version" }
|
||||
|
||||
@@ -6,7 +6,7 @@ description = "Primitives for Aura consensus"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
parity-codec = { version = "4.1.1", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
|
||||
substrate-client = { path = "../../../client", default-features = false }
|
||||
primitives = { package = "substrate-primitives", path = "../../../primitives", default-features = false }
|
||||
rstd = { package = "sr-std", path = "../../../sr-std", default-features = false }
|
||||
@@ -16,7 +16,7 @@ sr-primitives = { path = "../../../sr-primitives", default-features = false }
|
||||
default = ["std"]
|
||||
std = [
|
||||
"rstd/std",
|
||||
"parity-codec/std",
|
||||
"codec/std",
|
||||
"sr-primitives/std",
|
||||
"substrate-client/std",
|
||||
"primitives/std",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use parity_codec::{Encode, Decode, Codec};
|
||||
use codec::{Encode, Decode, Codec};
|
||||
use substrate_client::decl_runtime_apis;
|
||||
use rstd::vec::Vec;
|
||||
use sr_primitives::ConsensusEngineId;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
use primitives::Pair;
|
||||
use aura_primitives::AURA_ENGINE_ID;
|
||||
use sr_primitives::generic::{DigestItem, OpaqueDigestItemId};
|
||||
use parity_codec::{Encode, Codec};
|
||||
use codec::{Encode, Codec};
|
||||
use std::fmt::Debug;
|
||||
|
||||
type Signature<P> = <P as Pair>::Signature;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#![forbid(missing_docs, unsafe_code)]
|
||||
use std::{sync::Arc, time::Duration, thread, marker::PhantomData, hash::Hash, fmt::Debug, pin::Pin};
|
||||
|
||||
use parity_codec::{Encode, Decode, Codec};
|
||||
use codec::{Encode, Decode, Codec};
|
||||
use consensus_common::{self, BlockImport, Environment, Proposer,
|
||||
ForkChoiceStrategy, BlockImportParams, BlockOrigin, Error as ConsensusError,
|
||||
SelectChain, well_known_cache_keys::{self, Id as CacheKeyId}
|
||||
@@ -623,7 +623,7 @@ fn initialize_authorities_cache<A, B, C>(client: &C) -> Result<(), ConsensusErro
|
||||
let genesis_id = BlockId::Number(Zero::zero());
|
||||
let genesis_authorities: Option<Vec<A>> = cache
|
||||
.get_at(&well_known_cache_keys::AUTHORITIES, &genesis_id)
|
||||
.and_then(|v| Decode::decode(&mut &v[..]));
|
||||
.and_then(|v| Decode::decode(&mut &v[..]).ok());
|
||||
if genesis_authorities.is_some() {
|
||||
return Ok(());
|
||||
}
|
||||
@@ -651,7 +651,7 @@ fn authorities<A, B, C>(client: &C, at: &BlockId<B>) -> Result<Vec<A>, Consensus
|
||||
.cache()
|
||||
.and_then(|cache| cache
|
||||
.get_at(&well_known_cache_keys::AUTHORITIES, at)
|
||||
.and_then(|v| Decode::decode(&mut &v[..]))
|
||||
.and_then(|v| Decode::decode(&mut &v[..]).ok())
|
||||
)
|
||||
.or_else(|| AuraApi::authorities(&*client.runtime_api(), at).ok())
|
||||
.ok_or_else(|| consensus_common::Error::InvalidAuthoritiesSet.into())
|
||||
|
||||
Reference in New Issue
Block a user