Improvements to VDF computation daemon
Context
The 8x increase in VDF difficulty in Kathmandu (!5848 (merged)) revealed some non-critical bugs in both the computation daemon and the external VDF library (fix here). This MR fixes the daemon issue.
Currently, the VDF daemon consumes a stream of blocks and monitors which phase of the seed computation the chan is in. When the VDF revelation period begins, it launches the lengthy by design VDF computation. Consuming the stream of blocks is suspended during this blocking computation and resumed after it is finished. With a higher difficulty, the number of blocks added to the chain during this time is higher. The VDF revelation operation is forged on top of the block immediately following the one during which the VDF computation was launched. This is now too old and the operation is rejected. The main fix in this MR is to reinitialise the stream of blocks after the completion of a VDF computation.
The MR also contains some smaller improvements for the VDF daemon and its Tezt test.
Manually testing the MR
The MR is cumbersome to manually test given the length of the VDF computation. This branch contains an additional commit which allows the Tezt test to run with mainnnet parameters. It runs through a full mainnet cycle, during which the VDF computation can take ~14h depending on machine.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR