ethereum

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoHealthyNode indicates no healthy execution node is available.
	ErrNoHealthyNode = errors.New("no healthy execution node available")

	// ErrBlockNotFound indicates a block was not found on the execution client.
	ErrBlockNotFound = errors.New("block not found")

	// ErrTransactionNotFound indicates a transaction was not found.
	ErrTransactionNotFound = errors.New("transaction not found")

	// ErrUnsupportedChainID indicates an unsupported chain ID was provided.
	ErrUnsupportedChainID = errors.New("unsupported chain ID")
)

Sentinel errors for Ethereum client operations.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Execution configuration
	Execution []*execution.Config `yaml:"execution"`
	// Override network name for custom networks (bypasses networkMap)
	OverrideNetworkName *string `yaml:"overrideNetworkName"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

func GetMetricsInstance

func GetMetricsInstance(namespace string) *Metrics

func (*Metrics) SetNodesTotal

func (m *Metrics) SetNodesTotal(count float64, labels []string)

type Network

type Network struct {
	Name string
}

func GetNetworkByChainID

func GetNetworkByChainID(chainID int64) (*Network, error)

GetNetworkByChainID returns the network information for the given chain ID.

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool(log logrus.FieldLogger, namespace string, config *Config) *Pool

NewPool creates a new pool from config, using RPC nodes. This function imports go-ethereum types through the geth package. For embedded mode (no go-ethereum dependency), use NewPoolWithNodes instead.

func NewPoolWithNodes added in v0.1.5

func NewPoolWithNodes(log logrus.FieldLogger, namespace string, nodes []execution.Node, config *Config) *Pool

NewPoolWithNodes creates a pool with pre-created Node implementations. Use this when embedding execution-processor as a library where the host provides custom Node implementations (e.g., EmbeddedNode with DataSource).

Parameters:

  • log: Logger for pool operations
  • namespace: Metrics namespace prefix (will have "_ethereum" appended)
  • nodes: Pre-created Node implementations
  • config: Optional configuration (nil creates empty config with defaults)

Example:

// Create embedded node with custom data source
dataSource := &MyDataSource{client: myClient}
node := execution.NewEmbeddedNode(log, "my-node", dataSource)

// Create pool with the embedded node
pool := ethereum.NewPoolWithNodes(log, "processor", []execution.Node{node}, nil)
pool.Start(ctx)

// Mark ready when data source is ready
node.MarkReady(ctx)

func (*Pool) GetHealthyExecutionNode

func (p *Pool) GetHealthyExecutionNode() execution.Node

func (*Pool) GetHealthyExecutionNodes

func (p *Pool) GetHealthyExecutionNodes() []execution.Node

func (*Pool) GetNetworkByChainID

func (p *Pool) GetNetworkByChainID(chainID int64) (*Network, error)

GetNetworkByChainID returns the network information for the given chain ID. If overrideNetworkName is set in config, it returns that name instead of using networkMap.

func (*Pool) HasExecutionNodes

func (p *Pool) HasExecutionNodes() bool

func (*Pool) HasHealthyExecutionNodes

func (p *Pool) HasHealthyExecutionNodes() bool

func (*Pool) Start

func (p *Pool) Start(ctx context.Context)

func (*Pool) Stop

func (p *Pool) Stop(ctx context.Context) error

Stop gracefully shuts down the pool.

func (*Pool) UpdateNodeMetrics

func (p *Pool) UpdateNodeMetrics()

func (*Pool) WaitForHealthyExecutionNode

func (p *Pool) WaitForHealthyExecutionNode(ctx context.Context) (execution.Node, error)

Directories

Path Synopsis
geth
Package geth provides go-ethereum adapters for the execution interfaces.
Package geth provides go-ethereum adapters for the execution interfaces.

Jump to

Keyboard shortcuts

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