forkchoice

package
v0.0.0-...-3bf8caa Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: Apache-2.0, MIT, GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, config string, fork int)

Run executes "forkchoice" and "sync" test.

Types

type Builder

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

func NewBuilder

func NewBuilder(t testing.TB, initialState state.BeaconState, initialBlock interfaces.ReadOnlySignedBeaconBlock) *Builder

func (*Builder) Attestation

func (bb *Builder) Attestation(t testing.TB, a *ethpb.Attestation)

Attestation receives the attestation and updates forkchoice.

func (*Builder) AttesterSlashing

func (bb *Builder) AttesterSlashing(s *ethpb.AttesterSlashing)

AttesterSlashing receives an attester slashing and feeds it to forkchoice.

func (*Builder) Check

func (bb *Builder) Check(t testing.TB, c *Check)

Check evaluates the fork choice results and compares them to the expected values.

func (*Builder) InvalidBlock

func (bb *Builder) InvalidBlock(t testing.TB, b interfaces.ReadOnlySignedBeaconBlock)

InvalidBlock receives the invalid block and notifies forkchoice.

func (*Builder) PoWBlock

func (bb *Builder) PoWBlock(pb *ethpb.PowBlock)

PoWBlock receives the block and notifies a mocked execution engine.

func (*Builder) SetPayloadStatus

func (bb *Builder) SetPayloadStatus(resp *MockEngineResp) error

SetPayloadStatus sets the payload status that the engine will return

func (*Builder) Tick

func (bb *Builder) Tick(t testing.TB, tick int64)

Tick resets the genesis time to now()-tick and adjusts the slot to the appropriate value.

func (*Builder) ValidBlock

func (bb *Builder) ValidBlock(t testing.TB, b interfaces.ReadOnlySignedBeaconBlock)

ValidBlock receives the valid block and notifies forkchoice.

type Check

type Check struct {
	Time                    *int       `json:"time"`
	GenesisTime             int        `json:"genesis_time"`
	ProposerBoostRoot       *string    `json:"proposer_boost_root"`
	Head                    *SlotRoot  `json:"head"`
	JustifiedCheckPoint     *EpochRoot `json:"justified_checkpoint"`
	BestJustifiedCheckPoint *EpochRoot `json:"best_justified_checkpoint"`
	FinalizedCheckPoint     *EpochRoot `json:"finalized_checkpoint"`
}

type EpochRoot

type EpochRoot struct {
	Epoch int    `json:"epoch"`
	Root  string `json:"root"`
}

type MockEngineResp

type MockEngineResp struct {
	Status          *string `json:"status"`
	LatestValidHash *string `json:"latest_valid_hash"`
	ValidationError *string `json:"validation_error"`
}

type SlotRoot

type SlotRoot struct {
	Slot int    `json:"slot"`
	Root string `json:"root"`
}

type Step

type Step struct {
	Tick             *int            `json:"tick"`
	Block            *string         `json:"block"`
	Valid            *bool           `json:"valid"`
	Attestation      *string         `json:"attestation"`
	AttesterSlashing *string         `json:"attester_slashing"`
	PayloadStatus    *MockEngineResp `json:"payload_status"`
	PowBlock         *string         `json:"pow_block"`
	Check            *Check          `json:"checks"`
}

Jump to

Keyboard shortcuts

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