Im looking into some of the procedural macros used, namely the #[pallet] attribute to declare a pallet that is recognised by construct_runtime!. However, I cannot find the source code for the pallet module (mod pallet; line 30) that implements the functionality in the pallet attribute.


Can anyone direct me to the source?

1 Answer 1


I believe the entry point you are looking for can be found here:


You will find basically all of the FRAME macros in the frame/support/procedural folder.

//! Implementation for pallet attribute macro.
//! General workflow:
//! 1 - parse all pallet attributes:
//!   This step remove all attributes `#[pallet::*]` from the ItemMod and build the `Def` struct
//!   which holds the ItemMod without `#[pallet::*]` and information given by those attributes
//! 2 - expand from the parsed information
//!   This step will modify the ItemMod by adding some derive attributes or phantom data variants
//!   to user defined types. And also crate new types and implement block.

mod expand;
mod parse;

pub use parse::Def;
use syn::spanned::Spanned;

pub fn pallet(
    attr: proc_macro::TokenStream,
    item: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
    // -- snip --

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.