node

package
v0.0.0-...-011bec4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHeaderTraversalAheadOfProvider            = errors.New("the HeaderTraversal's internal state is ahead of the provider")
	ErrHeaderTraversalAndProviderMismatchedState = errors.New("the HeaderTraversal and provider have diverged in state")
)

Functions

func HeadersByRange

func HeadersByRange(ctx context.Context, c client.Client, startHeight, endHeight *big.Int) ([]types.Header, error)

HeadersByRange will retrieve block headers within the specified range -- inclusive. No restrictions are placed on the range such as blocks in the "latest", "safe" or "finalized" states. If the specified range is too large, `endHeight > latest`, the resulting list is truncated to the available headers

func StorageHash

func StorageHash(ctx context.Context, c client.Client, address common.Address, blockNumber *big.Int) (common.Hash, error)

StorageHash returns the sha3 of the storage root for the specified account

Types

type HeaderTraversal

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

func NewHeaderTraversal

func NewHeaderTraversal(client client.Client, fromHeader *types.Header, confDepth *big.Int) *HeaderTraversal

NewHeaderTraversal instantiates a new instance of HeaderTraversal against the supplied rpc client. The HeaderTraversal will start fetching blocks starting from the supplied header unless nil, indicating genesis.

func (*HeaderTraversal) LastTraversedHeader

func (f *HeaderTraversal) LastTraversedHeader() *types.Header

LastTraversedHeader returns the last header traversed.

  • This is useful for testing the state of the HeaderTraversal
  • LastTraversedHeader may be << LatestHeader depending on the number headers traversed via `NextHeaders`.

func (*HeaderTraversal) LatestHeader

func (f *HeaderTraversal) LatestHeader() *types.Header

LatestHeader returns the latest header reported by underlying eth client as headers are traversed via `NextHeaders`.

func (*HeaderTraversal) NextHeaders

func (f *HeaderTraversal) NextHeaders(maxSize uint64) ([]types.Header, error)

NextHeaders retrieves the next set of headers that have been marked as finalized by the connected client, bounded by the supplied size

type Logs

type Logs struct {
	Logs          []types.Log
	ToBlockHeader *types.Header
}

func FilterLogsSafe

func FilterLogsSafe(ctx context.Context, c client.Client, query ethereum.FilterQuery) (Logs, error)

FilterLogsSafe returns logs that fit the query parameters. The underlying request is a batch request including `eth_getBlockByNumber` to allow the caller to check that connected node has the state necessary to fulfill this request

Jump to

Keyboard shortcuts

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