headertest

package
v0.11.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFraudExtHeader

func CreateFraudExtHeader(
	t *testing.T,
	eh *header.ExtendedHeader,
	serv blockservice.BlockService,
) (*header.ExtendedHeader, *rsmt2d.ExtendedDataSquare)

func ExtendedHeaderFromEDS added in v0.11.0

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

func FraudMaker

func FraudMaker(t *testing.T, faultHeight int64, bServ blockservice.BlockService) header.ConstructFn

FraudMaker creates a custom ConstructFn that breaks the block at the given height.

func MakeCommit

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

func NewStore added in v0.9.0

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

func RandBlockID

func RandBlockID(*testing.T) types.BlockID

RandBlockID provides a BlockID fixture.

func RandExtendedHeader

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

RandExtendedHeader provides an ExtendedHeader fixture.

func RandRawHeader

func RandRawHeader(t *testing.T) *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, num int) *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 int64, 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

Jump to

Keyboard shortcuts

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