substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Remove `without_storage_info` on pallets

Open shawntabrizi opened this issue 4 years ago • 0 comments

https://github.com/paritytech/substrate/pull/8556

Need to update all instances of Vec in the runtime storage to BoundedVec, which will allow us to start generating worse case scenario PoV sizes.

  • [ ] Validators / Session Stuff: https://github.com/paritytech/substrate/issues/8640
    • [x] Aura
    • [x] Authority Discovery
    • [x] Babe
    • [x] Grandpa
    • [x] Im-Online
    • [ ] Session
  • [x] Authorship @koute https://github.com/paritytech/substrate/pull/11610
  • [x] Beefy @KiChjang #11584
  • [ ] Collective @koute
  • [x] ConvictionVoting @gavofyork https://github.com/paritytech/substrate/pull/11631
  • [x] Democracy @gavofyork https://github.com/paritytech/substrate/pull/11649
  • [ ] ElectionProviderMultiPhase
  • [ ] ElectionsPhragmen
  • [ ] (Examples)
  • [x] Lottery https://github.com/paritytech/substrate/pull/10594
  • [x] Membership @skunert https://github.com/paritytech/substrate/pull/11591
  • [ ] Multisig @shawntabrizi
  • [ ] NodeAuthorization @koute https://github.com/paritytech/substrate/pull/11621
  • [ ] Offences @ggwpez https://github.com/paritytech/substrate/pull/11585
  • [x] Preimage @gavofyork https://github.com/paritytech/substrate/pull/11649
  • [x] RankedCollective @shawntabrizi https://github.com/paritytech/substrate/pull/11602/files
  • [x] Referenda @gavofyork https://github.com/paritytech/substrate/pull/11631
  • [x] Remark @KiChjang #11590
  • [x] Scheduler @gavofyork https://github.com/paritytech/substrate/pull/11649
  • [ ] ScoredPool @hbulgarini https://github.com/paritytech/substrate/pull/11996
  • [x] Society @gavofyork https://github.com/paritytech/substrate/pull/11324
  • [ ] Staking
  • [x] StateTrieMigration @ggwpez https://github.com/paritytech/substrate/pull/11639
  • [ ] Sudo @shawntabrizi https://github.com/paritytech/substrate/pull/11596
  • [ ] System @gavofyork Blocked on (Infra 3).
  • [ ] Tips @shawntabrizi https://github.com/paritytech/substrate/pull/11596
  • [x] TransactionStorage @skunert https://github.com/paritytech/substrate/pull/11668
  • [x] Treasury https://github.com/paritytech/substrate/pull/8665

Polkadot:

  • [ ] Pallet XCM
  • [ ] XCM in general.

Infra stuff:

  1. [x] PalletsOrigin @gavofyork https://github.com/paritytech/substrate/pull/11631
  2. [ ] ~~Call should impl MaxEncodedLen. Two options:~~
  • ~~Any dispatchables whose args do not all impl MaxEncodedLen should be marked #[pallet::call(unbounded)] and will not be included in Call. Introduce an additional UnboundedCall type which gets created in parallel to Call, and includes all dispatchables but does not impl MaxEncodedLen.~~
  • ~~Introduce a new Signed Extension AuxData, from Preimages pallet. This places one or more blobs of data in a non-persistent storage item of Preimages pallet, indexed by its hash. It can be a map which is cleared at on_finalize but would ideally use https://github.com/paritytech/substrate/issues/5396. The data can be retrieved through the usual Preimages API in exactly the same manner as the persistent preimages. Large arguments for Calls dispatched immediately in a transaction would be encoded and placed in this AuxData Signed Extension and referenced through hash. If such a Call were expected to execution autonomously on-chain then the preimage would need to be registered as usual. note_preimage would use AuxData, set_code would use (via the trait interface) Preimages pallet.~~
  • Call need not impl MEL, instead we can just avoid storing it directly but do so through a preimage. https://github.com/paritytech/substrate/pull/11649
  1. [ ] #[pallet::storage(write_only)] for items which cannot/must not be read. the MEL is allowed to be undefined. in this case, and if a new production feature is enabled, then there should be no storage API to read the item (this is a larger refactoring and will need additional changes to storage macros). this together with marking the low-level storage accesses as unsafe APIs will give build-time safety for PoV size.
  2. [ ] #[derive(MaxEncodedLen) should respect #[codec(skip)].

Before any pallet is checked off above, the final step in this process would be do remove the without_storage_info macro:

	#[pallet::pallet]
	#[pallet::generate_store(pub(super) trait Store)]
	#[pallet::without_storage_info] <--- here
	pub struct Pallet<T, I = ()>(PhantomData<(T, I)>);

This tells us that all the storage item in the pallet are compatible with the storage info trait.

shawntabrizi avatar Apr 16 '21 14:04 shawntabrizi