FRAME v2 (#[pallet]
macro)
#7788
Replies: 10 comments 22 replies
-
I wouldn't mind finding out about the backstory here - when was this major update decided on, how come, is it a breaking change for Substrate, does it affect the tutorials and / or node-template, etc.? |
Beta Was this translation helpful? Give feedback.
-
Just out of curiosity: has there been a specific reason to not make the |
Beta Was this translation helpful? Give feedback.
-
I have a question regarding the
This is causing compile time issues, since What is supposed to be the right/canonical approach here? |
Beta Was this translation helpful? Give feedback.
-
It would be nice to have the English in the documentation improved. It needs to be easy to read and understand especially as such a crucial piece to developers. |
Beta Was this translation helpful? Give feedback.
-
For more complicated runtimes one of the things on my wishlist is to have "batch" pallets. Where internal pieces that work together are split up, because scoping behavior is important for correctness and code is easier to maintain when it's not all in a 10k LoC file. Within a batch of modules, initialization order is important. How do you think that might look with the |
Beta Was this translation helpful? Give feedback.
-
Am I the only finding the readability of storage syntax is not as good as the old one? This is the old code
This is the new code
It is just harder to me to identify the key type and value type at a glance. |
Beta Was this translation helpful? Give feedback.
-
Regarding the storage syntax, another thing is that if a pallet has several/dozen storage items, it will be verbose to repeat It might be more clean and easier to tell which pallet item is a storage, if we could group storage items in a mod, like: // The macro can add `use storage::*;` to make items available in upper level mod.
#[pallet::storage]
mod storage {
#[pallet::getter(fn total_issuance)]
pub type TotalIssuance<T: Config> = StorageMap<_, Twox64Concat, T::CurrencyId, T::Balance, ValueQuery>;
#[pallet::getter(fn locks)]
pub type Locks<T: Config> = StorageDoubleMap<
_,
Blake2_128Concat,
T::AccountId,
Twox64Concat,
T::CurrencyId,
Vec<BalanceLock<T::Balance>>,
ValueQuery,
>;
#[pallet::getter(fn accounts)]
pub type Accounts<T: Config> = StorageDoubleMap<
_,
Blake2_128Concat,
T::AccountId,
Twox64Concat,
T::CurrencyId,
AccountData<T::Balance>,
ValueQuery,
>;
} |
Beta Was this translation helpful? Give feedback.
-
I may have encountered a situation while attempting to migrate to FRAMEv2: Suppose I have an instantiable pallet construct_runtime!(
pub enum Runtime // where clause
{
// other pallet declarations
InstanceName: pallet_name::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>},
}
) In FRAMEv1, the storage prefix for the pallet in question is |
Beta Was this translation helpful? Give feedback.
-
This issue #8547 reminds me of a change I forgot to propose about pallet macro. In dispatchable calls impl, currently it's quite easy to miss something and break "Check First, Write Last" rule. Since in most cases extrinsics are transactional, I think we can make |
Beta Was this translation helpful? Give feedback.
-
Can anyone suggest that how can I resolve the below error <Wallet>::get(&account); |
Beta Was this translation helpful? Give feedback.
-
Here is a discussion on all things related to FRAME v2!
Ask questions, request features, share your projects, and tell us about bugs!
Happy hacking and holidays to everyone!
Documentation
Documentation for the new macro can be found here:
An example of fully using these macros to create a pallet can be found here:
cc @thiolliere
Beta Was this translation helpful? Give feedback.
All reactions