stategen

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

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

State represents a management object that handles the internal logic of maintaining both hot and cold states in DB.

func New

func New(db db.NoHeadAccessDatabase) *State

New returns a new state management object.

func (*State) ComputeStateUpToSlot added in v0.3.4

func (s *State) ComputeStateUpToSlot(ctx context.Context, targetSlot uint64) (*state.BeaconState, error)

ComputeStateUpToSlot returns a processed state up to input target slot. If the last processed block is at slot 32, given input target slot at 40, this returns processed state up to slot 40 via empty slots. If there's duplicated blocks in a single slot, the canonical block will be returned.

func (*State) LoadBlocks

func (s *State) LoadBlocks(ctx context.Context, startSlot uint64, endSlot uint64, endBlockRoot [32]byte) ([]*ethpb.SignedBeaconBlock, error)

LoadBlocks loads the blocks between start slot and end slot by recursively fetching from end block root. The Blocks are returned in slot-descending order.

func (*State) MigrateToCold added in v0.3.4

func (s *State) MigrateToCold(ctx context.Context, finalizedState *state.BeaconState, finalizedRoot [32]byte) error

MigrateToCold advances the split point in between the cold and hot state sections. It moves the recent finalized states from the hot section to the cold section and only preserve the ones that's on archived point.

func (*State) ReplayBlocks

func (s *State) ReplayBlocks(ctx context.Context, state *state.BeaconState, signed []*ethpb.SignedBeaconBlock, targetSlot uint64) (*state.BeaconState, error)

ReplayBlocks replays the input blocks on the input state until the target slot is reached.

Jump to

Keyboard shortcuts

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