-
Notifications
You must be signed in to change notification settings - Fork 2.7k
pallet macro: always generate storage info on pallet struct #9246
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. I think one question that I would have now is the discoverability of storage items that were implemented with PartialStorageInfo
. This is useful when I may later on want to visit those items and implement StorageInfo
directly, but I guess this is more of a UI issue than anything else.
The partial storage info doesn't have the max_size bound. I think when the benchmarking process fail to get proper bound for max_size it will return an error or a warning saying that the storage doesn't have valid bound for PoV size computation. |
bot merge |
Trying merge. |
* master: fix staking version in genesis (#9280) fix storage info for decl_storage (#9274) Authority_discovery: expose assimilate_storage with GenesisBuild (#9279) Update CODEOWNERS (#9278) Remove in-tree `max-encoded-len` and use the new SCALE codec crate instead (#9163) bump a bunch of deps in parity-common (#9263) Bump linregress due to security vulnerability (#9262) pallet macro: always generate storage info on pallet struct (#9246) Less duplication in test code (#9270) Add `Chilled` event to staking chill extrinsics (#9250)
Currently the trait
StorageInfoTrait
is implemented on the structPallet
only when the attributegenerate_storage_info
is set.But it can be handy to always generate the storage info even with partial information.
This PR makes storage implement a new trait PartialStorageInfoTrait which allows to return some partial information.
Then depending on whereas the attribute
generate_storage_info
is set, the Pallet will implement the StorageInfo using PartialStorageInfo or using StorageInfoas a side note, the span should be improved in a follow up by #8850
the implementation should also be improved currently we allocate some small vec way too much. But we can do in a follow-up.
cc @shawntabrizi