Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ConstEncodedLen #428

Merged
merged 9 commits into from
May 4, 2023
Merged

Add ConstEncodedLen #428

merged 9 commits into from
May 4, 2023

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Apr 29, 2023

Closes #427
Adds a ConstEncodedLen trait that marks types that can be used for in-place memory operations.

I put it under the max-encoded-len feature. Another feature seems overkill, since it already relies on MEL.
Derive macro makes no sense here, or? I did not add one.

As context: in the MQ we are abusing the MEL bound as CEL in multiple spots under the assumption that they are equal, eg here. This is bound to break if someone configures compact integers in the pallet config.

TODO:

  • Formatting / CI
  • Changelog
  • Minor version bump

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Seems all to come from the 'proptest'. But the the 'quickcheck'
is unmaintained, so rather not using it.

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

@mrcnski mrcnski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get some compile errors when I run cargo test --features "max-encoded-len". Looks like CI doesn't catch this.

Apart from that looks good to me!

src/const_encoded_len.rs Outdated Show resolved Hide resolved
src/const_encoded_len.rs Outdated Show resolved Hide resolved
Co-authored-by: Bastian Köcher <git@kchr.de>
@ggwpez ggwpez mentioned this pull request May 3, 2023
ggwpez added 5 commits May 3, 2023 22:44
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Just to ensure that there is no accidential update of the lock.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez requested a review from mrcnski May 4, 2023 08:16
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez merged commit 4502678 into master May 4, 2023
@ggwpez ggwpez deleted the oty-const-encoded-len branch October 27, 2023 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Marker trait ConstEncodedLen
3 participants