I'm fiddling with substrate's #[pallet::generate_store(pub(super) trait Store)]
https://docs.substrate.io/v3/runtime/macros/#palletpallet
Documentation says
Generates the Store trait if the attribute is provided, which contains an associated type for each storage item. It takes the form of a more explicit Rust struct module and can be written as pub struct Pallet(_);, with the appropriate PhantomData replacing _ to make it generic.
Here is my kittens pallet. Even if I remove the macro mentioned above, node works fine as expected.
https://github.com/yourarj/substrate-node-playground/blob/adfafc5e0733ade8fd9b422585716baea11da35a/pallets/kittens/src/lib.rs#L13
I tried applying cargo expand with both cases is that I found out the following differences. A Store trait
and it's implemented for Pallet Struct
.
But in both the cases my functionality is not impacted at all. It mutates chain state and queries the state as expected.
So
Why should we use this
#[pallet::generate_store(pub(super) trait Store)]
? What's the point?
access the Storage item
, do you mean accessing the state of storage?cargo build
and have ran the chain? What check did you do to verify that it "mutates chain state and queries the state as expected" ?cargo build
. And checked with polkadot.js chainstate and extrinsics. Worked perfectly identcal.