safedb

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT, MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Disabled      = &DisabledDB{}
	ErrNotEnabled = errors.New("safe head database not enabled")
)
View Source
var (
	ErrNotFound     = errors.New("not found")
	ErrInvalidEntry = errors.New("invalid db entry")
	ErrClosed       = errors.New("safe db closed")

	// ErrL1AtSafeHeadNotFound is transient: target above latest, or DB empty.
	ErrL1AtSafeHeadNotFound = errors.New("l1 at safe head not found")

	// ErrL1AtSafeHeadUnavailable is permanent: target predates recorded history.
	ErrL1AtSafeHeadUnavailable = errors.New("l1 at safe head history unavailable")
)

Functions

This section is empty.

Types

type DisabledDB

type DisabledDB struct{}

func (*DisabledDB) Close

func (d *DisabledDB) Close() error

func (*DisabledDB) Enabled

func (d *DisabledDB) Enabled() bool

func (*DisabledDB) FirstEntry added in v1.19.0

func (d *DisabledDB) FirstEntry(_ context.Context) (l1 eth.BlockID, safeHead eth.BlockID, err error)

func (*DisabledDB) L1AtSafeHead added in v1.19.0

func (d *DisabledDB) L1AtSafeHead(_ context.Context, _ uint64) (l1 eth.BlockID, safeHead eth.BlockID, err error)

func (*DisabledDB) LastEntry added in v1.19.1

func (d *DisabledDB) LastEntry(_ context.Context) (l1 eth.BlockID, safeHead eth.BlockID, err error)

func (*DisabledDB) SafeHeadAtL1

func (d *DisabledDB) SafeHeadAtL1(_ context.Context, _ uint64) (l1 eth.BlockID, safeHead eth.BlockID, err error)

func (*DisabledDB) SafeHeadReset

func (d *DisabledDB) SafeHeadReset(_ eth.L2BlockRef) error

func (*DisabledDB) SafeHeadUpdated

func (d *DisabledDB) SafeHeadUpdated(_ eth.L2BlockRef, _ eth.BlockID) error

type SafeDB

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

func NewSafeDB

func NewSafeDB(logger log.Logger, path string) (*SafeDB, error)

func (*SafeDB) Close

func (d *SafeDB) Close() error

func (*SafeDB) Enabled

func (d *SafeDB) Enabled() bool

func (*SafeDB) FirstEntry added in v1.19.0

func (d *SafeDB) FirstEntry(ctx context.Context) (l1Block eth.BlockID, safeHead eth.BlockID, err error)

func (*SafeDB) L1AtSafeHead added in v1.19.0

func (d *SafeDB) L1AtSafeHead(ctx context.Context, targetL2Num uint64) (l1 eth.BlockID, safeHead eth.BlockID, err error)

L1AtSafeHead returns the earliest L1 block at which the recorded L2 safe head reached at least targetL2Num, along with the L2 safe head recorded at that L1. Each SafeDB entry records a real deriver-emitted transition, so the answer is exact when target is within recorded history.

func (*SafeDB) LastEntry added in v1.19.1

func (d *SafeDB) LastEntry(ctx context.Context) (l1Block eth.BlockID, safeHead eth.BlockID, err error)

LastEntry returns the highest recorded (L1, L2 safe head) pair, i.e. the safedb tip. Returns ErrNotFound when no entries exist yet.

func (*SafeDB) SafeHeadAtL1

func (d *SafeDB) SafeHeadAtL1(ctx context.Context, l1BlockNum uint64) (l1Block eth.BlockID, safeHead eth.BlockID, err error)

func (*SafeDB) SafeHeadReset

func (d *SafeDB) SafeHeadReset(safeHead eth.L2BlockRef) error

func (*SafeDB) SafeHeadUpdated

func (d *SafeDB) SafeHeadUpdated(safeHead eth.L2BlockRef, l1Head eth.BlockID) error

Jump to

Keyboard shortcuts

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