3

I am doing Substrate-tutorial and I just have a question about template-node. Inside impl 'frame_system::Config for Runtime {} code, there are type Event = Event and type Call = Call, but I don't see any import statement for 'Event' and 'Call' types, where do these 'Event' and 'Call' come from...? It just seems like they come from nowhere.

Thank You.

1 Answer 1

5

Indeed, this is where Macro magic is happening. These Event and Call types are coming from construct_runtime!, and is generating an "outer enum" which collects all the events and calls from all the other pallets and puts it together into a single overall type which is then transferred back into the pallet.

You can think of it kind of like a recursive definition, where values must first be collected from the pallets, "constructed" in the runtime, and then sent back to the pallets.

The Rust compiler ensures all of this maintains all of the type rules required.

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.