parent
ba08520b28
commit
de603b3b94
@ -0,0 +1,163 @@ |
||||
package harmony |
||||
|
||||
// HarmonyConfig contains all the configs user can set for running harmony binary. Served as the bridge
|
||||
// from user set flags to internal node configs. Also user can persist this structure to a toml file
|
||||
// to avoid inputting all arguments.
|
||||
type HarmonyConfig struct { |
||||
Version string |
||||
General GeneralConfig |
||||
Network NetworkConfig |
||||
P2P P2pConfig |
||||
HTTP HttpConfig |
||||
WS WsConfig |
||||
RPCOpt RpcOptConfig |
||||
BLSKeys BlsConfig |
||||
TxPool TxPoolConfig |
||||
Pprof PprofConfig |
||||
Log LogConfig |
||||
Sync SyncConfig |
||||
Sys *SysConfig `toml:",omitempty"` |
||||
Consensus *ConsensusConfig `toml:",omitempty"` |
||||
Devnet *DevnetConfig `toml:",omitempty"` |
||||
Revert *RevertConfig `toml:",omitempty"` |
||||
Legacy *LegacyConfig `toml:",omitempty"` |
||||
Prometheus *PrometheusConfig `toml:",omitempty"` |
||||
DNSSync DnsSync |
||||
} |
||||
|
||||
type DnsSync struct { |
||||
Port int // replaces: Network.DNSSyncPort
|
||||
Zone string // replaces: Network.DNSZone
|
||||
LegacySyncing bool // replaces: Network.LegacySyncing
|
||||
Client bool // replaces: Sync.LegacyClient
|
||||
Server bool // replaces: Sync.LegacyServer
|
||||
ServerPort int |
||||
} |
||||
|
||||
type NetworkConfig struct { |
||||
NetworkType string |
||||
BootNodes []string |
||||
} |
||||
|
||||
type P2pConfig struct { |
||||
Port int |
||||
IP string |
||||
KeyFile string |
||||
DHTDataStore *string `toml:",omitempty"` |
||||
} |
||||
|
||||
type GeneralConfig struct { |
||||
NodeType string |
||||
NoStaking bool |
||||
ShardID int |
||||
IsArchival bool |
||||
IsBeaconArchival bool |
||||
IsOffline bool |
||||
DataDir string |
||||
} |
||||
|
||||
type ConsensusConfig struct { |
||||
MinPeers int |
||||
AggregateSig bool |
||||
} |
||||
|
||||
type BlsConfig struct { |
||||
KeyDir string |
||||
KeyFiles []string |
||||
MaxKeys int |
||||
|
||||
PassEnabled bool |
||||
PassSrcType string |
||||
PassFile string |
||||
SavePassphrase bool |
||||
|
||||
KMSEnabled bool |
||||
KMSConfigSrcType string |
||||
KMSConfigFile string |
||||
} |
||||
|
||||
type TxPoolConfig struct { |
||||
BlacklistFile string |
||||
} |
||||
|
||||
type PprofConfig struct { |
||||
Enabled bool |
||||
ListenAddr string |
||||
} |
||||
|
||||
type LogConfig struct { |
||||
Folder string |
||||
FileName string |
||||
RotateSize int |
||||
Verbosity int |
||||
VerbosePrints map[string]bool |
||||
Context *LogContext `toml:",omitempty"` |
||||
} |
||||
|
||||
type LogContext struct { |
||||
IP string |
||||
Port int |
||||
} |
||||
|
||||
type SysConfig struct { |
||||
NtpServer string |
||||
} |
||||
|
||||
type HttpConfig struct { |
||||
Enabled bool |
||||
IP string |
||||
Port int |
||||
RosettaEnabled bool |
||||
RosettaPort int |
||||
} |
||||
|
||||
type WsConfig struct { |
||||
Enabled bool |
||||
IP string |
||||
Port int |
||||
} |
||||
|
||||
type RpcOptConfig struct { |
||||
DebugEnabled bool // Enables PrivateDebugService APIs, including the EVM tracer
|
||||
RateLimterEnabled bool // Enable Rate limiter for RPC
|
||||
RequestsPerSecond int // for RPC rate limiter
|
||||
} |
||||
|
||||
type DevnetConfig struct { |
||||
NumShards int |
||||
ShardSize int |
||||
HmyNodeSize int |
||||
} |
||||
|
||||
// TODO: make `revert` to a separate command
|
||||
type RevertConfig struct { |
||||
RevertBeacon bool |
||||
RevertTo int |
||||
RevertBefore int |
||||
} |
||||
|
||||
type LegacyConfig struct { |
||||
WebHookConfig *string `toml:",omitempty"` |
||||
TPBroadcastInvalidTxn *bool `toml:",omitempty"` |
||||
} |
||||
|
||||
type PrometheusConfig struct { |
||||
Enabled bool |
||||
IP string |
||||
Port int |
||||
EnablePush bool |
||||
Gateway string |
||||
} |
||||
|
||||
type SyncConfig struct { |
||||
// TODO: Remove this bool after stream sync is fully up.
|
||||
Enabled bool // enable the stream sync protocol
|
||||
Downloader bool // start the sync downloader client
|
||||
Concurrency int // concurrency used for stream sync protocol
|
||||
MinPeers int // minimum streams to start a sync task.
|
||||
InitStreams int // minimum streams in bootstrap to start sync loop.
|
||||
DiscSoftLowCap int // when number of streams is below this value, spin discover during check
|
||||
DiscHardLowCap int // when removing stream, num is below this value, spin discovery immediately
|
||||
DiscHighCap int // upper limit of streams in one sync protocol
|
||||
DiscBatch int // size of each discovery
|
||||
} |
Loading…
Reference in new issue