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
@@ -29,7 +29,7 @@ mod tests {
pub trait Config: frame_support_test::Config {
type Origin2: codec::Codec + codec::EncodeLike + Default
+ frame_support::traits::MaxEncodedLen;
+ codec::MaxEncodedLen;
}
frame_support::decl_storage! {
+2 -3
View File
@@ -19,7 +19,6 @@ use frame_support::{
weights::{DispatchInfo, DispatchClass, Pays, GetDispatchInfo},
traits::{
GetCallName, OnInitialize, OnFinalize, OnRuntimeUpgrade, GetPalletVersion, OnGenesis,
MaxEncodedLen,
},
dispatch::{UnfilteredDispatchable, Parameter},
storage::unhashed,
@@ -48,10 +47,10 @@ impl From<SomeType6> for u64 { fn from(_t: SomeType6) -> Self { 0u64 } }
pub struct SomeType7;
impl From<SomeType7> for u64 { fn from(_t: SomeType7) -> Self { 0u64 } }
pub trait SomeAssociation1 { type _1: Parameter + MaxEncodedLen; }
pub trait SomeAssociation1 { type _1: Parameter + codec::MaxEncodedLen; }
impl SomeAssociation1 for u64 { type _1 = u64; }
pub trait SomeAssociation2 { type _2: Parameter + MaxEncodedLen; }
pub trait SomeAssociation2 { type _2: Parameter + codec::MaxEncodedLen; }
impl SomeAssociation2 for u64 { type _2 = u64; }
#[frame_support::pallet]
@@ -33,9 +33,9 @@ error[E0277]: the trait bound `<T as pallet::Config>::Bar: WrapperTypeEncode` is
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^ the trait `WrapperTypeEncode` is not implemented for `<T as pallet::Config>::Bar`
|
::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:216:21
::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.2.0/src/codec.rs:223:21
|
216 | fn encode_to<T: Output + ?Sized>(&self, dest: &mut T) {
223 | fn encode_to<T: Output + ?Sized>(&self, dest: &mut T) {
| ------ required by this bound in `encode_to`
|
= note: required because of the requirements on the impl of `pallet::_::_parity_scale_codec::Encode` for `<T as pallet::Config>::Bar`
@@ -46,9 +46,9 @@ error[E0277]: the trait bound `<T as pallet::Config>::Bar: WrapperTypeDecode` is
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^ the trait `WrapperTypeDecode` is not implemented for `<T as pallet::Config>::Bar`
|
::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:277:18
::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.2.0/src/codec.rs:284:18
|
277 | fn decode<I: Input>(input: &mut I) -> Result<Self, Error>;
284 | fn decode<I: Input>(input: &mut I) -> Result<Self, Error>;
| ----- required by this bound in `pallet::_::_parity_scale_codec::Decode::decode`
|
= note: required because of the requirements on the impl of `Decode` for `<T as pallet::Config>::Bar`