config

package
v0.0.48 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides configuration loading, validation, and persistence for the Push Universal Validator.

Directory layout:

<NodeHome>/                        (default: ~/.puniversal)
├── config/
│   └── pushuv_config.json
├── databases/
│   ├── eip155_1.db
│   └── eip155_97.db
└── relayer/
    └── <namespace>.json

Index

Constants

View Source
const (
	NodeDir         = ".puniversal"
	ConfigSubdir    = "config"
	ConfigFileName  = "pushuv_config.json"
	DatabasesSubdir = "databases"
	RelayerSubdir   = "relayer"
)
View Source
const NetworkTestnet = "testnet"

Variables

This section is empty.

Functions

func DefaultNodeHome added in v0.0.23

func DefaultNodeHome() string

DefaultNodeHome returns the default node home directory (~/.puniversal).

func Save

func Save(cfg *Config, basePath string) error

Save validates the config and writes it to <basePath>/config/pushuv_config.json.

Types

type ChainSpecificConfig

type ChainSpecificConfig struct {
	RPCURLs                     []string          `json:"rpc_urls,omitempty"`
	CleanupIntervalSeconds      *int              `json:"cleanup_interval_seconds,omitempty"`
	RetentionPeriodSeconds      *int              `json:"retention_period_seconds,omitempty"`
	EventPollingIntervalSeconds *int              `json:"event_polling_interval_seconds,omitempty"`
	EventStartFrom              *int64            `json:"event_start_from,omitempty"`
	GasPriceIntervalSeconds     *int              `json:"gas_price_interval_seconds,omitempty"`
	GasPriceMarkupPercent       *int              `json:"gas_price_markup_percent,omitempty"` // % markup on fetched gas price to handle spikes
	ProtocolALT                 string            `json:"protocol_alt,omitempty"`             // Protocol ALT address (base58) for V0 transactions
	TokenALTs                   map[string]string `json:"token_alts,omitempty"`               // mint address → token ALT address (base58)

	// SVM rent reclaimer (orphaned StoredIxData PDA cleanup). Both default if unset.
	RentReclaimSweepIntervalSeconds *int `json:"rent_reclaim_sweep_interval_seconds,omitempty"` // how often to sweep
	RentReclaimMinPDAAgeSeconds     *int `json:"rent_reclaim_min_pda_age_seconds,omitempty"`    // skip PDAs younger than this
}

ChainSpecificConfig holds per-chain configuration.

type Config

type Config struct {
	// Logging
	LogLevel   int    `json:"log_level"`
	LogFormat  string `json:"log_format"`
	LogSampler bool   `json:"log_sampler"`

	// Node
	NodeHome string `json:"node_home"`

	// Push Chain
	PushChainID                  string   `json:"push_chain_id"`
	PushChainGRPCURLs            []string `json:"push_chain_grpc_urls"`
	PushValoperAddress           string   `json:"push_valoper_address"`
	ConfigRefreshIntervalSeconds int      `json:"config_refresh_interval_seconds"`
	MaxRetries                   int      `json:"max_retries"`

	// PushNetwork is "mainnet" or "testnet"; unset/unknown is treated as mainnet.
	PushNetwork string `json:"push_network"`

	// Query Server
	QueryServerPort int `json:"query_server_port"`

	// Keyring
	KeyringBackend  KeyringBackend `json:"keyring_backend"`
	KeyringPassword string         `json:"keyring_password"`

	// Per-chain settings (keyed by CAIP-2 chain ID)
	ChainConfigs map[string]ChainSpecificConfig `json:"chain_configs"`

	// TSS
	TSSP2PPrivateKeyHex string `json:"tss_p2p_private_key_hex"`
	TSSP2PListen        string `json:"tss_p2p_listen"`
	TSSPassword         string `json:"tss_password"`
	TSSHomeDir          string `json:"tss_home_dir"`
}

Config holds all configuration for the Universal Validator.

func Load

func Load(basePath string) (Config, error)

Load reads the config from <basePath>/config/pushuv_config.json, applies defaults for any missing fields, and validates.

func LoadDefaultConfig

func LoadDefaultConfig() (Config, error)

LoadDefaultConfig loads the embedded default configuration.

func (*Config) AllowsZeroConfirmations added in v0.0.48

func (c *Config) AllowsZeroConfirmations() bool

AllowsZeroConfirmations reports whether a registry confirmation depth of 0 is honored instead of falling back to a safe depth.

A registry 0 is ambiguous: proto3 encodes a deliberate 0 and an unset field identically, so it cannot be read as "instant finality" on its own. Honoring it therefore needs an out-of-band signal, which today is a testnet deployment.

func (*Config) GetChainCleanupSettings

func (c *Config) GetChainCleanupSettings(chainID string) (cleanupInterval, retentionPeriod int, err error)

GetChainCleanupSettings returns cleanup settings for a specific chain.

func (*Config) GetChainConfig

func (c *Config) GetChainConfig(chainID string) *ChainSpecificConfig

GetChainConfig returns the configuration for a specific chain, or an empty config if not found.

func (*Config) IsTestnet added in v0.0.48

func (c *Config) IsTestnet() bool

IsTestnet reports whether this node is on testnet. Any other value, including unset, is treated as mainnet.

type KeyringBackend

type KeyringBackend string

KeyringBackend represents the type of keyring backend to use.

const (
	KeyringBackendTest KeyringBackend = "test"
	KeyringBackendFile KeyringBackend = "file"
)

Jump to

Keyboard shortcuts

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