1

I've implementen the treasury, session collective and staking pallets myself. why doesn't my node produce blocks? https://github.com/noahsalvadordenjo/unprod.git

Noah Bergh
  • 493
  • 4
  • 14
  • Thanks for providing a link to your repo, Noah! Feel free to tag me on GitHub or ping me on Riot with links to such things. Here's an example of what a good Stack Overflow question looks like https://stackoverflow.com/questions/62601759/extrinsic-failed-when-invoke-hashmap-btreemap-insert-in-ink-contract-via-polk. – Dan Forbes Jun 27 '20 at 17:09
  • You may want to look into how you've configured your chain spec, specifically, the values you've set for the staking module's validator count and minimum validator count values. I am not at all familiar with the staking module, really, but I think this may be your problem. https://github.com/noahsalvadordenjo/unprod/blob/new_branch/node/src/chain_spec.rs#L149 – Dan Forbes Jun 27 '20 at 17:34

1 Answers1

2

It will not be enough to simply add Staking, Elections, Session, etc to the Node Template Runtime and have a NPoS system working.

Unfortunately the Substrate Node Template uses AURA, which is a Proof of Authority consensus algorithm, that is defined here:

https://github.com/noahsalvadordenjo/unprod/blob/new_branch/node/src/service.rs

And matching runtime components which are defined in the runtime.

If you want to start with a NPoS node, I recommend starting with the base substrate node here:

https://github.com/paritytech/substrate/tree/master/bin/node

And then remove from it any optional pallets you may not be using. Otherwise, maybe you can learn from it how to implement BABE consensus instead of AURA, but this is a little bit out of scope for a new Substrate developer.

Shawn Tabrizi
  • 12,206
  • 1
  • 38
  • 69
  • thanks then why is this node not producing blocks? I started the node with alice and bob https://github.com/noahsalvadordenjo/poa – Noah Bergh Jun 28 '20 at 12:40
  • I see you have removed initial authorities here: https://github.com/noahsalvadordenjo/poa/commit/6e73e994df662c5bd600a3fae74f2eb01bbffd39 How are you making decisions about what you are changing? – Shawn Tabrizi Jun 28 '20 at 12:42
  • Yeah but i thought the session template would insert them, thats what im trying to accomplish – Noah Bergh Jun 28 '20 at 12:46
  • You need some initial authorities to start producing initial blocks, else you will never get past block zero, and no blockchain logic will execute. Also session does not quite work this way with a Proof Of Authority network afaik. In either case, you are making some changes which are breaking your chain, and thus you are unable to produce blocks. – Shawn Tabrizi Jun 28 '20 at 12:48
  • If there is a higher level question that can be answered to help you, please open that as a new stackoverflow post, and include details and information about what you are trying to do. You cannot just post a link to a repository and ask "why does this not work". it will not be productive for getting a good answer – Shawn Tabrizi Jun 28 '20 at 12:49