config

package
v0.0.0-...-d7cfa30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2024 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Global
	GlobalLoggingLevel string        `mapstructure:"LOGGING"`          // Log Level: FATAL, PANIC, ERROR, WARN, INFO, DEBUG.
	Path               string        `mapstructure:"DATA_DIR"`         // Main datastore path.
	BlockSourceURL     string        `mapstructure:"BLOCK_SOURCE_URL"` // Main datastore path.
	DSTimeout          time.Duration `mapstructure:"DS_TIMEOUT"`       // Datastore timeout.

	// Statestore
	StateStoreGCPeriod time.Duration `mapstructure:"STATESTORE_GC_PERIOD"` // Statestore GC period.

	// Blockchain
	BlockchainMaxBlockToRetain uint64 `mapstructure:"BLOCKCHAIN_MAX_BLOCK_TO_RETAIN"` // Blockchain max block to retain.
	BlockchainPruningFrequency uint64 `mapstructure:"BLOCKCHAIN_PRUNING_FREQUENCY"`   // Blockchain pruning frequency.

	// WorldState
	WorldStateMaxLayerToRetain uint64 `mapstructure:"WORLDSTATE_MAX_LAYER_TO_RETAIN"` // World state max layer to retain.
	WorldStatePruningFrequency uint64 `mapstructure:"WORLDSTATE_PRUNING_FREQUENCY"`   // World state pruning frequency.

	// RPC
	RPCHost       string        `mapstructure:"RPC_HOST"`        // RPC Server host.
	RPCPort       uint64        `mapstructure:"RPC_PORT"`        // RPC Server port.
	RPCGasCap     uint64        `mapstructure:"RPC_GAS_CAP"`     // RPC gas cap for answering calls.
	RPCEVMTimeout time.Duration `mapstructure:"RPC_EVM_TIMEOUT"` // RPC evm timeout for answering calls.

	// Node
	NodeCheckFrequency                    time.Duration `mapstructure:"NODE_CHECK_FREQUENCY"`                // Frequency node checks for new blocks.
	NodeMaxAllowedLeadBlocks              uint64        `mapstructure:"NODE_MAX_ALLOWED_LEAD_BLOCKS"`        // The max allowed blocks local can lead remote.
	NodeForwardSyncMinDistanceToStart     uint64        `mapstructure:"NODE_FORWARD_SYNC_MIN_DIST"`          // The minimum distance from local to remote to start forward sync.
	NodeForwardSyncTargetGap              uint64        `mapstructure:"NODE_FORWARD_SYNC_TARGET_GAP"`        // The gap between remote head and the forward sync target.
	NodeBackwardSyncMaxBlocksToQuery      uint64        `mapstructure:"NODE_BACKWARD_SYNC_MAX_BLOCKS"`       // The max allowed blocks to query in backward sync.
	NodeBackwardSyncMaxBlocksToQueryReorg uint64        `mapstructure:"NODE_BACKWARD_SYNC_MAX_BLOCKS_REORG"` // The max allowed blocks to query in backward sync  (during reorg).
}
var DefaultConfig Config = Config{
	Path:                                  "$HOME/.teler",
	BlockSourceURL:                        "http://localhost:8545",
	GlobalLoggingLevel:                    "INFO",
	DSTimeout:                             5 * time.Second,
	StateStoreGCPeriod:                    30 * time.Minute,
	BlockchainMaxBlockToRetain:            512,
	BlockchainPruningFrequency:            257,
	WorldStateMaxLayerToRetain:            256,
	WorldStatePruningFrequency:            127,
	RPCHost:                               "localhost",
	RPCPort:                               9424,
	RPCGasCap:                             50000000,
	RPCEVMTimeout:                         5 * time.Second,
	NodeCheckFrequency:                    10 * time.Second,
	NodeMaxAllowedLeadBlocks:              64,
	NodeForwardSyncMinDistanceToStart:     256,
	NodeForwardSyncTargetGap:              64,
	NodeBackwardSyncMaxBlocksToQuery:      260,
	NodeBackwardSyncMaxBlocksToQueryReorg: 64,
}

Default configs

func NewConfig

func NewConfig(configFile string) (Config, error)

NewConfig creates a new configuration.

@output - configuration, error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL