components

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: GPL-3.0 Imports: 57 Imported by: 0

Documentation

Overview

Package components defines utilities to spin up actual beacon node and validator processes as needed by end to end tests.

Index

Constants

View Source
const DefaultFeeRecipientAddress = "Z099FB65722e7b2455043bfebF6177f1D2E9738d9"
View Source
const KeystorePassword = ""
View Source
const NetworkId = 1337

NetworkId is the ID of the Zond chain.

Variables

This section is empty.

Functions

func FeeRecipientFromPubkey

func FeeRecipientFromPubkey(key string) string

FeeRecipientFromPubkey slices, from the beginning of the hex-encoded pubkey string, the 1 character Z preamble plus enough hex chars to fill out the fee_recipient byte value.

func SendTransaction

func SendTransaction(client *rpc.Client, key *dilithium.Dilithium, f *filler.Filler, gasFeeCap *big.Int, gasTipCap *big.Int, addr string, N uint64, al bool) error

func WaitForBlocks

func WaitForBlocks(web3 *zondclient.Client, blocksToWait uint64) error

WaitForBlocks waits for a certain amount of blocks to be included before returning.

Types

type BeaconNode

type BeaconNode struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

BeaconNode represents beacon node.

func NewBeaconNode

func NewBeaconNode(config *e2etypes.E2EConfig, index int, enr string) *BeaconNode

NewBeaconNode creates and returns a beacon node.

func (*BeaconNode) Pause

func (node *BeaconNode) Pause() error

Pause pauses the component and its underlying process.

func (*BeaconNode) Resume

func (node *BeaconNode) Resume() error

Resume resumes the component and its underlying process.

func (*BeaconNode) Start

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

Start starts a fresh beacon node, connecting to all passed in beacon nodes.

func (*BeaconNode) Started

func (node *BeaconNode) Started() <-chan struct{}

Started checks whether beacon node is started and ready to be queried.

func (*BeaconNode) Stop

func (node *BeaconNode) Stop() error

Stop stops the component and its underlying process.

func (*BeaconNode) UnderlyingProcess

func (node *BeaconNode) UnderlyingProcess() *os.Process

type BeaconNodeSet

type BeaconNodeSet struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

BeaconNodeSet represents set of beacon nodes.

func NewBeaconNodes

func NewBeaconNodes(config *e2etypes.E2EConfig) *BeaconNodeSet

NewBeaconNodes creates and returns a set of beacon nodes.

func (*BeaconNodeSet) ComponentAtIndex

func (s *BeaconNodeSet) ComponentAtIndex(i int) (e2etypes.ComponentRunner, error)

ComponentAtIndex returns the component at the provided index.

func (*BeaconNodeSet) Pause

func (s *BeaconNodeSet) Pause() error

Pause pauses the component and its underlying process.

func (*BeaconNodeSet) PauseAtIndex

func (s *BeaconNodeSet) PauseAtIndex(i int) error

PauseAtIndex pauses the component and its underlying process at the desired index.

func (*BeaconNodeSet) Resume

func (s *BeaconNodeSet) Resume() error

Resume resumes the component and its underlying process.

func (*BeaconNodeSet) ResumeAtIndex

func (s *BeaconNodeSet) ResumeAtIndex(i int) error

ResumeAtIndex resumes the component and its underlying process at the desired index.

func (*BeaconNodeSet) SetENR

func (s *BeaconNodeSet) SetENR(enr string)

SetENR assigns ENR to the set of beacon nodes.

func (*BeaconNodeSet) Start

func (s *BeaconNodeSet) Start(ctx context.Context) error

Start starts all the beacon nodes in set.

func (*BeaconNodeSet) Started

func (s *BeaconNodeSet) Started() <-chan struct{}

Started checks whether beacon node set is started and all nodes are ready to be queried.

func (*BeaconNodeSet) Stop

func (s *BeaconNodeSet) Stop() error

Stop stops the component and its underlying process.

func (*BeaconNodeSet) StopAtIndex

func (s *BeaconNodeSet) StopAtIndex(i int) error

StopAtIndex stops the component and its underlying process at the desired index.

type BootNode

type BootNode struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

BootNode represents boot node.

func NewBootNode

func NewBootNode() *BootNode

NewBootNode creates and returns boot node.

func (*BootNode) ENR

func (node *BootNode) ENR() string

ENR exposes node's ENR.

func (*BootNode) Pause

func (node *BootNode) Pause() error

Pause pauses the component and its underlying process.

func (*BootNode) Resume

func (node *BootNode) Resume() error

Resume resumes the component and its underlying process.

func (*BootNode) Start

func (node *BootNode) Start(ctx context.Context) error

Start starts a bootnode blocks up until ctx is cancelled.

func (*BootNode) Started

func (node *BootNode) Started() <-chan struct{}

Started checks whether a boot node is started and ready to be queried.

func (*BootNode) Stop

func (node *BootNode) Stop() error

Stop stops the component and its underlying process.

type Builder

type Builder struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

Builder represents a block builder.

func NewBuilder

func NewBuilder(index int) *Builder

NewBuilder creates and returns a builder.

func (*Builder) Pause

func (node *Builder) Pause() error

Pause pauses the component and its underlying process.

func (*Builder) Resume

func (node *Builder) Resume() error

Resume resumes the component and its underlying process.

func (*Builder) Start

func (node *Builder) Start(ctx context.Context) error

Start runs a builder.

func (*Builder) Started

func (node *Builder) Started() <-chan struct{}

Started checks whether the builder is started and ready to be queried.

func (*Builder) Stop

func (node *Builder) Stop() error

Stop kills the component and its underlying process.

type BuilderSet

type BuilderSet struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

BuilderSet represents a set of builders for the validators running via a relay.

func NewBuilderSet

func NewBuilderSet() *BuilderSet

NewBuilderSet creates and returns a set of builders.

func (*BuilderSet) ComponentAtIndex

func (s *BuilderSet) ComponentAtIndex(i int) (e2etypes.ComponentRunner, error)

ComponentAtIndex returns the component at the provided index.

func (*BuilderSet) Pause

func (s *BuilderSet) Pause() error

Pause pauses the component and its underlying process.

func (*BuilderSet) PauseAtIndex

func (s *BuilderSet) PauseAtIndex(i int) error

PauseAtIndex pauses the component and its underlying process at the desired index.

func (*BuilderSet) Resume

func (s *BuilderSet) Resume() error

Resume resumes the component and its underlying process.

func (*BuilderSet) ResumeAtIndex

func (s *BuilderSet) ResumeAtIndex(i int) error

ResumeAtIndex resumes the component and its underlying process at the desired index.

func (*BuilderSet) Start

func (s *BuilderSet) Start(ctx context.Context) error

Start starts all the builders in set.

func (*BuilderSet) Started

func (s *BuilderSet) Started() <-chan struct{}

Started checks whether builder set is started and all builders are ready to be queried.

func (*BuilderSet) Stop

func (s *BuilderSet) Stop() error

Stop stops the component and its underlying process.

func (*BuilderSet) StopAtIndex

func (s *BuilderSet) StopAtIndex(i int) error

StopAtIndex stops the component and its underlying process at the desired index.

type DepositHistory

type DepositHistory struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DepositHistory is a type used by Depositor to keep track of batches of deposit for test assertion purposes.

func (*DepositHistory) Balances

Balances sums, by validator, all deposit amounts that were sent as part of the given batch. This can be used in e2e evaluators to check that the results of deposit transactions are visible on chain.

type Depositor

type Depositor struct {
	// The EmptyComponent type is embedded in the Depositor so that it satisfies the ComponentRunner interface.
	// This allows other components or e2e set up code to block until its Start method has been called.
	types.EmptyComponent
	Key       *keystore.Key
	Client    *zondclient.Client
	ChainID   *big.Int
	NetworkId *big.Int
	// contains filtered or unexported fields
}

func (*Depositor) History

func (d *Depositor) History() *DepositHistory

History exposes the DepositHistory value for a Depositor.

func (*Depositor) SendAndMine

func (d *Depositor) SendAndMine(ctx context.Context, offset, nvals int, batch types.DepositBatch, partial bool) error

SendAndMine uses the deterministic validator generator to generate deposits for `nvals` (number of validators). To control which validators should receive deposits, so that we can generate deposits at different stages of e2e, the `offset` parameter skips the first N validators in the deterministic list. In order to test the requirement that our deposit follower is able to handle multiple partial deposits, the `partial` flag specifies that half of the deposits should be broken up into 2 transactions. Once the set of deposits has been generated, it submits a transaction for each deposit (using 2 transactions for partial deposits) and then uses WaitForBlocks (which spams the miner node with transactions to and from its own address) to advance the chain until it has moved forward ETH1_FOLLOW_DISTANCE blocks.

func (*Depositor) SendDeposit

func (d *Depositor) SendDeposit(dep *zond.Deposit, txo *bind.TransactOpts, batch types.DepositBatch) error

SendDeposit sends a single deposit. A record of this deposit will be tracked for the life of the Depositor, allowing evaluators to use the deposit history to make assertions about those deposits.

func (*Depositor) UnderlyingProcess

func (d *Depositor) UnderlyingProcess() *os.Process

type ExecutionNode

type ExecutionNode struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

Node represents a zond node.

func NewExecutionNode

func NewExecutionNode(index int) *ExecutionNode

NewExecutionNode creates and returns an execution node.

func (*ExecutionNode) Pause

func (node *ExecutionNode) Pause() error

Pause pauses the component and its underlying process.

func (*ExecutionNode) Resume

func (node *ExecutionNode) Resume() error

Resume resumes the component and its underlying process.

func (*ExecutionNode) Start

func (node *ExecutionNode) Start(ctx context.Context) error

Start runs a non-mining zond node. To connect to a miner and start working properly, this node should be a part of a NodeSet.

func (*ExecutionNode) Started

func (node *ExecutionNode) Started() <-chan struct{}

Started checks whether zond node is started and ready to be queried.

func (*ExecutionNode) Stop

func (node *ExecutionNode) Stop() error

Stop kills the component and its underlying process.

func (*ExecutionNode) UnderlyingProcess

func (node *ExecutionNode) UnderlyingProcess() *os.Process

type ExecutionNodeSet

type ExecutionNodeSet struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

ExecutionNodeSet represents a set of execution nodes, none of which is a mining node.

func NewExecutionNodeSet

func NewExecutionNodeSet() *ExecutionNodeSet

NewNodeSet creates and returns a set of zond nodes.

func (*ExecutionNodeSet) ComponentAtIndex

func (s *ExecutionNodeSet) ComponentAtIndex(i int) (e2etypes.ComponentRunner, error)

ComponentAtIndex returns the component at the provided index.

func (*ExecutionNodeSet) Pause

func (s *ExecutionNodeSet) Pause() error

Pause pauses the component and its underlying process.

func (*ExecutionNodeSet) PauseAtIndex

func (s *ExecutionNodeSet) PauseAtIndex(i int) error

PauseAtIndex pauses the component and its underlying process at the desired index.

func (*ExecutionNodeSet) Resume

func (s *ExecutionNodeSet) Resume() error

Resume resumes the component and its underlying process.

func (*ExecutionNodeSet) ResumeAtIndex

func (s *ExecutionNodeSet) ResumeAtIndex(i int) error

ResumeAtIndex resumes the component and its underlying process at the desired index.

func (*ExecutionNodeSet) Start

func (s *ExecutionNodeSet) Start(ctx context.Context) error

Start starts all the execution nodes in set.

func (*ExecutionNodeSet) Started

func (s *ExecutionNodeSet) Started() <-chan struct{}

Started checks whether execution node set is started and all nodes are ready to be queried.

func (*ExecutionNodeSet) Stop

func (s *ExecutionNodeSet) Stop() error

Stop stops the component and its underlying process.

func (*ExecutionNodeSet) StopAtIndex

func (s *ExecutionNodeSet) StopAtIndex(i int) error

StopAtIndex stops the component and its underlying process at the desired index.

type Proxy

type Proxy struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

Proxy represents an engine-api proxy.

func NewProxy

func NewProxy(index int) *Proxy

NewProxy creates and returns an engine-api proxy.

func (*Proxy) AddRequestInterceptor

func (node *Proxy) AddRequestInterceptor(rpcMethodName string, responseGen func() interface{}, trigger func() bool)

AddRequestInterceptor adds in a json-rpc request interceptor.

func (*Proxy) Pause

func (node *Proxy) Pause() error

Pause pauses the component and its underlying process.

func (*Proxy) ReleaseBackedUpRequests

func (node *Proxy) ReleaseBackedUpRequests(rpcMethodName string)

ReleaseBackedUpRequests releases backed up http requests which were previously ignored due to our interceptors.

func (*Proxy) RemoveRequestInterceptor

func (node *Proxy) RemoveRequestInterceptor(rpcMethodName string)

RemoveRequestInterceptor removes the request interceptor for the provided method.

func (*Proxy) Resume

func (node *Proxy) Resume() error

Resume resumes the component and its underlying process.

func (*Proxy) Start

func (node *Proxy) Start(ctx context.Context) error

Start runs a proxy.

func (*Proxy) Started

func (node *Proxy) Started() <-chan struct{}

Started checks whether the zond proxy is started and ready to be queried.

func (*Proxy) Stop

func (node *Proxy) Stop() error

Stop kills the component and its underlying process.

type ProxySet

type ProxySet struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

ProxySet represents a set of proxies for the engine-api.

func NewProxySet

func NewProxySet() *ProxySet

NewProxySet creates and returns a set of engine-api proxies.

func (*ProxySet) ComponentAtIndex

func (s *ProxySet) ComponentAtIndex(i int) (e2etypes.ComponentRunner, error)

ComponentAtIndex returns the component at the provided index.

func (*ProxySet) Pause

func (s *ProxySet) Pause() error

Pause pauses the component and its underlying process.

func (*ProxySet) PauseAtIndex

func (s *ProxySet) PauseAtIndex(i int) error

PauseAtIndex pauses the component and its underlying process at the desired index.

func (*ProxySet) Resume

func (s *ProxySet) Resume() error

Resume resumes the component and its underlying process.

func (*ProxySet) ResumeAtIndex

func (s *ProxySet) ResumeAtIndex(i int) error

ResumeAtIndex resumes the component and its underlying process at the desired index.

func (*ProxySet) Start

func (s *ProxySet) Start(ctx context.Context) error

Start starts all the proxies in set.

func (*ProxySet) Started

func (s *ProxySet) Started() <-chan struct{}

Started checks whether proxy set is started and all proxies are ready to be queried.

func (*ProxySet) Stop

func (s *ProxySet) Stop() error

Stop stops the component and its underlying process.

func (*ProxySet) StopAtIndex

func (s *ProxySet) StopAtIndex(i int) error

StopAtIndex stops the component and its underlying process at the desired index.

type SentDeposit

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

SentDeposit is the record of an individual deposit which has been successfully submitted as a transaction.

type TracingSink

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

TracingSink to capture HTTP requests from opentracing pushes. This is meant to capture all opentracing spans from Qrysm during an end-to-end test. Spans are normally sent to a jaeger (https://www.jaegertracing.io/docs/1.25/getting-started/) endpoint, but here we instead replace that with our own http request sink. The request sink receives any requests, raw marshals them and base64-encodes them, then writes them newline-delimited into a file.

The output file from this component can then be used by tools/replay-http in the Qrysm repository to replay requests to a jaeger collector endpoint. This can then be used to visualize the spans themselves in the jaeger UI.

func NewTracingSink

func NewTracingSink(endpoint string) *TracingSink

NewTracingSink initializes the tracing sink component.

func (*TracingSink) Pause

func (ts *TracingSink) Pause() error

Pause pauses the component and its underlying process.

func (*TracingSink) Resume

func (ts *TracingSink) Resume() error

Resume resumes the component and its underlying process.

func (*TracingSink) Start

func (ts *TracingSink) Start(ctx context.Context) error

Start the tracing sink.

func (*TracingSink) Started

func (ts *TracingSink) Started() <-chan struct{}

Started checks whether a tracing sink is started and ready to be queried.

func (*TracingSink) Stop

func (ts *TracingSink) Stop() error

Stop stops the component and its underlying process.

func (*TracingSink) UnderlyingProcess

func (ts *TracingSink) UnderlyingProcess() *os.Process

type TransactionGenerator

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

func NewTransactionGenerator

func NewTransactionGenerator(keystore string, seed int64) *TransactionGenerator

func (*TransactionGenerator) Pause

func (t *TransactionGenerator) Pause() error

Pause pauses the component and its underlying process.

func (*TransactionGenerator) Resume

func (t *TransactionGenerator) Resume() error

Resume resumes the component and its underlying process.

func (*TransactionGenerator) Start

func (t *TransactionGenerator) Start(ctx context.Context) error

func (*TransactionGenerator) Started

func (s *TransactionGenerator) Started() <-chan struct{}

Started checks whether beacon node set is started and all nodes are ready to be queried.

func (*TransactionGenerator) Stop

func (t *TransactionGenerator) Stop() error

Stop stops the component and its underlying process.

type ValidatorNode

type ValidatorNode struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

ValidatorNode represents a validator node.

func NewValidatorNode

func NewValidatorNode(config *e2etypes.E2EConfig, validatorNum, index, offset int) *ValidatorNode

NewValidatorNode creates and returns a validator node.

func (*ValidatorNode) Pause

func (v *ValidatorNode) Pause() error

Pause pauses the component and its underlying process.

func (*ValidatorNode) Resume

func (v *ValidatorNode) Resume() error

Resume resumes the component and its underlying process.

func (*ValidatorNode) Start

func (v *ValidatorNode) Start(ctx context.Context) error

Start starts a validator client.

func (*ValidatorNode) Started

func (v *ValidatorNode) Started() <-chan struct{}

Started checks whether validator node is started and ready to be queried.

func (*ValidatorNode) Stop

func (v *ValidatorNode) Stop() error

Stop stops the component and its underlying process.

func (*ValidatorNode) UnderlyingProcess

func (v *ValidatorNode) UnderlyingProcess() *os.Process

type ValidatorNodeSet

type ValidatorNodeSet struct {
	e2etypes.ComponentRunner
	// contains filtered or unexported fields
}

ValidatorNodeSet represents set of validator nodes.

func NewValidatorNodeSet

func NewValidatorNodeSet(config *e2etypes.E2EConfig) *ValidatorNodeSet

NewValidatorNodeSet creates and returns a set of validator nodes.

func (*ValidatorNodeSet) ComponentAtIndex

func (s *ValidatorNodeSet) ComponentAtIndex(i int) (e2etypes.ComponentRunner, error)

ComponentAtIndex returns the component at the provided index.

func (*ValidatorNodeSet) Pause

func (s *ValidatorNodeSet) Pause() error

Pause pauses the component and its underlying process.

func (*ValidatorNodeSet) PauseAtIndex

func (s *ValidatorNodeSet) PauseAtIndex(i int) error

PauseAtIndex pauses the component and its underlying process at the desired index.

func (*ValidatorNodeSet) Resume

func (s *ValidatorNodeSet) Resume() error

Resume resumes the component and its underlying process.

func (*ValidatorNodeSet) ResumeAtIndex

func (s *ValidatorNodeSet) ResumeAtIndex(i int) error

ResumeAtIndex resumes the component and its underlying process at the desired index.

func (*ValidatorNodeSet) Start

func (s *ValidatorNodeSet) Start(ctx context.Context) error

Start starts the configured amount of validators, also sending and mining their deposits.

func (*ValidatorNodeSet) Started

func (s *ValidatorNodeSet) Started() <-chan struct{}

Started checks whether validator node set is started and all nodes are ready to be queried.

func (*ValidatorNodeSet) Stop

func (s *ValidatorNodeSet) Stop() error

Stop stops the component and its underlying process.

func (*ValidatorNodeSet) StopAtIndex

func (s *ValidatorNodeSet) StopAtIndex(i int) error

StopAtIndex stops the component and its underlying process at the desired index.

Jump to

Keyboard shortcuts

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