-
Notifications
You must be signed in to change notification settings - Fork 766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ideas for a new set of example/template pallets #186
Comments
Yes and in one of those we should clearly demonstrate all V2 benchmarking syntax. |
Another issue I see is that we don't seem to have good examples for manual and instant seal. Would be good to have a template that is devoid of all the consensus noise and just uses these consensus methods. Update: https://github.com/paritytech/substrate-contracts-node is a good example. |
All in all, I think it is not a good idea that our default templates that we provide are so noisy from top to bottom:
ideally, we would have templates that cover a wider range of things, and then we can use them in a cli tool that @ggwpez and @gupnik are working on:
Then, for the runtime, we should have templates that have:
each runtime would have its own corresponding node. Note that Once we have all of these templates in place, the CLI can just pull from these and build a substrate based project for you in a lego-like manner. |
A good, well-documented OCW example would be highly appreciated as well. |
Yes. It is not really helpful in that state. I think we could have one example for each specific feature in FRAME. Like one for I cant say much about the runtime templates regarding the consensus. Maybe start with the one that is most often used by para-chains? |
This was recently done by @bernardoaraujor, I think he pushed his changes upstream to substrate as well, so the existing template is much better. |
I haven't pushed any changes to upstream substrate yet. Re-writing |
Yeah I like this and I am kinda doing it as a part of paritytech/substrate#13454. |
Thinking a bit more about the CLI, I think it would be great for us imagine what questions the end-user would be asked when going through that CLI, and then based on that, we can build as many templates as we need. Indeed, I think these templates can be the backing repository of the CLI. What I would imagine is: (questions about the overall node)
All of this should be enough to build the node, its chain spec, and its service.rs with the consensus code in it. Then, finally we ask:
This is more or less the direction that I see for this CLI, and one use-case of having more numerous example/templates. If this CLI is actually going to surgically assemble a pallet, it can very well use @sam0x17's docify under the hood to move items around. |
About the CLI: I remember that @shawntabrizi had the idea to use some TOML/YAML config files to eventually generate a runtime. Not sure if the idea was to parse the config files in a proc macro, or to stuff the config files into a CLI. |
As we re-construct these example pallets (or do this CLI thing), I think it is a good opportunity to, for each item we add to the pallet, go through the (rust) docs for that item and make sure that the behavior we are using is actually documented. For example, the rust docs on My point is the example pallets should be such that they could have been constructed from first principles using only the rust docs as a guide, and this is a good opportunity to take a step towards that |
Another idea: A pallet that implements all the different |
When I suggested auto-generation of the runtime, I was thinking web app or CLI. Cosmos has this: https://github.com/ignite/cli I haven't had time to use it yet, but seems to be a popular way for people to get started in their ecosystem and scaffold out projects. |
TOML would be very railsy so I'm definitely for it |
#225 might help with this. @liamaharon based on the above, would be great if you try and improve the documentation of these APIs, probably add more examples and so on as well. |
Sure. I'll create a new issue to track improving the docs, and work on those as I go with the tests. I've tried to include descriptive inline comments in all of the tests so they should be good candidates to include as examples with the help of docify. |
This is already implemented here: Do we really need both a 'basic' pallet and a 'kitchensink' pallet?
'template' and 'basic' have similar meanings, I could imagine people being confused about the difference just from looking at the names. Maybe a more descriptive name for the template pallet could be 'starter' or 'skeleton'? |
Side note / random nit: I would really like to see all the frame examples in a proper/real "examples" directory for the |
Trying to get a solution into this StackExchange Question: How to customize pallet_contracts? I found this very old tutorial by Shawn: Extending Substrate Runtime Modules where it shows how to create a pallet that wraps the I believe it makes sense to add an example of a “wrapper pallet” which adds some functionality on top of an existing pallet ( |
I can imagine set of 4 example pallets:
As for nodes
Tasks
I can actually work on this myself as a part of doc-revamp.
Originally posted by @kianenigma in paritytech/substrate#13944 (review)
The text was updated successfully, but these errors were encountered: