Skip to content

Lack of clarity between run.go flags and environment variable descriptions #1472

@StarGeezerPhil

Description

@StarGeezerPhil

Suggest minor improvements to the core/run.go (and/or environment notes) to clarify flags relating to sync_type and hypersync.

This would improve clarity - as the team could see even seasoned node operators had some disagreement over the meaning of these flags.

Further to our discussion in the PoS Discussion Telegram group, please see details below...

HYPERSYNC

"hypersync" - as clarified by the team, the notes in the environment file are accurate - this flag, when true, indicates that the node will generate the hypersync indices needed for other nodes to hypersync from this node. It is also required when using a hypersync* type sync_type method... but it being set to true does not mean that the node will sync in hypersync mode itself.

Line 69 of run.go defines this flag as Use hyper sync protocol for faster block syncing (default true)

cmd.PersistentFlags().Bool("hypersync", true, "Use hyper sync protocol for faster block syncing")

The environment variable note reads more comprehensively, https://github.com/deso-protocol/run/blob/4c49266458f0cfecfea0a86e217330e4fdd08051/base.env#L26C1-L29C15

# When true, the node will build the indexes needed to allow *other nodes* to sync from it.
# Note this can be true with any SYNC_TyPE, but it's required with the hypersync-*
# sync types.
HYPERSYNC=true

Suggest updating /core/cmd.go something along the lines of:
Enable hypersync indexing for other nodes to sync from it. This must also be enabled for this node to utilize hypersync* sync_types (default true)

SYNC_TYPE

Similar discrepancies between the same files...

core/cmd/run.go, L81-88,

cmd.PersistentFlags().String("sync-type", "any", `We have the following options for SyncType:

Defines sync_type as:

	cmd.PersistentFlags().String("sync-type", "any", `We have the following options for SyncType:
		- any: Will sync with a node no matter what kind of syncing it supports.
		- full-historical: Will sync by connecting blocks from the beginning of time.
		- hypersync-archival: Will sync by hypersyncing state, but then it will
		  still download historical blocks at the end. Can only be set if HyperSync
		  is true.
		- hypersync: Will sync by downloading historical state, and will NOT
		  download historical blocks. Can only be set if HyperSync is true.`)

However, these options are different to those defined in the base.env, L11-23, https://github.com/deso-protocol/run/blob/4c49266458f0cfecfea0a86e217330e4fdd08051/base.env#L11

As below:

# Options are: [blocksync, hypersync, hypersync-archival]
# - blocksync: Runs a vanilla blocksync. Will download headers from the beginning of time and
#   then download all blocks and connect them. This is the slowest sync type but it's also
#   the best supported as of Apr 2024.
#
# - hypersync: Your node will download a snapshot of the state that is at most one week old,
#   validate that the state lines up with a checksum, and then only connect the last week of
#   blocks. This is much faster than blocksync, but a little more error-prone. In the coming
#   months, this will become the recommended sync type.
#
# - hypersync-archival: The same as hypersync, but it also downloads historical blocks without
#   connecting them. Much faster than blocksync, but still allows for historical analysis or
#   building interesting data structures off of historical data.
SYNC_TYPE='blocksync'

The core/cmd/run.go also introduces "archival-mode" as a flag.... I presume setting environment variable to "blocksync" also sets "archival" to true?

Minor changes, but would add clarity within the codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions