-
Notifications
You must be signed in to change notification settings - Fork 94
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
Issue with bounds #691
Comments
So the PR 508 make use of compact type for max encoded len, So now staking doesn't compile because solution:
diff --git a/derive/src/max_encoded_len.rs b/derive/src/max_encoded_len.rs
index 8a592e1..d773096 100644
--- a/derive/src/max_encoded_len.rs
+++ b/derive/src/max_encoded_len.rs
@@ -85,14 +85,8 @@ fn fields_length_expr(fields: &Fields, crate_path: &syn::Path) -> proc_macro2::T
// caused the issue.
let expansion = fields_iter.map(|field| {
let ty = &field.ty;
- if utils::is_compact(field) {
- quote_spanned! {
- ty.span() => .saturating_add(<#crate_path::Compact::<#ty> as #crate_path::MaxEncodedLen>::max_encoded_len())
- }
- } else {
- quote_spanned! {
- ty.span() => .saturating_add(<#ty as #crate_path::MaxEncodedLen>::max_encoded_len())
- }
+ quote_spanned! {
+ ty.span() => .saturating_add(<#ty as #crate_path::MaxEncodedLen>::max_encoded_len())
}
});
quote! {
diff --git a/derive/src/max_encoded_len.rs b/derive/src/max_encoded_len.rs
index 8a592e1..f09f6c8 100644
--- a/derive/src/max_encoded_len.rs
+++ b/derive/src/max_encoded_len.rs
@@ -44,7 +44,7 @@ pub fn derive_max_encoded_len(input: proc_macro::TokenStream) -> proc_macro::Tok
None,
has_dumb_trait_bound(&input.attrs),
&crate_path,
- false,
+ true,
) {
return e.to_compile_error().into();
}
@@ -87,7 +87,9 @@ fn fields_length_expr(fields: &Fields, crate_path: &syn::Path) -> proc_macro2::T
let ty = &field.ty;
if utils::is_compact(field) {
quote_spanned! {
- ty.span() => .saturating_add(<#crate_path::Compact::<#ty> as #crate_path::MaxEncodedLen>::max_encoded_len())
+ ty.span() => .saturating_add(
+ <<#ty as #crate_path::HasCompact>::Type as #crate_path::MaxEncodedLen>::max_encoded_len()
+ )
}
} else {
quote_spanned! { |
I don't have much time to work on it for now, I can start again tomorrow. |
@gui1117 I can take it |
Now I see that there are multiple issues left even after fixing this one:
Seems related to #653
Maybe there are others as well Will tackle them one by one |
Opened #693 for fixing this specific issue Also opened a separate issues for the things mentiond above: |
compiling polkadot-sdk with the latest version fails with:
The text was updated successfully, but these errors were encountered: