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

Only use types in pallets implementing MaxEncodedLen #132

Open
3 of 6 tasks
clangenb opened this issue Jan 27, 2022 · 0 comments
Open
3 of 6 tasks

Only use types in pallets implementing MaxEncodedLen #132

clangenb opened this issue Jan 27, 2022 · 0 comments

Comments

@clangenb
Copy link
Member

clangenb commented Jan 27, 2022

With a recent update, substrate changed the default requirements of a pallet's storage and dispatchable arguments. See paritytech/substrate#10652. This default shall become mandatory in the future for all pallets.

For most of our types, we can simply add a derive attribute MaxEncodedLen, which specifies the maximum number of bytes that an encoded value can have. To support this in all pallets, we need:

For the time being, I added the pallet attribute #[pallet::without_storage_info] to pallets not yet supporting the MaxEncodedLen.

Pallets that still need migration:

  • encointer-bazaar
  • encointer-ceremonies
  • encointer-communities
clangenb added a commit to encointer/geohash that referenced this issue Jan 28, 2022
#2)

* See encointer/pallets#132. This means we can't use `Vec<u8>` as the field for the `GeoHash`.

I chose to go for a const generic approach as it is more efficient than a `bounded_vec` approach. Further, the bounded_vec approach would require checking each operation if it lets the vec grow beyond its size.

Other changes:
* GeoHash field is private now: Implies that every GeoHash object does now contain a valid geo hash, as all construction helpers would fail upon construction.
* Implemented some more conversion traits.
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