headertest

package
v0.7.0-rc10 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 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,
	dag blockservice.BlockService,
) (*header.ExtendedHeader, *rsmt2d.ExtendedDataSquare)

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 RandBlockID

func RandBlockID(t *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 DummySubscriber

type DummySubscriber struct {
	Headers []*header.ExtendedHeader
}

func (*DummySubscriber) AddValidator

func (*DummySubscriber) Cancel

func (mhs *DummySubscriber) Cancel()

func (*DummySubscriber) NextHeader

func (mhs *DummySubscriber) NextHeader(ctx context.Context) (*header.ExtendedHeader, error)

func (*DummySubscriber) Stop

func (mhs *DummySubscriber) Stop(context.Context) error

func (*DummySubscriber) Subscribe

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) GenExtendedHeader

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

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) GetRandomHeader

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

func (*TestSuite) Head

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

Jump to

Keyboard shortcuts

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