statefetcher

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: 16 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

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 primitives.Slot) (state.BeaconState, error)
}

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

type StateIdParseError

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

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

func NewStateIdParseError

func NewStateIdParseError(reason error) StateIdParseError

NewStateIdParseError creates a new error instance.

func (*StateIdParseError) Error

func (e *StateIdParseError) Error() string

Error returns the underlying error message.

type StateNotFoundError

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

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

func NewStateNotFoundError

func NewStateNotFoundError(stateRootsSize int) StateNotFoundError

NewStateNotFoundError creates a new error instance.

func NewStateRootNotFoundError

func NewStateRootNotFoundError(stateRootsSize int) StateNotFoundError

NewStateRootNotFoundError creates a new error instance.

func (*StateNotFoundError) Error

func (e *StateNotFoundError) Error() string

Error returns the underlying error message.

type StateProvider

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

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

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

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

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

func (*StateRootNotFoundError) Error

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