Nyzo techRelease notesNyzo 543: consensus tracking

Nyzo 543: consensus tracking

Nyzo version 543 (commit on GitHub) adds optional consensus tracking and a small sentinel-monitoring change.

This version affects primarily the verifier. It also includes a minor monitoring change for the sentinel.

The verifier identifier has been added to the Block.toString() method.

RN_543 code 0

In BlockVoteManager, all non-null votes are now registered with the new ConsensusTracker. If the tracker is not enabled, this method does nothing.

RN_543 code 1

Unrelated to the consensus tracker, the activationHeight is now considered when scoring blocks to determine if a block is a missed upgrade opportunity or an improperly timed upgrade.

RN_543 code 2

In PersistentData, reading of the file has been modified to support values that contain equals signs.

RN_543 code 3

In UnfrozenBlockManager, all non-null blocks are registered with the ConsensusTracker. This uses the same registration method used for votes. A height is provided to this method to help the tracker organize its data.

RN_543 code 4

In Verifier, freezing of blocks is registered with the ConsensusTracker. Also, maintenance is performed each time a block is frozen. This allows the ConsensusTracker to periodically write old data to files and remove it from memory.

RN_543 code 5

A logging statement was removed from BlockResponse. This statement was not particularly helpful, and it was cluttering the output. If logging of blocks responses is added again in the future, it will be done at an aggregate level.

RN_543 code 6

A persistent value storing the full string representation of the last block transmitted has been added to the Sentinel class. This new value is displayed by the SentinelController.

RN_543 code 7

ConsensusEvent encapsulates data points for the ConsensusTracker. Each event includes a timestamp, height, and data object.

RN_543 code 8

ConsensusTracker collects data about the consensus process and writes one or more file for each height. To enable the ConsensusTracker, add the following line to /var/lib/nyzo/production/preferences:

enable_consensus_tracker=1

By default, the tracker will disable itself when available disk space falls below 20GB. A higher or lower threshold can be specified in the preferences file. For instance, if you want the tracker to disable itself when available disk space falls below 30GB, add the following line to /var/lib/nyzo/production/preferences:

consensus_tracker_storage_threshold_bytes=30000000000

RN_543 code 9

The register() method adds an event to the map. Events outside a reasonable height range are rejected, and concurrency concerns are handled appropriately. If a set of events at a particular height has gotten too large, it is written to a file prematurely to conserve memory.

RN_543 code 10

The performMaintenance() method removes completed or excessively large heights from memory and writes them to files. It also deactivates the consensus tracker if available storage space has fallen below the specified threshold.

RN_543 code 11

The writeFile() method writes events for a single height to a file. The events are sorted on timestamp, and vote totals for each hash are written at the end of the file. To conserve space, individual votes are not written when voting for a block is unanimous. In cases where consensus is not unanimous, this file could be used to make a graph showing how voting evolves over time, and it should provide some interesting insight into the consensus process.

RN_543 code 12

The getUsableSpace() method checks for usable storage space in the destination folder. If the actual space cannot be determined, a value of 0 is returned, which will cause the ConsensusTracker to terminate if the threshold is set to any value greater than 0.

RN_543 code 13

In PrintUtil, a compact version of printTimestamp() has been added for use in the consensus-tracker files.

RN_543 code 14

In SentinelController, the new block string replaces the block height in the display.

RN_543 code 15