testutil

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEmptyNotarization added in v0.1.1

func NewEmptyNotarization(nodes []bft.NodeID, round uint64, seq uint64) *bft.EmptyNotarization

NewEmptyNotarization creates a new empty notarization

func NewFinalizationRecord added in v0.1.1

func NewFinalizationRecord(t *testing.T, logger bft.Logger, signatureAggregator bft.SignatureAggregator, block bft.VerifiedBlock, ids []bft.NodeID) (bft.Finalization, []byte)

creates a new finalization

func NewNotarization added in v0.1.1

func NewNotarization(logger bft.Logger, signatureAggregator bft.SignatureAggregator, block bft.VerifiedBlock, ids []bft.NodeID) (bft.Notarization, error)

func NewNotarizationRecord added in v0.1.1

func NewNotarizationRecord(logger bft.Logger, signatureAggregator bft.SignatureAggregator, block bft.VerifiedBlock, ids []bft.NodeID) ([]byte, error)

func NewTestFinalizeVote added in v0.1.1

func NewTestFinalizeVote(t *testing.T, block bft.VerifiedBlock, id bft.NodeID) *bft.FinalizeVote

func NewTestVote added in v0.1.1

func NewTestVote(block AnyBlock, id bft.NodeID) (*bft.Vote, error)

Types

type AnyBlock added in v0.1.1

type AnyBlock interface {
	// BlockHeader encodes a succinct and collision-free representation of a block.
	BlockHeader() bft.BlockHeader
}

type BlockDeserializer added in v0.1.1

type BlockDeserializer struct {
	// DelayedVerification will block verifying any deserialized blocks until we send to the channel
	DelayedVerification chan struct{}
}

func (*BlockDeserializer) DeserializeBlock added in v0.1.1

func (b *BlockDeserializer) DeserializeBlock(ctx context.Context, buff []byte) (bft.Block, error)

type EncodedTestBlock added in v0.1.1

type EncodedTestBlock struct {
	Data      []byte
	Metadata  []byte
	Blacklist []byte
}

type TestBlock added in v0.1.1

type TestBlock struct {
	Data     []byte
	Metadata bft.ProtocolMetadata

	Digest            [32]byte
	OnVerify          func()
	VerificationDelay chan struct{}
	VerificationError error
	// contains filtered or unexported fields
}

func NewTestBlock added in v0.1.1

func NewTestBlock(metadata bft.ProtocolMetadata, blacklist bft.Blacklist) *TestBlock

func (*TestBlock) Blacklist added in v0.1.1

func (tb *TestBlock) Blacklist() bft.Blacklist

func (*TestBlock) BlockHeader added in v0.1.1

func (t *TestBlock) BlockHeader() bft.BlockHeader

func (*TestBlock) Bytes added in v0.1.1

func (t *TestBlock) Bytes() ([]byte, error)

func (*TestBlock) ComputeDigest added in v0.1.1

func (tb *TestBlock) ComputeDigest()

func (*TestBlock) Verify added in v0.1.1

type TestLogger

type TestLogger struct {
	*zap.Logger
	// contains filtered or unexported fields
}

func MakeLogger

func MakeLogger(t *testing.T, node ...int) *TestLogger

func (*TestLogger) Intercept

func (t *TestLogger) Intercept(hook func(entry zapcore.Entry) error)

func (*TestLogger) Silence

func (t *TestLogger) Silence()

func (*TestLogger) Trace

func (tl *TestLogger) Trace(msg string, fields ...log.Field)

func (*TestLogger) Verbo

func (tl *TestLogger) Verbo(msg string, fields ...log.Field)

type TestQC added in v0.1.1

type TestQC []bft.Signature

func (TestQC) Bytes added in v0.1.1

func (t TestQC) Bytes() []byte

func (TestQC) Signers added in v0.1.1

func (t TestQC) Signers() []bft.NodeID

func (TestQC) Verify added in v0.1.1

func (t TestQC) Verify(msg []byte) error

type TestSignatureAggregator added in v0.1.1

type TestSignatureAggregator struct {
	Err error
}

func (*TestSignatureAggregator) Aggregate added in v0.1.1

func (t *TestSignatureAggregator) Aggregate(signatures []bft.Signature) (bft.QuorumCertificate, error)

Jump to

Keyboard shortcuts

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