w3f / w3f-education

Technical Education at Web3 Foundation
Other
17 stars 19 forks source link

Shawn: Introduction to FRAME and Substrate #135

Open shawntabrizi opened 1 year ago

shawntabrizi commented 1 year ago

In Progress

This issue will capture my thoughts on the different topics that an introduction to FRAME and Substrate.

I have explicitly not chosen to look at the existing content, and work from my own experience to compile a list of content that I think should be covered.



need to begin with emphasis on what kind of environment we are working with in the runtime / blockchain:


need to establish wasm, how it is used, why it is good


need to establish the wasm / runtime barrier.

Probably not in detail, but have users already start thinking that they are building some internal logic within a native running client.

perhaps there are parallels to wasm web dev that we can lean on.


need to establish many of the basics of blockchains. things i see users have problems with:


resource constraints of the blockchain:


def SCALE if we did not already cover it in Rust sections.



students should feel comfortable with the idea and how forkless upgrades work


an overview of the different parts of a blockchain:

should very much be like anatomy, what the part is, what it does, what it connects to.


philosophies of substrate

levels of developer interaction


deep dive into chain spec and configuring it

how custom modules can add items to the chain spec


runtime upgrades, and what you might need to consider


Philosophies of FRAME


Basics of the Substrate CLI


We don't cover in the academy, but this is an advance topic: reference counters.

not really something that we need users to know, but it would make sense for it to exist in docs or introduced here if we want users to understand it at some point.


Pallet features:




CrackTheCode016 commented 1 year ago

Linking this issue here, as I feel it could add some considerations for us (although it may be out of scope, so feel free to ignore if so): https://github.com/paritytech/polkadot-sdk/issues/5

Particularly, we always emphasize the runtime (which is important), but never anything outside of it, such as the outer node and client implementation (something almost never touched). Is it something we should consider?

shawntabrizi commented 1 year ago

I think it is very much about audience and context.

Normally, we leave the client opaque because we assume that our audience is mostly runtime developers, that wont really touch the client too much, if at all.

Indeed, we also hope this is the case, since as soon as you touch the client, you start to have potential issues with compatibility with being a Parachain on Polkadot.

Understanding the client deeper is important for a core developer role, or building complex / custom solo-chains.

This information is good, but it greatly expands the prerequisite knowledge they need to have about blockchains, designing low level systems, Rust, etc...

I think it would be very hard to create an "introduction to client" course beyond doing small customization of the RPCs, CLIs, etc... Anything deeper to me is "advanced" by definition.

kianenigma commented 1 year ago

Hey Bader and Shawn,

I am looking into this tutorial today as well and will write down some of my thoughts as well.

Substrate Development 101: I like the first section explaining the node and runtime structure. The storage part is also interesting. I would add snippets Ext::execute_with(|| { write_stuff(); read_stuff(); }). I wouldn't mention FRAME storage primitives here, maybe you can link to "if you want a peak at storage primitives provided by FRAME, see ". Finally, I would rename the Pallet section to Runtime. Also, first talk about Runtime, mention that it is mere WASM blob, maybe link to frameless, then mention that you can use FRAME for this, and FRAME has Pallets etc. The section is missing links but it otherwise good.

kianenigma commented 1 year ago

on ensure: I would first actually write the code without ensure! such that I can also hint at what DispatchResult is, then say that ensure is a shorthand.

I am still confused about the categorization. What is the difference between "Building Custom FRAME Pallet" and "Custom FRAME Pallets", and how is events are in one, but dispatchable in another?

I would not mention Currency traits at all.