heimdall

package
v3.0.0-alpha5.0...-c974331 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: LGPL-3.0 Imports: 59 Imported by: 0

Documentation

Overview

Package heimdall is a generated GoMock package.

Package heimdall is a generated GoMock package.

Package heimdall is a generated GoMock package.

Package heimdall is a generated GoMock package.

Index

Constants

View Source
const (
	StateEventsFetchLimit = 50
	SpansFetchLimit       = 150
	CheckpointsFetchLimit = 10_000
)

Variables

View Source
var (
	// ErrShutdownDetected is returned if a shutdown was detected
	ErrShutdownDetected      = errors.New("shutdown detected")
	ErrNoResponse            = errors.New("got a nil response")
	ErrNotSuccessfulResponse = errors.New("error while fetching data from Heimdall")
	ErrNotInRejectedList     = errors.New("milestoneId doesn't exist in rejected list")
	ErrNotInMilestoneList    = errors.New("milestoneId doesn't exist in Heimdall")
	ErrNotInCheckpointList   = errors.New("checkpontId doesn't exist in Heimdall")
	ErrBadGateway            = errors.New("bad gateway")
	ErrServiceUnavailable    = errors.New("service unavailable")
)
View Source
var (
	Events = snaptype.RegisterType(
		Enums.Events,
		"borevents",
		snaptype.Versions{
			Current:      1,
			MinSupported: 1,
		},
		EventRangeExtractor{},
		[]snaptype.Index{Indexes.BorTxnHash},
		snaptype.IndexBuilderFunc(
			func(ctx context.Context, sn snaptype.FileInfo, salt uint32, chainConfig *chain.Config, tmpDir string, p *background.Progress, lvl log.Lvl, logger log.Logger) (err error) {
				defer func() {
					if rec := recover(); rec != nil {
						err = fmt.Errorf("BorEventsIdx: at=%d-%d, %v, %s", sn.From, sn.To, rec, dbg.Stack())
					}
				}()

				d, err := seg.NewDecompressor(sn.Path)
				if err != nil {
					return err
				}
				defer d.Close()
				g := d.MakeGetter()
				var blockNumBuf [length.BlockNum]byte
				var first bool = true
				word := make([]byte, 0, 4096)
				var blockCount int
				var baseEventId uint64
				for g.HasNext() {
					word, _ = g.Next(word[:0])
					if first || !bytes.Equal(blockNumBuf[:], word[length.Hash:length.Hash+length.BlockNum]) {
						blockCount++
						copy(blockNumBuf[:], word[length.Hash:length.Hash+length.BlockNum])
					}
					if first {
						baseEventId = binary.BigEndian.Uint64(word[length.Hash+length.BlockNum : length.Hash+length.BlockNum+8])
						first = false
					}
					select {
					case <-ctx.Done():
						return ctx.Err()
					default:
					}
				}

				rs, err := recsplit.NewRecSplit(recsplit.RecSplitArgs{
					KeyCount:   blockCount,
					Enums:      blockCount > 0,
					BucketSize: 2000,
					LeafSize:   8,
					TmpDir:     tmpDir,
					IndexFile:  filepath.Join(sn.Dir(), snaptype.IdxFileName(sn.Version, sn.From, sn.To, Enums.Events.String())),
					BaseDataID: baseEventId,
				}, logger)
				if err != nil {
					return err
				}
				rs.LogLvl(log.LvlDebug)

				defer d.EnableReadAhead().DisableReadAhead()

				for {
					g.Reset(0)
					first = true
					var i, offset, nextPos uint64
					for g.HasNext() {
						word, nextPos = g.Next(word[:0])
						i++
						if first || !bytes.Equal(blockNumBuf[:], word[length.Hash:length.Hash+length.BlockNum]) {
							if err = rs.AddKey(word[:length.Hash], offset); err != nil {
								return err
							}
							copy(blockNumBuf[:], word[length.Hash:length.Hash+length.BlockNum])
						}
						if first {
							first = false
						}
						select {
						case <-ctx.Done():
							return ctx.Err()
						default:
						}
						offset = nextPos
					}
					if err = rs.Build(ctx); err != nil {
						if errors.Is(err, recsplit.ErrCollision) {
							logger.Info("Building recsplit. Collision happened. It's ok. Restarting with another salt...", "err", err)
							rs.ResetNextSalt()
							continue
						}
						return err
					}

					return nil
				}
			}))

	Spans = snaptype.RegisterType(
		Enums.Spans,
		"borspans",
		snaptype.Versions{
			Current:      1,
			MinSupported: 1,
		},
		snaptype.RangeExtractorFunc(
			func(ctx context.Context, blockFrom, blockTo uint64, firstKeyGetter snaptype.FirstKeyGetter, db kv.RoDB, _ *chain.Config, collect func([]byte) error, workers int, lvl log.Lvl, logger log.Logger) (uint64, error) {
				spanFrom := uint64(SpanIdAt(blockFrom))
				spanTo := uint64(SpanIdAt(blockTo))
				return extractValueRange(ctx, kv.BorSpans, spanFrom, spanTo, db, collect, workers, lvl, logger)
			}),
		[]snaptype.Index{Indexes.BorSpanId},
		snaptype.IndexBuilderFunc(
			func(ctx context.Context, sn snaptype.FileInfo, salt uint32, _ *chain.Config, tmpDir string, p *background.Progress, lvl log.Lvl, logger log.Logger) (err error) {
				d, err := seg.NewDecompressor(sn.Path)

				if err != nil {
					return err
				}
				defer d.Close()

				baseSpanId := uint64(SpanIdAt(sn.From))

				return buildValueIndex(ctx, sn, salt, d, baseSpanId, tmpDir, p, lvl, logger)
			}),
	)

	Checkpoints = snaptype.RegisterType(
		Enums.Checkpoints,
		"borcheckpoints",
		snaptype.Versions{
			Current:      1,
			MinSupported: 1,
		},
		snaptype.RangeExtractorFunc(
			func(ctx context.Context, blockFrom, blockTo uint64, firstKeyGetter snaptype.FirstKeyGetter, db kv.RoDB, _ *chain.Config, collect func([]byte) error, workers int, lvl log.Lvl, logger log.Logger) (uint64, error) {
				var checkpointTo, checkpointFrom CheckpointId

				checkpointId := func(rangeIndex RangeIndex, blockNum uint64) (CheckpointId, error) {
					checkpointId, _, err := rangeIndex.Lookup(ctx, blockNum)
					return CheckpointId(checkpointId), err
				}

				err := db.View(ctx, func(tx kv.Tx) (err error) {
					rangeIndex := NewTxRangeIndex(db, kv.BorCheckpointEnds, tx)

					checkpointFrom, err = checkpointId(rangeIndex, blockFrom)

					if err != nil {
						return err
					}

					checkpointTo, err = checkpointId(rangeIndex, blockTo)

					if err != nil {
						return err
					}

					if blockFrom > 0 {
						if prevTo, err := checkpointId(rangeIndex, blockFrom-1); err == nil {
							if prevTo == checkpointFrom {
								if prevTo == checkpointTo {
									checkpointFrom = 0
									checkpointTo = 0
								} else {
									checkpointFrom++
								}
							}
						}
					}

					return err
				})

				if err != nil {
					return 0, err
				}

				return extractValueRange(ctx, kv.BorCheckpoints, uint64(checkpointFrom), uint64(checkpointTo), db, collect, workers, lvl, logger)
			}),
		[]snaptype.Index{Indexes.BorCheckpointId},
		snaptype.IndexBuilderFunc(
			func(ctx context.Context, sn snaptype.FileInfo, salt uint32, _ *chain.Config, tmpDir string, p *background.Progress, lvl log.Lvl, logger log.Logger) (err error) {
				d, err := seg.NewDecompressor(sn.Path)

				if err != nil {
					return err
				}
				defer d.Close()

				gg := d.MakeGetter()

				var firstCheckpointId uint64

				if gg.HasNext() {
					buf, _ := d.MakeGetter().Next(nil)
					var firstCheckpoint Checkpoint

					if err = json.Unmarshal(buf, &firstCheckpoint); err != nil {
						return err
					}

					firstCheckpointId = uint64(firstCheckpoint.Id)
				}

				return buildValueIndex(ctx, sn, salt, d, firstCheckpointId, tmpDir, p, lvl, logger)
			}),
	)

	Milestones = snaptype.RegisterType(
		Enums.Milestones,
		"bormilestones",
		snaptype.Versions{
			Current:      1,
			MinSupported: 1,
		},
		snaptype.RangeExtractorFunc(
			func(ctx context.Context, blockFrom, blockTo uint64, firstKeyGetter snaptype.FirstKeyGetter, db kv.RoDB, _ *chain.Config, collect func([]byte) error, workers int, lvl log.Lvl, logger log.Logger) (uint64, error) {
				var milestoneFrom, milestoneTo MilestoneId

				milestoneId := func(rangeIndex RangeIndex, blockNum uint64) (MilestoneId, error) {
					milestoneId, _, err := rangeIndex.Lookup(ctx, blockNum)
					return MilestoneId(milestoneId), err
				}
				err := db.View(ctx, func(tx kv.Tx) (err error) {
					rangeIndex := NewTxRangeIndex(db, kv.BorMilestoneEnds, tx)

					milestoneFrom, err = milestoneId(rangeIndex, blockFrom)

					if err != nil && !errors.Is(err, ErrMilestoneNotFound) {
						return err
					}

					milestoneTo, err = milestoneId(rangeIndex, blockTo)

					if err != nil && !errors.Is(err, ErrMilestoneNotFound) {
						return err
					}

					if milestoneFrom > 0 && blockFrom > 0 {
						if prevTo, err := milestoneId(rangeIndex, blockFrom-1); err == nil && prevTo == milestoneFrom {
							if prevTo == milestoneFrom {
								if prevTo == milestoneTo {
									milestoneFrom = 0
									milestoneTo = 0
								} else {
									milestoneFrom++
								}
							}
						}
					}

					return nil
				})

				if err != nil {
					return 0, err
				}

				return extractValueRange(ctx, kv.BorMilestones, uint64(milestoneFrom), uint64(milestoneTo), db, collect, workers, lvl, logger)
			}),
		[]snaptype.Index{Indexes.BorMilestoneId},
		snaptype.IndexBuilderFunc(
			func(ctx context.Context, sn snaptype.FileInfo, salt uint32, _ *chain.Config, tmpDir string, p *background.Progress, lvl log.Lvl, logger log.Logger) (err error) {
				d, err := seg.NewDecompressor(sn.Path)

				if err != nil {
					return err
				}
				defer d.Close()

				gg := d.MakeGetter()

				var firstMilestoneId uint64

				if gg.HasNext() {
					buf, _ := gg.Next(nil)
					if len(buf) > 0 {
						var firstMilestone Milestone
						if err = json.Unmarshal(buf, &firstMilestone); err != nil {
							return err
						}
						firstMilestoneId = uint64(firstMilestone.Id)
					}
				}

				return buildValueIndex(ctx, sn, salt, d, firstMilestoneId, tmpDir, p, lvl, logger)
			}),
	)
)
View Source
var APIVersion = &typesproto.VersionReply{Major: 1, Minor: 0, Patch: 0}
View Source
var Enums = struct {
	snaptype.Enums
	Events,
	Spans,
	Checkpoints,
	Milestones snaptype.Enum
}{
	Enums:       snaptype.Enums{},
	Events:      snaptype.MinBorEnum,
	Spans:       snaptype.MinBorEnum + 1,
	Checkpoints: snaptype.MinBorEnum + 2,
	Milestones:  snaptype.MinBorEnum + 3,
}
View Source
var ErrCheckpointNotFound = errors.New("checkpoint not found")
View Source
var ErrEventRecordNotFound = errors.New("event record not found")
View Source
var ErrMilestoneNotFound = errors.New("milestone not found")
View Source
var ErrSpanNotFound = errors.New("span not found")
View Source
var Indexes = struct {
	BorTxnHash,
	BorSpanId,
	BorCheckpointId,
	BorMilestoneId snaptype.Index
}{
	BorTxnHash:      snaptype.Index{Name: "borevents"},
	BorSpanId:       snaptype.Index{Name: "borspans"},
	BorCheckpointId: snaptype.Index{Name: "borcheckpoints"},
	BorMilestoneId:  snaptype.Index{Name: "bormilestones"},
}

Functions

func CalculateEventWindow

func CalculateEventWindow(ctx context.Context, config *borcfg.BorConfig, header *types.Header, tx kv.Getter, headerReader headerReader) (from time.Time, to time.Time, err error)

func CheckpointsEnabled

func CheckpointsEnabled() bool

func EventId

func EventId(encodedEvent rlp.RawValue) uint64

func EventTime

func EventTime(encodedEvent rlp.RawValue) time.Time

func Fetch

func Fetch[T any](ctx context.Context, request *Request, logger log.Logger) (*T, error)

Fetch fetches response from heimdall

func FetchWithRetry

func FetchWithRetry[T any](ctx context.Context, client *Client, url *url.URL, logger log.Logger) (*T, error)

FetchWithRetry returns data from heimdall with retry

func FetchWithRetryEx

func FetchWithRetryEx[T any](
	ctx context.Context,
	client *Client,
	url *url.URL,
	isRecoverableError func(error) bool,
	logger log.Logger,
) (result *T, err error)

FetchWithRetryEx returns data from heimdall with retry

func IsBlockInLastSprintOfSpan

func IsBlockInLastSprintOfSpan(blockNum uint64, config *borcfg.BorConfig) bool

IsBlockInLastSprintOfSpan returns true if a block num is within the last sprint of a span and false otherwise.

func MilestonesEnabled

func MilestonesEnabled() bool

func NewSpanSnapshotStore

func NewSpanSnapshotStore(base EntityStore[*Span], snapshots *RoSnapshots) *spanSnapshotStore

func RecordWayPoints

func RecordWayPoints(value bool)

func RemoteEventCheckForBlock

func RemoteEventCheckForBlock(header *types.Header, previousHeader *types.Header, chainId string, startEventId uint64, events []rlp.RawValue,
	heimdallClient HeimdallClient, config *borcfg.BorConfig, logger log.Logger) error

func SnapshotTypes

func SnapshotTypes() []snaptype.Type

func SpanEndBlockNum

func SpanEndBlockNum(spanId SpanId) uint64

SpanEndBlockNum returns the number of the last block in the given span.

func ValidateBorEvents

func ValidateBorEvents(ctx context.Context, config *borcfg.BorConfig, db kv.RoDB, blockReader blockReader, eventSegment *snapshotsync.VisibleSegment, prevEventId uint64, maxBlockNum uint64, failFast bool, logEvery *time.Ticker) (uint64, error)

Types

type BackendServer

type BackendServer struct {
	remoteproto.UnimplementedHeimdallBackendServer // must be embedded to have forward compatible implementations.
	// contains filtered or unexported fields
}

func NewBackendServer

func NewBackendServer(ctx context.Context, spanProducersReader spanProducersReader) *BackendServer

func (*BackendServer) Version

type Checkpoint

type Checkpoint struct {
	Id     CheckpointId
	Fields WaypointFields
}

Checkpoint defines a response object type of bor checkpoint

func (*Checkpoint) BlockNumRange

func (c *Checkpoint) BlockNumRange() ClosedRange

func (*Checkpoint) CmpRange

func (c *Checkpoint) CmpRange(n uint64) int

func (*Checkpoint) EndBlock

func (c *Checkpoint) EndBlock() *big.Int

func (*Checkpoint) Length

func (c *Checkpoint) Length() uint64

func (*Checkpoint) MarshalJSON

func (c *Checkpoint) MarshalJSON() ([]byte, error)

func (*Checkpoint) RawId

func (c *Checkpoint) RawId() uint64

func (*Checkpoint) RootHash

func (c *Checkpoint) RootHash() libcommon.Hash

func (*Checkpoint) SetRawId

func (c *Checkpoint) SetRawId(id uint64)

func (*Checkpoint) StartBlock

func (c *Checkpoint) StartBlock() *big.Int

func (*Checkpoint) String

func (c *Checkpoint) String() string

func (*Checkpoint) Timestamp

func (c *Checkpoint) Timestamp() uint64

func (*Checkpoint) UnmarshalJSON

func (c *Checkpoint) UnmarshalJSON(b []byte) error

type CheckpointCount

type CheckpointCount struct {
	Result int64 `json:"result"`
}

type CheckpointCountResponse

type CheckpointCountResponse struct {
	Height string          `json:"height"`
	Result CheckpointCount `json:"result"`
}

type CheckpointId

type CheckpointId uint64

type CheckpointListResponse

type CheckpointListResponse struct {
	Height string      `json:"height"`
	Result checkpoints `json:"result"`
}

type CheckpointResponse

type CheckpointResponse struct {
	Height string     `json:"height"`
	Result Checkpoint `json:"result"`
}

type Client

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

func NewHeimdallClient

func NewHeimdallClient(urlString string, logger log.Logger) *Client

func (*Client) Close

func (c *Client) Close()

Close sends a signal to stop the running process

func (*Client) FetchCheckpoint

func (c *Client) FetchCheckpoint(ctx context.Context, number int64) (*Checkpoint, error)

FetchCheckpoint fetches the checkpoint from heimdall

func (*Client) FetchCheckpointCount

func (c *Client) FetchCheckpointCount(ctx context.Context) (int64, error)

FetchCheckpointCount fetches the checkpoint count from heimdall

func (*Client) FetchCheckpoints

func (c *Client) FetchCheckpoints(ctx context.Context, page uint64, limit uint64) ([]*Checkpoint, error)

func (*Client) FetchFirstMilestoneNum

func (c *Client) FetchFirstMilestoneNum(ctx context.Context) (int64, error)

func (*Client) FetchLastNoAckMilestone

func (c *Client) FetchLastNoAckMilestone(ctx context.Context) (string, error)

FetchLastNoAckMilestone fetches the last no-ack-milestone from heimdall

func (*Client) FetchLatestSpan

func (c *Client) FetchLatestSpan(ctx context.Context) (*Span, error)

func (*Client) FetchMilestone

func (c *Client) FetchMilestone(ctx context.Context, number int64) (*Milestone, error)

FetchMilestone fetches a milestone from heimdall

func (*Client) FetchMilestoneCount

func (c *Client) FetchMilestoneCount(ctx context.Context) (int64, error)

FetchMilestoneCount fetches the milestone count from heimdall

func (*Client) FetchMilestoneID

func (c *Client) FetchMilestoneID(ctx context.Context, milestoneID string) error

FetchMilestoneID fetches the bool result from Heimdall whether the ID corresponding to the given milestone is in process in Heimdall

func (*Client) FetchNoAckMilestone

func (c *Client) FetchNoAckMilestone(ctx context.Context, milestoneID string) error

FetchNoAckMilestone fetches the last no-ack-milestone from heimdall

func (*Client) FetchSpan

func (c *Client) FetchSpan(ctx context.Context, spanID uint64) (*Span, error)

func (*Client) FetchSpans

func (c *Client) FetchSpans(ctx context.Context, page uint64, limit uint64) ([]*Span, error)

func (*Client) FetchStateSyncEvent

func (c *Client) FetchStateSyncEvent(ctx context.Context, id uint64) (*EventRecordWithTime, error)

func (*Client) FetchStateSyncEvents

func (c *Client) FetchStateSyncEvents(ctx context.Context, fromID uint64, to time.Time, limit int) ([]*EventRecordWithTime, error)

type ClosedRange

type ClosedRange struct {
	Start uint64
	End   uint64
}

func (ClosedRange) Len

func (r ClosedRange) Len() uint64

type Entity

type Entity interface {
	RawId() uint64
	BlockNumRange() ClosedRange
	SetRawId(uint64)
}

type EntityStore

type EntityStore[TEntity Entity] interface {
	Prepare(ctx context.Context) error
	Close()

	LastEntityId(ctx context.Context) (uint64, bool, error)
	LastFrozenEntityId() uint64
	LastEntity(ctx context.Context) (TEntity, bool, error)
	Entity(ctx context.Context, id uint64) (TEntity, bool, error)
	PutEntity(ctx context.Context, id uint64, entity TEntity) error

	EntityIdFromBlockNum(ctx context.Context, blockNum uint64) (uint64, bool, error)
	RangeFromBlockNum(ctx context.Context, startBlockNum uint64) ([]TEntity, error)
	DeleteToBlockNum(ctx context.Context, unwindPoint uint64, limit int) (int, error)
	DeleteFromBlockNum(ctx context.Context, unwindPoint uint64) (int, error)

	SnapType() snaptype.Type
}

type EventRangeExtractor

type EventRangeExtractor struct {
	EventsDb func() kv.RoDB
}

func (EventRangeExtractor) Extract

func (e EventRangeExtractor) Extract(ctx context.Context, blockFrom, blockTo uint64, firstEventId snaptype.FirstKeyGetter, chainDb kv.RoDB, chainConfig *chain.Config, collect func([]byte) error, workers int, lvl log.Lvl, logger log.Logger) (uint64, error)

type EventRecord

type EventRecord struct {
	ID       uint64            `json:"id" yaml:"id"`
	Contract libcommon.Address `json:"contract" yaml:"contract"`
	Data     hexutility.Bytes  `json:"data" yaml:"data"`
	TxHash   libcommon.Hash    `json:"tx_hash" yaml:"tx_hash"`
	LogIndex uint64            `json:"log_index" yaml:"log_index"`
	ChainID  string            `json:"bor_chain_id" yaml:"bor_chain_id"`
}

EventRecord represents state record

type EventRecordWithTime

type EventRecordWithTime struct {
	EventRecord
	Time time.Time `json:"record_time" yaml:"record_time"`
}

func (*EventRecordWithTime) BuildEventRecord

func (e *EventRecordWithTime) BuildEventRecord() *EventRecord

func (*EventRecordWithTime) MarshallBytes

func (e *EventRecordWithTime) MarshallBytes() ([]byte, error)

func (*EventRecordWithTime) MarshallIdBytes

func (e *EventRecordWithTime) MarshallIdBytes() []byte

func (*EventRecordWithTime) String

func (e *EventRecordWithTime) String() string

String returns the string representation of a state record

func (*EventRecordWithTime) UnmarshallBytes

func (e *EventRecordWithTime) UnmarshallBytes(v []byte) error

type HeimdallClient

type HeimdallClient interface {
	FetchStateSyncEvents(ctx context.Context, fromId uint64, to time.Time, limit int) ([]*EventRecordWithTime, error)
	FetchStateSyncEvent(ctx context.Context, id uint64) (*EventRecordWithTime, error)

	FetchLatestSpan(ctx context.Context) (*Span, error)
	FetchSpan(ctx context.Context, spanID uint64) (*Span, error)
	FetchSpans(ctx context.Context, page uint64, limit uint64) ([]*Span, error)

	FetchCheckpoint(ctx context.Context, number int64) (*Checkpoint, error)
	FetchCheckpointCount(ctx context.Context) (int64, error)
	FetchCheckpoints(ctx context.Context, page uint64, limit uint64) ([]*Checkpoint, error)

	FetchMilestone(ctx context.Context, number int64) (*Milestone, error)
	FetchMilestoneCount(ctx context.Context) (int64, error)
	FetchFirstMilestoneNum(ctx context.Context) (int64, error)

	// FetchNoAckMilestone fetches a bool value whether milestone corresponding to the given id failed in the Heimdall
	FetchNoAckMilestone(ctx context.Context, milestoneID string) error

	// FetchLastNoAckMilestone fetches the latest failed milestone id
	FetchLastNoAckMilestone(ctx context.Context) (string, error)

	// FetchMilestoneID fetches a bool value whether milestone corresponding to the given id is in process in Heimdall
	FetchMilestoneID(ctx context.Context, milestoneID string) error

	Close()
}

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
	CloseIdleConnections()
}

type MdbxStore

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

func NewDbStore

func NewDbStore(db kv.RoDB) *MdbxStore

func NewMdbxStore

func NewMdbxStore(logger log.Logger, dataDir string, roTxLimit int64) *MdbxStore

func (*MdbxStore) Checkpoints

func (s *MdbxStore) Checkpoints() EntityStore[*Checkpoint]

func (*MdbxStore) Close

func (s *MdbxStore) Close()

func (*MdbxStore) Milestones

func (s *MdbxStore) Milestones() EntityStore[*Milestone]

func (*MdbxStore) Prepare

func (s *MdbxStore) Prepare(ctx context.Context) error

func (*MdbxStore) SpanBlockProducerSelections

func (s *MdbxStore) SpanBlockProducerSelections() EntityStore[*SpanBlockProducerSelection]

func (*MdbxStore) Spans

func (s *MdbxStore) Spans() EntityStore[*Span]

type Milestone

type Milestone struct {
	Id          MilestoneId // numerical one that we assign in heimdall client
	MilestoneId string      // string based in original json response
	Fields      WaypointFields
}

Milestone defines a response object type of bor milestone

func (*Milestone) BlockNumRange

func (m *Milestone) BlockNumRange() ClosedRange

func (*Milestone) CmpRange

func (m *Milestone) CmpRange(n uint64) int

func (*Milestone) EndBlock

func (m *Milestone) EndBlock() *big.Int

func (*Milestone) Length

func (m *Milestone) Length() uint64

func (*Milestone) MarshalJSON

func (m *Milestone) MarshalJSON() ([]byte, error)

func (*Milestone) RawId

func (m *Milestone) RawId() uint64

func (*Milestone) RootHash

func (m *Milestone) RootHash() libcommon.Hash

func (*Milestone) SetRawId

func (m *Milestone) SetRawId(_ uint64)

func (*Milestone) StartBlock

func (m *Milestone) StartBlock() *big.Int

func (*Milestone) String

func (m *Milestone) String() string

func (*Milestone) Timestamp

func (m *Milestone) Timestamp() uint64

func (*Milestone) UnmarshalJSON

func (m *Milestone) UnmarshalJSON(b []byte) error

type MilestoneCount

type MilestoneCount struct {
	Count int64 `json:"count"`
}

type MilestoneCountResponse

type MilestoneCountResponse struct {
	Height string         `json:"height"`
	Result MilestoneCount `json:"result"`
}

type MilestoneID

type MilestoneID struct {
	Result bool `json:"result"`
}

type MilestoneIDResponse

type MilestoneIDResponse struct {
	Height string      `json:"height"`
	Result MilestoneID `json:"result"`
}

type MilestoneId

type MilestoneId uint64

type MilestoneLastNoAck

type MilestoneLastNoAck struct {
	Result string `json:"result"`
}

type MilestoneLastNoAckResponse

type MilestoneLastNoAckResponse struct {
	Height string             `json:"height"`
	Result MilestoneLastNoAck `json:"result"`
}

type MilestoneNoAck

type MilestoneNoAck struct {
	Result bool `json:"result"`
}

type MilestoneNoAckResponse

type MilestoneNoAckResponse struct {
	Height string         `json:"height"`
	Result MilestoneNoAck `json:"result"`
}

type MilestoneResponse

type MilestoneResponse struct {
	Height string    `json:"height"`
	Result Milestone `json:"result"`
}

type MockEntityStore

type MockEntityStore[TEntity Entity] struct {
	// contains filtered or unexported fields
}

MockEntityStore is a mock of EntityStore interface.

func NewMockEntityStore

func NewMockEntityStore[TEntity Entity](ctrl *gomock.Controller) *MockEntityStore[TEntity]

NewMockEntityStore creates a new mock instance.

func (*MockEntityStore[TEntity]) Close

func (m *MockEntityStore[TEntity]) Close()

Close mocks base method.

func (*MockEntityStore[TEntity]) DeleteFromBlockNum

func (m *MockEntityStore[TEntity]) DeleteFromBlockNum(ctx context.Context, blockNum uint64) (int, error)

EntityIdFromBlockNum mocks base method.

func (*MockEntityStore[TEntity]) DeleteToBlockNum

func (m *MockEntityStore[TEntity]) DeleteToBlockNum(ctx context.Context, blockNum uint64, limit int) (int, error)

EntityIdFromBlockNum mocks base method.

func (*MockEntityStore[TEntity]) EXPECT

func (m *MockEntityStore[TEntity]) EXPECT() *MockEntityStoreMockRecorder[TEntity]

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockEntityStore[TEntity]) Entity

func (m *MockEntityStore[TEntity]) Entity(ctx context.Context, id uint64) (TEntity, bool, error)

Entity mocks base method.

func (*MockEntityStore[TEntity]) EntityIdFromBlockNum

func (m *MockEntityStore[TEntity]) EntityIdFromBlockNum(ctx context.Context, blockNum uint64) (uint64, bool, error)

EntityIdFromBlockNum mocks base method.

func (*MockEntityStore[TEntity]) LastEntity

func (m *MockEntityStore[TEntity]) LastEntity(ctx context.Context) (TEntity, bool, error)

LastEntity mocks base method.

func (*MockEntityStore[TEntity]) LastEntityId

func (m *MockEntityStore[TEntity]) LastEntityId(ctx context.Context) (uint64, bool, error)

LastEntityId mocks base method.

func (*MockEntityStore[TEntity]) LastFrozenEntityId

func (m *MockEntityStore[TEntity]) LastFrozenEntityId() uint64

LastFrozenEntityId mocks base method.

func (*MockEntityStore[TEntity]) Prepare

func (m *MockEntityStore[TEntity]) Prepare(ctx context.Context) error

Prepare mocks base method.

func (*MockEntityStore[TEntity]) PutEntity

func (m *MockEntityStore[TEntity]) PutEntity(ctx context.Context, id uint64, entity TEntity) error

PutEntity mocks base method.

func (*MockEntityStore[TEntity]) RangeFromBlockNum

func (m *MockEntityStore[TEntity]) RangeFromBlockNum(ctx context.Context, startBlockNum uint64) ([]TEntity, error)

RangeFromBlockNum mocks base method.

func (*MockEntityStore[TEntity]) SnapType

func (m *MockEntityStore[TEntity]) SnapType() snaptype.Type

SnapType mocks base method.

type MockEntityStoreCloseCall

type MockEntityStoreCloseCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreCloseCall wrap *gomock.Call

func (*MockEntityStoreCloseCall[TEntity]) Do

func (c *MockEntityStoreCloseCall[TEntity]) Do(f func()) *MockEntityStoreCloseCall[TEntity]

Do rewrite *gomock.Call.Do

func (*MockEntityStoreCloseCall[TEntity]) DoAndReturn

func (c *MockEntityStoreCloseCall[TEntity]) DoAndReturn(f func()) *MockEntityStoreCloseCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreCloseCall[TEntity]) Return

func (c *MockEntityStoreCloseCall[TEntity]) Return() *MockEntityStoreCloseCall[TEntity]

Return rewrite *gomock.Call.Return

type MockEntityStoreDeleteFromBlockNumCall

type MockEntityStoreDeleteFromBlockNumCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreDeleteToBlockNumCall wrap *gomock.Call

func (*MockEntityStoreDeleteFromBlockNumCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockEntityStoreDeleteFromBlockNumCall[TEntity]) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreDeleteFromBlockNumCall[TEntity]) Return

Return rewrite *gomock.Call.Return

type MockEntityStoreDeleteToBlockNumCall

type MockEntityStoreDeleteToBlockNumCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreDeleteToBlockNumCall wrap *gomock.Call

func (*MockEntityStoreDeleteToBlockNumCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockEntityStoreDeleteToBlockNumCall[TEntity]) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreDeleteToBlockNumCall[TEntity]) Return

func (c *MockEntityStoreDeleteToBlockNumCall[TEntity]) Return(arg0 int, arg1 error) *MockEntityStoreDeleteToBlockNumCall[TEntity]

Return rewrite *gomock.Call.Return

type MockEntityStoreEntityCall

type MockEntityStoreEntityCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreEntityCall wrap *gomock.Call

func (*MockEntityStoreEntityCall[TEntity]) Do

func (c *MockEntityStoreEntityCall[TEntity]) Do(f func(context.Context, uint64) (TEntity, bool, error)) *MockEntityStoreEntityCall[TEntity]

Do rewrite *gomock.Call.Do

func (*MockEntityStoreEntityCall[TEntity]) DoAndReturn

func (c *MockEntityStoreEntityCall[TEntity]) DoAndReturn(f func(context.Context, uint64) (TEntity, bool, error)) *MockEntityStoreEntityCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreEntityCall[TEntity]) Return

func (c *MockEntityStoreEntityCall[TEntity]) Return(arg0 TEntity, arg1 bool, arg2 error) *MockEntityStoreEntityCall[TEntity]

Return rewrite *gomock.Call.Return

type MockEntityStoreEntityIdFromBlockNumCall

type MockEntityStoreEntityIdFromBlockNumCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreEntityIdFromBlockNumCall wrap *gomock.Call

func (*MockEntityStoreEntityIdFromBlockNumCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockEntityStoreEntityIdFromBlockNumCall[TEntity]) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreEntityIdFromBlockNumCall[TEntity]) Return

Return rewrite *gomock.Call.Return

type MockEntityStoreLastEntityCall

type MockEntityStoreLastEntityCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreLastEntityCall wrap *gomock.Call

func (*MockEntityStoreLastEntityCall[TEntity]) Do

func (c *MockEntityStoreLastEntityCall[TEntity]) Do(f func(context.Context) (TEntity, bool, error)) *MockEntityStoreLastEntityCall[TEntity]

Do rewrite *gomock.Call.Do

func (*MockEntityStoreLastEntityCall[TEntity]) DoAndReturn

func (c *MockEntityStoreLastEntityCall[TEntity]) DoAndReturn(f func(context.Context) (TEntity, bool, error)) *MockEntityStoreLastEntityCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreLastEntityCall[TEntity]) Return

func (c *MockEntityStoreLastEntityCall[TEntity]) Return(arg0 TEntity, arg1 bool, arg2 error) *MockEntityStoreLastEntityCall[TEntity]

Return rewrite *gomock.Call.Return

type MockEntityStoreLastEntityIdCall

type MockEntityStoreLastEntityIdCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreLastEntityIdCall wrap *gomock.Call

func (*MockEntityStoreLastEntityIdCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockEntityStoreLastEntityIdCall[TEntity]) DoAndReturn

func (c *MockEntityStoreLastEntityIdCall[TEntity]) DoAndReturn(f func(context.Context) (uint64, bool, error)) *MockEntityStoreLastEntityIdCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreLastEntityIdCall[TEntity]) Return

func (c *MockEntityStoreLastEntityIdCall[TEntity]) Return(arg0 uint64, arg1 bool, arg2 error) *MockEntityStoreLastEntityIdCall[TEntity]

Return rewrite *gomock.Call.Return

type MockEntityStoreLastFrozenEntityIdCall

type MockEntityStoreLastFrozenEntityIdCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreLastFrozenEntityIdCall wrap *gomock.Call

func (*MockEntityStoreLastFrozenEntityIdCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockEntityStoreLastFrozenEntityIdCall[TEntity]) DoAndReturn

func (c *MockEntityStoreLastFrozenEntityIdCall[TEntity]) DoAndReturn(f func() uint64) *MockEntityStoreLastFrozenEntityIdCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreLastFrozenEntityIdCall[TEntity]) Return

Return rewrite *gomock.Call.Return

type MockEntityStoreMockRecorder

type MockEntityStoreMockRecorder[TEntity Entity] struct {
	// contains filtered or unexported fields
}

MockEntityStoreMockRecorder is the mock recorder for MockEntityStore.

func (*MockEntityStoreMockRecorder[TEntity]) Close

func (mr *MockEntityStoreMockRecorder[TEntity]) Close() *MockEntityStoreCloseCall[TEntity]

Close indicates an expected call of Close.

func (*MockEntityStoreMockRecorder[TEntity]) DeleteFromBlockNum

func (mr *MockEntityStoreMockRecorder[TEntity]) DeleteFromBlockNum(ctx any, blockNum any) *MockEntityStoreDeleteFromBlockNumCall[TEntity]

DeleteFromBlockNum indicates an expected call of DeleteFromBlockNum.

func (*MockEntityStoreMockRecorder[TEntity]) DeleteToBlockNum

func (mr *MockEntityStoreMockRecorder[TEntity]) DeleteToBlockNum(ctx any, blockNum any, limit any) *MockEntityStoreDeleteToBlockNumCall[TEntity]

DeleteToBlockNum indicates an expected call of DeleteToBlockNum.

func (*MockEntityStoreMockRecorder[TEntity]) Entity

func (mr *MockEntityStoreMockRecorder[TEntity]) Entity(ctx, id any) *MockEntityStoreEntityCall[TEntity]

Entity indicates an expected call of Entity.

func (*MockEntityStoreMockRecorder[TEntity]) EntityIdFromBlockNum

func (mr *MockEntityStoreMockRecorder[TEntity]) EntityIdFromBlockNum(ctx any, blockNum any) *MockEntityStoreEntityIdFromBlockNumCall[TEntity]

EntityIdFromBlockNum indicates an expected call of EntityIdFromBlockNum.

func (*MockEntityStoreMockRecorder[TEntity]) LastEntity

func (mr *MockEntityStoreMockRecorder[TEntity]) LastEntity(ctx any) *MockEntityStoreLastEntityCall[TEntity]

LastEntity indicates an expected call of LastEntity.

func (*MockEntityStoreMockRecorder[TEntity]) LastEntityId

func (mr *MockEntityStoreMockRecorder[TEntity]) LastEntityId(ctx any) *MockEntityStoreLastEntityIdCall[TEntity]

LastEntityId indicates an expected call of LastEntityId.

func (*MockEntityStoreMockRecorder[TEntity]) LastFrozenEntityId

func (mr *MockEntityStoreMockRecorder[TEntity]) LastFrozenEntityId() *MockEntityStoreLastFrozenEntityIdCall[TEntity]

LastFrozenEntityId indicates an expected call of LastFrozenEntityId.

func (*MockEntityStoreMockRecorder[TEntity]) Prepare

func (mr *MockEntityStoreMockRecorder[TEntity]) Prepare(ctx any) *MockEntityStorePrepareCall[TEntity]

Prepare indicates an expected call of Prepare.

func (*MockEntityStoreMockRecorder[TEntity]) PutEntity

func (mr *MockEntityStoreMockRecorder[TEntity]) PutEntity(ctx, id, entity any) *MockEntityStorePutEntityCall[TEntity]

PutEntity indicates an expected call of PutEntity.

func (*MockEntityStoreMockRecorder[TEntity]) RangeFromBlockNum

func (mr *MockEntityStoreMockRecorder[TEntity]) RangeFromBlockNum(ctx, startBlockNum any) *MockEntityStoreRangeFromBlockNumCall[TEntity]

RangeFromBlockNum indicates an expected call of RangeFromBlockNum.

func (*MockEntityStoreMockRecorder[TEntity]) SnapType

func (mr *MockEntityStoreMockRecorder[TEntity]) SnapType() *MockEntityStoreSnapTypeCall[TEntity]

SnapType indicates an expected call of SnapType.

type MockEntityStorePrepareCall

type MockEntityStorePrepareCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStorePrepareCall wrap *gomock.Call

func (*MockEntityStorePrepareCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockEntityStorePrepareCall[TEntity]) DoAndReturn

func (c *MockEntityStorePrepareCall[TEntity]) DoAndReturn(f func(context.Context) error) *MockEntityStorePrepareCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStorePrepareCall[TEntity]) Return

func (c *MockEntityStorePrepareCall[TEntity]) Return(arg0 error) *MockEntityStorePrepareCall[TEntity]

Return rewrite *gomock.Call.Return

type MockEntityStorePutEntityCall

type MockEntityStorePutEntityCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStorePutEntityCall wrap *gomock.Call

func (*MockEntityStorePutEntityCall[TEntity]) Do

func (c *MockEntityStorePutEntityCall[TEntity]) Do(f func(context.Context, uint64, TEntity) error) *MockEntityStorePutEntityCall[TEntity]

Do rewrite *gomock.Call.Do

func (*MockEntityStorePutEntityCall[TEntity]) DoAndReturn

func (c *MockEntityStorePutEntityCall[TEntity]) DoAndReturn(f func(context.Context, uint64, TEntity) error) *MockEntityStorePutEntityCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStorePutEntityCall[TEntity]) Return

func (c *MockEntityStorePutEntityCall[TEntity]) Return(arg0 error) *MockEntityStorePutEntityCall[TEntity]

Return rewrite *gomock.Call.Return

type MockEntityStoreRangeFromBlockNumCall

type MockEntityStoreRangeFromBlockNumCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreRangeFromBlockNumCall wrap *gomock.Call

func (*MockEntityStoreRangeFromBlockNumCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockEntityStoreRangeFromBlockNumCall[TEntity]) DoAndReturn

func (c *MockEntityStoreRangeFromBlockNumCall[TEntity]) DoAndReturn(f func(context.Context, uint64) ([]TEntity, error)) *MockEntityStoreRangeFromBlockNumCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreRangeFromBlockNumCall[TEntity]) Return

func (c *MockEntityStoreRangeFromBlockNumCall[TEntity]) Return(arg0 []TEntity, arg1 error) *MockEntityStoreRangeFromBlockNumCall[TEntity]

Return rewrite *gomock.Call.Return

type MockEntityStoreSnapTypeCall

type MockEntityStoreSnapTypeCall[TEntity Entity] struct {
	*gomock.Call
}

MockEntityStoreSnapTypeCall wrap *gomock.Call

func (*MockEntityStoreSnapTypeCall[TEntity]) Do

func (c *MockEntityStoreSnapTypeCall[TEntity]) Do(f func() snaptype.Type) *MockEntityStoreSnapTypeCall[TEntity]

Do rewrite *gomock.Call.Do

func (*MockEntityStoreSnapTypeCall[TEntity]) DoAndReturn

func (c *MockEntityStoreSnapTypeCall[TEntity]) DoAndReturn(f func() snaptype.Type) *MockEntityStoreSnapTypeCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockEntityStoreSnapTypeCall[TEntity]) Return

func (c *MockEntityStoreSnapTypeCall[TEntity]) Return(arg0 snaptype.Type) *MockEntityStoreSnapTypeCall[TEntity]

Return rewrite *gomock.Call.Return

type MockHeimdallClient

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

MockHeimdallClient is a mock of HeimdallClient interface.

func NewMockHeimdallClient

func NewMockHeimdallClient(ctrl *gomock.Controller) *MockHeimdallClient

NewMockHeimdallClient creates a new mock instance.

func (*MockHeimdallClient) Close

func (m *MockHeimdallClient) Close()

Close mocks base method.

func (*MockHeimdallClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHeimdallClient) FetchCheckpoint

func (m *MockHeimdallClient) FetchCheckpoint(ctx context.Context, number int64) (*Checkpoint, error)

FetchCheckpoint mocks base method.

func (*MockHeimdallClient) FetchCheckpointCount

func (m *MockHeimdallClient) FetchCheckpointCount(ctx context.Context) (int64, error)

FetchCheckpointCount mocks base method.

func (*MockHeimdallClient) FetchCheckpoints

func (m *MockHeimdallClient) FetchCheckpoints(ctx context.Context, page, limit uint64) ([]*Checkpoint, error)

FetchCheckpoints mocks base method.

func (*MockHeimdallClient) FetchFirstMilestoneNum

func (m *MockHeimdallClient) FetchFirstMilestoneNum(ctx context.Context) (int64, error)

FetchFirstMilestoneNum mocks base method.

func (*MockHeimdallClient) FetchLastNoAckMilestone

func (m *MockHeimdallClient) FetchLastNoAckMilestone(ctx context.Context) (string, error)

FetchLastNoAckMilestone mocks base method.

func (*MockHeimdallClient) FetchLatestSpan

func (m *MockHeimdallClient) FetchLatestSpan(ctx context.Context) (*Span, error)

FetchLatestSpan mocks base method.

func (*MockHeimdallClient) FetchMilestone

func (m *MockHeimdallClient) FetchMilestone(ctx context.Context, number int64) (*Milestone, error)

FetchMilestone mocks base method.

func (*MockHeimdallClient) FetchMilestoneCount

func (m *MockHeimdallClient) FetchMilestoneCount(ctx context.Context) (int64, error)

FetchMilestoneCount mocks base method.

func (*MockHeimdallClient) FetchMilestoneID

func (m *MockHeimdallClient) FetchMilestoneID(ctx context.Context, milestoneID string) error

FetchMilestoneID mocks base method.

func (*MockHeimdallClient) FetchNoAckMilestone

func (m *MockHeimdallClient) FetchNoAckMilestone(ctx context.Context, milestoneID string) error

FetchNoAckMilestone mocks base method.

func (*MockHeimdallClient) FetchSpan

func (m *MockHeimdallClient) FetchSpan(ctx context.Context, spanID uint64) (*Span, error)

FetchSpan mocks base method.

func (*MockHeimdallClient) FetchSpans

func (m *MockHeimdallClient) FetchSpans(ctx context.Context, page, limit uint64) ([]*Span, error)

FetchSpans mocks base method.

func (*MockHeimdallClient) FetchStateSyncEvent

func (m *MockHeimdallClient) FetchStateSyncEvent(ctx context.Context, id uint64) (*EventRecordWithTime, error)

FetchStateSyncEvent mocks base method.

func (*MockHeimdallClient) FetchStateSyncEvents

func (m *MockHeimdallClient) FetchStateSyncEvents(ctx context.Context, fromId uint64, to time.Time, limit int) ([]*EventRecordWithTime, error)

FetchStateSyncEvents mocks base method.

type MockHeimdallClientCloseCall

type MockHeimdallClientCloseCall struct {
	*gomock.Call
}

MockHeimdallClientCloseCall wrap *gomock.Call

func (*MockHeimdallClientCloseCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientCloseCall) DoAndReturn

func (c *MockHeimdallClientCloseCall) DoAndReturn(f func()) *MockHeimdallClientCloseCall

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientCloseCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchCheckpointCall

type MockHeimdallClientFetchCheckpointCall struct {
	*gomock.Call
}

MockHeimdallClientFetchCheckpointCall wrap *gomock.Call

func (*MockHeimdallClientFetchCheckpointCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchCheckpointCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchCheckpointCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchCheckpointCountCall

type MockHeimdallClientFetchCheckpointCountCall struct {
	*gomock.Call
}

MockHeimdallClientFetchCheckpointCountCall wrap *gomock.Call

func (*MockHeimdallClientFetchCheckpointCountCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchCheckpointCountCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchCheckpointCountCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchCheckpointsCall

type MockHeimdallClientFetchCheckpointsCall struct {
	*gomock.Call
}

MockHeimdallClientFetchCheckpointsCall wrap *gomock.Call

func (*MockHeimdallClientFetchCheckpointsCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchCheckpointsCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchCheckpointsCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchFirstMilestoneNumCall

type MockHeimdallClientFetchFirstMilestoneNumCall struct {
	*gomock.Call
}

MockHeimdallClientFetchFirstMilestoneNumCall wrap *gomock.Call

func (*MockHeimdallClientFetchFirstMilestoneNumCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchFirstMilestoneNumCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchFirstMilestoneNumCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchLastNoAckMilestoneCall

type MockHeimdallClientFetchLastNoAckMilestoneCall struct {
	*gomock.Call
}

MockHeimdallClientFetchLastNoAckMilestoneCall wrap *gomock.Call

func (*MockHeimdallClientFetchLastNoAckMilestoneCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchLastNoAckMilestoneCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchLastNoAckMilestoneCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchLatestSpanCall

type MockHeimdallClientFetchLatestSpanCall struct {
	*gomock.Call
}

MockHeimdallClientFetchLatestSpanCall wrap *gomock.Call

func (*MockHeimdallClientFetchLatestSpanCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchLatestSpanCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchLatestSpanCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchMilestoneCall

type MockHeimdallClientFetchMilestoneCall struct {
	*gomock.Call
}

MockHeimdallClientFetchMilestoneCall wrap *gomock.Call

func (*MockHeimdallClientFetchMilestoneCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchMilestoneCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchMilestoneCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchMilestoneCountCall

type MockHeimdallClientFetchMilestoneCountCall struct {
	*gomock.Call
}

MockHeimdallClientFetchMilestoneCountCall wrap *gomock.Call

func (*MockHeimdallClientFetchMilestoneCountCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchMilestoneCountCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchMilestoneCountCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchMilestoneIDCall

type MockHeimdallClientFetchMilestoneIDCall struct {
	*gomock.Call
}

MockHeimdallClientFetchMilestoneIDCall wrap *gomock.Call

func (*MockHeimdallClientFetchMilestoneIDCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchMilestoneIDCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchMilestoneIDCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchNoAckMilestoneCall

type MockHeimdallClientFetchNoAckMilestoneCall struct {
	*gomock.Call
}

MockHeimdallClientFetchNoAckMilestoneCall wrap *gomock.Call

func (*MockHeimdallClientFetchNoAckMilestoneCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchNoAckMilestoneCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchNoAckMilestoneCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchSpanCall

type MockHeimdallClientFetchSpanCall struct {
	*gomock.Call
}

MockHeimdallClientFetchSpanCall wrap *gomock.Call

func (*MockHeimdallClientFetchSpanCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchSpanCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchSpanCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchSpansCall

type MockHeimdallClientFetchSpansCall struct {
	*gomock.Call
}

MockHeimdallClientFetchSpansCall wrap *gomock.Call

func (*MockHeimdallClientFetchSpansCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchSpansCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchSpansCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchStateSyncEventCall

type MockHeimdallClientFetchStateSyncEventCall struct {
	*gomock.Call
}

MockHeimdallClientFetchStateSyncEventCall wrap *gomock.Call

func (*MockHeimdallClientFetchStateSyncEventCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchStateSyncEventCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchStateSyncEventCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientFetchStateSyncEventsCall

type MockHeimdallClientFetchStateSyncEventsCall struct {
	*gomock.Call
}

MockHeimdallClientFetchStateSyncEventsCall wrap *gomock.Call

func (*MockHeimdallClientFetchStateSyncEventsCall) Do

Do rewrite *gomock.Call.Do

func (*MockHeimdallClientFetchStateSyncEventsCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHeimdallClientFetchStateSyncEventsCall) Return

Return rewrite *gomock.Call.Return

type MockHeimdallClientMockRecorder

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

MockHeimdallClientMockRecorder is the mock recorder for MockHeimdallClient.

func (*MockHeimdallClientMockRecorder) Close

Close indicates an expected call of Close.

func (*MockHeimdallClientMockRecorder) FetchCheckpoint

FetchCheckpoint indicates an expected call of FetchCheckpoint.

func (*MockHeimdallClientMockRecorder) FetchCheckpointCount

FetchCheckpointCount indicates an expected call of FetchCheckpointCount.

func (*MockHeimdallClientMockRecorder) FetchCheckpoints

func (mr *MockHeimdallClientMockRecorder) FetchCheckpoints(ctx, page, limit any) *MockHeimdallClientFetchCheckpointsCall

FetchCheckpoints indicates an expected call of FetchCheckpoints.

func (*MockHeimdallClientMockRecorder) FetchFirstMilestoneNum

FetchFirstMilestoneNum indicates an expected call of FetchFirstMilestoneNum.

func (*MockHeimdallClientMockRecorder) FetchLastNoAckMilestone

FetchLastNoAckMilestone indicates an expected call of FetchLastNoAckMilestone.

func (*MockHeimdallClientMockRecorder) FetchLatestSpan

FetchLatestSpan indicates an expected call of FetchLatestSpan.

func (*MockHeimdallClientMockRecorder) FetchMilestone

FetchMilestone indicates an expected call of FetchMilestone.

func (*MockHeimdallClientMockRecorder) FetchMilestoneCount

FetchMilestoneCount indicates an expected call of FetchMilestoneCount.

func (*MockHeimdallClientMockRecorder) FetchMilestoneID

func (mr *MockHeimdallClientMockRecorder) FetchMilestoneID(ctx, milestoneID any) *MockHeimdallClientFetchMilestoneIDCall

FetchMilestoneID indicates an expected call of FetchMilestoneID.

func (*MockHeimdallClientMockRecorder) FetchNoAckMilestone

func (mr *MockHeimdallClientMockRecorder) FetchNoAckMilestone(ctx, milestoneID any) *MockHeimdallClientFetchNoAckMilestoneCall

FetchNoAckMilestone indicates an expected call of FetchNoAckMilestone.

func (*MockHeimdallClientMockRecorder) FetchSpan

FetchSpan indicates an expected call of FetchSpan.

func (*MockHeimdallClientMockRecorder) FetchSpans

func (mr *MockHeimdallClientMockRecorder) FetchSpans(ctx, page, limit any) *MockHeimdallClientFetchSpansCall

FetchSpans indicates an expected call of FetchSpans.

func (*MockHeimdallClientMockRecorder) FetchStateSyncEvent

FetchStateSyncEvent indicates an expected call of FetchStateSyncEvent.

func (*MockHeimdallClientMockRecorder) FetchStateSyncEvents

func (mr *MockHeimdallClientMockRecorder) FetchStateSyncEvents(ctx, fromId, to, limit any) *MockHeimdallClientFetchStateSyncEventsCall

FetchStateSyncEvents indicates an expected call of FetchStateSyncEvents.

type MockHttpClient

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

MockHttpClient is a mock of HttpClient interface.

func NewMockHttpClient

func NewMockHttpClient(ctrl *gomock.Controller) *MockHttpClient

NewMockHttpClient creates a new mock instance.

func (*MockHttpClient) CloseIdleConnections

func (m *MockHttpClient) CloseIdleConnections()

CloseIdleConnections mocks base method.

func (*MockHttpClient) Do

func (m *MockHttpClient) Do(req *http.Request) (*http.Response, error)

Do mocks base method.

func (*MockHttpClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockHttpClientCloseIdleConnectionsCall

type MockHttpClientCloseIdleConnectionsCall struct {
	*gomock.Call
}

MockHttpClientCloseIdleConnectionsCall wrap *gomock.Call

func (*MockHttpClientCloseIdleConnectionsCall) Do

Do rewrite *gomock.Call.Do

func (*MockHttpClientCloseIdleConnectionsCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHttpClientCloseIdleConnectionsCall) Return

Return rewrite *gomock.Call.Return

type MockHttpClientDoCall

type MockHttpClientDoCall struct {
	*gomock.Call
}

MockHttpClientDoCall wrap *gomock.Call

func (*MockHttpClientDoCall) Do

Do rewrite *gomock.Call.Do

func (*MockHttpClientDoCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHttpClientDoCall) Return

Return rewrite *gomock.Call.Return

type MockHttpClientMockRecorder

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

MockHttpClientMockRecorder is the mock recorder for MockHttpClient.

func (*MockHttpClientMockRecorder) CloseIdleConnections

CloseIdleConnections indicates an expected call of CloseIdleConnections.

func (*MockHttpClientMockRecorder) Do

Do indicates an expected call of Do.

type MockentityFetcher

type MockentityFetcher[TEntity Entity] struct {
	// contains filtered or unexported fields
}

MockentityFetcher is a mock of entityFetcher interface.

func NewMockentityFetcher

func NewMockentityFetcher[TEntity Entity](ctrl *gomock.Controller) *MockentityFetcher[TEntity]

NewMockentityFetcher creates a new mock instance.

func (*MockentityFetcher[TEntity]) EXPECT

func (m *MockentityFetcher[TEntity]) EXPECT() *MockentityFetcherMockRecorder[TEntity]

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockentityFetcher[TEntity]) FetchAllEntities

func (m *MockentityFetcher[TEntity]) FetchAllEntities(ctx context.Context) ([]TEntity, error)

FetchAllEntities mocks base method.

func (*MockentityFetcher[TEntity]) FetchEntitiesRange

func (m *MockentityFetcher[TEntity]) FetchEntitiesRange(ctx context.Context, idRange ClosedRange) ([]TEntity, error)

FetchEntitiesRange mocks base method.

func (*MockentityFetcher[TEntity]) FetchEntityIdRange

func (m *MockentityFetcher[TEntity]) FetchEntityIdRange(ctx context.Context) (ClosedRange, error)

FetchEntityIdRange mocks base method.

type MockentityFetcherFetchAllEntitiesCall

type MockentityFetcherFetchAllEntitiesCall[TEntity Entity] struct {
	*gomock.Call
}

MockentityFetcherFetchAllEntitiesCall wrap *gomock.Call

func (*MockentityFetcherFetchAllEntitiesCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockentityFetcherFetchAllEntitiesCall[TEntity]) DoAndReturn

func (c *MockentityFetcherFetchAllEntitiesCall[TEntity]) DoAndReturn(f func(context.Context) ([]TEntity, error)) *MockentityFetcherFetchAllEntitiesCall[TEntity]

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockentityFetcherFetchAllEntitiesCall[TEntity]) Return

func (c *MockentityFetcherFetchAllEntitiesCall[TEntity]) Return(arg0 []TEntity, arg1 error) *MockentityFetcherFetchAllEntitiesCall[TEntity]

Return rewrite *gomock.Call.Return

type MockentityFetcherFetchEntitiesRangeCall

type MockentityFetcherFetchEntitiesRangeCall[TEntity Entity] struct {
	*gomock.Call
}

MockentityFetcherFetchEntitiesRangeCall wrap *gomock.Call

func (*MockentityFetcherFetchEntitiesRangeCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockentityFetcherFetchEntitiesRangeCall[TEntity]) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockentityFetcherFetchEntitiesRangeCall[TEntity]) Return

func (c *MockentityFetcherFetchEntitiesRangeCall[TEntity]) Return(arg0 []TEntity, arg1 error) *MockentityFetcherFetchEntitiesRangeCall[TEntity]

Return rewrite *gomock.Call.Return

type MockentityFetcherFetchEntityIdRangeCall

type MockentityFetcherFetchEntityIdRangeCall[TEntity Entity] struct {
	*gomock.Call
}

MockentityFetcherFetchEntityIdRangeCall wrap *gomock.Call

func (*MockentityFetcherFetchEntityIdRangeCall[TEntity]) Do

Do rewrite *gomock.Call.Do

func (*MockentityFetcherFetchEntityIdRangeCall[TEntity]) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockentityFetcherFetchEntityIdRangeCall[TEntity]) Return

Return rewrite *gomock.Call.Return

type MockentityFetcherMockRecorder

type MockentityFetcherMockRecorder[TEntity Entity] struct {
	// contains filtered or unexported fields
}

MockentityFetcherMockRecorder is the mock recorder for MockentityFetcher.

func (*MockentityFetcherMockRecorder[TEntity]) FetchAllEntities

func (mr *MockentityFetcherMockRecorder[TEntity]) FetchAllEntities(ctx any) *MockentityFetcherFetchAllEntitiesCall[TEntity]

FetchAllEntities indicates an expected call of FetchAllEntities.

func (*MockentityFetcherMockRecorder[TEntity]) FetchEntitiesRange

func (mr *MockentityFetcherMockRecorder[TEntity]) FetchEntitiesRange(ctx, idRange any) *MockentityFetcherFetchEntitiesRangeCall[TEntity]

FetchEntitiesRange indicates an expected call of FetchEntitiesRange.

func (*MockentityFetcherMockRecorder[TEntity]) FetchEntityIdRange

func (mr *MockentityFetcherMockRecorder[TEntity]) FetchEntityIdRange(ctx any) *MockentityFetcherFetchEntityIdRangeCall[TEntity]

FetchEntityIdRange indicates an expected call of FetchEntityIdRange.

type NoopEntityStore

type NoopEntityStore[TEntity Entity] struct {
	Type snaptype.Type
}

func (NoopEntityStore[TEntity]) Close

func (NoopEntityStore[TEntity]) Close()

func (NoopEntityStore[TEntity]) DeleteFromBlockNum

func (NoopEntityStore[TEntity]) DeleteFromBlockNum(ctx context.Context, unwindPoint uint64) (int, error)

func (NoopEntityStore[TEntity]) DeleteToBlockNum

func (NoopEntityStore[TEntity]) DeleteToBlockNum(ctx context.Context, unwindPoint uint64, limit int) (int, error)

func (NoopEntityStore[TEntity]) Entity

func (NoopEntityStore[TEntity]) Entity(ctx context.Context, id uint64) (TEntity, bool, error)

func (NoopEntityStore[TEntity]) EntityIdFromBlockNum

func (NoopEntityStore[TEntity]) EntityIdFromBlockNum(ctx context.Context, blockNum uint64) (uint64, bool, error)

func (NoopEntityStore[TEntity]) LastEntity

func (NoopEntityStore[TEntity]) LastEntity(ctx context.Context) (TEntity, bool, error)

func (NoopEntityStore[TEntity]) LastEntityId

func (NoopEntityStore[TEntity]) LastEntityId(ctx context.Context) (uint64, bool, error)

func (NoopEntityStore[TEntity]) LastFrozenEntityId

func (NoopEntityStore[TEntity]) LastFrozenEntityId() uint64

func (NoopEntityStore[TEntity]) Prepare

func (NoopEntityStore[TEntity]) Prepare(ctx context.Context) error

func (NoopEntityStore[TEntity]) PutEntity

func (NoopEntityStore[TEntity]) PutEntity(ctx context.Context, id uint64, entity TEntity) error

func (NoopEntityStore[TEntity]) RangeFromBlockNum

func (NoopEntityStore[TEntity]) RangeFromBlockNum(ctx context.Context, startBlockNum uint64) ([]TEntity, error)

func (NoopEntityStore[TEntity]) SnapType

func (ns NoopEntityStore[TEntity]) SnapType() snaptype.Type

type ObserverOption

type ObserverOption func(opts *ObserverOptions)

func WithEventsLimit

func WithEventsLimit(eventsLimit int) ObserverOption

type ObserverOptions

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

func NewObserverOptions

func NewObserverOptions(opts ...ObserverOption) ObserverOptions

type RangeIndex

type RangeIndex interface {
	Lookup(ctx context.Context, blockNum uint64) (uint64, bool, error)
}

func NewRangeIndex

func NewRangeIndex(db *polygoncommon.Database, table string) RangeIndex

func NewTxRangeIndex

func NewTxRangeIndex(db kv.RoDB, table string, tx kv.Tx) RangeIndex

type RangeIndexFactory

type RangeIndexFactory func(ctx context.Context) (*RangeIndex, error)

type RangeIndexFunc

type RangeIndexFunc func(ctx context.Context, blockNum uint64) (uint64, bool, error)

func (RangeIndexFunc) Lookup

func (f RangeIndexFunc) Lookup(ctx context.Context, blockNum uint64) (uint64, bool, error)

type RangeIndexer

type RangeIndexer interface {
	RangeIndex
	Put(ctx context.Context, r ClosedRange, id uint64) error
}

type Reader

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

func AssembleReader

func AssembleReader(ctx context.Context, config ReaderConfig) (*Reader, error)

AssembleReader creates and opens the MDBX store. For use cases where the store is only being read from. Must call Close.

func NewReader

func NewReader(borConfig *borcfg.BorConfig, store Store, logger log.Logger) *Reader

func (*Reader) CheckpointsFromBlock

func (r *Reader) CheckpointsFromBlock(ctx context.Context, startBlock uint64) ([]*Checkpoint, error)

func (*Reader) Close

func (r *Reader) Close()

func (*Reader) MilestonesFromBlock

func (r *Reader) MilestonesFromBlock(ctx context.Context, startBlock uint64) ([]*Milestone, error)

func (*Reader) Prepare

func (r *Reader) Prepare(ctx context.Context) error

func (*Reader) Producers

func (r *Reader) Producers(ctx context.Context, blockNum uint64) (*valset.ValidatorSet, error)

func (*Reader) Span

func (r *Reader) Span(ctx context.Context, id uint64) (*Span, bool, error)

type ReaderConfig

type ReaderConfig struct {
	Store     Store
	BorConfig *borcfg.BorConfig
	DataDir   string
	Logger    log.Logger
}

type RemoteReader

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

func NewRemoteReader

func NewRemoteReader(client remote.HeimdallBackendClient) *RemoteReader

func (*RemoteReader) Close

func (r *RemoteReader) Close()

Close implements bridge.ReaderService. It's a noop as there is no attached store.

func (*RemoteReader) EnsureVersionCompatibility

func (r *RemoteReader) EnsureVersionCompatibility() bool

func (*RemoteReader) Producers

func (r *RemoteReader) Producers(ctx context.Context, blockNum uint64) (*valset.ValidatorSet, error)

type Request

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

type RoSnapshots

type RoSnapshots struct {
	snapshotsync.RoSnapshots
}

func NewRoSnapshots

func NewRoSnapshots(cfg ethconfig.BlocksFreezing, snapDir string, segmentsMin uint64, logger log.Logger) *RoSnapshots

NewBorRoSnapshots - opens all bor snapshots. But to simplify everything:

  • it opens snapshots only on App start and immutable after
  • all snapshots of given blocks range must exist - to make this blocks range available
  • gaps are not allowed
  • segment have [from:to] semantic

func (*RoSnapshots) Ranges

func (s *RoSnapshots) Ranges() []snapshotsync.Range

func (*RoSnapshots) View

func (s *RoSnapshots) View() *View

type Service

type Service interface {
	Span(ctx context.Context, id uint64) (*Span, bool, error)
	CheckpointsFromBlock(ctx context.Context, startBlock uint64) ([]*Checkpoint, error)
	MilestonesFromBlock(ctx context.Context, startBlock uint64) ([]*Milestone, error)
	Producers(ctx context.Context, blockNum uint64) (*valset.ValidatorSet, error)
	RegisterMilestoneObserver(callback func(*Milestone), opts ...ObserverOption) polygoncommon.UnregisterFunc
	Run(ctx context.Context) error
	SynchronizeCheckpoints(ctx context.Context) (latest *Checkpoint, err error)
	SynchronizeMilestones(ctx context.Context) (latest *Milestone, err error)
	SynchronizeSpans(ctx context.Context, blockNum uint64) error
	Ready(ctx context.Context) <-chan error
}

func AssembleService

func AssembleService(config ServiceConfig) Service

func NewService

func NewService(borConfig *borcfg.BorConfig, client HeimdallClient, store Store, logger log.Logger) Service

type ServiceConfig

type ServiceConfig struct {
	Store       Store
	BorConfig   *borcfg.BorConfig
	HeimdallURL string
	Logger      log.Logger
}

type SnapshotStore

type SnapshotStore struct {
	Store
	// contains filtered or unexported fields
}

func NewSnapshotStore

func NewSnapshotStore(base Store, snapshots *RoSnapshots) *SnapshotStore

func (*SnapshotStore) Checkpoints

func (s *SnapshotStore) Checkpoints() EntityStore[*Checkpoint]

func (*SnapshotStore) Milestones

func (s *SnapshotStore) Milestones() EntityStore[*Milestone]

func (*SnapshotStore) Prepare

func (s *SnapshotStore) Prepare(ctx context.Context) error

func (*SnapshotStore) SpanBlockProducerSelections

func (s *SnapshotStore) SpanBlockProducerSelections() EntityStore[*SpanBlockProducerSelection]

func (*SnapshotStore) Spans

func (s *SnapshotStore) Spans() EntityStore[*Span]

type Span

type Span struct {
	Id                SpanId              `json:"span_id" yaml:"span_id"`
	StartBlock        uint64              `json:"start_block" yaml:"start_block"`
	EndBlock          uint64              `json:"end_block" yaml:"end_block"`
	ValidatorSet      valset.ValidatorSet `json:"validator_set,omitempty" yaml:"validator_set"`
	SelectedProducers []valset.Validator  `json:"selected_producers,omitempty" yaml:"selected_producers"`
	ChainID           string              `json:"bor_chain_id,omitempty" yaml:"bor_chain_id"`
}

func (*Span) BlockNumRange

func (s *Span) BlockNumRange() ClosedRange

func (*Span) CmpRange

func (s *Span) CmpRange(n uint64) int

func (*Span) Less

func (s *Span) Less(other btree.Item) bool

func (*Span) Producers

func (s *Span) Producers() []*valset.Validator

func (*Span) RawId

func (s *Span) RawId() uint64

func (*Span) SetRawId

func (s *Span) SetRawId(_ uint64)

type SpanBlockProducerSelection

type SpanBlockProducerSelection struct {
	SpanId     SpanId
	StartBlock uint64
	EndBlock   uint64
	Producers  *valset.ValidatorSet
}

SpanBlockProducerSelection represents the block producer selection at each epoch with their corresponding accumulated ProposerPriority.

In the context of the bor chain, an epoch is equal to 1 span, while in the context of the heimdall chain, an epoch is equal to 1 checkpoint. This data type aims to make this distinction a bit more visible and is intended to be used specifically for span based epochs.

The difference between SpanBlockProducerSelection and Span.SelectedProducers is that SpanBlockProducerSelection contains the correct accumulated ProposerPriority for each selected producer, while Span.SelectedProducers always has ProposerPriority=0.

This is because the heimdall/bor/span/<spanId> API only tells us what the "frozen" selected producers for the next span epoch are. More info about how that works can be found in the "FreezeSet" logic in heimdall at https://github.com/maticnetwork/heimdall/tree/master/bor#how-does-it-work.

However, to correctly calculate the accumulated proposer priorities, one has to start from span zero, create a valset.ValidatorSet, call IncrementProposerPriority(spanSprintCount) and at every next span call bor.GetUpdatedValidatorSet(oldValidatorSet, span.SelectedProducers) and repeat.

func (*SpanBlockProducerSelection) BlockNumRange

func (s *SpanBlockProducerSelection) BlockNumRange() ClosedRange

func (*SpanBlockProducerSelection) CmpRange

func (s *SpanBlockProducerSelection) CmpRange(n uint64) int

func (*SpanBlockProducerSelection) RawId

func (*SpanBlockProducerSelection) SetRawId

func (s *SpanBlockProducerSelection) SetRawId(id uint64)

type SpanId

type SpanId uint64

func SpanIdAt

func SpanIdAt(blockNum uint64) SpanId

SpanIdAt returns the corresponding span id for the given block number.

type SpanListResponse

type SpanListResponse struct {
	Height string `json:"height"`
	Result spans  `json:"result"`
}

type SpanResponse

type SpanResponse struct {
	Height string `json:"height"`
	Result Span   `json:"result"`
}

type StateSyncEventResponse

type StateSyncEventResponse struct {
	Height string              `json:"height"`
	Result EventRecordWithTime `json:"result"`
}

type StateSyncEventsResponse

type StateSyncEventsResponse struct {
	Height string                 `json:"height"`
	Result []*EventRecordWithTime `json:"result"`
}

type Store

type Store interface {
	Checkpoints() EntityStore[*Checkpoint]
	Milestones() EntityStore[*Milestone]
	Spans() EntityStore[*Span]
	SpanBlockProducerSelections() EntityStore[*SpanBlockProducerSelection]
	Prepare(ctx context.Context) error
	Close()
}

type TransactionalRangeIndex

type TransactionalRangeIndex interface {
	RangeIndex
	WithTx(tx kv.Tx) RangeIndex
}

type View

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

func (*View) Checkpoints

func (v *View) Checkpoints() []*snapshotsync.VisibleSegment

func (*View) Close

func (v *View) Close()

func (*View) Events

func (v *View) Events() []*snapshotsync.VisibleSegment

func (*View) EventsSegment

func (v *View) EventsSegment(blockNum uint64) (*snapshotsync.VisibleSegment, bool)

func (*View) Milestones

func (v *View) Milestones() []*snapshotsync.VisibleSegment

func (*View) Spans

func (v *View) Spans() []*snapshotsync.VisibleSegment

func (*View) SpansSegment

func (v *View) SpansSegment(blockNum uint64) (*snapshotsync.VisibleSegment, bool)

type Waypoint

type Waypoint interface {
	Entity
	fmt.Stringer
	StartBlock() *big.Int
	EndBlock() *big.Int
	RootHash() libcommon.Hash
	Timestamp() uint64
	Length() uint64
	CmpRange(n uint64) int
}

type WaypointFields

type WaypointFields struct {
	Proposer   libcommon.Address `json:"proposer"`
	StartBlock *big.Int          `json:"start_block"`
	EndBlock   *big.Int          `json:"end_block"`
	RootHash   libcommon.Hash    `json:"root_hash"`
	ChainID    string            `json:"bor_chain_id"`
	Timestamp  uint64            `json:"timestamp"`
}

func (*WaypointFields) CmpRange

func (wf *WaypointFields) CmpRange(n uint64) int

func (*WaypointFields) Length

func (wf *WaypointFields) Length() uint64

type Waypoints

type Waypoints []Waypoint

func AsWaypoints

func AsWaypoints[T Waypoint](wp []T) Waypoints

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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