forkchoice

package
v7.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: GPL-3.0 Imports: 50 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.Att)

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) ExecutionPayloadEnvelope added in v7.1.5

func (bb *Builder) ExecutionPayloadEnvelope(t testing.TB, signed *ethpb.SignedExecutionPayloadEnvelope, expectValid bool)

ExecutionPayloadEnvelope receives an envelope and notifies the chain service. If expectValid is false the receive call must error; otherwise it must succeed.

func (*Builder) InvalidBlock

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

InvalidBlock receives the invalid block and notifies forkchoice.

func (*Builder) PayloadAttestationMessage added in v7.1.5

func (bb *Builder) PayloadAttestationMessage(t testing.TB, m *ethpb.PayloadAttestationMessage, expectValid bool)

PayloadAttestationMessage feeds the message to the chain service. If expectValid is false the receive call must error; otherwise it must succeed.

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"`
	GetProposerHead             *string         `json:"get_proposer_head"`
	ShouldOverrideFCU           *ShouldOverride `json:"should_override_forkchoice_update"`
	HeadPayloadStatus           *int            `json:"head_payload_status"`
	PayloadTimelinessVote       *PTCVotes       `json:"payload_timeliness_vote"`
	PayloadDataAvailabilityVote *PTCVotes       `json:"payload_data_availability_vote"`
}

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 PTCVotes added in v7.1.5

type PTCVotes struct {
	BlockRoot string  `json:"block_root"`
	Votes     []*bool `json:"votes"`
}

type ShouldOverride

type ShouldOverride struct {
	ValidatorConnected bool `json:"validator_is_connected"`
	Result             bool `json:"result"`
}

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"`
	Blobs                     *string         `json:"blobs"`
	Proofs                    []*string       `json:"proofs"`
	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"`
	DataColumns               []*string       `json:"columns"`
	ExecutionPayload          *string         `json:"execution_payload"`
	PayloadAttestationMessage *string         `json:"payload_attestation_message"`
}

Jump to

Keyboard shortcuts

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