From dbb3f24e3ec5b488b07e60f0d6eec9ff7f44add3 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Tue, 1 Feb 2022 14:45:16 +0100 Subject: [PATCH] Add `MaxEncodedLen` to `implement_fixed!` (#10768) Signed-off-by: Oliver Tale-Yazdi --- substrate/primitives/arithmetic/src/fixed_point.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/substrate/primitives/arithmetic/src/fixed_point.rs b/substrate/primitives/arithmetic/src/fixed_point.rs index 206e63af95..1c61d6c380 100644 --- a/substrate/primitives/arithmetic/src/fixed_point.rs +++ b/substrate/primitives/arithmetic/src/fixed_point.rs @@ -369,6 +369,7 @@ macro_rules! implement_fixed { Default, Copy, Clone, + codec::MaxEncodedLen, PartialEq, Eq, PartialOrd, @@ -667,6 +668,15 @@ macro_rules! implement_fixed { assert!($name::DIV > 0); } + #[test] + fn has_max_encoded_len() { + struct AsMaxEncodedLen { + _data: T, + } + + let _ = AsMaxEncodedLen { _data: $name::min_value() }; + } + #[test] fn from_i129_works() { let a = I129 { value: 1, negative: true };