This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
MaxBoundedLen
into its own crate (#8814)
* move MaxEncodedLen into its own crate * remove MaxEncodedLen impl from frame-support * add to assets and balances * try more fixes * fix compile Co-authored-by: Shawn Tabrizi <[email protected]>
- Loading branch information
1 parent
43edcac
commit 2001d32
Showing
28 changed files
with
143 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[package] | ||
name = "max-encoded-len" | ||
version = "3.0.0" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
edition = "2018" | ||
license = "Apache-2.0" | ||
homepage = "https://substrate.dev" | ||
repository = "https://github.com/paritytech/substrate/" | ||
description = "Trait MaxEncodedLen bounds the max encoded length of an item." | ||
|
||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false } | ||
impl-trait-for-tuples = "0.2.1" | ||
max-encoded-len-derive = { package = "max-encoded-len-derive", version = "3.0.0", path = "derive", default-features = false, optional = true } | ||
primitive-types = { version = "0.9.0", default-features = false, features = ["codec"] } | ||
|
||
[dev-dependencies] | ||
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [ "derive" ] } | ||
rustversion = "1.0.4" | ||
trybuild = "1.0.42" | ||
|
||
[features] | ||
default = [ | ||
"derive", | ||
"std", | ||
] | ||
derive = [ | ||
"max-encoded-len-derive", | ||
] | ||
std = [ | ||
"codec/std", | ||
"max-encoded-len-derive/std", | ||
"primitive-types/std", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[package] | ||
name = "max-encoded-len-derive" | ||
version = "3.0.0" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
edition = "2018" | ||
license = "Apache-2.0" | ||
homepage = "https://substrate.dev" | ||
repository = "https://github.com/paritytech/substrate/" | ||
description = "Derive support for MaxEncodedLen" | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[lib] | ||
proc-macro = true | ||
|
||
[dependencies] | ||
frame-support-procedural-tools = { version = "3.0.0", path = "../../support/procedural/tools" } | ||
proc-macro2 = "1.0.6" | ||
quote = "1.0.3" | ||
syn = { version = "1.0.58", features = ["full"] } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...st/tests/max_encoded_len_ui/not_encode.rs → ...en/tests/max_encoded_len_ui/not_encode.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...ests/max_encoded_len_ui/not_encode.stderr → ...ests/max_encoded_len_ui/not_encode.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
error[E0277]: the trait bound `NotEncode: WrapperTypeEncode` is not satisfied | ||
error[E0277]: the trait bound `NotEncode: parity_scale_codec::codec::WrapperTypeEncode` is not satisfied | ||
--> $DIR/not_encode.rs:3:10 | ||
| | ||
3 | #[derive(MaxEncodedLen)] | ||
| ^^^^^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `NotEncode` | ||
| ^^^^^^^^^^^^^ the trait `parity_scale_codec::codec::WrapperTypeEncode` is not implemented for `NotEncode` | ||
| | ||
::: $WORKSPACE/frame/support/src/traits/max_encoded_len.rs | ||
::: $WORKSPACE/frame/max-encoded-len/src/lib.rs | ||
| | ||
| pub trait MaxEncodedLen: Encode { | ||
| ------ required by this bound in `MaxEncodedLen` | ||
| | ||
= note: required because of the requirements on the impl of `frame_support::dispatch::Encode` for `NotEncode` | ||
= note: required because of the requirements on the impl of `parity_scale_codec::codec::Encode` for `NotEncode` | ||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) |
2 changes: 1 addition & 1 deletion
2
.../test/tests/max_encoded_len_ui/not_mel.rs → ...d-len/tests/max_encoded_len_ui/not_mel.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...rt/test/tests/max_encoded_len_ui/union.rs → ...ded-len/tests/max_encoded_len_ui/union.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...max_encoded_len_ui/unsupported_variant.rs → ...max_encoded_len_ui/unsupported_variant.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.