Remove in-tree max-encoded-len and use the new SCALE codec crate instead (#9163)

* Update impl-codec to use new upstream MaxEncodedLen trait

* Adapt crates to use the updated codec crate for `MaxEncodedLen`

* Remove max-encoded-len crate altogether

* Fix test compilation in `pallet-proxy`

* reorganize import (#9186)

* Fix remaining `MaxEncodedLen` imports

* Fix remaining old usages of max-encoded-len crate

* Fix UI test

* Manually depend on new impl-codec to fix Polkadot companion build

* Use newly released primitive-types v0.9.1 that has new codec impls

* Make sure codec deps are up-to-date in crates that use them

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
Igor Matuszewski
2021-07-05 22:37:24 +02:00
committed by GitHub
parent b61dd3e8c5
commit eb6d651f9c
70 changed files with 72 additions and 1037 deletions
+1 -3
View File
@@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
sp-std = { version = "3.0.0", default-features = false, path = "../std" }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive", "max-encoded-len"] }
log = { version = "0.4.11", default-features = false }
serde = { version = "1.0.101", optional = true, features = ["derive"] }
byteorder = { version = "1.3.2", default-features = false }
@@ -40,7 +40,6 @@ parity-util-mem = { version = "0.10.0", default-features = false, features = ["p
futures = { version = "0.3.1", optional = true }
dyn-clonable = { version = "0.9.0", optional = true }
thiserror = { version = "1.0.21", optional = true }
max-encoded-len = { version = "3.0.0", default-features = false, path = "../../max-encoded-len", features = [ "derive" ] }
# full crypto
ed25519-dalek = { version = "1.0.1", default-features = false, features = ["u64_backend", "alloc"], optional = true }
@@ -114,7 +113,6 @@ std = [
"futures/thread-pool",
"libsecp256k1/std",
"dyn-clonable",
"max-encoded-len/std",
]
# This feature enables all crypto primitives for `no_std` builds like microcontrollers
+1 -2
View File
@@ -20,7 +20,6 @@
// end::description[]
use crate::{sr25519, ed25519};
use max_encoded_len::MaxEncodedLen;
use sp_std::hash::Hash;
use sp_std::vec::Vec;
use sp_std::str;
@@ -31,7 +30,7 @@ use sp_std::convert::TryFrom;
use parking_lot::Mutex;
#[cfg(feature = "std")]
use rand::{RngCore, rngs::OsRng};
use codec::{Encode, Decode};
use codec::{Encode, Decode, MaxEncodedLen};
#[cfg(feature = "std")]
use regex::Regex;
#[cfg(feature = "std")]
+2 -2
View File
@@ -23,7 +23,7 @@
use sp_std::vec::Vec;
use sp_std::cmp::Ordering;
use codec::{Encode, Decode};
use codec::{Encode, Decode, MaxEncodedLen};
#[cfg(feature = "full_crypto")]
use core::convert::{TryFrom, TryInto};
@@ -52,7 +52,7 @@ pub const CRYPTO_ID: CryptoTypeId = CryptoTypeId(*b"ecds");
type Seed = [u8; 32];
/// The ECDSA compressed public key.
#[derive(Clone, Encode, Decode, PassByInner, max_encoded_len::MaxEncodedLen)]
#[derive(Clone, Encode, Decode, PassByInner, MaxEncodedLen)]
pub struct Public(pub [u8; 33]);
impl PartialOrd for Public {
+2 -2
View File
@@ -23,7 +23,7 @@
use sp_std::vec::Vec;
use crate::{hash::H256, hash::H512};
use codec::{Encode, Decode};
use codec::{Encode, Decode, MaxEncodedLen};
#[cfg(feature = "full_crypto")]
use core::convert::TryFrom;
@@ -56,7 +56,7 @@ type Seed = [u8; 32];
#[cfg_attr(feature = "full_crypto", derive(Hash))]
#[derive(
PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Encode, Decode, Default, PassByInner,
max_encoded_len::MaxEncodedLen,
MaxEncodedLen,
)]
pub struct Public(pub [u8; 32]);
+2 -2
View File
@@ -42,7 +42,7 @@ use crate::crypto::Ss58Codec;
use crate::crypto::{Public as TraitPublic, CryptoTypePublicPair, UncheckedFrom, CryptoType, Derive, CryptoTypeId};
use crate::hash::{H256, H512};
use codec::{Encode, Decode};
use codec::{Encode, Decode, MaxEncodedLen};
use sp_std::ops::Deref;
#[cfg(feature = "std")]
@@ -62,7 +62,7 @@ pub const CRYPTO_ID: CryptoTypeId = CryptoTypeId(*b"sr25");
#[cfg_attr(feature = "full_crypto", derive(Hash))]
#[derive(
PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Encode, Decode, Default, PassByInner,
max_encoded_len::MaxEncodedLen,
MaxEncodedLen,
)]
pub struct Public(pub [u8; 32]);