headertest

package
v0.18.0-rc23 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtendedHeaderFromEDS added in v0.11.0

func ExtendedHeaderFromEDS(t testing.TB, height uint64, eds *rsmt2d.ExtendedDataSquare) *header.ExtendedHeader

func ExtendedHeadersFromEdsses added in v0.15.0

func ExtendedHeadersFromEdsses(t testing.TB, edsses []*rsmt2d.ExtendedDataSquare) []*header.ExtendedHeader

func MakeCommit

func MakeCommit(
	blockID types.BlockID, height int64, round int32,
	voteSet *types.VoteSet, validators []types.PrivValidator, now time.Time,
) (*types.Commit, error)

func NewCustomStore added in v0.14.0

func NewCustomStore(
	t *testing.T,
	generator headertest.Generator[*header.ExtendedHeader],
	numHeaders int,
) libhead.Store[*header.ExtendedHeader]

func NewStore added in v0.9.0

func NewStore(t *testing.T) libhead.Store[*header.ExtendedHeader]

func RandBlockID

func RandBlockID(testing.TB) types.BlockID

RandBlockID provides a BlockID fixture.

func RandExtendedHeader

func RandExtendedHeader(t testing.TB) *header.ExtendedHeader

RandExtendedHeader provides an ExtendedHeader fixture.

func RandExtendedHeaderAtTimestamp added in v0.14.0

func RandExtendedHeaderAtTimestamp(t testing.TB, timestamp time.Time) *header.ExtendedHeader

func RandExtendedHeaderWithRoot added in v0.11.0

func RandExtendedHeaderWithRoot(t testing.TB, dah *da.DataAvailabilityHeader) *header.ExtendedHeader

func RandRawHeader

func RandRawHeader(t testing.TB) *header.RawHeader

RandRawHeader provides a RawHeader fixture.

func RandValidator

func RandValidator(randPower bool, minPower int64) (*types.Validator, types.PrivValidator)

func RandValidatorSet

func RandValidatorSet(numValidators int, votingPower int64) (*types.ValidatorSet, []types.PrivValidator)

Types

type Subscriber added in v0.9.0

type Subscriber struct {
	headertest.Subscriber[*header.ExtendedHeader]
}

type TestSuite

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

TestSuite provides everything you need to test chain of Headers. If not, please don't hesitate to extend it for your case.

func NewTestSuite

func NewTestSuite(t *testing.T, numValidators int, blockTime time.Duration) *TestSuite

NewTestSuite setups a new test suite with a given number of validators.

func (*TestSuite) Commit

func (s *TestSuite) Commit(h *header.RawHeader) *types.Commit

func (*TestSuite) GenExtendedHeaders

func (s *TestSuite) GenExtendedHeaders(num int) []*header.ExtendedHeader

func (*TestSuite) GenRawHeader

func (s *TestSuite) GenRawHeader(
	height uint64, lastHeader, lastCommit, dataHash libhead.Hash,
) *header.RawHeader

func (*TestSuite) Head

func (s *TestSuite) Head() *header.ExtendedHeader

func (*TestSuite) NextHeader added in v0.9.0

func (s *TestSuite) NextHeader() *header.ExtendedHeader

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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