ec

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// GetTipsetByEpoch should return the tipset immediately before the one requested.
	// If the epoch requested is null, it returns the latest not-null one.
	GetTipsetByEpoch(ctx context.Context, epoch int64) (TipSet, error)
	// GetTipset returns the tipset with the given key.
	GetTipset(context.Context, gpbft.TipSetKey) (TipSet, error)
	// GetHead returns the current head tipset of the chain
	GetHead(context.Context) (TipSet, error)
	// GetParent returns the parent of the current tipset.
	GetParent(context.Context, TipSet) (TipSet, error)
	// GetPowerTable returns the power table at the tipset given as an argument.
	GetPowerTable(context.Context, gpbft.TipSetKey) (gpbft.PowerEntries, error)
}

func WithModifiedPower

func WithModifiedPower(backend Backend, explicitPower gpbft.PowerEntries, ignoreEcPower bool) Backend

type FakeEC

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

func NewFakeEC

func NewFakeEC(seed uint64, bootstrapEpoch int64, ecPeriod time.Duration, initialPowerTable gpbft.PowerEntries, useTime bool) *FakeEC

func (*FakeEC) GetCurrentHead

func (ec *FakeEC) GetCurrentHead() int64

func (*FakeEC) GetHead

func (ec *FakeEC) GetHead(ctx context.Context) (TipSet, error)

func (*FakeEC) GetParent

func (ec *FakeEC) GetParent(ctx context.Context, ts TipSet) (TipSet, error)

func (*FakeEC) GetPowerTable

func (ec *FakeEC) GetPowerTable(ctx context.Context, tsk gpbft.TipSetKey) (gpbft.PowerEntries, error)

func (*FakeEC) GetTipset

func (ec *FakeEC) GetTipset(ctx context.Context, tsk gpbft.TipSetKey) (TipSet, error)

func (*FakeEC) GetTipsetByEpoch

func (ec *FakeEC) GetTipsetByEpoch(ctx context.Context, epoch int64) (TipSet, error)

GetTipsetByHeight should return a tipset or nil/empty byte array if it does not exists

func (*FakeEC) SetCurrentHead

func (ec *FakeEC) SetCurrentHead(head int64)

SetCurrentHead sets the current head epoch. This is only supported by FakeEC if `useTime=false`

type TipSet

type TipSet interface {
	fmt.Stringer

	Key() gpbft.TipSetKey
	Beacon() []byte
	Epoch() int64
	Timestamp() time.Time
}

type Tipset

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

func (*Tipset) Beacon

func (ts *Tipset) Beacon() []byte

func (*Tipset) Epoch

func (ts *Tipset) Epoch() int64

func (*Tipset) Key

func (ts *Tipset) Key() gpbft.TipSetKey

func (*Tipset) String added in v0.0.4

func (ts *Tipset) String() string

func (*Tipset) Timestamp

func (ts *Tipset) Timestamp() time.Time

Jump to

Keyboard shortcuts

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