Nyzo techRelease notesNyzo 648: Fix cycle digest block height in CycleDigestManager

Nyzo 648: Fix cycle digest block height in CycleDigestManager

Author: Benjamin Van Renterghem @ construct0 FV

Date: 04/12/2024

Last updated: 04/12/2024


Nyzo version 648 (commit on construct0's GitHub) fixes the suggested cycle digest block height used by the CycleDigestManager to create a genesis CycleDigest instance if no cycle digests are available on the system, it also ensures the suggested block height is only provided for the genesis block with block height 0.
Changes have been released on construct0's nyzoVerifier repository.


This version affects the Client run mode.

Subversion 0 is the final subversion and concludes the release of this major version release.


If you have enabled the CycleDigestManager before the release of this version, please remove the individual cycle digest files and consolidated cycle digest files present on your system. Developing and releasing at a relatively fast pace was deemed acceptable due to the logic having no impact on the Verifier and Sentinel run modes & no user-oriented interfacing related to cycle digests being present at the time of introduction - it was however unexpected, and the operational and technical cause now serve as a lesson for future releases.


Subversion 0 - Fix cycle digest block height in CycleDigestManager

The CycleDigestManager facilitates the creation of individual cycle digests; if no cycle digests are available on the system whatsoever an attempt is made to create a CycleDigest instance for block height 0. Due to the use of two cycle digest variables, the generation of cycle digests in batches of at most 5000 cycle digests, and a small but incorrect change which was made late in the development stage of version 647 when testing had already concluded, the process created 5000 - 1 CycleDigest instances with incorrect content during the first batch.

In short, if conditions were met the content did not match the block height of the cycle digest when creating and storing cycle digests on disk.

In addition to that, the delay in between consolidate & create calls has been lowered to 20 seconds - in order to align with the present divisions into milliseconds.



The amount of variables storing cycle digests has been reduced to 1 (one), the lastCycleDigest is initially used to store the CycleDigest with the highest block height available on disk, and subsequently the last CycleDigest generated and successfully written to disk during this call.



The creation of the CycleDigest for block height 0 now uses a hardcoded zero instead of the block height of the block.
The logic for creating a CycleDigest using the lastCycleDigest is simplified due to the aforementioned reduction to 1 (one) variable.
Additional checks pertaining to the continuity state of the newly created CycleDigest instance are added to prevent writing cycle digests with an undesirable continuity state to disk.



The rollingCycleDigest is removed, making place for the assigning of the last created and stored cycle digest to the lastCycleDigest variable. Assigning to said variable prevents the previously incorrect re-execution of the logic which pertains to the genesis block, solving the previously incorrect cycle digest block height attribution.