2

I have an my own Substrate node (not a parachain, based on the template-node, so Aura consensus is used) and I changed the block time to 6 seconds in the runtime/src/lib.rs by setting

pub const MILLISECS_PER_BLOCK: u64 = 6000;

Though, when running the node locally with --dev configuration, it takes 12 seconds to produce blocks:

2022-09-01 12:50:36.010  INFO tokio-runtime-worker sc_basic_authorship::basic_authorship: 🙌 Starting consensus session on top of parent 0x7b2d27b8c9d1bacda74bf281bcf1f3fa6fdc9e017490860e55356b695aec9d4d    
2022-09-01 12:50:36.029 DEBUG tokio-runtime-worker runtime::system: [1] length: 11 (normal 0%, op: 0%, mandatory 0%) / normal weight: 0 (0%) / op weight 0 (0%) / mandatory weight 5921651000 (0%)    
2022-09-01 12:50:36.030  INFO tokio-runtime-worker sc_basic_authorship::basic_authorship: 🎁 Prepared block for proposing at 1 (3 ms) [hash: 0x017f1e5a02dcccb639a13c5fb9e5c5844b4efdfc596613db9da255000b89e414; parent_hash: 0x7b2d…9d4d; extrinsics (1): [0x7932…5556]]    
2022-09-01 12:50:36.031  INFO tokio-runtime-worker aura: 🔖 Pre-sealed block for proposal at 1. Hash now 0xdd564786a31bceefd7b4468173234870866615cd9433b438e84214e9debb9a18, previously 0x017f1e5a02dcccb639a13c5fb9e5c5844b4efdfc596613db9da255000b89e414.    
2022-09-01 12:50:36.032  INFO tokio-runtime-worker substrate: ✨ Imported #1 (0xdd56…9a18)    
2022-09-01 12:50:39.100  INFO tokio-runtime-worker substrate: 💤 Idle (0 peers), best: #1 (0xdd56…9a18), finalized #0 (0x7b2d…9d4d), ⬇ 0 ⬆ 0    
2022-09-01 12:50:44.101  INFO tokio-runtime-worker substrate: 💤 Idle (0 peers), best: #1 (0xdd56…9a18), finalized #0 (0x7b2d…9d4d), ⬇ 0 ⬆ 0    
2022-09-01 12:50:48.001  INFO tokio-runtime-worker sc_basic_authorship::basic_authorship: 🙌 Starting consensus session on top of parent 0xdd564786a31bceefd7b4468173234870866615cd9433b438e84214e9debb9a18    

Why is it taking 12 seconds to produce blocks?

1 Answer 1

3

Does your Aura chain_spec.rs have 2 validators in it? Aura is a round-robin based protocol, if you have more than 1 validator, it will expect another block to be made in order of the list of authorities of your chain. Therefore, it might be the case that Bob fails to make a block after 6 seconds and loses his turn (since an extra 6 seconds are given to buffer the possibility that Bob is slow).

2
  • 1
    Excellent! Yes, the chain spec in dev mode has two validators in it. I just removed Bob and it is now 6 seconds. Thank you so much ! I need to study more in depth this part. Sep 1, 2022 at 12:36
  • Just for reference to other people who may have this same question, I searched and found that Drew's answer is also explained in the OpenEthereum documentation about Aura: openethereum.github.io/… . Sep 1, 2022 at 12:59

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.