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

[Feature] Can implement the Compact trait for U256? #895

Open
atenjin opened this issue Jan 15, 2025 · 0 comments
Open

[Feature] Can implement the Compact trait for U256? #895

atenjin opened this issue Jan 15, 2025 · 0 comments

Comments

@atenjin
Copy link

atenjin commented Jan 15, 2025

For current version, codec provide the compact for u8 ~ u128, while in substrate, there are also lots of cases need to use U256.

In my case, we use lots of u256 in some structs, which are the types in some extrinsic and storage. I hope I can use Compact to wrap U256 type to save some bytes

I tested for it, while meet error:
e.g.:

#[derive(Encode, Decode)]
struct A {
   a: Compact<U256>
}

When compile, it will print

error[E0275]: overflow evaluating the requirement `for<'b> CompactRef<'b, _>: Encode`
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "512"]` attribute to your crate (`primitive_zklogin`)
  = note: required for `CompactRef<'b, _>` to implement `for<'b> Encode`
  = note: 253 redundant requirements hidden
  = note: required for `CompactRef<'a, _>` to implement `for<'a> Encode`

it looks like it's in a dead loop, so that what ever value for recursion_limit I set is useless

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

No branches or pull requests

1 participant