config

package
v0.18.15 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default permissions for writing files
	// These are based on default umask settings
	// User+Group: rw, Other: r
	FilePerms = 0664
	// User+Group: rwx, Other: rx
	DirPerms               = 0775
	FileName               = "config.toml"
	DefaultDir             = ".olfullnode"
	DefaultRPCStartTimeout = 2
)

Variables

This section is empty.

Functions

func Setup added in v0.13.0

func Setup(cfg *Server, key string, value string) error

Types

type APIConfig added in v0.18.15

type APIConfig struct {
	HTTPConfig *HTTPConfig `toml:"http"`
	WSConfig   *WSConfig   `toml:"ws"`
}

func DefaultAPIConfig added in v0.18.15

func DefaultAPIConfig() *APIConfig

type Authorisation added in v0.14.0

type Authorisation struct {
	//owner's password
	OwnerCredentials []string `` /* 275-byte string literal not displayed */

	//Private key for RPC Authentication
	RPCPrivateKey string `` /* 207-byte string literal not displayed */
}

type ChainDriverConfig added in v0.13.0

type ChainDriverConfig struct {
	BitcoinChainType   string `toml:"bitcoin_chain_type" desc:"bitcoin chain types, mainnet, testnet3, or regtest"`
	BitcoinNodeAddress string `toml:"bitcoin_node_address" desc:"ip address of bitcoin node"`
	BitcoinRPCPort     string `toml:"bitcoin rpc_port" desc:"rpc port of bitcoin node"`
	BitcoinRPCUsername string `toml:"bitcoin_rpc_username" desc:"rpc username of bitcoin node"`
	BitcoinRPCPassword string `toml:"bitcoin_rpc_password" desc:"rpc password of bitcoin node"`

	BlockCypherToken string `toml:"blockcypher_token" desc:"token to use blockcypher APIs"`
}

func DefaultChainDriverConfig added in v0.13.0

func DefaultChainDriverConfig() *ChainDriverConfig

type ChainStateRotationCfg added in v0.14.0

type ChainStateRotationCfg struct {

	// "recent" : latest number of version to persist
	// recent = 0 : keep last version only
	// recent = 3 : keep last 4 version
	Recent int64

	// "every"  : every X number of version to persist
	// every = 0 : keep no other epoch version
	// every = 1 : keep every version
	// every > 1 : epoch number = every
	Every int64

	// "cycles" : number of latest cycles for "every" to persist
	// cycles = 1 : only keep one of latest every
	// cycles = 0 : keep every "every"
	Cycles int64
}

type Client

type Client struct {
	Node NodeConfig `toml:"node"`

	BroadcastMode string `toml:"async"`
	Proof         bool   `toml:"proof"`
}

type ConsensusConfig

type ConsensusConfig struct {
	LogOutput             string   `toml:"log_output" desc:"Determines where consensus is logged (stdout|<filename>)"`
	LogLevel              string   `toml:"log_level" desc:"Determines the verbosity of consensus logs"`
	TimeoutPropose        Duration `toml:"timeout_propose" desc:"All timeouts are in milliseconds"`
	TimeoutProposeDelta   Duration `toml:"timeout_propose_delta"`
	TimeoutPrevote        Duration `toml:"timeout_prevote"`
	TimeoutPrevoteDelta   Duration `toml:"timeout_prevote_delta"`
	TimeoutPrecommit      Duration `toml:"timeout_precommit"`
	TimeoutPrecommitDelta Duration `toml:"timeout_precommit_delta"`
	TimeoutCommit         Duration `toml:"timeout_commit"`

	SkipTimeoutCommit bool `toml:"skip_timeout_commit" desc:"Make progress as soon as we have all precommits (as if TimeoutCommit = 0)"`

	CreateEmptyBlocks           bool     `toml:"create_empty_blocks" desc:"Should this node create empty blocks"`
	CreateEmptyBlocksInterval   Duration `toml:"create_empty_blocks_interval" desc:"Interval between empty block creation in milliseconds"`
	PeerGossipSleepDuration     Duration `toml:"peer_gossip_sleep_duration" desc:"Duration values in milliseconds"`
	PeerQueryMaj23SleepDuration Duration `toml:"peer_query_maj23_sleep_duration"`
}

ConsensusConfig handles consensus-specific options

func DefaultConsensusConfig

func DefaultConsensusConfig() *ConsensusConfig

func (*ConsensusConfig) TMConfig

func (cfg *ConsensusConfig) TMConfig() *tmconfig.ConsensusConfig

type Duration

type Duration int64

Duration is a time.Duration that marshals and unmarshals with millisecond values

func (Duration) Nanoseconds

func (d Duration) Nanoseconds() time.Duration

Returns a nanosecond duration

type EthereumChainDriverConfig added in v0.13.0

type EthereumChainDriverConfig struct {
	Connection string `toml:"connection" desc:"ethereum node connection url default: http://localhost:7545"`
}

func DefaultEthConfig added in v0.13.0

func DefaultEthConfig(network string, key string) *EthereumChainDriverConfig

type ForkParams added in v0.18.15

type ForkParams struct {
	FrankensteinBlock int64 `json:"frankensteinBlock"`
}

ForkParams determine the fork blocks number where to apply the global update for network

func DefaultForkParams added in v0.18.15

func DefaultForkParams() *ForkParams

DefaultForkParams initial config

func (*ForkParams) IsFrankensteinBlock added in v0.18.15

func (f *ForkParams) IsFrankensteinBlock(height int64) bool

IsFrankensteinBlock check if fork update arrived to apply change at specific block

func (*ForkParams) IsFrankensteinUpdate added in v0.18.15

func (f *ForkParams) IsFrankensteinUpdate(height int64) bool

IsFrankensteinUpdate check if fork update arrived to apply changes after specific block

func (*ForkParams) ToMap added in v0.18.15

func (f *ForkParams) ToMap() (map[string]interface{}, error)

ToMap converts fork struct to map

func (*ForkParams) Validate added in v0.18.15

func (f *ForkParams) Validate() error

Validate validates the ForkParams to ensure all values are within their allowed limits, and returns an error if they are not.

type GenesisDoc

type GenesisDoc struct {
	GenesisTime     time.Time                  `json:"genesis_time"`
	ChainID         string                     `json:"chain_id"`
	ConsensusParams *tmtypes.ConsensusParams   `json:"consensus_params,omitempty"`
	Validators      []tmtypes.GenesisValidator `json:"validators,omitempty"`
	AppHash         tmbytes.HexBytes           `json:"app_hash"`
	AppState        json.RawMessage            `json:"app_state,omitempty"`
	ForkParams      *ForkParams                `json:"fork"`
}

func GenesisDocFromFile added in v0.18.15

func GenesisDocFromFile(genDocFile string) (*GenesisDoc, error)

GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc.

func GenesisDocFromJSON added in v0.18.15

func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error)

GenesisDocFromJSON unmarshalls JSON data into a GenesisDoc.

func (*GenesisDoc) SaveAs added in v0.18.15

func (genDoc *GenesisDoc) SaveAs(file string) error

SaveAs is a utility method for saving GenensisDoc as a JSON file.

func (*GenesisDoc) ValidateAndComplete added in v0.18.15

func (genDoc *GenesisDoc) ValidateAndComplete() error

ValidateAndComplete checks that all necessary fields are present and fills in defaults for optional fields left empty

func (*GenesisDoc) ValidatorHash added in v0.18.15

func (genDoc *GenesisDoc) ValidatorHash() []byte

ValidatorHash returns the hash of the validator set contained in the GenesisDoc

type HTTPConfig added in v0.18.15

type HTTPConfig struct {
	Enabled bool   `toml:"enabled" desc:"Enable the HTTP-RPC server"`
	Addr    string `toml:"addr" desc:"HTTP-RPC server listening interface (default: \"localhost\")"`
	Port    int    `toml:"port" desc:"HTTP-RPC server listening port (default: 8545)"`

	KeepAlive  bool     `` /* 170-byte string literal not displayed */
	API        []string `toml:"api" desc:"API's offered over the HTTP-RPC interface"`
	CORSDomain []string `toml:"corsdomain" desc:"Comma separated list of domains from which to accept cross origin requests (browser enforced)"`
	VHosts     []string `` /* 158-byte string literal not displayed */
}

type MempoolConfig

type MempoolConfig struct {
	Recheck   bool `toml:"recheck"`
	Broadcast bool `toml:"broadcast"`
	Size      int  `toml:"size" desc:"Size of the mempool"`
	CacheSize int  `toml:"cache_size"`
}

MempoolConfig defines configuration options for the mempool

func DefaultMempoolConfig

func DefaultMempoolConfig() *MempoolConfig

func (*MempoolConfig) TMConfig

func (cfg *MempoolConfig) TMConfig() *tmconfig.MempoolConfig

type NetworkConfig

type NetworkConfig struct {
	RPCAddress      string `toml:"rpc_address"`
	RPCStartTimeout int    `toml:"rpc_start_timeout" desc:"RPC startup timeout in seconds"`

	P2PAddress string `toml:"p2p_address" desc:"Main address for P2P connections"`

	ExternalP2PAddress string `toml:"external_p2p_address" desc:"Address to advertise for incoming peers to connect to"`

	SDKAddress string `toml:"sdk_address"`
}

NetworkConfig exposes configuration files for the current

func DefaultNetworkConfig

func DefaultNetworkConfig() *NetworkConfig

type NodeConfig

type NodeConfig struct {
	NodeName string `toml:"node_name"`
	FastSync bool   `` /* 143-byte string literal not displayed */
	DB       string `toml:"db" desc:"Specify what backend database to use (goleveldb|cleveldb)"`
	DBDir    string `toml:"db_dir" desc:"Specify the application database directory. This is always relative to the root directory of the app."`

	UseAsync bool `toml:"use_async" desc:"Toggle async mode (default: false)"`
	LogLevel int  `toml:"loglevel" desc:"Specify the log level for olfullnode. 0: Fatal, 1: Error, 2: Warning, 3: Info, 4: Debug, 5: Detail"`
	// List of transaction tags to index in the db, allows them to be searched
	// by this parameter
	IndexTags []string `toml:"index_tags" desc:"List of transaction tags to index in the database, allows them to be searched by the specified tags"`
	// Tells the indexer to index all available tags, IndexTags has precedence
	// over IndexAllTAgs
	IndexAllTags bool `toml:"index_all_tags" desc:"Tells the indexer to index all available tags, IndexTags has precedence over IndexAllTags"`

	//rpc package
	Services []string `toml:"services" desc:"List of services used by the current Node. Possible valued [broadcast, node, owner, query, tx]"`

	Auth Authorisation `toml:"Auth" desc:"the OwnerCredentials and RPCPrivateKey should be configured together"`

	ChainStateRotation ChainStateRotationCfg `toml:"ChainStateRotation" desc:"the schedule for chain state rotation"`
}

NodeConfig handles general configuration settings for the node

func DefaultNodeConfig

func DefaultNodeConfig() *NodeConfig

type P2PConfig

type P2PConfig struct {
	Seeds []string `toml:"seeds" desc:"List of seed nodes to connect to"`

	SeedMode bool `toml:"seed_mode" desc:"Enables seed mode, which will make the node crawl the network looking for peers"`

	PersistentPeers []string `toml:"persistent_peers" desc:"List of peers to maintain a persistent connection to"`

	UPNP bool `toml:"upnp" desc:"Enable UPNP port forwarding"`

	AddrBookStrict bool `` /* 155-byte string literal not displayed */

	MaxNumInboundPeers int `toml:"max_num_inbound_peers" desc:"Max number of inbound peers"`

	MaxNumOutboundPeers int `toml:"max_num_outbound_peers" desc:"Max number of outbound peers to connect to, excluding persistent peers"`

	FlushThrottleTimeout Duration `toml:"flush_throttle_timeout" desc:"Time to wait before flushing messages out on the connection in milliseconds"`

	MaxPacketMsgPayloadSize int `toml:"max_packet_msg_payload_size" desc:"Max size of a message packet payload, in bytes"`

	SendRate int64 `toml:"send_rate" desc:"Rate at which packets can be sent, in bytes/second"`

	// Rate at which packets can be received, in bytes/second
	RecvRate int64 `toml:"recv_rate" desc:"Rate at which packets can be received, in bytes/second"`

	PexReactor bool `toml:"pex" desc:"Set true to enable the peer-exchange reactor"`

	PrivatePeerIDs []string `toml:"private_peer_ids" desc:"List of peer IDs to keep private (will not be gossiped to other peers)"`

	AllowDuplicateIP bool `toml:"allow_duplicate_ip" desc:"Toggle to disable guard against peers connecting from the same IP"`

	HandshakeTimeout Duration `toml:"handshake_timeout" desc:"In milliseconds"`
	DialTimeout      Duration `toml:"dial_timeout" desc:"In milliseconds"`
}

P2PConfig defines the options for P2P networking layer

func DefaultP2PConfig

func DefaultP2PConfig() *P2PConfig

func (*P2PConfig) SetPersistentPeers added in v0.13.0

func (cfg *P2PConfig) SetPersistentPeers(peers []string)

func (*P2PConfig) TMConfig

func (cfg *P2PConfig) TMConfig() *tmconfig.P2PConfig

type Server

type Server struct {
	Node           *NodeConfig                `toml:"node"`
	Network        *NetworkConfig             `toml:"network"`
	API            *APIConfig                 `toml:"api"`
	P2P            *P2PConfig                 `toml:"p2p"`
	Mempool        *MempoolConfig             `toml:"mempool"`
	Consensus      *ConsensusConfig           `toml:"consensus"`
	ChainDriver    *ChainDriverConfig         `toml:"chain_driver"`
	EthChainDriver *EthereumChainDriverConfig `toml:"ethereum_chain_driver"`
	// contains filtered or unexported fields
}

Struct for holding the configuration details for the node

func DefaultServerConfig

func DefaultServerConfig() *Server

func (*Server) ChainID

func (cfg *Server) ChainID() string

func (*Server) Marshal

func (cfg *Server) Marshal() (text []byte, err error)

Marshal returns the text form of Server as TOML

func (*Server) ReadFile

func (cfg *Server) ReadFile(path string) error

ReadFile accepts a filepath and returns the

func (*Server) RootDir

func (cfg *Server) RootDir() string

func (*Server) SaveFile

func (cfg *Server) SaveFile(filepath string) error

SaveFile saves the current config to a file at the specified path

func (*Server) TMConfig

func (cfg *Server) TMConfig() tmconfig.Config

func (*Server) Unmarshal

func (cfg *Server) Unmarshal(text []byte) error

Marshal accepts the text form of a TOML configuration file and fills Server with its values

type WSConfig added in v0.18.15

type WSConfig struct {
	Enabled bool   `toml:"enabled" desc:"Enable the WS-RPC server"`
	Addr    string `toml:"addr" desc:"WS-RPC server listening interface (default: \"localhost\")"`
	Port    int    `toml:"port" desc:"WS-RPC server listening port (default: 8546)"`

	API     []string `toml:"api" desc:"API's offered over the WS-RPC interface"`
	Origins []string `toml:"origins" desc:"Origins from which to accept websockets requests"`
}

Jump to

Keyboard shortcuts

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