lookup

package
v5.0.1-rc.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeaconDbBlocker

type BeaconDbBlocker struct {
	BeaconDB           db.ReadOnlyDatabase
	ChainInfoFetcher   blockchain.ChainInfoFetcher
	GenesisTimeFetcher blockchain.TimeFetcher
	BlobStorage        *filesystem.BlobStorage
}

BeaconDbBlocker is an implementation of Blocker. It retrieves blocks from the beacon chain database.

func (*BeaconDbBlocker) Blobs

func (p *BeaconDbBlocker) Blobs(ctx context.Context, id string, indices []uint64) ([]*blocks.VerifiedROBlob, *core.RpcError)

Blobs returns the blobs for a given block id identifier and blob indices. The identifier can be one of:

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

cases:

  • no block, 404
  • block exists, no commitment, 200 w/ empty list
  • block exists, has commitments, inside retention period (greater of protocol- or user-specified) serve then w/ 200 unless we hit an error reading them. we are technically not supposed to import a block to forkchoice unless we have the blobs, so the nuance here is if we can't find the file and we are inside the protocol-defined retention period, then it's actually a 500.
  • block exists, has commitments, outside retention period (greater of protocol- or user-specified) - ie just like block exists, no commitment

func (*BeaconDbBlocker) Block

Block returns the beacon block for a given identifier. The identifier can be one of:

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

type BeaconDbStater

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

BeaconDbStater is an implementation of Stater. It retrieves states from the beacon chain database.

func (*BeaconDbStater) State

func (p *BeaconDbStater) 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>
  • <state root>

func (*BeaconDbStater) StateBySlot

func (p *BeaconDbStater) 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 (*BeaconDbStater) StateRoot

func (p *BeaconDbStater) 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 BlockIdParseError

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

BlockIdParseError represents an error scenario where a block ID could not be parsed.

func NewBlockIdParseError

func NewBlockIdParseError(reason error) BlockIdParseError

NewBlockIdParseError creates a new error instance.

func (BlockIdParseError) Error

func (e BlockIdParseError) Error() string

Error returns the underlying error message.

type Blocker

type Blocker interface {
	Block(ctx context.Context, id []byte) (interfaces.ReadOnlySignedBeaconBlock, error)
	Blobs(ctx context.Context, id string, indices []uint64) ([]*blocks.VerifiedROBlob, *core.RpcError)
}

Blocker is responsible for retrieving blocks.

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

type Stater

type Stater interface {
	State(ctx context.Context, id []byte) (state.BeaconState, error)
	StateRoot(ctx context.Context, id []byte) ([]byte, error)
	StateBySlot(ctx context.Context, slot primitives.Slot) (state.BeaconState, error)
}

Stater is responsible for retrieving states.

Jump to

Keyboard shortcuts

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