ethereum

package
v0.0.47 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package ethereum provides Ethereum beacon node functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeaconNode

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

BeaconNode represents a connection to an Ethereum beacon node and manages any associated services (eg: metadata, etc).

func NewBeaconNode

func NewBeaconNode(
	log logrus.FieldLogger,
	config *Config,
	sinks []sinks.ContributoorSink,
	clockDrift clockdrift.ClockDrift,
	cache *events.DuplicateCache,
	summary *events.Summary,
	metrics *events.Metrics,
	opt *Options,
) (*BeaconNode, error)

NewBeaconNode creates a new beacon node instance with the given configuration. It initializes any services and configures the beacon subscriptions.

func (*BeaconNode) GetEpoch

func (b *BeaconNode) GetEpoch(epoch uint64) ethwallclock.Epoch

GetEpoch returns the wallclock epoch for a given slot number.

func (*BeaconNode) GetEpochFromSlot

func (b *BeaconNode) GetEpochFromSlot(slot uint64) ethwallclock.Epoch

GetEpochFromSlot returns the wallclock epoch for a given slot.

func (*BeaconNode) GetSlot

func (b *BeaconNode) GetSlot(slot uint64) ethwallclock.Slot

GetSlot returns the wallclock slot for a given slot number.

func (*BeaconNode) GetWallclock

func (b *BeaconNode) GetWallclock() *ethwallclock.EthereumBeaconChain

GetWallclock returns the wallclock for the beacon chain.

func (*BeaconNode) Metadata

func (b *BeaconNode) Metadata() *services.MetadataService

Metadata returns the metadata service instance.

func (*BeaconNode) Node

func (b *BeaconNode) Node() beacon.Node

Node returns the underlying beacon node instance.

func (*BeaconNode) Start

func (b *BeaconNode) Start(ctx context.Context) error

Start begins the beacon node operation and its services It waits for the node to become healthy before starting services.

func (*BeaconNode) Stop

func (b *BeaconNode) Stop(ctx context.Context) error

Stop gracefully shuts down the beacon node and its services.

func (*BeaconNode) Synced

func (b *BeaconNode) Synced(ctx context.Context) error

Synced checks if the beacon node is synced and ready It verifies sync state, wallclock, and service readiness.

type Config

type Config struct {
	// The address of the Beacon node to connect to
	BeaconNodeAddress string `yaml:"beaconNodeAddress"`
	// OverrideNetworkName is the name of the network to use for the sentry.
	// If not set, the network name will be retrieved from the beacon node.
	OverrideNetworkName string `yaml:"overrideNetworkName"  default:""`
	// BeaconNodeHeaders is a map of headers to send to the beacon node.
	BeaconNodeHeaders map[string]string `yaml:"beaconNodeHeaders"`
	// BeaconSubscriptions is a list of beacon subscriptions to subscribe to.
	BeaconSubscriptions *[]string `yaml:"beaconSubscriptions"`
}

Config defines the configuration for the Ethereum beacon node.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for the beacon node.

type Options

type Options struct {
	FetchBeaconCommittees bool
	FetchProposerDuties   bool
}

Options defines the options for the Ethereum beacon node.

func (*Options) WithFetchBeaconCommittees

func (o *Options) WithFetchBeaconCommittees(fetchBeaconCommittees bool) *Options

WithFetchBeaconCommittees sets the option to fetch beacon committees.

func (*Options) WithFetchProposerDuties

func (o *Options) WithFetchProposerDuties(fetchProposerDuties bool) *Options

WithFetchProposerDuties sets the option to fetch proposer duties.

Directories

Path Synopsis
Package services provides Ethereum consensus client related functionality
Package services provides Ethereum consensus client related functionality

Jump to

Keyboard shortcuts

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