geth

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 42 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func ConnectP2P

func ConnectP2P(t *testing.T, node1 *ethclient.Client, node2 *ethclient.Client)

ConnectP2P creates a p2p peer connection between node1 and node2.

func FindBlock added in v1.7.2

func FindBlock(client *ethclient.Client,
	from, to int, timeout time.Duration,
	pred func(*types.Block) (bool, error),
) (*types.Block, error)

FindBlock finds the first block for which the predicate [pred] matches and returns it. It starts at [from] and iterates until [to], inclusively, using the provided [client]. It supports both search directions, forwards and backwards.

func WaitForBlock

func WaitForBlock(number *big.Int, client *ethclient.Client, opts ...WaitForBlockOption) (*types.Block, error)

WaitForBlock waits for the chain to advance to the provided block number. It can be configured with two different timeout: an absolute timeout, and a no change timeout. The absolute timeout caps the maximum amount of time this method will run. The no change timeout will return an error if the block number does not change within that time window. This is useful to bail out early in the event of a stuck chain, but allow things to continue if the chain is still advancing.

This function will also retry fetch errors up to three times before returning an error in order to protect against transient network problems. This function uses polling rather than websockets.

func WaitForBlockToBeFinalized added in v1.4.2

func WaitForBlockToBeFinalized(number *big.Int, client *ethclient.Client, timeout time.Duration) (*types.Block, error)

func WaitForBlockToBeSafe added in v1.4.2

func WaitForBlockToBeSafe(number *big.Int, client *ethclient.Client, timeout time.Duration) (*types.Block, error)

func WaitForL1OriginOnL2

func WaitForL1OriginOnL2(rollupCfg *rollup.Config, l1BlockNum uint64, client *ethclient.Client, timeout time.Duration) (*types.Block, error)

func WaitForTransaction

func WaitForTransaction(hash common.Hash, client *ethclient.Client, timeout time.Duration) (*types.Receipt, error)

func WithP2P

func WithP2P() func(ethCfg *ethconfig.Config, nodeCfg *node.Config) error

Types

type Beacon added in v1.4.2

type Beacon interface {
	StoreBlobsBundle(slot uint64, bundle *engine.BlobsBundleV1) error
}

type GethInstance added in v1.9.1

type GethInstance struct {
	Backend *eth.Ethereum
	Node    *node.Node
}

func InitL1

func InitL1(blockTime uint64, finalizedDistance uint64, genesis *core.Genesis, c clock.Clock, blobPoolDir string, beaconSrv Beacon, opts ...GethOption) (*GethInstance, error)

func InitL2

func InitL2(name string, genesis *core.Genesis, jwtPath string, opts ...GethOption) (*GethInstance, error)

InitL2 inits a L2 geth node.

func (*GethInstance) AuthRPC added in v1.9.1

func (gi *GethInstance) AuthRPC() endpoint.RPC

func (*GethInstance) Close added in v1.9.1

func (gi *GethInstance) Close() error

func (*GethInstance) UserRPC added in v1.9.1

func (gi *GethInstance) UserRPC() endpoint.RPC

type GethOption

type GethOption func(ethCfg *ethconfig.Config, nodeCfg *node.Config) error

type WaitForBlockOption added in v1.9.5

type WaitForBlockOption func(*waitForBlockOptions)

func WithAbsoluteTimeout added in v1.9.5

func WithAbsoluteTimeout(timeout time.Duration) WaitForBlockOption

func WithNoChangeTimeout added in v1.9.5

func WithNoChangeTimeout(timeout time.Duration) WaitForBlockOption

Jump to

Keyboard shortcuts

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