testutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MPL-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NodePortEth1Http is the http port for the eth1 node.
	NodePortEth1Http = "eth1.http"

	// NodePortP2P is the p2p port for an eth2 node.
	NodePortP2P = "eth2.p2p"

	// NodePortHttp is the http port for an eth2 node.
	NodePortHttp = "eth2.http"

	// NodePortPrysmGrpc is the specific prysm port for its Grpc server
	NodePortPrysmGrpc = "eth2.prysm.grpc"
)

Variables

This section is empty.

Functions

func UnmarshalSSZTest

func UnmarshalSSZTest(content []byte, result interface{}) error

UnmarshalSSZTest decodes a spec tests in yaml format

func WithCmd

func WithCmd(cmd []string) nodeOption

func WithContainer

func WithContainer(repository, tag string) nodeOption

func WithFile

func WithFile(path string, obj interface{}) nodeOption

func WithHostNetwork

func WithHostNetwork() nodeOption

func WithLabels

func WithLabels(m map[string]string) nodeOption

func WithMount

func WithMount(mount string) nodeOption

func WithName

func WithName(name string) nodeOption

func WithOutput

func WithOutput(output io.Writer) nodeOption

func WithRetry

func WithRetry(retry func(n *node) error) nodeOption

Types

type Account

type Account struct {
	Bls   *bls.Key
	Ecdsa *wallet.Key
}

func NewAccount

func NewAccount() *Account

type Bootnode

type Bootnode struct {
	Enr string
	// contains filtered or unexported fields
}

func NewBootnode

func NewBootnode() (*Bootnode, error)

type Eth1Server

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

Eth1Server is an eth1x testutil server using go-ethereum

func NewEth1Server

func NewEth1Server() (*Eth1Server, error)

NewEth1Server creates a new eth1 server with go-ethereum

func (*Eth1Server) Deposit

func (e *Eth1Server) Deposit() ethgo.Address

func (Eth1Server) GetAddr

func (n Eth1Server) GetAddr(port NodePort) string

func (*Eth1Server) GetDepositContract

func (e *Eth1Server) GetDepositContract() *deposit.Deposit

func (Eth1Server) GetLogs

func (n Eth1Server) GetLogs() (string, error)

func (Eth1Server) IP

func (n Eth1Server) IP() string

func (*Eth1Server) MakeDeposit

func (e *Eth1Server) MakeDeposit(account *Account, config *beacon.ChainConfig) error

MakeDeposit deposits the minimum required value to become a validator

func (*Eth1Server) Owner

func (e *Eth1Server) Owner() ethgo.Address

Owner returns the account with balance on go-ethereum

func (*Eth1Server) Provider

func (e *Eth1Server) Provider() *jsonrpc.Client

Provider returns the jsonrpc provider

func (Eth1Server) Stop

func (n Eth1Server) Stop()

type Eth2Spec

type Eth2Spec struct {
	GenesisValidatorCount     int
	GenesisDelay              int
	MinGenesisTime            int
	EthFollowDistance         int
	SecondsPerEth1Block       int
	EpochsPerEth1VotingPeriod int
	ShardCommitteePeriod      int
	NetworkID                 int
	SlotsPerEpoch             int
	SecondsPerSlot            int
	DepositContract           string
}

Eth2Spec is the config of the Eth2.0 node

func (*Eth2Spec) GetChainConfig

func (e *Eth2Spec) GetChainConfig() *beacon.ChainConfig

func (*Eth2Spec) MarshalText

func (e *Eth2Spec) MarshalText() ([]byte, error)

type LighthouseBeacon

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

LighthouseBeacon is a prysm test server

func NewLighthouseBeacon

func NewLighthouseBeacon(e *Eth1Server) (*LighthouseBeacon, error)

NewLighthouseBeacon creates a new prysm server

func (LighthouseBeacon) GetAddr

func (n LighthouseBeacon) GetAddr(port NodePort) string

func (LighthouseBeacon) GetLogs

func (n LighthouseBeacon) GetLogs() (string, error)

func (LighthouseBeacon) IP

func (n LighthouseBeacon) IP() string

func (LighthouseBeacon) Stop

func (n LighthouseBeacon) Stop()

func (*LighthouseBeacon) Type

func (b *LighthouseBeacon) Type() NodeClient

type LighthouseValidator

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

func NewLighthouseValidator

func NewLighthouseValidator(account *Account, spec *Eth2Spec, beacon Node) (*LighthouseValidator, error)

type Node

type Node interface {
	IP() string
	Type() NodeClient
	GetAddr(NodePort) string
}

type NodeClient

type NodeClient string
const (
	Teku       NodeClient = "teku"
	Prysm      NodeClient = "prysm"
	Lighthouse NodeClient = "lighthouse"
)

type NodePort

type NodePort string

type PrysmBeacon

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

PrysmBeacon is a prysm test server

func NewPrysmBeacon

func NewPrysmBeacon(e *Eth1Server) (*PrysmBeacon, error)

NewPrysmBeacon creates a new prysm server

func (PrysmBeacon) GetAddr

func (n PrysmBeacon) GetAddr(port NodePort) string

func (PrysmBeacon) GetLogs

func (n PrysmBeacon) GetLogs() (string, error)

func (PrysmBeacon) IP

func (n PrysmBeacon) IP() string

func (PrysmBeacon) Stop

func (n PrysmBeacon) Stop()

func (*PrysmBeacon) Type

func (b *PrysmBeacon) Type() NodeClient

type PrysmValidator

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

func NewPrysmValidator

func NewPrysmValidator(account *Account, spec *Eth2Spec, beacon Node) (*PrysmValidator, error)

type TekuBeacon

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

TekuBeacon is a teku test server

func NewTekuBeacon

func NewTekuBeacon(e *Eth1Server) (*TekuBeacon, error)

NewTekuBeacon creates a new teku server

func (TekuBeacon) GetAddr

func (n TekuBeacon) GetAddr(port NodePort) string

func (TekuBeacon) GetLogs

func (n TekuBeacon) GetLogs() (string, error)

func (TekuBeacon) IP

func (n TekuBeacon) IP() string

func (*TekuBeacon) Stop

func (b *TekuBeacon) Stop()

func (*TekuBeacon) Type

func (b *TekuBeacon) Type() NodeClient

type TekuValidator

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

func NewTekuValidator

func NewTekuValidator(account *Account, spec *Eth2Spec, beacon Node) (*TekuValidator, error)

func (*TekuValidator) IP

func (v *TekuValidator) IP() string

Jump to

Keyboard shortcuts

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