eth1

package
v3.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: GPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EthAddress = "0x878705ba3f8bc32fcf7f4caa1a35e72af65cf766"
)
View Source
const KeystorePassword = "password"

KeystorePassword is the password used to decrypt ETH1 keystores.

View Source
const NetworkId = 1337

NetworkId is the ID of the ETH1 chain.

Variables

This section is empty.

Functions

func SendTransaction

func SendTransaction(client *rpc.Client, key *ecdsa.PrivateKey, f *filler.Filler, gasPrice *big.Int, addr string, N uint64, al bool) error

func WaitForBlocks

func WaitForBlocks(web3 *ethclient.Client, key *keystore.Key, blocksToWait uint64) error

WaitForBlocks waits for a certain amount of blocks to be mined by the ETH1 chain before returning.

Types

type DepositHistory added in v3.2.0

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 added in v3.2.0

func (h *DepositHistory) Balances(batch types.DepositBatch) map[[48]byte]uint64

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 added in v3.2.0

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    *ethclient.Client
	ChainID   *big.Int
	NetworkId *big.Int
	// contains filtered or unexported fields
}

func (*Depositor) History added in v3.2.0

func (d *Depositor) History() *DepositHistory

History exposes the DepositHistory value for a Depositor.

func (*Depositor) SendAndMine added in v3.2.0

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 added in v3.2.0

func (d *Depositor) SendDeposit(dep *eth.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 added in v3.2.1

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

type Miner

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

Miner represents an ETH1 node which mines blocks.

func NewMiner

func NewMiner() *Miner

NewMiner creates and returns an ETH1 node miner.

func (*Miner) DataDir added in v3.2.0

func (*Miner) DataDir(sub ...string) string

func (*Miner) ENR

func (m *Miner) ENR() string

ENR returns the miner's enode.

func (*Miner) Password added in v3.2.0

func (*Miner) Password() string

func (*Miner) Pause

func (m *Miner) Pause() error

Pause pauses the component and its underlying process.

func (*Miner) Resume

func (m *Miner) Resume() error

Resume resumes the component and its underlying process.

func (*Miner) SetBootstrapENR

func (m *Miner) SetBootstrapENR(bootstrapEnr string)

SetBootstrapENR sets the bootstrap record.

func (*Miner) Start

func (m *Miner) Start(ctx context.Context) error

Start runs a mining ETH1 node. The miner is responsible for moving the ETH1 chain forward and for deploying the deposit contract.

func (*Miner) Started

func (m *Miner) Started() <-chan struct{}

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

func (*Miner) Stop

func (m *Miner) Stop() error

Stop kills the component and its underlying process.

type Node

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

Node represents an ETH1 node.

func NewNode

func NewNode(index int, enr string) *Node

NewNode creates and returns ETH1 node.

func (*Node) Pause

func (node *Node) Pause() error

Pause pauses the component and its underlying process.

func (*Node) Resume

func (node *Node) Resume() error

Resume resumes the component and its underlying process.

func (*Node) Start

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

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

func (*Node) Started

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

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

func (*Node) Stop

func (node *Node) Stop() error

Stop kills the component and its underlying process.

func (*Node) UnderlyingProcess added in v3.2.1

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

type NodeSet

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

NodeSet represents a set of Eth1 nodes, none of which is a mining node.

func NewNodeSet

func NewNodeSet() *NodeSet

NewNodeSet creates and returns a set of Eth1 nodes.

func (*NodeSet) ComponentAtIndex

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

ComponentAtIndex returns the component at the provided index.

func (*NodeSet) Pause

func (s *NodeSet) Pause() error

Pause pauses the component and its underlying process.

func (*NodeSet) PauseAtIndex

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

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

func (*NodeSet) Resume

func (s *NodeSet) Resume() error

Resume resumes the component and its underlying process.

func (*NodeSet) ResumeAtIndex

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

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

func (*NodeSet) SetMinerENR

func (s *NodeSet) SetMinerENR(enr string)

SetMinerENR sets the miner's enode, used to connect to the miner through P2P.

func (*NodeSet) Start

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

Start starts all the execution nodes in set.

func (*NodeSet) Started

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

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

func (*NodeSet) Stop

func (s *NodeSet) Stop() error

Stop stops the component and its underlying process.

func (*NodeSet) StopAtIndex

func (s *NodeSet) 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 eth1 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 added in v3.2.0

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 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.

Jump to

Keyboard shortcuts

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