types

package
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: GPL-3.0 Imports: 8 Imported by: 10

Documentation

Overview

Package types includes important structs used by end to end tests, such as a configuration type, an evaluator type, and more.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenesisFork

func GenesisFork() int

Types

type BeaconNodeSet

type BeaconNodeSet interface {
	ComponentRunner
	// SetENR provides the relevant bootnode's enr to the beacon nodes.
	SetENR(enr string)
}

BeaconNodeSet defines an interface for an object that fulfills the duties of a group of beacon nodes.

type ComponentRunner

type ComponentRunner interface {
	// Start starts a component.
	Start(ctx context.Context) error
	// Started checks whether an underlying component is started and ready to be queried.
	Started() <-chan struct{}
	// Pause pauses a component.
	Pause() error
	// Resume resumes a component.
	Resume() error
	// Stop stops a component.
	Stop() error
	// UnderlyingProcess is the underlying process, once started.
	UnderlyingProcess() *os.Process
}

ComponentRunner defines an interface via which E2E component's configuration, execution and termination is managed.

type DepositBalancer

type DepositBalancer interface {
	Balances(DepositBatch) map[[48]byte]uint64
}

DepositBalancer represents a type that can sum, by validator, all deposits made in E2E prior to the function call.

type DepositBatch

type DepositBatch int

DepositBatch represents a group of deposits that are sent together during an e2e run.

const (

	// GenesisDepositBatch deposits are sent to populate the initial set of validators for genesis.
	GenesisDepositBatch DepositBatch
	// PostGenesisDepositBatch deposits are sent to test that deposits appear in blocks as expected
	// and validators become active.
	PostGenesisDepositBatch
)

type E2EConfig

type E2EConfig struct {
	TestCheckpointSync      bool
	TestSync                bool
	TestFeature             bool
	UsePrysmShValidator     bool
	UsePprof                bool
	UseWeb3RemoteSigner     bool
	TestDeposits            bool
	UseFixedPeerIDs         bool
	UseValidatorCrossClient bool
	UseBeaconRestApi        bool
	EpochsToRun             uint64
	Seed                    int64
	TracingSinkEndpoint     string
	Evaluators              []Evaluator
	EvalInterceptor         func(*EvaluationContext, uint64, []*grpc.ClientConn) bool
	BeaconFlags             []string
	ValidatorFlags          []string
	PeerIDs                 []string
	ExtraEpochs             uint64
}

E2EConfig defines the struct for all configurations needed for E2E testing.

type E2EConfigOpt

type E2EConfigOpt func(*E2EConfig)

func WithCheckpointSync

func WithCheckpointSync() E2EConfigOpt

func WithEpochs

func WithEpochs(e uint64) E2EConfigOpt

func WithRemoteSigner

func WithRemoteSigner() E2EConfigOpt

func WithValidatorCrossClient

func WithValidatorCrossClient() E2EConfigOpt

func WithValidatorRESTApi

func WithValidatorRESTApi() E2EConfigOpt

type EmptyComponent

type EmptyComponent struct {
	sync.Mutex
	// contains filtered or unexported fields
}

EmptyComponent satisfies the component interface. It can be embedded in other types in order to turn them into components.

func (*EmptyComponent) Pause

func (*EmptyComponent) Pause() error

func (*EmptyComponent) Resume

func (*EmptyComponent) Resume() error

func (*EmptyComponent) Start

func (c *EmptyComponent) Start(context.Context) error

func (*EmptyComponent) Started

func (c *EmptyComponent) Started() <-chan struct{}

func (*EmptyComponent) Stop

func (*EmptyComponent) Stop() error

type EngineProxy

type EngineProxy interface {
	ComponentRunner
	// AddRequestInterceptor adds in a json-rpc request interceptor.
	AddRequestInterceptor(rpcMethodName string, responseGen func() interface{}, trigger func() bool)
	// RemoveRequestInterceptor removes the request interceptor for the provided method.
	RemoveRequestInterceptor(rpcMethodName string)
	// ReleaseBackedUpRequests releases backed up http requests.
	ReleaseBackedUpRequests(rpcMethodName string)
}

type EvaluationContext

type EvaluationContext struct {
	DepositBalancer
	ExitedVals           map[[48]byte]bool
	SeenVotes            map[primitives.Slot][]byte
	ExpectedEth1DataVote []byte
}

EvaluationContext allows for additional data to be provided to evaluators that need extra state.

func NewEvaluationContext

func NewEvaluationContext(d DepositBalancer) *EvaluationContext

NewEvaluationContext handles initializing internal datastructures (like maps) provided by the EvaluationContext.

type Evaluator

type Evaluator struct {
	Name   string
	Policy func(currentEpoch primitives.Epoch) bool
	// Evaluation accepts one or many/all conns, depending on what is needed by the set of evaluators.
	Evaluation func(ec *EvaluationContext, conn ...*grpc.ClientConn) error
}

Evaluator defines the structure of the evaluators used to conduct the current beacon state during the E2E.

type MultipleComponentRunners

type MultipleComponentRunners interface {
	ComponentRunner
	// ComponentAtIndex returns the component at index
	ComponentAtIndex(i int) (ComponentRunner, error)
	// PauseAtIndex pauses the grouped component element at the desired index.
	PauseAtIndex(i int) error
	// ResumeAtIndex resumes the grouped component element at the desired index.
	ResumeAtIndex(i int) error
	// StopAtIndex stops the grouped component element at the desired index.
	StopAtIndex(i int) error
}

Jump to

Keyboard shortcuts

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