Skip to content
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

Improvements in minimal template #4119

Merged
merged 17 commits into from
Apr 30, 2024
Merged

Improvements in minimal template #4119

merged 17 commits into from
Apr 30, 2024

Conversation

gupnik
Copy link
Contributor

@gupnik gupnik commented Apr 15, 2024

This PR makes a few improvements in the docs for the minimal template.

@gupnik gupnik added R0-silent Changes should not be mentioned in any release notes T1-FRAME This PR/Issue is related to core FRAME, the framework. labels Apr 15, 2024
Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start. I think last step you should run this, and see what details you need to provide to the user about how to run etc.

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding running the node:

  • The block time being configurable
  • Fixed transaction fees

codekitz and others added 10 commits April 16, 2024 12:44
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
@gupnik gupnik marked this pull request as ready for review April 18, 2024 09:43
@gupnik gupnik requested a review from a team as a code owner April 18, 2024 09:43
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
templates/minimal/README.md Show resolved Hide resolved
templates/minimal/runtime/src/lib.rs Outdated Show resolved Hide resolved
@gupnik
Copy link
Contributor Author

gupnik commented Apr 24, 2024

Where will the readme.md be hosted? Could you remind me the distinction between deciding between whether to put content in the readme or rustdoc?

My preference would be to move most of it to rustdoc and keep readme as a light intro.

@kianenigma
Copy link
Contributor

kianenigma commented Apr 24, 2024

I don't think pallet developers should be concerned about needing to write a default config for every runtime variation the pallet could be used in, the point of pallets exposing a config is so the customisation happens in the runtime?

Is a correct comment in general. I foresee that a pallet can expose optionally, at most 3 configs:

  1. Test, non-important and should be permissive to allow things in test
  2. Solochain config, restrictive.
  3. Parachain config, mostly same as Solochain, but with higher emphasis on weights or other concepts that differ between parachain and Solochains.

And anything more can live in independent crate, possibly even outside polkadot-sdk. A crate that uses pallet-x as a dependency and exposes defaults for pallet-x. Imagine many variants of pallet-balances-default-config, provided by different teams with varying degrees of opinionation.

I've also raised that a team (eg. OZ) can instead of building a full runtime with 10 pallets, simply provide a set of defaults for those 10 pallets.

This also encourages lazy, or blind runtime development. Critical configuration of your runtime is decided for you in a crates.io package you'll probably only skim read. Even if you do check it thoroughly, what if a new default config item is added to the downstream package in an upgrade that doesn't suit your runtime? There is a risk that decisions will be made for you without you knowing.

Indeed, any default configs added to polkadot-sdk should be carefully reviewed for safety. If any doubt remains, we should not provide a default.

A downstream team can always opt out of using derive_impl if they feel more comfortable not using arbitrary defaults from upstream.

Possibly, we can even provide a default type that does nothing and raises a compiler_error! such that a downstream teams, even if they opted into derive_impl have to provide their own.

@paritytech-review-bot paritytech-review-bot bot requested a review from a team April 26, 2024 04:42
@gupnik
Copy link
Contributor Author

gupnik commented Apr 29, 2024

@liamaharon @franciscoaguirre @ggwpez Could you take a look at this again please?

@gupnik gupnik enabled auto-merge April 30, 2024 05:11
@gupnik gupnik added this pull request to the merge queue Apr 30, 2024
Merged via the queue into master with commit 31dc8bb Apr 30, 2024
139 checks passed
@gupnik gupnik deleted the gupnik/templates branch April 30, 2024 06:20
@@ -198,9 +198,9 @@ pub fn expand_tt_default_parts(def: &mut Def) -> proc_macro2::TokenStream {
macro_rules! #default_parts_unique_id_v2 {
{
$caller:tt
frame_support = [{ $($frame_support:ident)::* }]
your_tt_return = [{ $my_tt_return:path }]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually had the same issue on the polkadot-sdk umbrella crate and ended up using ::tt * since path seems to also not be enough.

Morganamilo pushed a commit that referenced this pull request May 2, 2024
This PR makes a few improvements in the docs for the minimal template.

---------

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Aug 2, 2024
This PR makes a few improvements in the docs for the minimal template.

---------

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants