Documentation
¶
Index ¶
- func Register(typ EngineType, factory EngineFactory)
- type BeaconNodeStatus
- type ChainInfo
- type ConsensusClient
- type Engine
- type EngineFactory
- type EngineType
- type Eth2Config
- type Eth2Engine
- func (e *Eth2Engine) ChainID() ids.ID
- func (e *Eth2Engine) Health(ctx context.Context) (*HealthStatus, error)
- func (e *Eth2Engine) IsRunning() bool
- func (e *Eth2Engine) Metrics() map[string]interface{}
- func (e *Eth2Engine) Name() string
- func (e *Eth2Engine) NetworkID() uint32
- func (e *Eth2Engine) P2PEndpoint() string
- func (e *Eth2Engine) ParentChain() *ChainInfo
- func (e *Eth2Engine) RPCEndpoint() string
- func (e *Eth2Engine) Restart(ctx context.Context) error
- func (e *Eth2Engine) Start(ctx context.Context, config *NodeConfig) error
- func (e *Eth2Engine) Stop(ctx context.Context) error
- func (e *Eth2Engine) Type() EngineType
- func (e *Eth2Engine) Uptime() time.Duration
- func (e *Eth2Engine) WSEndpoint() string
- type ExecutionClient
- type HealthStatus
- type NodeConfig
- type OPStackEngine
- func (e *OPStackEngine) ChainID() ids.ID
- func (e *OPStackEngine) Health(ctx context.Context) (*HealthStatus, error)
- func (e *OPStackEngine) IsRunning() bool
- func (e *OPStackEngine) Metrics() map[string]interface{}
- func (e *OPStackEngine) Name() string
- func (e *OPStackEngine) NetworkID() uint32
- func (e *OPStackEngine) P2PEndpoint() string
- func (e *OPStackEngine) ParentChain() *ChainInfo
- func (e *OPStackEngine) RPCEndpoint() string
- func (e *OPStackEngine) Restart(ctx context.Context) error
- func (e *OPStackEngine) Start(ctx context.Context, config *NodeConfig) error
- func (e *OPStackEngine) Stop(ctx context.Context) error
- func (e *OPStackEngine) Type() EngineType
- func (e *OPStackEngine) Uptime() time.Duration
- func (e *OPStackEngine) WSEndpoint() string
- type RollupConfig
- type RollupGenesis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(typ EngineType, factory EngineFactory)
Register registers an engine factory
Types ¶
type BeaconNodeStatus ¶
type BeaconNodeStatus struct {
HeadSlot uint64 `json:"head_slot"`
SyncDistance uint64 `json:"sync_distance"`
IsSyncing bool `json:"is_syncing"`
IsOptimistic bool `json:"is_optimistic"`
ElOffline bool `json:"el_offline"`
CurrentEpoch uint64 `json:"current_epoch"`
FinalizedEpoch uint64 `json:"finalized_epoch"`
JustifiedEpoch uint64 `json:"justified_epoch"`
}
BeaconNodeStatus represents beacon chain status
type ChainInfo ¶
type ChainInfo struct {
ChainID ids.ID
NetworkID uint32
ParentID *ids.ID // nil for L1, set for L2/L3
}
ChainInfo describes a blockchain's network properties
type ConsensusClient ¶
type ConsensusClient string
ConsensusClient types
const ( Prysm ConsensusClient = "prysm" Lighthouse ConsensusClient = "lighthouse" Teku ConsensusClient = "teku" Nimbus ConsensusClient = "nimbus" Lodestar ConsensusClient = "lodestar" )
type Engine ¶
type Engine interface {
// Lifecycle
Name() string
Type() EngineType
Start(ctx context.Context, config *NodeConfig) error
Stop(ctx context.Context) error
Restart(ctx context.Context) error
// Status
Health(ctx context.Context) (*HealthStatus, error)
IsRunning() bool
Uptime() time.Duration
// Network info
NetworkID() uint32
ChainID() ids.ID
RPCEndpoint() string
WSEndpoint() string
P2PEndpoint() string
// Chain relationships
ParentChain() *ChainInfo // nil for L1s
// Metrics
Metrics() map[string]interface{}
}
Engine is the interface for all consensus implementations
func Eth2Factory ¶
Eth2Factory creates Ethereum 2.0 engines
type EngineFactory ¶
EngineFactory creates engines from configs
type EngineType ¶
type EngineType string
EngineType identifies the consensus engine implementation
const ( EngineLux EngineType = "lux" EngineGeth EngineType = "geth" EngineOP EngineType = "op" EngineEth2 EngineType = "eth2" )
type Eth2Config ¶
type Eth2Config struct {
ChainID uint64 `json:"chain_id"`
NetworkName string `json:"network_name"`
ConsensusClient ConsensusClient `json:"consensus_client"`
ExecutionClient ExecutionClient `json:"execution_client"`
ValidatorEnabled bool `json:"validator_enabled"`
ValidatorKeys []string `json:"validator_keys,omitempty"`
InitialValidators []string `json:"initial_validators,omitempty"`
TerminalTotalDifficulty string `json:"terminal_total_difficulty"`
GenesisTime uint64 `json:"genesis_time"`
}
Eth2Config contains Ethereum 2.0 specific configuration
type Eth2Engine ¶
type Eth2Engine struct {
// contains filtered or unexported fields
}
Eth2Engine implements Ethereum 2.0 consensus (Beacon Chain + Execution Layer)
func NewEth2Engine ¶
func NewEth2Engine(name string, beaconBinary string, executionBinary string) *Eth2Engine
NewEth2Engine creates a new Ethereum 2.0 engine
func (*Eth2Engine) ChainID ¶
func (e *Eth2Engine) ChainID() ids.ID
func (*Eth2Engine) Health ¶
func (e *Eth2Engine) Health(ctx context.Context) (*HealthStatus, error)
func (*Eth2Engine) IsRunning ¶
func (e *Eth2Engine) IsRunning() bool
func (*Eth2Engine) Metrics ¶
func (e *Eth2Engine) Metrics() map[string]interface{}
func (*Eth2Engine) Name ¶
func (e *Eth2Engine) Name() string
func (*Eth2Engine) NetworkID ¶
func (e *Eth2Engine) NetworkID() uint32
func (*Eth2Engine) P2PEndpoint ¶
func (e *Eth2Engine) P2PEndpoint() string
func (*Eth2Engine) ParentChain ¶
func (e *Eth2Engine) ParentChain() *ChainInfo
func (*Eth2Engine) RPCEndpoint ¶
func (e *Eth2Engine) RPCEndpoint() string
func (*Eth2Engine) Start ¶
func (e *Eth2Engine) Start(ctx context.Context, config *NodeConfig) error
func (*Eth2Engine) Type ¶
func (e *Eth2Engine) Type() EngineType
func (*Eth2Engine) Uptime ¶
func (e *Eth2Engine) Uptime() time.Duration
func (*Eth2Engine) WSEndpoint ¶
func (e *Eth2Engine) WSEndpoint() string
type ExecutionClient ¶
type ExecutionClient string
ExecutionClient types
const ( Geth ExecutionClient = "geth" Erigon ExecutionClient = "erigon" Nethermind ExecutionClient = "nethermind" Besu ExecutionClient = "besu" )
type HealthStatus ¶
type HealthStatus struct {
Healthy bool
BlockHeight uint64
PeerCount int
Syncing bool
Version string
}
HealthStatus represents engine health
type NodeConfig ¶
type NodeConfig struct {
NetworkID uint32
HTTPPort uint16
WSPort uint16
StakingPort uint16
DataDir string
LogLevel string
BootstrapIPs []string
// Chain-specific configs
Extra map[string]interface{}
}
NodeConfig contains engine startup configuration
type OPStackEngine ¶
type OPStackEngine struct {
// contains filtered or unexported fields
}
OPStackEngine implements the OP Stack consensus engine
func NewOPStackEngine ¶
func NewOPStackEngine(name string, opNodeBinary string, opGethBinary string) *OPStackEngine
NewOPStackEngine creates a new OP Stack engine
func (*OPStackEngine) ChainID ¶
func (e *OPStackEngine) ChainID() ids.ID
func (*OPStackEngine) Health ¶
func (e *OPStackEngine) Health(ctx context.Context) (*HealthStatus, error)
func (*OPStackEngine) IsRunning ¶
func (e *OPStackEngine) IsRunning() bool
func (*OPStackEngine) Metrics ¶
func (e *OPStackEngine) Metrics() map[string]interface{}
func (*OPStackEngine) Name ¶
func (e *OPStackEngine) Name() string
func (*OPStackEngine) NetworkID ¶
func (e *OPStackEngine) NetworkID() uint32
func (*OPStackEngine) P2PEndpoint ¶
func (e *OPStackEngine) P2PEndpoint() string
func (*OPStackEngine) ParentChain ¶
func (e *OPStackEngine) ParentChain() *ChainInfo
func (*OPStackEngine) RPCEndpoint ¶
func (e *OPStackEngine) RPCEndpoint() string
func (*OPStackEngine) Start ¶
func (e *OPStackEngine) Start(ctx context.Context, config *NodeConfig) error
func (*OPStackEngine) Type ¶
func (e *OPStackEngine) Type() EngineType
func (*OPStackEngine) Uptime ¶
func (e *OPStackEngine) Uptime() time.Duration
func (*OPStackEngine) WSEndpoint ¶
func (e *OPStackEngine) WSEndpoint() string
type RollupConfig ¶
type RollupConfig struct {
Genesis RollupGenesis `json:"genesis"`
BlockTime uint64 `json:"block_time"`
MaxSequencerDrift uint64 `json:"max_sequencer_drift"`
SeqWindowSize uint64 `json:"seq_window_size"`
ChannelTimeout uint64 `json:"channel_timeout"`
L1ChainID uint64 `json:"l1_chain_id"`
L2ChainID uint64 `json:"l2_chain_id"`
P2PSequencerAddress string `json:"p2p_sequencer_address"`
}
RollupConfig contains OP Stack rollup configuration