Require MaxEncodedLen per default (#10662)

* Remove generate_storage_info

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add without_storage_info where needed

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update doc tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add more without_storage_info

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fix TryBuild

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fix TryBuild tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2022-01-20 12:16:04 +01:00
committed by GitHub
parent 6b60c3dbff
commit 362a6d9b28
64 changed files with 127 additions and 109 deletions
+1 -1
View File
@@ -156,7 +156,6 @@ pub mod pallet {
#[pallet::pallet]
#[pallet::generate_store(pub(crate) trait Store)]
#[pallet::generate_storage_info]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(_);
@@ -450,6 +449,7 @@ pub mod pallet2 {
#[pallet::pallet]
#[pallet::generate_store(pub(crate) trait Store)]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);
#[pallet::hooks]
@@ -124,6 +124,7 @@ pub mod pallet {
}
#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);
#[pallet::hooks]
@@ -109,6 +109,7 @@ pub mod pallet {
}
#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);
#[pallet::hooks]
@@ -7,6 +7,7 @@ mod pallet {
pub trait Config: frame_system::Config {}
#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T>(core::marker::PhantomData<T>);
#[pallet::hooks]
@@ -1,97 +1,97 @@
error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen.rs:9:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:10:12
|
9 | #[pallet::pallet]
| ^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $DIR/storage.rs:88:2
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
88 | fn partial_storage_info() -> Vec<StorageInfo>;
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen.rs:9:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:10:12
|
9 | #[pallet::pallet]
| ^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $DIR/storage.rs:88:2
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
88 | fn partial_storage_info() -> Vec<StorageInfo>;
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen.rs:9:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:10:12
|
9 | #[pallet::pallet]
| ^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $DIR/storage.rs:88:2
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
88 | fn partial_storage_info() -> Vec<StorageInfo>;
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: TypeInfo` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen.rs:20:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
20 | #[pallet::storage]
21 | #[pallet::storage]
| ^^^^^^^ the trait `TypeInfo` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `StaticTypeInfo` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $DIR/mod.rs:113:2
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
113 | fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen.rs:20:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
20 | #[pallet::storage]
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $DIR/mod.rs:113:2
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
113 | fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen.rs:20:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
20 | #[pallet::storage]
21 | #[pallet::storage]
| ^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $DIR/mod.rs:113:2
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
113 | fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen.rs:20:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen.rs:21:12
|
20 | #[pallet::storage]
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Encode` for `Bar`
@@ -99,7 +99,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $DIR/mod.rs:113:2
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
113 | fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -7,6 +7,7 @@ mod pallet {
pub trait Config: frame_system::Config {}
#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T>(core::marker::PhantomData<T>);
#[pallet::hooks]
@@ -1,97 +1,97 @@
error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:9:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:10:12
|
9 | #[pallet::pallet]
| ^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $DIR/storage.rs:88:2
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
88 | fn partial_storage_info() -> Vec<StorageInfo>;
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:9:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:10:12
|
9 | #[pallet::pallet]
| ^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $DIR/storage.rs:88:2
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
88 | fn partial_storage_info() -> Vec<StorageInfo>;
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:9:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:10:12
|
9 | #[pallet::pallet]
| ^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
10 | #[pallet::without_storage_info]
| ^^^^^^^^^^^^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Encode` for `Bar`
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `PartialStorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `partial_storage_info`
--> $DIR/storage.rs:88:2
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
88 | fn partial_storage_info() -> Vec<StorageInfo>;
| fn partial_storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: TypeInfo` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:20:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
20 | #[pallet::storage]
21 | #[pallet::storage]
| ^^^^^^^ the trait `TypeInfo` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `StaticTypeInfo` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $DIR/mod.rs:113:2
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
113 | fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: WrapperTypeDecode` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:20:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
20 | #[pallet::storage]
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeDecode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Decode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $DIR/mod.rs:113:2
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
113 | fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: EncodeLike` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:20:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
20 | #[pallet::storage]
21 | #[pallet::storage]
| ^^^^^^^ the trait `EncodeLike` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `FullEncode` for `Bar`
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $DIR/mod.rs:113:2
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
113 | fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
--> $DIR/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:20:12
--> tests/pallet_ui/storage_ensure_span_are_ok_on_wrong_gen_unnamed.rs:21:12
|
20 | #[pallet::storage]
21 | #[pallet::storage]
| ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `Encode` for `Bar`
@@ -99,7 +99,7 @@ error[E0277]: the trait bound `Bar: WrapperTypeEncode` is not satisfied
= note: required because of the requirements on the impl of `FullCodec` for `Bar`
= note: required because of the requirements on the impl of `StorageEntryMetadataBuilder` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `build_metadata`
--> $DIR/mod.rs:113:2
--> $WORKSPACE/frame/support/src/storage/types/mod.rs
|
113 | fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| fn build_metadata(doc: Vec<&'static str>, entries: &mut Vec<StorageEntryMetadata>);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -7,7 +7,6 @@ mod pallet {
pub trait Config: frame_system::Config {}
#[pallet::pallet]
#[pallet::generate_storage_info]
pub struct Pallet<T>(core::marker::PhantomData<T>);
#[pallet::hooks]
@@ -1,12 +1,12 @@
error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied
--> $DIR/storage_info_unsatisfied.rs:10:12
--> tests/pallet_ui/storage_info_unsatisfied.rs:9:12
|
10 | #[pallet::generate_storage_info]
| ^^^^^^^^^^^^^^^^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
9 | #[pallet::pallet]
| ^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageValue<_GeneratedPrefixForStorageFoo<T>, Bar>`
note: required by `storage_info`
--> $DIR/storage.rs:71:2
--> $WORKSPACE/frame/support/src/traits/storage.rs
|
71 | fn storage_info() -> Vec<StorageInfo>;
| fn storage_info() -> Vec<StorageInfo>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -10,7 +10,6 @@ mod pallet {
pub trait Config: frame_system::Config {}
#[pallet::pallet]
#[pallet::generate_storage_info]
pub struct Pallet<T>(core::marker::PhantomData<T>);
#[pallet::hooks]
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied
--> tests/pallet_ui/storage_info_unsatisfied_nmap.rs:13:12
--> tests/pallet_ui/storage_info_unsatisfied_nmap.rs:12:12
|
13 | #[pallet::generate_storage_info]
| ^^^^^^^^^^^^^^^^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
12 | #[pallet::pallet]
| ^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `Key<frame_support::Twox64Concat, Bar>`
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo<T>, Key<frame_support::Twox64Concat, Bar>, u32>`