Documentation
¶
Index ¶
- Constants
- Variables
- func AddFlags(cmd *cobra.Command)
- func AddGlobalFlags(cmd *cobra.Command, defaultHome string)
- func DefaultRootDirWithName(appName string) string
- func GetMultiAddr(addr string) (multiaddr.Multiaddr, error)
- func TranslateAddresses(conf *Config) error
- type Config
- type DAConfig
- type DurationWrapper
- type InstrumentationConfig
- type LogConfig
- type NodeConfig
- type P2PConfig
- type RPCConfig
- type RaftConfig
- type SignerConfig
Constants ¶
const ( FlagPrefixRollkit = "rollkit." FlagPrefixEvnode = "evnode." // FlagRootDir is a flag for specifying the root directory FlagRootDir = "home" // FlagDBPath is a flag for specifying the database path FlagDBPath = FlagPrefixEvnode + "db_path" // FlagAggregator is a flag for running node in aggregator mode FlagAggregator = FlagPrefixEvnode + "node.aggregator" // FlagBasedSequencer is a flag for enabling based sequencer mode (requires aggregator mode) FlagBasedSequencer = FlagPrefixEvnode + "node.based_sequencer" // FlagLight is a flag for running the node in light mode FlagLight = FlagPrefixEvnode + "node.light" // FlagBlockTime is a flag for specifying the block time FlagBlockTime = FlagPrefixEvnode + "node.block_time" // FlagLazyAggregator is a flag for enabling lazy aggregation mode that only produces blocks when transactions are available FlagLazyAggregator = FlagPrefixEvnode + "node.lazy_mode" // FlagMaxPendingHeadersAndData is a flag to limit and pause block production when too many headers or data are waiting for DA confirmation FlagMaxPendingHeadersAndData = FlagPrefixEvnode + "node.max_pending_headers_and_data" // FlagLazyBlockTime is a flag for specifying the maximum interval between blocks in lazy aggregation mode FlagLazyBlockTime = FlagPrefixEvnode + "node.lazy_block_interval" // FlagReadinessWindowSeconds configures the time window (in seconds) used to calculate readiness threshold FlagReadinessWindowSeconds = FlagPrefixEvnode + "node.readiness_window_seconds" // FlagReadinessMaxBlocksBehind configures how many blocks behind best-known head is still considered ready FlagReadinessMaxBlocksBehind = FlagPrefixEvnode + "node.readiness_max_blocks_behind" // FlagScrapeInterval is a flag for specifying the reaper scrape interval FlagScrapeInterval = FlagPrefixEvnode + "node.scrape_interval" // FlagClearCache is a flag for clearing the cache FlagClearCache = FlagPrefixEvnode + "clear_cache" // FlagDAAddress is a flag for specifying the data availability layer address FlagDAAddress = FlagPrefixEvnode + "da.address" // FlagDAAuthToken is a flag for specifying the data availability layer auth token FlagDAAuthToken = FlagPrefixEvnode + "da.auth_token" // #nosec G101 // FlagDABlockTime is a flag for specifying the data availability layer block time FlagDABlockTime = FlagPrefixEvnode + "da.block_time" // FlagDANamespace is a flag for specifying the DA namespace ID FlagDANamespace = FlagPrefixEvnode + "da.namespace" // FlagDADataNamespace is a flag for specifying the DA data namespace ID FlagDADataNamespace = FlagPrefixEvnode + "da.data_namespace" // FlagDAForcedInclusionNamespace is a flag for specifying the DA forced inclusion namespace ID FlagDAForcedInclusionNamespace = FlagPrefixEvnode + "da.forced_inclusion_namespace" // FlagDASubmitOptions is a flag for data availability submit options FlagDASubmitOptions = FlagPrefixEvnode + "da.submit_options" // FlagDASigningAddresses is a flag for specifying multiple DA signing addresses FlagDASigningAddresses = FlagPrefixEvnode + "da.signing_addresses" // FlagDAMempoolTTL is a flag for specifying the DA mempool TTL FlagDAMempoolTTL = FlagPrefixEvnode + "da.mempool_ttl" // FlagDAMaxSubmitAttempts is a flag for specifying the maximum DA submit attempts FlagDAMaxSubmitAttempts = FlagPrefixEvnode + "da.max_submit_attempts" // FlagDARequestTimeout controls the per-request timeout when talking to the DA layer FlagDARequestTimeout = FlagPrefixEvnode + "da.request_timeout" // FlagDABatchingStrategy is a flag for specifying the batching strategy FlagDABatchingStrategy = FlagPrefixEvnode + "da.batching_strategy" // FlagDABatchSizeThreshold is a flag for specifying the batch size threshold FlagDABatchSizeThreshold = FlagPrefixEvnode + "da.batch_size_threshold" // FlagDABatchMaxDelay is a flag for specifying the maximum batch delay FlagDABatchMaxDelay = FlagPrefixEvnode + "da.batch_max_delay" // FlagDABatchMinItems is a flag for specifying the minimum batch items FlagDABatchMinItems = FlagPrefixEvnode + "da.batch_min_items" // FlagP2PListenAddress is a flag for specifying the P2P listen address FlagP2PListenAddress = FlagPrefixEvnode + "p2p.listen_address" // FlagP2PPeers is a flag for specifying the P2P peers FlagP2PPeers = FlagPrefixEvnode + "p2p.peers" // FlagP2PBlockedPeers is a flag for specifying the P2P blocked peers FlagP2PBlockedPeers = FlagPrefixEvnode + "p2p.blocked_peers" // FlagP2PAllowedPeers is a flag for specifying the P2P allowed peers FlagP2PAllowedPeers = FlagPrefixEvnode + "p2p.allowed_peers" // FlagPrometheus is a flag for enabling Prometheus metrics FlagPrometheus = FlagPrefixEvnode + "instrumentation.prometheus" // FlagPrometheusListenAddr is a flag for specifying the Prometheus listen address FlagPrometheusListenAddr = FlagPrefixEvnode + "instrumentation.prometheus_listen_addr" // FlagMaxOpenConnections is a flag for specifying the maximum number of open connections FlagMaxOpenConnections = FlagPrefixEvnode + "instrumentation.max_open_connections" // FlagPprof is a flag for enabling pprof profiling endpoints for runtime debugging FlagPprof = FlagPrefixEvnode + "instrumentation.pprof" // FlagPprofListenAddr is a flag for specifying the pprof listen address FlagPprofListenAddr = FlagPrefixEvnode + "instrumentation.pprof_listen_addr" // FlagTracing enables OpenTelemetry tracing FlagTracing = FlagPrefixEvnode + "instrumentation.tracing" // FlagTracingEndpoint configures the OTLP endpoint (host:port) FlagTracingEndpoint = FlagPrefixEvnode + "instrumentation.tracing_endpoint" // FlagTracingServiceName configures the service.name resource attribute FlagTracingServiceName = FlagPrefixEvnode + "instrumentation.tracing_service_name" // FlagTracingSampleRate configures the TraceID ratio-based sampler FlagTracingSampleRate = FlagPrefixEvnode + "instrumentation.tracing_sample_rate" // FlagLogLevel is a flag for specifying the log level FlagLogLevel = FlagPrefixEvnode + "log.level" // FlagLogFormat is a flag for specifying the log format FlagLogFormat = FlagPrefixEvnode + "log.format" // FlagLogTrace is a flag for enabling stack traces in error logs FlagLogTrace = FlagPrefixEvnode + "log.trace" // FlagSignerType is a flag for specifying the signer type FlagSignerType = FlagPrefixEvnode + "signer.signer_type" // FlagSignerPath is a flag for specifying the signer path FlagSignerPath = FlagPrefixEvnode + "signer.signer_path" // FlagSignerPassphraseFile is a flag for specifying the file containing the signer passphrase FlagSignerPassphraseFile = FlagPrefixEvnode + "signer.passphrase_file" // FlagRPCAddress is a flag for specifying the RPC server address FlagRPCAddress = FlagPrefixEvnode + "rpc.address" // FlagRPCEnableDAVisualization is a flag for enabling DA visualization endpoints FlagRPCEnableDAVisualization = FlagPrefixEvnode + "rpc.enable_da_visualization" // FlagRaftEnable is a flag for enabling Raft consensus FlagRaftEnable = FlagPrefixEvnode + "raft.enable" // FlagRaftNodeID is a flag for specifying the Raft node ID FlagRaftNodeID = FlagPrefixEvnode + "raft.node_id" // FlagRaftAddr is a flag for specifying the Raft communication address FlagRaftAddr = FlagPrefixEvnode + "raft.raft_addr" // FlagRaftDir is a flag for specifying the Raft data directory FlagRaftDir = FlagPrefixEvnode + "raft.raft_dir" // FlagRaftBootstrap is a flag for bootstrapping a new Raft cluster FlagRaftBootstrap = FlagPrefixEvnode + "raft.bootstrap" // FlagRaftPeers is a flag for specifying Raft peer addresses FlagRaftPeers = FlagPrefixEvnode + "raft.peers" // FlagRaftSnapCount is a flag for specifying snapshot frequency FlagRaftSnapCount = FlagPrefixEvnode + "raft.snap_count" // FlagRaftSendTimeout max time to wait for a message to be sent to a peer FlagRaftSendTimeout = FlagPrefixEvnode + "raft.send_timeout" // FlagRaftHeartbeatTimeout is a flag for specifying heartbeat timeout FlagRaftHeartbeatTimeout = FlagPrefixEvnode + "raft.heartbeat_timeout" // FlagRaftLeaderLeaseTimeout is a flag for specifying leader lease timeout FlagRaftLeaderLeaseTimeout = FlagPrefixEvnode + "raft.leader_lease_timeout" )
const ( // ConfigFileName is the base name of the evolve configuration file without extension. ConfigFileName = "evnode" // ConfigExtension is the file extension for the configuration file without the leading dot. ConfigExtension = "yaml" // ConfigPath is the filename for the evolve configuration file. ConfigName = ConfigFileName + "." + ConfigExtension // AppConfigDir is the directory name for the app configuration. AppConfigDir = "config" )
Variables ¶
var DefaultRootDir = DefaultRootDirWithName(ConfigFileName)
DefaultRootDir returns the default root directory for evolve
var ErrReadYaml = fmt.Errorf("reading %s", ConfigName)
ErrReadYaml is the error returned when reading the evnode.yml file fails.
Functions ¶
func AddGlobalFlags ¶
AddGlobalFlags registers the basic configuration flags that are common across applications. This includes logging configuration and root directory settings. It should be used in apps that do not already define their logger and home flag.
func DefaultRootDirWithName ¶
DefaultRootDirWithName returns the default root directory for an application, based on the app name and the user's home directory
func GetMultiAddr ¶
GetMultiAddr converts single Cosmos-style network address into Multiaddr. Input format: [protocol://][<NODE_ID>@]<IPv4>:<PORT>
func TranslateAddresses ¶
TranslateAddresses updates conf by changing Cosmos-style addresses to Multiaddr format.
Types ¶
type Config ¶
type Config struct {
RootDir string `mapstructure:"-" yaml:"-" comment:"Root directory where rollkit files are located"`
ClearCache bool `mapstructure:"-" yaml:"-" comment:"Clear the cache"`
// Base configuration
DBPath string `mapstructure:"db_path" yaml:"db_path" comment:"Path inside the root directory where the database is located"`
// P2P configuration
P2P P2PConfig `mapstructure:"p2p" yaml:"p2p"`
// Node specific configuration
Node NodeConfig `mapstructure:"node" yaml:"node"`
// Data availability configuration
DA DAConfig `mapstructure:"da" yaml:"da"`
// RPC configuration
RPC RPCConfig `mapstructure:"rpc" yaml:"rpc"`
// Instrumentation configuration
Instrumentation *InstrumentationConfig `mapstructure:"instrumentation" yaml:"instrumentation"`
// Logging configuration
Log LogConfig `mapstructure:"log" yaml:"log"`
// Remote signer configuration
Signer SignerConfig `mapstructure:"signer" yaml:"signer"`
// Raft consensus configuration
Raft RaftConfig `mapstructure:"raft" yaml:"raft"`
}
Config stores Rollkit configuration.
func Load ¶
Load loads the node configuration in the following order of precedence: 1. DefaultNodeConfig() (lowest priority) 2. YAML configuration file 3. Command line flags (highest priority)
func LoadFromViper ¶
LoadFromViper loads the node configuration from a provided viper instance. It gets the home directory from the input viper, sets up a new viper instance to read the config file, and then merges both instances. This allows getting configuration values from both command line flags (or other sources) and the config file, with the same precedence as Load.
func (*Config) ConfigPath ¶
ConfigPath returns the path to the configuration file.
func (*Config) SaveAsYaml ¶
SaveAsYaml saves the current configuration to a YAML file.
type DAConfig ¶
type DAConfig struct {
Address string `` /* 184-byte string literal not displayed */
AuthToken string `` /* 164-byte string literal not displayed */
SubmitOptions string `` /* 186-byte string literal not displayed */
SigningAddresses []string `` /* 258-byte string literal not displayed */
Namespace string `` /* 185-byte string literal not displayed */
DataNamespace string `` /* 143-byte string literal not displayed */
ForcedInclusionNamespace string `` /* 149-byte string literal not displayed */
BlockTime DurationWrapper `` /* 301-byte string literal not displayed */
MempoolTTL uint64 `` /* 184-byte string literal not displayed */
MaxSubmitAttempts int `` /* 216-byte string literal not displayed */
RequestTimeout DurationWrapper `mapstructure:"request_timeout" yaml:"request_timeout" comment:"Timeout for requests to DA layer"`
// Batching strategy configuration
BatchingStrategy string `` /* 311-byte string literal not displayed */
BatchSizeThreshold float64 `` /* 273-byte string literal not displayed */
BatchMaxDelay DurationWrapper `` /* 286-byte string literal not displayed */
BatchMinItems uint64 `` /* 227-byte string literal not displayed */
}
DAConfig contains all Data Availability configuration parameters
func (*DAConfig) GetDataNamespace ¶
GetDataNamespace returns the namespace for data submissions, falling back to the header namespace if not set
func (*DAConfig) GetForcedInclusionNamespace ¶
GetForcedInclusionNamespace returns the namespace for forced inclusion transactions
func (*DAConfig) GetNamespace ¶
GetNamespace returns the namespace for header submissions.
type DurationWrapper ¶
DurationWrapper is a wrapper for time.Duration that implements encoding.TextMarshaler and encoding.TextUnmarshaler needed for YAML marshalling/unmarshalling especially for time.Duration
func (DurationWrapper) MarshalText ¶
func (d DurationWrapper) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler to format the duration as text
func (*DurationWrapper) UnmarshalText ¶
func (d *DurationWrapper) UnmarshalText(text []byte) error
UnmarshalText implements encoding.TextUnmarshaler to parse the duration from text
type InstrumentationConfig ¶
type InstrumentationConfig struct {
// When true, Prometheus metrics are served under /metrics on
// PrometheusListenAddr.
// Check out the documentation for the list of available metrics.
Prometheus bool `yaml:"prometheus" comment:"Enable Prometheus metrics"` // When true, Prometheus metrics are served
// Address to listen for Prometheus collector(s) connections.
PrometheusListenAddr string `mapstructure:"prometheus_listen_addr" yaml:"prometheus_listen_addr" comment:"Address to listen for Prometheus metrics"`
// Maximum number of simultaneous connections.
// If you want to accept a larger number than the default, make sure
// you increase your OS limits.
// 0 - unlimited.
MaxOpenConnections int `mapstructure:"max_open_connections" yaml:"max_open_connections" comment:"Maximum number of simultaneous connections"`
// Instrumentation namespace.
Namespace string `yaml:"namespace" comment:"Namespace for metrics"` // Instrumentation namespace
// When true, pprof endpoints are served under /debug/pprof/ on
// PprofListenAddr. This enables runtime profiling of the application.
// Available endpoints include:
// - /debug/pprof/ - Index page
// - /debug/pprof/cmdline - Command line arguments
// - /debug/pprof/profile - CPU profile
// - /debug/pprof/symbol - Symbol lookup
// - /debug/pprof/trace - Execution trace
// - /debug/pprof/goroutine - Goroutine stack dumps
// - /debug/pprof/heap - Heap memory profile
// - /debug/pprof/mutex - Mutex contention profile
// - /debug/pprof/block - Block profile
// - /debug/pprof/allocs - Allocation profile
Pprof bool `yaml:"pprof" comment:"Enable pprof profiling server"` // When true, pprof endpoints are served
// Address to listen for pprof connections.
// Default is ":6060" which is the standard port for pprof.
PprofListenAddr string `mapstructure:"pprof_listen_addr" yaml:"pprof_listen_addr" comment:"Address to listen for pprof connections"`
// Tracing enables OpenTelemetry tracing when true.
Tracing bool `mapstructure:"tracing" yaml:"tracing" comment:"Enable OpenTelemetry tracing"`
// TracingEndpoint is the OTLP endpoint (host:port) for exporting traces.
TracingEndpoint string `mapstructure:"tracing_endpoint" yaml:"tracing_endpoint" comment:"OTLP endpoint for traces (host:port)"`
// TracingServiceName is the service.name resource attribute for this node.
TracingServiceName string `mapstructure:"tracing_service_name" yaml:"tracing_service_name" comment:"OpenTelemetry service.name for this process"`
// TracingSampleRate is the TraceID ratio-based sampling rate (0.0 - 1.0).
TracingSampleRate float64 `mapstructure:"tracing_sample_rate" yaml:"tracing_sample_rate" comment:"Sampling rate for traces (0.0-1.0)"`
}
InstrumentationConfig defines the configuration for metrics reporting.
func DefaultInstrumentationConfig ¶
func DefaultInstrumentationConfig() *InstrumentationConfig
DefaultInstrumentationConfig returns a default configuration for metrics reporting.
func (*InstrumentationConfig) GetPprofListenAddr ¶
func (cfg *InstrumentationConfig) GetPprofListenAddr() string
GetPprofListenAddr returns the address to listen for pprof connections. If PprofListenAddr is empty, it returns the default pprof port ":6060".
func (*InstrumentationConfig) IsPprofEnabled ¶
func (cfg *InstrumentationConfig) IsPprofEnabled() bool
IsPprofEnabled returns true if pprof endpoints are enabled.
func (*InstrumentationConfig) IsPrometheusEnabled ¶
func (cfg *InstrumentationConfig) IsPrometheusEnabled() bool
IsPrometheusEnabled returns true if Prometheus metrics are enabled.
func (*InstrumentationConfig) IsTracingEnabled ¶
func (cfg *InstrumentationConfig) IsTracingEnabled() bool
IsTracingEnabled returns true if OpenTelemetry tracing is enabled.
func (*InstrumentationConfig) ValidateBasic ¶
func (cfg *InstrumentationConfig) ValidateBasic() error
ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.
type LogConfig ¶
type LogConfig struct {
Level string `mapstructure:"level" yaml:"level" comment:"Log level (debug, info, warn, error)"`
Format string `mapstructure:"format" yaml:"format" comment:"Log format (text, json)"`
Trace bool `mapstructure:"trace" yaml:"trace" comment:"Enable stack traces in error logs"`
}
LogConfig contains all logging configuration parameters
type NodeConfig ¶
type NodeConfig struct {
// Node mode configuration
Aggregator bool `yaml:"aggregator" comment:"Run node in aggregator mode"`
BasedSequencer bool `` /* 166-byte string literal not displayed */
Light bool `yaml:"light" comment:"Run node in light mode"`
// Block management configuration
BlockTime DurationWrapper `` /* 141-byte string literal not displayed */
MaxPendingHeadersAndData uint64 `` /* 275-byte string literal not displayed */
LazyMode bool `` /* 252-byte string literal not displayed */
LazyBlockInterval DurationWrapper `` /* 272-byte string literal not displayed */
ScrapeInterval DurationWrapper `` /* 253-byte string literal not displayed */
// Readiness / health configuration
ReadinessWindowSeconds uint64 `` /* 189-byte string literal not displayed */
ReadinessMaxBlocksBehind uint64 `` /* 206-byte string literal not displayed */
}
NodeConfig contains all Rollkit specific configuration parameters
type P2PConfig ¶
type P2PConfig struct {
ListenAddress string `mapstructure:"listen_address" yaml:"listen_address" comment:"Address to listen for incoming connections (host:port)"`
Peers string `mapstructure:"peers" yaml:"peers" comment:"Comma-separated list of peers to connect to"`
BlockedPeers string `mapstructure:"blocked_peers" yaml:"blocked_peers" comment:"Comma-separated list of peer IDs to block from connecting"`
AllowedPeers string `mapstructure:"allowed_peers" yaml:"allowed_peers" comment:"Comma-separated list of peer IDs to allow connections from"`
}
P2PConfig contains all peer-to-peer networking configuration parameters
type RPCConfig ¶
type RPCConfig struct {
Address string `mapstructure:"address" yaml:"address" comment:"Address to bind the RPC server to (host:port). Default: 127.0.0.1:7331"`
EnableDAVisualization bool `` /* 161-byte string literal not displayed */
}
RPCConfig contains all RPC server configuration parameters
type RaftConfig ¶
type RaftConfig struct {
Enable bool `mapstructure:"enable" yaml:"enable" comment:"Enable Raft consensus for leader election and state replication"`
NodeID string `mapstructure:"node_id" yaml:"node_id" comment:"Unique identifier for this node in the Raft cluster"`
RaftAddr string `mapstructure:"raft_addr" yaml:"raft_addr" comment:"Address for Raft communication (host:port)"`
RaftDir string `mapstructure:"raft_dir" yaml:"raft_dir" comment:"Directory for Raft logs and snapshots"`
Bootstrap bool `mapstructure:"bootstrap" yaml:"bootstrap" comment:"Bootstrap a new Raft cluster (only for the first node)"`
Peers string `mapstructure:"peers" yaml:"peers" comment:"Comma-separated list of peer Raft addresses (nodeID@host:port)"`
SnapCount uint64 `mapstructure:"snap_count" yaml:"snap_count" comment:"Number of log entries between snapshots"`
SendTimeout time.Duration `mapstructure:"send_timeout" yaml:"send_timeout" comment:"Max duration to wait for a message to be sent to a peer"`
HeartbeatTimeout time.Duration `mapstructure:"heartbeat_timeout" yaml:"heartbeat_timeout" comment:"Time between leader heartbeats to followers"`
LeaderLeaseTimeout time.Duration `mapstructure:"leader_lease_timeout" yaml:"leader_lease_timeout" comment:"Duration of the leader lease"`
}
RaftConfig contains all Raft consensus configuration parameters
func (RaftConfig) Validate ¶
func (c RaftConfig) Validate() error
type SignerConfig ¶
type SignerConfig struct {
SignerType string `mapstructure:"signer_type" yaml:"signer_type" comment:"Type of remote signer to use (file, grpc)"`
SignerPath string `mapstructure:"signer_path" yaml:"signer_path" comment:"Path to the signer file or address"`
}
SignerConfig contains all signer configuration parameters