devnet

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentChainID

func CurrentChainID(ctx context.Context) *big.Int

func CurrentChainName

func CurrentChainName(ctx context.Context) string

func HTTPHost

func HTTPHost(n Node) string

func Logger

func Logger(ctx context.Context) log.Logger

Types

type Context

type Context interface {
	context.Context
	WithValue(key, value interface{}) Context
	WithCurrentNetwork(selector interface{}) Context
	WithCurrentNode(selector interface{}) Context
}

func AsContext

func AsContext(ctx context.Context) Context

func WithCurrentNetwork

func WithCurrentNetwork(ctx context.Context, selector interface{}) Context

func WithCurrentNode

func WithCurrentNode(ctx context.Context, selector interface{}) Context

func WithDevnet

func WithDevnet(ctx context.Context, devnet Devnet, logger log.Logger) Context

func WithNetwork

func WithNetwork(ctx context.Context, nw *Network) Context

type Devnet

type Devnet []*Network

func (Devnet) SelectNetwork

func (d Devnet) SelectNetwork(ctx context.Context, selector interface{}) *Network

func (Devnet) Start

func (d Devnet) Start(logger log.Logger) (Context, error)

func (Devnet) Stop

func (d Devnet) Stop()

func (Devnet) Wait

func (d Devnet) Wait()

type Network

type Network struct {
	DataDir            string
	Chain              string
	Logger             log.Logger
	BasePort           int
	BasePrivateApiAddr string
	BaseRPCHost        string
	BaseRPCPort        int
	Snapshots          bool
	Nodes              []Node
	Services           []Service
	Alloc              types.GenesisAlloc
	BorStateSyncDelay  time.Duration
	BorPeriod          time.Duration
	BorMinBlockSize    int
	BorWithMilestones  *bool

	// max number of blocks to look for a transaction in
	MaxNumberOfEmptyBlockChecks int
	// contains filtered or unexported fields
}

func CurrentNetwork

func CurrentNetwork(ctx context.Context) *Network

func Networks

func Networks(ctx context.Context) []*Network

func (*Network) BlockProducers

func (nw *Network) BlockProducers() []Node

func (*Network) ChainID

func (nw *Network) ChainID() *big.Int

func (*Network) FirstNode

func (nw *Network) FirstNode() Node

func (*Network) NonBlockProducers

func (nw *Network) NonBlockProducers() []Node

func (*Network) SelectNode

func (nw *Network) SelectNode(ctx context.Context, selector interface{}) Node

func (*Network) Start

func (nw *Network) Start(ctx context.Context) error

Start starts the process for multiple erigon nodes running on the dev chain

func (*Network) Stop

func (nw *Network) Stop()

func (*Network) Wait

func (nw *Network) Wait()

type NetworkSelector

type NetworkSelector interface {
	Test(ctx context.Context, network *Network) bool
}

type NetworkSelectorFunc

type NetworkSelectorFunc func(ctx context.Context, network *Network) bool

func (NetworkSelectorFunc) Test

func (f NetworkSelectorFunc) Test(ctx context.Context, network *Network) bool

type Node

type Node interface {
	requests.RequestGenerator
	GetName() string
	ChainID() *big.Int
	GetHttpPort() int
	GetEnodeURL() string
	Account() *accounts.Account
	IsBlockProducer() bool
	Configure(baseNode args.NodeArgs, nodeNumber int) error
	EnableMetrics(port int)
}

func CurrentNode

func CurrentNode(ctx context.Context) Node

func SelectBlockProducer

func SelectBlockProducer(ctx context.Context, selector ...interface{}) Node

func SelectNode

func SelectNode(ctx context.Context, selector ...interface{}) Node

func SelectNonBlockProducer

func SelectNonBlockProducer(ctx context.Context, selector ...interface{}) Node

type NodeSelector

type NodeSelector interface {
	Test(ctx context.Context, node Node) bool
}

type NodeSelectorFunc

type NodeSelectorFunc func(ctx context.Context, node Node) bool

func (NodeSelectorFunc) Test

func (f NodeSelectorFunc) Test(ctx context.Context, node Node) bool

type Service

type Service interface {
	Start(context context.Context) error
	Stop()

	NodeCreated(ctx context.Context, node Node)
	NodeStarted(ctx context.Context, node Node)
}

Jump to

Keyboard shortcuts

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