sync

package
v0.0.0-...-ada6850 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EvNewHead             = &request.EventType{Name: "newHead"}             // data: types.HeadInfo
	EvNewOptimisticUpdate = &request.EventType{Name: "newOptimisticUpdate"} // data: types.OptimisticUpdate
	EvNewFinalityUpdate   = &request.EventType{Name: "newFinalityUpdate"}   // data: types.FinalityUpdate
)

Functions

This section is empty.

Types

type CheckpointInit

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

CheckpointInit implements request.Module; it fetches the light client bootstrap data belonging to the given checkpoint hash and initializes the committee chain if successful.

func NewCheckpointInit

func NewCheckpointInit(chain committeeChain, checkpointHash common.Hash) *CheckpointInit

NewCheckpointInit creates a new CheckpointInit.

func (*CheckpointInit) Process

func (s *CheckpointInit) Process(requester request.Requester, events []request.Event)

Process implements request.Module.

type ForwardUpdateSync

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

ForwardUpdateSync implements request.Module; it fetches updates between the committee chain head and each server's announced head. Updates are fetched in batches and multiple batches can also be requested in parallel. Out of order responses are also handled; if a batch of updates cannot be added to the chain immediately because of a gap then the future updates are remembered until they can be processed.

func NewForwardUpdateSync

func NewForwardUpdateSync(chain committeeChain) *ForwardUpdateSync

NewForwardUpdateSync creates a new ForwardUpdateSync.

func (*ForwardUpdateSync) Process

func (s *ForwardUpdateSync) Process(requester request.Requester, events []request.Event)

Process implements request.Module.

type HeadSync

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

HeadSync implements request.Module; it updates the validated and prefetch heads of HeadTracker based on the EvHead and EvSignedHead events coming from registered servers. It can also postpone the validation of the latest announced signed head until the committee chain is synced up to at least the required period.

func NewHeadSync

func NewHeadSync(headTracker headTracker, chain committeeChain) *HeadSync

NewHeadSync creates a new HeadSync.

func (*HeadSync) Process

func (s *HeadSync) Process(requester request.Requester, events []request.Event)

Process implements request.Module.

type ReqBeaconBlock

type ReqBeaconBlock common.Hash

type ReqCheckpointData

type ReqCheckpointData common.Hash

type ReqFinality

type ReqFinality struct{}

type ReqHeader

type ReqHeader common.Hash

type ReqUpdates

type ReqUpdates struct {
	FirstPeriod, Count uint64
}

type RespHeader

type RespHeader struct {
	Header               types.Header
	Canonical, Finalized bool
}

type RespUpdates

type RespUpdates struct {
	Updates    []*types.LightClientUpdate
	Committees []*types.SerializedSyncCommittee
}

type TestCommitteeChain

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

func (*TestCommitteeChain) CheckpointInit

func (tc *TestCommitteeChain) CheckpointInit(bootstrap types.BootstrapData) error

func (*TestCommitteeChain) ExpInit

func (tc *TestCommitteeChain) ExpInit(t *testing.T, ExpInit bool)

func (*TestCommitteeChain) ExpNextSyncPeriod

func (tc *TestCommitteeChain) ExpNextSyncPeriod(t *testing.T, expNsp uint64)

func (*TestCommitteeChain) InsertUpdate

func (tc *TestCommitteeChain) InsertUpdate(update *types.LightClientUpdate, nextCommittee *types.SerializedSyncCommittee) error

func (*TestCommitteeChain) NextSyncPeriod

func (tc *TestCommitteeChain) NextSyncPeriod() (uint64, bool)

func (*TestCommitteeChain) SetNextSyncPeriod

func (tc *TestCommitteeChain) SetNextSyncPeriod(nsp uint64)

type TestHeadTracker

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

func (*TestHeadTracker) ExpPrefetch

func (ht *TestHeadTracker) ExpPrefetch(t *testing.T, tci int, exp types.HeadInfo)

func (*TestHeadTracker) ExpValidated

func (ht *TestHeadTracker) ExpValidated(t *testing.T, tci int, expHeads []types.OptimisticUpdate)

func (*TestHeadTracker) SetPrefetchHead

func (ht *TestHeadTracker) SetPrefetchHead(head types.HeadInfo)

func (*TestHeadTracker) ValidateFinality

func (ht *TestHeadTracker) ValidateFinality(update types.FinalityUpdate) (bool, error)

func (*TestHeadTracker) ValidateOptimistic

func (ht *TestHeadTracker) ValidateOptimistic(update types.OptimisticUpdate) (bool, error)

func (*TestHeadTracker) ValidatedFinality

func (ht *TestHeadTracker) ValidatedFinality() (types.FinalityUpdate, bool)

type TestScheduler

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

func NewTestScheduler

func NewTestScheduler(t *testing.T, module request.Module) *TestScheduler

func (*TestScheduler) AddAllowance

func (ts *TestScheduler) AddAllowance(server request.Server, allowance int)

func (*TestScheduler) AddServer

func (ts *TestScheduler) AddServer(server request.Server, allowance int)

func (*TestScheduler) CanSendTo

func (ts *TestScheduler) CanSendTo() (cs []request.Server)

func (*TestScheduler) ExpFail

func (ts *TestScheduler) ExpFail(server request.Server)

func (*TestScheduler) Fail

func (ts *TestScheduler) Fail(server request.Server, desc string)

func (*TestScheduler) RemoveServer

func (ts *TestScheduler) RemoveServer(server request.Server)

func (*TestScheduler) Request

func (ts *TestScheduler) Request(testIndex, reqIndex int) requestWithID

func (*TestScheduler) RequestEvent

func (ts *TestScheduler) RequestEvent(evType *request.EventType, req requestWithID, resp request.Response)

func (*TestScheduler) Run

func (ts *TestScheduler) Run(testIndex int, exp ...any)

func (*TestScheduler) Send

func (ts *TestScheduler) Send(server request.Server, req request.Request) request.ID

func (*TestScheduler) ServerEvent

func (ts *TestScheduler) ServerEvent(evType *request.EventType, server request.Server, data any)

Jump to

Keyboard shortcuts

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