heimdall

package
v1.9.7-0...-a45a6e3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: LGPL-3.0 Imports: 61 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")

	TransientErrors = []error{
		ErrBadGateway,
		ErrServiceUnavailable,
		context.DeadlineExceeded,
	}
)
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: recsplit.DefaultBucketSize,
					LeafSize:   recsplit.DefaultLeafSize,
					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 *HttpRequest, logger log.Logger) (*T, error)

Fetch fetches response from heimdall

func FetchWithRetry

func FetchWithRetry[T any](ctx context.Context, client *HttpClient, 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 *HttpClient,
	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 RecordWayPoints

func RecordWayPoints(value bool)

func RemoteEventCheckForBlock

func RemoteEventCheckForBlock(header *types.Header, previousHeader *types.Header, chainId string, startEventId uint64, events []rlp.RawValue,
	heimdallClient Client, 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 UpdateObservedWaypointCheckpointLength

func UpdateObservedWaypointCheckpointLength(length uint64)

func UpdateObservedWaypointMilestoneLength

func UpdateObservedWaypointMilestoneLength(length uint64)

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 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 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 EntityFetcher

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

func NewCheckpointFetcher

func NewCheckpointFetcher(client Client, logger log.Logger) *EntityFetcher[*Checkpoint]

func NewEntityFetcher

func NewEntityFetcher[TEntity Entity](
	name string,
	fetchFirstEntityId func(ctx context.Context) (int64, error),
	fetchLastEntityId func(ctx context.Context) (int64, error),
	fetchEntity func(ctx context.Context, id int64) (TEntity, error),
	fetchEntitiesPage func(ctx context.Context, page uint64, limit uint64) ([]TEntity, error),
	fetchEntitiesPageLimit uint64,
	fetchAllEntitiesIdxOffset uint64,
	logger log.Logger,
) *EntityFetcher[TEntity]

func NewMilestoneFetcher

func NewMilestoneFetcher(client Client, logger log.Logger) *EntityFetcher[*Milestone]

func NewSpanFetcher

func NewSpanFetcher(client Client, logger log.Logger) *EntityFetcher[*Span]

func (*EntityFetcher[TEntity]) FetchAllEntities

func (f *EntityFetcher[TEntity]) FetchAllEntities(ctx context.Context) ([]TEntity, error)

func (*EntityFetcher[TEntity]) FetchEntitiesRange

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

func (*EntityFetcher[TEntity]) FetchEntitiesRangeSequentially

func (f *EntityFetcher[TEntity]) FetchEntitiesRangeSequentially(ctx context.Context, idRange ClosedRange) ([]TEntity, error)

func (*EntityFetcher[TEntity]) FetchEntityIdRange

func (f *EntityFetcher[TEntity]) FetchEntityIdRange(ctx context.Context) (ClosedRange, error)

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 HttpClient

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

func NewHttpClient

func NewHttpClient(urlString string, logger log.Logger, opts ...HttpClientOption) *HttpClient

func (*HttpClient) Close

func (c *HttpClient) Close()

Close sends a signal to stop the running process

func (*HttpClient) FetchCheckpoint

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

FetchCheckpoint fetches the checkpoint from heimdall

func (*HttpClient) FetchCheckpointCount

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

FetchCheckpointCount fetches the checkpoint count from heimdall

func (*HttpClient) FetchCheckpoints

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

func (*HttpClient) FetchFirstMilestoneNum

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

func (*HttpClient) FetchLastNoAckMilestone

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

FetchLastNoAckMilestone fetches the last no-ack-milestone from heimdall

func (*HttpClient) FetchLatestSpan

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

func (*HttpClient) FetchMilestone

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

FetchMilestone fetches a milestone from heimdall

func (*HttpClient) FetchMilestoneCount

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

FetchMilestoneCount fetches the milestone count from heimdall

func (*HttpClient) FetchMilestoneID

func (c *HttpClient) 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 (*HttpClient) FetchNoAckMilestone

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

FetchNoAckMilestone fetches the last no-ack-milestone from heimdall

func (*HttpClient) FetchSpan

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

func (*HttpClient) FetchSpans

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

func (*HttpClient) FetchStateSyncEvent

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

func (*HttpClient) FetchStateSyncEvents

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

type HttpClientOption

type HttpClientOption func(*HttpClient)

func WithHttpMaxRetries

func WithHttpMaxRetries(maxRetries int) HttpClientOption

func WithHttpRequestHandler

func WithHttpRequestHandler(handler httpRequestHandler) HttpClientOption

func WithHttpRetryBackOff

func WithHttpRetryBackOff(retryBackOff time.Duration) HttpClientOption

type HttpRequest

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

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 MockClient

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

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) Close

func (m *MockClient) Close()

Close mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

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

func (*MockClient) FetchCheckpoint

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

FetchCheckpoint mocks base method.

func (*MockClient) FetchCheckpointCount

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

FetchCheckpointCount mocks base method.

func (*MockClient) FetchCheckpoints

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

FetchCheckpoints mocks base method.

func (*MockClient) FetchFirstMilestoneNum

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

FetchFirstMilestoneNum mocks base method.

func (*MockClient) FetchLastNoAckMilestone

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

FetchLastNoAckMilestone mocks base method.

func (*MockClient) FetchLatestSpan

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

FetchLatestSpan mocks base method.

func (*MockClient) FetchMilestone

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

FetchMilestone mocks base method.

func (*MockClient) FetchMilestoneCount

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

FetchMilestoneCount mocks base method.

func (*MockClient) FetchMilestoneID

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

FetchMilestoneID mocks base method.

func (*MockClient) FetchNoAckMilestone

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

FetchNoAckMilestone mocks base method.

func (*MockClient) FetchSpan

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

FetchSpan mocks base method.

func (*MockClient) FetchSpans

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

FetchSpans mocks base method.

func (*MockClient) FetchStateSyncEvent

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

FetchStateSyncEvent mocks base method.

func (*MockClient) FetchStateSyncEvents

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

FetchStateSyncEvents mocks base method.

type MockClientCloseCall

type MockClientCloseCall struct {
	*gomock.Call
}

MockClientCloseCall wrap *gomock.Call

func (*MockClientCloseCall) Do

func (c *MockClientCloseCall) Do(f func()) *MockClientCloseCall

Do rewrite *gomock.Call.Do

func (*MockClientCloseCall) DoAndReturn

func (c *MockClientCloseCall) DoAndReturn(f func()) *MockClientCloseCall

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientCloseCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchCheckpointCall

type MockClientFetchCheckpointCall struct {
	*gomock.Call
}

MockClientFetchCheckpointCall wrap *gomock.Call

func (*MockClientFetchCheckpointCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchCheckpointCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchCheckpointCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchCheckpointCountCall

type MockClientFetchCheckpointCountCall struct {
	*gomock.Call
}

MockClientFetchCheckpointCountCall wrap *gomock.Call

func (*MockClientFetchCheckpointCountCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchCheckpointCountCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchCheckpointCountCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchCheckpointsCall

type MockClientFetchCheckpointsCall struct {
	*gomock.Call
}

MockClientFetchCheckpointsCall wrap *gomock.Call

func (*MockClientFetchCheckpointsCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchCheckpointsCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchCheckpointsCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchFirstMilestoneNumCall

type MockClientFetchFirstMilestoneNumCall struct {
	*gomock.Call
}

MockClientFetchFirstMilestoneNumCall wrap *gomock.Call

func (*MockClientFetchFirstMilestoneNumCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchFirstMilestoneNumCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchFirstMilestoneNumCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchLastNoAckMilestoneCall

type MockClientFetchLastNoAckMilestoneCall struct {
	*gomock.Call
}

MockClientFetchLastNoAckMilestoneCall wrap *gomock.Call

func (*MockClientFetchLastNoAckMilestoneCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchLastNoAckMilestoneCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchLastNoAckMilestoneCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchLatestSpanCall

type MockClientFetchLatestSpanCall struct {
	*gomock.Call
}

MockClientFetchLatestSpanCall wrap *gomock.Call

func (*MockClientFetchLatestSpanCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchLatestSpanCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchLatestSpanCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchMilestoneCall

type MockClientFetchMilestoneCall struct {
	*gomock.Call
}

MockClientFetchMilestoneCall wrap *gomock.Call

func (*MockClientFetchMilestoneCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchMilestoneCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchMilestoneCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchMilestoneCountCall

type MockClientFetchMilestoneCountCall struct {
	*gomock.Call
}

MockClientFetchMilestoneCountCall wrap *gomock.Call

func (*MockClientFetchMilestoneCountCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchMilestoneCountCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchMilestoneCountCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchMilestoneIDCall

type MockClientFetchMilestoneIDCall struct {
	*gomock.Call
}

MockClientFetchMilestoneIDCall wrap *gomock.Call

func (*MockClientFetchMilestoneIDCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchMilestoneIDCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchMilestoneIDCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchNoAckMilestoneCall

type MockClientFetchNoAckMilestoneCall struct {
	*gomock.Call
}

MockClientFetchNoAckMilestoneCall wrap *gomock.Call

func (*MockClientFetchNoAckMilestoneCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchNoAckMilestoneCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchNoAckMilestoneCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchSpanCall

type MockClientFetchSpanCall struct {
	*gomock.Call
}

MockClientFetchSpanCall wrap *gomock.Call

func (*MockClientFetchSpanCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchSpanCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchSpanCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchSpansCall

type MockClientFetchSpansCall struct {
	*gomock.Call
}

MockClientFetchSpansCall wrap *gomock.Call

func (*MockClientFetchSpansCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchSpansCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchSpansCall) Return

func (c *MockClientFetchSpansCall) Return(arg0 []*Span, arg1 error) *MockClientFetchSpansCall

Return rewrite *gomock.Call.Return

type MockClientFetchStateSyncEventCall

type MockClientFetchStateSyncEventCall struct {
	*gomock.Call
}

MockClientFetchStateSyncEventCall wrap *gomock.Call

func (*MockClientFetchStateSyncEventCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchStateSyncEventCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchStateSyncEventCall) Return

Return rewrite *gomock.Call.Return

type MockClientFetchStateSyncEventsCall

type MockClientFetchStateSyncEventsCall struct {
	*gomock.Call
}

MockClientFetchStateSyncEventsCall wrap *gomock.Call

func (*MockClientFetchStateSyncEventsCall) Do

Do rewrite *gomock.Call.Do

func (*MockClientFetchStateSyncEventsCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockClientFetchStateSyncEventsCall) Return

Return rewrite *gomock.Call.Return

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Close

Close indicates an expected call of Close.

func (*MockClientMockRecorder) FetchCheckpoint

func (mr *MockClientMockRecorder) FetchCheckpoint(ctx, number any) *MockClientFetchCheckpointCall

FetchCheckpoint indicates an expected call of FetchCheckpoint.

func (*MockClientMockRecorder) FetchCheckpointCount

func (mr *MockClientMockRecorder) FetchCheckpointCount(ctx any) *MockClientFetchCheckpointCountCall

FetchCheckpointCount indicates an expected call of FetchCheckpointCount.

func (*MockClientMockRecorder) FetchCheckpoints

func (mr *MockClientMockRecorder) FetchCheckpoints(ctx, page, limit any) *MockClientFetchCheckpointsCall

FetchCheckpoints indicates an expected call of FetchCheckpoints.

func (*MockClientMockRecorder) FetchFirstMilestoneNum

func (mr *MockClientMockRecorder) FetchFirstMilestoneNum(ctx any) *MockClientFetchFirstMilestoneNumCall

FetchFirstMilestoneNum indicates an expected call of FetchFirstMilestoneNum.

func (*MockClientMockRecorder) FetchLastNoAckMilestone

func (mr *MockClientMockRecorder) FetchLastNoAckMilestone(ctx any) *MockClientFetchLastNoAckMilestoneCall

FetchLastNoAckMilestone indicates an expected call of FetchLastNoAckMilestone.

func (*MockClientMockRecorder) FetchLatestSpan

func (mr *MockClientMockRecorder) FetchLatestSpan(ctx any) *MockClientFetchLatestSpanCall

FetchLatestSpan indicates an expected call of FetchLatestSpan.

func (*MockClientMockRecorder) FetchMilestone

func (mr *MockClientMockRecorder) FetchMilestone(ctx, number any) *MockClientFetchMilestoneCall

FetchMilestone indicates an expected call of FetchMilestone.

func (*MockClientMockRecorder) FetchMilestoneCount

func (mr *MockClientMockRecorder) FetchMilestoneCount(ctx any) *MockClientFetchMilestoneCountCall

FetchMilestoneCount indicates an expected call of FetchMilestoneCount.

func (*MockClientMockRecorder) FetchMilestoneID

func (mr *MockClientMockRecorder) FetchMilestoneID(ctx, milestoneID any) *MockClientFetchMilestoneIDCall

FetchMilestoneID indicates an expected call of FetchMilestoneID.

func (*MockClientMockRecorder) FetchNoAckMilestone

func (mr *MockClientMockRecorder) FetchNoAckMilestone(ctx, milestoneID any) *MockClientFetchNoAckMilestoneCall

FetchNoAckMilestone indicates an expected call of FetchNoAckMilestone.

func (*MockClientMockRecorder) FetchSpan

func (mr *MockClientMockRecorder) FetchSpan(ctx, spanID any) *MockClientFetchSpanCall

FetchSpan indicates an expected call of FetchSpan.

func (*MockClientMockRecorder) FetchSpans

func (mr *MockClientMockRecorder) FetchSpans(ctx, page, limit any) *MockClientFetchSpansCall

FetchSpans indicates an expected call of FetchSpans.

func (*MockClientMockRecorder) FetchStateSyncEvent

func (mr *MockClientMockRecorder) FetchStateSyncEvent(ctx, id any) *MockClientFetchStateSyncEventCall

FetchStateSyncEvent indicates an expected call of FetchStateSyncEvent.

func (*MockClientMockRecorder) FetchStateSyncEvents

func (mr *MockClientMockRecorder) FetchStateSyncEvents(ctx, fromId, to, limit any) *MockClientFetchStateSyncEventsCall

FetchStateSyncEvents indicates an expected call of FetchStateSyncEvents.

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, unwindPoint uint64) (int, error)

DeleteFromBlockNum mocks base method.

func (*MockEntityStore[TEntity]) DeleteToBlockNum

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

DeleteToBlockNum 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
}

MockEntityStoreDeleteFromBlockNumCall 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, unwindPoint any) *MockEntityStoreDeleteFromBlockNumCall[TEntity]

DeleteFromBlockNum indicates an expected call of DeleteFromBlockNum.

func (*MockEntityStoreMockRecorder[TEntity]) DeleteToBlockNum

func (mr *MockEntityStoreMockRecorder[TEntity]) DeleteToBlockNum(ctx, unwindPoint, 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, 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 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 MockhttpRequestHandler

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

MockhttpRequestHandler is a mock of httpRequestHandler interface.

func NewMockhttpRequestHandler

func NewMockhttpRequestHandler(ctrl *gomock.Controller) *MockhttpRequestHandler

NewMockhttpRequestHandler creates a new mock instance.

func (*MockhttpRequestHandler) CloseIdleConnections

func (m *MockhttpRequestHandler) CloseIdleConnections()

CloseIdleConnections mocks base method.

func (*MockhttpRequestHandler) Do

Do mocks base method.

func (*MockhttpRequestHandler) EXPECT

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

type MockhttpRequestHandlerCloseIdleConnectionsCall

type MockhttpRequestHandlerCloseIdleConnectionsCall struct {
	*gomock.Call
}

MockhttpRequestHandlerCloseIdleConnectionsCall wrap *gomock.Call

func (*MockhttpRequestHandlerCloseIdleConnectionsCall) Do

Do rewrite *gomock.Call.Do

func (*MockhttpRequestHandlerCloseIdleConnectionsCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockhttpRequestHandlerCloseIdleConnectionsCall) Return

Return rewrite *gomock.Call.Return

type MockhttpRequestHandlerDoCall

type MockhttpRequestHandlerDoCall struct {
	*gomock.Call
}

MockhttpRequestHandlerDoCall wrap *gomock.Call

func (*MockhttpRequestHandlerDoCall) Do

Do rewrite *gomock.Call.Do

func (*MockhttpRequestHandlerDoCall) DoAndReturn

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockhttpRequestHandlerDoCall) Return

Return rewrite *gomock.Call.Return

type MockhttpRequestHandlerMockRecorder

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

MockhttpRequestHandlerMockRecorder is the mock recorder for MockhttpRequestHandler.

func (*MockhttpRequestHandlerMockRecorder) CloseIdleConnections

CloseIdleConnections indicates an expected call of CloseIdleConnections.

func (*MockhttpRequestHandlerMockRecorder) Do

Do indicates an expected call of Do.

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 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 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 Scraper

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

func NewScraper

func NewScraper[TEntity Entity](
	name string,
	store EntityStore[TEntity],
	fetcher entityFetcher[TEntity],
	pollDelay time.Duration,
	transientErrors []error,
	logger log.Logger,
) *Scraper[TEntity]

func (*Scraper[TEntity]) RegisterObserver

func (s *Scraper[TEntity]) RegisterObserver(observer func([]TEntity)) event.UnregisterFunc

func (*Scraper[TEntity]) Run

func (s *Scraper[TEntity]) Run(ctx context.Context) error

func (*Scraper[TEntity]) Synchronize

func (s *Scraper[TEntity]) Synchronize(ctx context.Context) (TEntity, error)

type Service

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

func NewService

func NewService(config ServiceConfig) *Service

func (*Service) CheckpointsFromBlock

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

func (*Service) MilestonesFromBlock

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

func (*Service) Producers

func (s *Service) Producers(ctx context.Context, blockNum uint64) (*valset.ValidatorSet, error)

func (*Service) Ready

func (s *Service) Ready(ctx context.Context) <-chan error

func (*Service) RegisterCheckpointObserver

func (s *Service) RegisterCheckpointObserver(callback func(*Checkpoint), opts ...ObserverOption) event.UnregisterFunc

func (*Service) RegisterMilestoneObserver

func (s *Service) RegisterMilestoneObserver(callback func(*Milestone), opts ...ObserverOption) event.UnregisterFunc

func (*Service) RegisterSpanObserver

func (s *Service) RegisterSpanObserver(callback func(*Span), opts ...ObserverOption) event.UnregisterFunc

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

func (*Service) Span

func (s *Service) Span(ctx context.Context, id uint64) (*Span, bool, error)

func (*Service) SynchronizeCheckpoints

func (s *Service) SynchronizeCheckpoints(ctx context.Context) (*Checkpoint, error)

func (*Service) SynchronizeMilestones

func (s *Service) SynchronizeMilestones(ctx context.Context) (*Milestone, error)

func (*Service) SynchronizeSpans

func (s *Service) SynchronizeSpans(ctx context.Context, blockNum uint64) error

type ServiceConfig

type ServiceConfig struct {
	Store     Store
	BorConfig *borcfg.BorConfig
	Client    Client
	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 SpanSnapshotStore

type SpanSnapshotStore struct {
	EntityStore[*Span]
	// contains filtered or unexported fields
}

func NewSpanSnapshotStore

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

func (*SpanSnapshotStore) Entity

func (s *SpanSnapshotStore) Entity(ctx context.Context, id uint64) (*Span, bool, error)

func (*SpanSnapshotStore) LastEntityId

func (s *SpanSnapshotStore) LastEntityId(ctx context.Context) (uint64, bool, error)

func (*SpanSnapshotStore) LastFrozenEntityId

func (s *SpanSnapshotStore) LastFrozenEntityId() uint64

func (*SpanSnapshotStore) Prepare

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

func (*SpanSnapshotStore) RangeExtractor

func (s *SpanSnapshotStore) RangeExtractor() snaptype.RangeExtractor

func (*SpanSnapshotStore) WithTx

func (s *SpanSnapshotStore) WithTx(tx kv.Tx) EntityStore[*Span]

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