3

The question can seem weird but here is the geist of it :

In a custom chain with 20 sec block time, we have a different format of header that includes more information. At the end of the block, we extended the system::finalize() to generate a "commitment". This process takes roughly between 2 and 8 seconds depending on the size of the block.

Now the issue is that when multiple blocks are full, all blocks take 28 seconds instead of 20 seconds. It's kinda working correctly, the timestamp are ok (since generated before) but I would like to know if there was a way to make this process happen in the 20 seconds.

Of course at the moment this process start, no more transactions can be included in the said block.

How it works currently it theoritically what we want but we would like more consistency.

Tl;dr: How could we allocate ≃25% of our block time to do custom process (just after processing extrinsic but before on_idle or on_finalize) ?

2
  • 1
    Is block production or import too slow? Why cant you reduce the number of maximal transactions in a block? Sep 4 at 13:50
  • Block production and import are fine, the the header extension generation takes time. The issue is not with the time it takes (which is normal and cannot be reduced without algorithmic changes). The issue is that this process happens at the end of the block (so after the 20 seconds). I can reduce the max number of tx or even reduce the blocktime but let's say the blocktime is x, the real blocktime will be x + Δ to generate the commitment. I want Δ to be included in x, in a way, even if it's only 1 second.
    – Leouarz
    Sep 4 at 14:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.