Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Make new Weight struct #[codec(compact)] #12149

Closed
shawntabrizi opened this issue Aug 31, 2022 · 7 comments
Closed

Make new Weight struct #[codec(compact)] #12149

shawntabrizi opened this issue Aug 31, 2022 · 7 comments

Comments

@shawntabrizi
Copy link
Member

The fields in the new weight struct should be #[codec(compact)], which will involve a storage migration for any places where weight is stored.

Makes sense to do this the same time we need to do a storage migration for the second field of Weight.

@bkchr
Copy link
Member

bkchr commented Aug 31, 2022

You should be able to implement scale_codec::CompactAs and then you should not need any migration.

@shawntabrizi
Copy link
Member Author

So the implementation will try compact decode, and if it fails, try u64 decode?

@bkchr
Copy link
Member

bkchr commented Aug 31, 2022

No, then you can write #[compact] as before. So, nothing would change in the declaration of dispatchables. However, weight would still be stored by default without compaction.

@shawntabrizi
Copy link
Member Author

okay, but actually i would like to also make the values compact by default in the future

@shawntabrizi
Copy link
Member Author

@bkchr here is me using compact as for now, but should make it actually compact in the future as mentioned in this issue:

b6eb595

@bkchr
Copy link
Member

bkchr commented Aug 31, 2022

@bkchr here is me using compact as for now, but should make it actually compact in the future as mentioned in this issue:

b6eb595

Okay :P Yeah, when we switch to the two dimensional we will need some migrations anyway.

@KiChjang
Copy link
Contributor

After #12277, the new Weight struct has its fields all #[codec(compact)] by default, and so the struct itself does not need to be #[pallet::compact] anymore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants