Documentation ¶
Index ¶
Constants ¶
const ( DefaultHTTPHost = "127.0.0.1" // Default host interface for the HTTP RPC server DefaultHTTPPort = 8545 // Default TCP port for the HTTP RPC server DefaultWSHost = "127.0.0.1" // Default host interface for the websocket RPC server DefaultWSPort = 8546 // Default TCP port for the websocket RPC server )
Variables ¶
var (
DefaultDataDir = defaultHomeDir()
)
var (
DefaultModules = []string{"admin", "personal", "txpool", "eth", "net", "web3", "miner", "debug"}
)
var DefaultRpcConfig = node.Config{ DataDir: DefaultDataDir, HTTPHost: DefaultHTTPHost, HTTPPort: DefaultHTTPPort, HTTPModules: DefaultModules, HTTPVirtualHosts: []string{"*"}, HTTPTimeouts: rpc.DefaultHTTPTimeouts, WSHost: DefaultWSHost, WSPort: DefaultWSPort, WSModules: DefaultModules, }
DefaultRpcConfig contains reasonable default settings.
Functions ¶
This section is empty.
Types ¶
type BaseConfig ¶
type BaseConfig struct { // Top-level directory of evm-lachesis data DataDir string `mapstructure:"datadir"` // Debug, info, warn, error, fatal, panic LogLevel string `mapstructure:"log"` }
BaseConfig contains the top level configuration for an EVM-Lachesis node
func DefaultBaseConfig ¶
func DefaultBaseConfig() BaseConfig
DefaultBaseConfig returns the default top-level configuration for EVM-Lachesis
type Config ¶
type Config struct { // Top level options use an anonymous struct BaseConfig `mapstructure:",squash"` // Options for EVM and State Eth *EthConfig `mapstructure:"eth"` // Options for Lachesis consensus Lachesis *LachesisConfig `mapstructure:"lachesis"` // Options for Raft consensus Raft *RaftConfig `mapstructure:"raft"` ProxyAddr string `mapstructure:"proxy"` ClientAddr string `mapstructure:"client-connect"` Standalone bool `mapstructure:"standalone"` Pidfile string `mapstructure:"pidfile"` }
Config contains de configuration for an EVM-Lite node
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default configuration for an EVM-Lite node
func (*Config) SetDataDir ¶
SetDataDir updates the root data directory as well as the various lower config for eth and consensus
type EthConfig ¶
type EthConfig struct { // Genesis file Genesis string `mapstructure:"genesis"` // Location of ethereum account keys Keystore string `mapstructure:"keystore"` // File containing passwords to unlock ethereum accounts PwdFile string `mapstructure:"pwd"` // File containing the levelDB database DbFile string `mapstructure:"db"` // Address of HTTP API Service EthAPIAddr string `mapstructure:"listen"` // Megabytes of memory allocated to internal caching (min 16MB / database forced) Cache int `mapstructure:"cache"` }
EthConfig contains the configuration relative to the accounts, EVM, trie/db, and service API
func DefaultEthConfig ¶
func DefaultEthConfig() *EthConfig
DefaultEthConfig return the default configuration for Eth services
func (*EthConfig) SetDataDir ¶
SetDataDir updates the eth configuration directories if they were set to default values.
type LachesisConfig ¶
type LachesisConfig struct { // Directory containing priv_key.pem and peers.json files DataDir string `mapstructure:"datadir"` // Address of Lachesis node (where it talks to other Lachesis nodes) BindAddr string `mapstructure:"listen"` // Lachesis HTTP API address ServiceAddr string `mapstructure:"service-listen"` // Gossip heartbeat Heartbeat time.Duration `mapstructure:"heartbeat"` // TCP timeout TCPTimeout time.Duration `mapstructure:"timeout"` // Max number of items in caches CacheSize int `mapstructure:"cache-size"` // Max number of Event in SyncResponse SyncLimit int64 `mapstructure:"sync-limit"` // Max number of connections in net pool MaxPool int `mapstructure:"max-pool"` // Database type; badger or inmeum Store bool `mapstructure:"store"` }
LachesisConfig contains the configuration of a Lachesis node
func DefaultLachesisConfig ¶
func DefaultLachesisConfig() *LachesisConfig
DefaultLachesisConfig returns the default configuration for a Lachesis node
func (*LachesisConfig) SetDataDir ¶
func (c *LachesisConfig) SetDataDir(datadir string)
SetDataDir updates the lachesis configuration directories if they were set to to default values.
func (*LachesisConfig) ToRealLachesisConfig ¶
func (c *LachesisConfig) ToRealLachesisConfig(logger *logrus.Logger) *_lachesis.LachesisConfig
ToRealLachesisConfig converts an evm/src/config.LachesisConfig to a lachesis/src/lachesis.LachesisConfig as used by Lachesis
type RaftConfig ¶
type RaftConfig struct { // ProtocolVersion allows a Raft server to inter-operate with older // Raft servers running an older version of the code. This is used to // version the wire protocol as well as Raft-specific log entries that // the server uses when _speaking_ to other servers. There is currently // no auto-negotiation of versions so all servers must be manually // configured with compatible versions. See ProtocolVersionMin and // ProtocolVersionMax for the versions of the protocol that this server // can _understand_. ProtocolVersion _raft.ProtocolVersion `mapstructure:"protocol_version"` // HeartbeatTimeout specifies the time in follower state without // a leader before we attempt an election. HeartbeatTimeout time.Duration `mapstructure:"heartbeat"` // ElectionTimeout specifies the time in candidate state without // a leader before we attempt an election. ElectionTimeout time.Duration `mapstructure:"election_timeout"` // CommitTimeout controls the time without an Apply() operation // before we heartbeat to ensure a timely commit. Due to random // staggering, may be delayed as much as 2x this value. CommitTimeout time.Duration `mapstructure:"commit_timeout"` // MaxAppendEntries controls the maximum number of append entries // to send at once. We want to strike a balance between efficiency // and avoiding waste if the follower is going to reject because of // an inconsistent log. MaxAppendEntries int `mapstructure:"max_append_entries"` // If we are a member of a cluster, and RemovePeer is invoked for the // local node, then we forget all peers and transition into the follower state. // If ShutdownOnRemove is is set, we additional shutdown Raft. Otherwise, // we can become a leader of a cluster containing only this node. ShutdownOnRemove bool `mapstructure:"shutdown_on_remove"` // TrailingLogs controls how many logs we leave after a snapshot. This is // used so that we can quickly replay logs on a follower instead of being // forced to send an entire snapshot. TrailingLogs uint64 `mapstructure:"trailing_logs"` // SnapshotInterval controls how often we check if we should perform a snapshot. // We randomly stagger between this value and 2x this value to avoid the entire // cluster from performing a snapshot at once. SnapshotInterval time.Duration `mapstructure:"snapshot_interval"` // SnapshotThreshold controls how many outstanding logs there must be before // we perform a snapshot. This is to prevent excessive snapshots when we can // just replay a small set of logs. SnapshotThreshold uint64 `mapstructure:"snapshot_threshold"` // LeaderLeaseTimeout is used to control how long the "lease" lasts // for being the leader without being able to contact a quorum // of nodes. If we reach this interval without contact, we will // step down as leader. LeaderLeaseTimeout time.Duration `mapstructure:"leader_lease_timeout"` // StartAsLeader forces Raft to start in the leader state. This should // never be used except for testing purposes, as it can cause a split-brain. StartAsLeader bool `mapstructure:"start_as_leader"` // The unique ID for this server across all time. When running with // ProtocolVersion < 3, you must set this to be the same as the network // address of your transport. LocalID _raft.ServerID `mapstructure:"server-id"` RaftDir string `mapstructure:"dir"` SnapshotDir string `mapstructure:"snapshot-dir"` NodeAddr string `mapstructure:"node-addr"` }
RaftConfig contains the configuration of a Raft node
func DefaultRaftConfig ¶
func DefaultRaftConfig() *RaftConfig
DefaultRaftConfig returns the default configuration for a Raft node
func (*RaftConfig) SetDataDir ¶
func (c *RaftConfig) SetDataDir(datadir string)
SetDataDir updates the raft configuration directories if they were set to default values