I am currently trying to understand how we could improve our block production performance at Avail.
By looking at this answer on a previous question, I get that for a 6 second block time, we allocate 2sec for block production, 2sec for syncing and 2sec for block propagation.
From what I can witness by adding some metrics to a node is that block propagation and import happen no matter what after the on_finalize hook is called, which is logic, but it's always called at the end of a block.
Also by checking this answer, and more especially this bit :
Let's assume we give the block production 500 ms. Of this 500ms 67% are allocated for the actual block initialization plus transaction execution. If we are now above these 67% of execution time we will stop the block production and finalize the block. Then you send out the block to the network.
I wanted to know how can this be actually triggered or if this even mean that block production can be stopped mid blocktime and start the on_finalize processes. For example, I filled a block with the maximum normal ratio (85%) but it still waited to call the on_finalize.
To give some context, in our chain, after all the transaction in a block, we want to do some additional process which is done right now in the on_finalize hook, the goal would be to do it just before or ideally trigger the on_finalize sooner.
My question being : Is there a way to adjust the timing of on_finalize to start it before reaching the end of the block time, particularly after reaching a certain block fill ratio ?
Don't hesitate in case more details are needed !