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 you implement the Compact trait for U256? #680

Closed
atenjin opened this issue Jan 15, 2025 · 4 comments
Closed

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

atenjin opened this issue Jan 15, 2025 · 4 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 add #[compact] derive on the fields so that it can save some bytes.

@atenjin atenjin changed the title [Feature] Can you provide the compact trait for U256? [Feature] Can you implement the Compact trait for U256? Jan 15, 2025
@bkchr
Copy link
Member

bkchr commented Jan 15, 2025

I think this would need to be done downstream in the primitive-types crate. It already implements Encode + Decode and it should be possible to implement Compact there as well.

@atenjin
Copy link
Author

atenjin commented Jan 15, 2025

But I think U256 is a 4 bytes u8 array, why it can implement Compact? while I will have a try later

@atenjin
Copy link
Author

atenjin commented Jan 15, 2025

anyway, you are right, I should ask this question in primitives-types repo, not here...

@atenjin
Copy link
Author

atenjin commented Jan 15, 2025

@atenjin atenjin closed this as completed Jan 15, 2025
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

2 participants