statefetcher

package
v1.4.2-0...-e33850b Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDBBlock = errors.New("invalid block found in database")
View Source
var ErrNoAncestorForBlock = errors.New("could not find an ancestor state for block")
View Source
var ErrNoCanonicalBlockForSlot = errors.New("none of the blocks found in the db slot index are canonical")

Functions

This section is empty.

Types

type Fetcher added in v1.3.6

type Fetcher interface {
	State(ctx context.Context, stateId []byte) (state.BeaconState, error)
	StateRoot(ctx context.Context, stateId []byte) ([]byte, error)
	StateBySlot(ctx context.Context, slot types.Slot) (state.BeaconState, error)
}

Fetcher is responsible for retrieving info related with the beacon chain.

type StateIdParseError added in v1.4.1

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

StateIdParseError represents an error scenario where a state ID could not be parsed.

func NewStateIdParseError added in v1.4.1

func NewStateIdParseError(reason error) StateIdParseError

NewStateIdParseError creates a new error instance.

func (*StateIdParseError) Error added in v1.4.1

func (e *StateIdParseError) Error() string

Error returns the underlying error message.

type StateNotFoundError added in v1.4.1

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

StateNotFoundError represents an error scenario where a state could not be found.

func NewStateNotFoundError added in v1.4.1

func NewStateNotFoundError(stateRootsSize int) StateNotFoundError

NewStateNotFoundError creates a new error instance.

func NewStateRootNotFoundError added in v1.4.1

func NewStateRootNotFoundError(stateRootsSize int) StateNotFoundError

NewStateRootNotFoundError creates a new error instance.

func (*StateNotFoundError) Error added in v1.4.1

func (e *StateNotFoundError) Error() string

Error returns the underlying error message.

type StateProvider added in v1.3.6

type StateProvider struct {
	BeaconDB           db.ReadOnlyDatabase
	ChainInfoFetcher   blockchain.ChainInfoFetcher
	GenesisTimeFetcher blockchain.TimeFetcher
	StateGenService    stategen.StateManager
	ReplayerBuilder    stategen.ReplayerBuilder
}

StateProvider is a real implementation of Fetcher.

func (*StateProvider) State added in v1.3.6

func (p *StateProvider) State(ctx context.Context, stateId []byte) (state.BeaconState, error)

State returns the BeaconState for a given identifier. The identifier can be one of:

  • "head" (canonical head in node's view)
  • "genesis"
  • "finalized"
  • "justified"
  • <slot>
  • <hex encoded state root with '0x' prefix>

func (*StateProvider) StateBySlot

func (p *StateProvider) StateBySlot(ctx context.Context, target types.Slot) (state.BeaconState, error)

StateBySlot returns the post-state for the requested slot. To generate the state, it uses the most recent canonical state prior to the target slot, and all canonical blocks between the found state's slot and the target slot. process_blocks is applied for all canonical blocks, and process_slots is called for any skipped slots, or slots following the most recent canonical block up to and including the target slot.

func (*StateProvider) StateRoot added in v1.4.1

func (p *StateProvider) StateRoot(ctx context.Context, stateId []byte) (root []byte, err error)

StateRoot returns a beacon state root for a given identifier. The identifier can be one of:

  • "head" (canonical head in node's view)
  • "genesis"
  • "finalized"
  • "justified"
  • <slot>
  • <hex encoded state root with '0x' prefix>

type StateRootNotFoundError added in v1.4.1

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

StateRootNotFoundError represents an error scenario where a state root could not be found.

func (*StateRootNotFoundError) Error added in v1.4.1

func (e *StateRootNotFoundError) Error() string

Error returns the underlying error message.

Jump to

Keyboard shortcuts

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