Documentation
¶
Overview ¶
Package ethereum provides Ethereum beacon node functionality
Index ¶
- Constants
- type BeaconNode
- func (b *BeaconNode) GetEpoch(epoch uint64) ethwallclock.Epoch
- func (b *BeaconNode) GetEpochFromSlot(slot uint64) ethwallclock.Epoch
- func (b *BeaconNode) GetSlot(slot uint64) ethwallclock.Slot
- func (b *BeaconNode) GetWallclock() *ethwallclock.EthereumBeaconChain
- func (b *BeaconNode) IsHealthy() bool
- func (b *BeaconNode) IsSlotFromUnexpectedNetwork(eventSlot uint64) bool
- func (b *BeaconNode) Metadata() *services.MetadataService
- func (b *BeaconNode) Node() beacon.Node
- func (b *BeaconNode) Start(ctx context.Context) (chan struct{}, error)
- func (b *BeaconNode) Stop(ctx context.Context) error
- func (b *BeaconNode) Synced(ctx context.Context) error
- type BeaconNodeAPI
- type Config
- type Options
Constants ¶
const MaxReasonableSlotDifference uint64 = 10000
MaxReasonableSlotDifference is the maximum number of slots that can be between the event slot and the current slot before we consider the event to be from a different network.
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, traceID string, 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) IsHealthy ¶ added in v0.0.55
func (b *BeaconNode) IsHealthy() bool
IsHealthy returns whether the node is healthy.
func (*BeaconNode) IsSlotFromUnexpectedNetwork ¶ added in v0.0.61
func (b *BeaconNode) IsSlotFromUnexpectedNetwork(eventSlot uint64) bool
IsSlotFromUnexpectedNetwork checks if a slot appears to be from an unexpected network by comparing it with the current wallclock slot.
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) (chan struct{}, error)
Start begins the beacon node operation and its services It returns a channel that will be closed when the node is healthy.
type BeaconNodeAPI ¶ added in v0.0.55
type BeaconNodeAPI interface {
// Start starts the beacon node. Returns a channel that will be closed when the node is healthy.
Start(ctx context.Context) (chan struct{}, error)
// Stop stops the beacon node.
Stop(ctx context.Context) error
// Synced checks if the beacon node is synced and ready.
Synced(ctx context.Context) error
}
BeaconNodeAPI is the interface for the BeaconNode.
type Config ¶
type Config struct {
// The address of the Beacon node to connect to
BeaconNodeAddress string `yaml:"beaconNodeAddress"`
// 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"`
// NetworkOverride is an optional network name to use instead of what's reported by the beacon node
NetworkOverride string `yaml:"networkOverride,omitempty"`
}
Config defines the configuration for the Ethereum beacon node.
type Options ¶
Options defines the options for the Ethereum beacon node.
func (*Options) WithFetchBeaconCommittees ¶
WithFetchBeaconCommittees sets the option to fetch beacon committees.
func (*Options) WithFetchProposerDuties ¶
WithFetchProposerDuties sets the option to fetch proposer duties.