Documentation
¶
Overview ¶
Copyright (C) 2019-2025, Ava Labs, Inc. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
- Constants
- func AllowAllMessages(*common.Message, common.NodeID, common.NodeID) bool
- func DefaultTestNodeEpochConfig(t *testing.T, nodeID common.NodeID, comm common.Communication, ...) (engine.EpochConfig, *TestWAL, *InMemStorage)
- func GenerateNodeID(t *testing.T) common.NodeID
- func InjectTestFinalization(t *testing.T, e *engine.Epoch, finalization *common.Finalization, ...)
- func InjectTestFinalizeVote(t *testing.T, e *engine.Epoch, block common.VerifiedBlock, id common.NodeID)
- func InjectTestNotarization(t *testing.T, e *engine.Epoch, notarization common.Notarization, ...)
- func InjectTestVote(t *testing.T, e *engine.Epoch, block common.VerifiedBlock, id common.NodeID)
- func NewEmptyNotarization(nodes []common.NodeID, round uint64) *common.EmptyNotarization
- func NewFinalizationRecord(t *testing.T, signatureAggregator common.SignatureAggregator, ...) (common.Finalization, []byte)
- func NewNotarization(logger common.Logger, signatureAggregator common.SignatureAggregator, ...) (common.Notarization, error)
- func NewNotarizationRecord(logger common.Logger, signatureAggregator common.SignatureAggregator, ...) ([]byte, error)
- func NewTestControlledBlockBuilder(t *testing.T) *testControlledBlockBuilder
- func NewTestFinalizeVote(t *testing.T, block common.VerifiedBlock, id common.NodeID) *common.FinalizeVote
- func NewTestVote(block AnyBlock, id common.NodeID) (*common.Vote, error)
- func UpdateEpochConfig(epochConfig *engine.EpochConfig, testConfig *TestNodeConfig)
- func WaitForBlockProposerTimeout(t *testing.T, e *engine.Epoch, startTime *time.Time, startRound uint64)
- func WaitToEnterRound(t *testing.T, e *engine.Epoch, round uint64)
- func WaitToEnterRoundWithTimeout(t *testing.T, e *engine.Epoch, round uint64, timeoutDuration time.Duration)
- type AnyBlock
- type BasicInMemoryNetwork
- func (b *BasicInMemoryNetwork) AddNode(node *BasicNode)
- func (b *BasicInMemoryNetwork) AdvanceTime(increment time.Duration)
- func (b *BasicInMemoryNetwork) Connect(node common.NodeID)
- func (b *BasicInMemoryNetwork) Disconnect(node common.NodeID)
- func (b *BasicInMemoryNetwork) GetInstances() []*BasicNode
- func (b *BasicInMemoryNetwork) IsDisconnected(node common.NodeID) bool
- func (b *BasicInMemoryNetwork) RemoveNode(node *BasicNode)
- func (b *BasicInMemoryNetwork) ReplaceNode(node *BasicNode)
- func (b *BasicInMemoryNetwork) SetAllNodesMessageFilter(filter MessageFilter)
- func (b *BasicInMemoryNetwork) SetNodeMessageFilter(node common.NodeID, filter MessageFilter)
- func (b *BasicInMemoryNetwork) StartInstances()
- func (b *BasicInMemoryNetwork) StopInstances()
- type BasicNode
- func (b *BasicNode) AdvanceTime(duration time.Duration)
- func (b *BasicNode) GetMessageTypesSent() map[string]uint64
- func (b *BasicNode) HandleMessage(msg *common.Message, from common.NodeID) error
- func (b *BasicNode) PrintMessageTypesSent()
- func (b *BasicNode) RecordMessageTypeSent(msg *common.Message)
- func (b *BasicNode) ResetMessageTypesSent()
- func (b *BasicNode) Silence()
- func (b *BasicNode) SilenceExceptKeywords(keywords ...string)
- func (b *BasicNode) Start()
- func (b *BasicNode) Stop()
- type BlockDeserializer
- type ControlledInMemoryNetwork
- type ControlledNode
- type EncodedTestBlock
- type InMemStorage
- func (mem *InMemStorage) Clone() *InMemStorage
- func (mem *InMemStorage) CloneUntil(stopSeq uint64) *InMemStorage
- func (mem *InMemStorage) Compare(other *InMemStorage) error
- func (mem *InMemStorage) EnsureNoBlockCommit(t *testing.T, seq uint64)
- func (mem *InMemStorage) Index(ctx context.Context, block common.VerifiedBlock, ...) error
- func (mem *InMemStorage) NumBlocks() uint64
- func (mem *InMemStorage) Retrieve(seq uint64) (common.VerifiedBlock, common.Finalization, error)
- func (mem *InMemStorage) WaitForBlockCommit(seq uint64) common.VerifiedBlock
- type InnerBlock
- type LogEntry
- type MessageFilter
- type NoopComm
- type TestBlock
- func (tb *TestBlock) Blacklist() common.Blacklist
- func (t *TestBlock) BlockHeader() common.BlockHeader
- func (t *TestBlock) Bytes() []byte
- func (tb *TestBlock) ComputeDigest()
- func (tb *TestBlock) SealingBlockInfo() *common.SealingBlockInfo
- func (t *TestBlock) Size() int
- func (tb *TestBlock) Verify(context.Context) (common.VerifiedBlock, error)
- type TestBlockBuilder
- func (t *TestBlockBuilder) BuildBlock(_ context.Context, metadata common.ProtocolMetadata, ...) (common.VerifiedBlock, bool)
- func (t *TestBlockBuilder) GetBuiltBlock() *TestBlock
- func (t *TestBlockBuilder) SetBuiltBlock(block *TestBlock)
- func (t *TestBlockBuilder) WaitForPendingBlock(ctx context.Context)
- func (t *TestBlockBuilder) WithBlockShouldBeBuiltBuffer(buffer uint64) *TestBlockBuilder
- func (t *TestBlockBuilder) WithBuiltBuffer(buffer uint64) *TestBlockBuilder
- type TestComm
- type TestLogger
- func (tl *TestLogger) Debug(msg string, fields ...log.Field)
- func (tl *TestLogger) Error(msg string, fields ...log.Field)
- func (tl *TestLogger) Fatal(msg string, fields ...log.Field)
- func (tl *TestLogger) Info(msg string, fields ...log.Field)
- func (tl *TestLogger) Intercept(hook func(entry LogEntry) error)
- func (tl *TestLogger) SetLevel(level log.Level)
- func (tl *TestLogger) SetPanicOnError(panicOnError bool)
- func (tl *TestLogger) SetPanicOnWarn(panicOnWarn bool)
- func (tl *TestLogger) Silence()
- func (tl *TestLogger) SilenceExceptKeywords(keywords ...string)
- func (tl *TestLogger) Trace(msg string, fields ...log.Field)
- func (tl *TestLogger) Verbo(msg string, fields ...log.Field)
- func (tl *TestLogger) Warn(msg string, fields ...log.Field)
- type TestNetworkCommunication
- type TestNodeConfig
- type TestQC
- type TestSignatureAggregator
- type TestSigner
- type TestVerifier
- type TestWAL
- func (tw *TestWAL) Append(b []byte) error
- func (tw *TestWAL) AssertBlockProposal(round uint64)
- func (tw *TestWAL) AssertEmptyVote(round uint64)
- func (tw *TestWAL) AssertHealthy(bd common.BlockDeserializer, qcd common.QCDeserializer)
- func (tw *TestWAL) AssertNotarization(round uint64) uint16
- func (tw *TestWAL) AssertWALSize(n int)
- func (tw *TestWAL) Clone() *TestWAL
- func (tw *TestWAL) ContainsEmptyNotarization(round uint64) bool
- func (tw *TestWAL) ContainsEmptyVote(round uint64) bool
- func (tw *TestWAL) ContainsNotarization(round uint64) bool
- func (tw *TestWAL) Delete() error
- func (tw *TestWAL) ReadAll() ([][]byte, error)
Constants ¶
const ( LOG_LEVEL = "LOG_LEVEL" INFO_LOG_LEVEL = "info" )
Variables ¶
This section is empty.
Functions ¶
func AllowAllMessages ¶ added in v0.3.0
AllowAllMessages allows every message to be sent
func DefaultTestNodeEpochConfig ¶ added in v0.3.0
func DefaultTestNodeEpochConfig(t *testing.T, nodeID common.NodeID, comm common.Communication, bb common.BlockBuilder) (engine.EpochConfig, *TestWAL, *InMemStorage)
DefaultTestNodeEpochConfig returns a default epoch config for a given node.
func InjectTestFinalization ¶ added in v0.3.0
func InjectTestFinalizeVote ¶ added in v0.3.0
func InjectTestNotarization ¶ added in v0.3.0
func InjectTestVote ¶ added in v0.3.0
func NewEmptyNotarization ¶ added in v0.1.1
func NewEmptyNotarization(nodes []common.NodeID, round uint64) *common.EmptyNotarization
NewEmptyNotarization creates a new empty notarization
func NewFinalizationRecord ¶ added in v0.1.1
func NewFinalizationRecord(t *testing.T, signatureAggregator common.SignatureAggregator, block common.VerifiedBlock, ids []common.NodeID) (common.Finalization, []byte)
creates a new finalization
func NewNotarization ¶ added in v0.1.1
func NewNotarization(logger common.Logger, signatureAggregator common.SignatureAggregator, block common.VerifiedBlock, ids []common.NodeID) (common.Notarization, error)
func NewNotarizationRecord ¶ added in v0.1.1
func NewNotarizationRecord(logger common.Logger, signatureAggregator common.SignatureAggregator, block common.VerifiedBlock, ids []common.NodeID) ([]byte, error)
func NewTestControlledBlockBuilder ¶ added in v0.3.0
NewTestControlledBlockBuilder returns a BlockBuilder that only builds a block when triggerNewBlock is called.
func NewTestFinalizeVote ¶ added in v0.1.1
func NewTestFinalizeVote(t *testing.T, block common.VerifiedBlock, id common.NodeID) *common.FinalizeVote
func NewTestVote ¶ added in v0.1.1
func UpdateEpochConfig ¶ added in v0.3.0
func UpdateEpochConfig(epochConfig *engine.EpochConfig, testConfig *TestNodeConfig)
func WaitForBlockProposerTimeout ¶ added in v0.3.0
func WaitToEnterRound ¶ added in v0.3.0
Types ¶
type AnyBlock ¶ added in v0.1.1
type AnyBlock interface {
// BlockHeader encodes a succinct and collision-free representation of a block.
BlockHeader() common.BlockHeader
}
type BasicInMemoryNetwork ¶ added in v0.3.0
type BasicInMemoryNetwork struct {
// contains filtered or unexported fields
}
func NewBasicInMemoryNetwork ¶ added in v0.3.0
func NewBasicInMemoryNetwork(t *testing.T, nodes common.NodeIDs) *BasicInMemoryNetwork
func (*BasicInMemoryNetwork) AddNode ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) AddNode(node *BasicNode)
func (*BasicInMemoryNetwork) AdvanceTime ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) AdvanceTime(increment time.Duration)
func (*BasicInMemoryNetwork) Connect ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) Connect(node common.NodeID)
func (*BasicInMemoryNetwork) Disconnect ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) Disconnect(node common.NodeID)
func (*BasicInMemoryNetwork) GetInstances ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) GetInstances() []*BasicNode
func (*BasicInMemoryNetwork) IsDisconnected ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) IsDisconnected(node common.NodeID) bool
func (*BasicInMemoryNetwork) RemoveNode ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) RemoveNode(node *BasicNode)
func (*BasicInMemoryNetwork) ReplaceNode ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) ReplaceNode(node *BasicNode)
func (*BasicInMemoryNetwork) SetAllNodesMessageFilter ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) SetAllNodesMessageFilter(filter MessageFilter)
func (*BasicInMemoryNetwork) SetNodeMessageFilter ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) SetNodeMessageFilter(node common.NodeID, filter MessageFilter)
func (*BasicInMemoryNetwork) StartInstances ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) StartInstances()
StartInstances starts all instances in the network. The first one is typically the leader, so we make sure to start it last.
func (*BasicInMemoryNetwork) StopInstances ¶ added in v0.3.0
func (b *BasicInMemoryNetwork) StopInstances()
type BasicNode ¶ added in v0.3.0
type BasicNode struct {
E *engine.Epoch
CustomHandler func(msg *common.Message, from common.NodeID) error
// contains filtered or unexported fields
}
BasicNode is a simple representation of an instance running an epoch. It does not know about any particular custom types, its sole responsibility is to run the epoch and handle messages.
func NewBasicNode ¶ added in v0.3.0
func (*BasicNode) AdvanceTime ¶ added in v0.3.0
func (*BasicNode) GetMessageTypesSent ¶ added in v0.3.0
func (*BasicNode) HandleMessage ¶ added in v0.3.0
func (*BasicNode) PrintMessageTypesSent ¶ added in v0.3.0
func (b *BasicNode) PrintMessageTypesSent()
func (*BasicNode) RecordMessageTypeSent ¶ added in v0.3.0
func (*BasicNode) ResetMessageTypesSent ¶ added in v0.3.0
func (b *BasicNode) ResetMessageTypesSent()
func (*BasicNode) SilenceExceptKeywords ¶ added in v0.3.0
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
type ControlledInMemoryNetwork ¶ added in v0.3.0
type ControlledInMemoryNetwork struct {
*BasicInMemoryNetwork
Instances []*ControlledNode
}
func NewControlledNetwork ¶ added in v0.3.0
func NewControlledNetwork(t *testing.T, nodes common.NodeIDs) *ControlledInMemoryNetwork
NewControlledNetwork creates an in-memory network. Node IDs must be provided before adding instances, as nodeWeights require prior knowledge of all participants.
func (*ControlledInMemoryNetwork) AdvanceWithoutLeader ¶ added in v0.3.0
func (n *ControlledInMemoryNetwork) AdvanceWithoutLeader(round uint64, laggingNodeId common.NodeID)
func (*ControlledInMemoryNetwork) TriggerLeaderBlockBuilder ¶ added in v0.3.0
func (n *ControlledInMemoryNetwork) TriggerLeaderBlockBuilder(round uint64)
type ControlledNode ¶ added in v0.3.0
type ControlledNode struct {
*BasicNode
WAL *TestWAL
Storage *InMemStorage
// contains filtered or unexported fields
}
func NewControlledBFTNode ¶ added in v0.3.0
func NewControlledBFTNode(t *testing.T, nodeID common.NodeID, net *ControlledInMemoryNetwork, config *TestNodeConfig) *ControlledNode
newBFTNode creates a new testNode and adds it to net.
func (*ControlledNode) BlockShouldBeBuilt ¶ added in v0.3.0
func (t *ControlledNode) BlockShouldBeBuilt()
func (*ControlledNode) ShouldBlockBeBuilt ¶ added in v0.3.0
func (t *ControlledNode) ShouldBlockBeBuilt() bool
func (*ControlledNode) TickUntilRoundAdvanced ¶ added in v0.3.0
func (t *ControlledNode) TickUntilRoundAdvanced(round uint64, tick time.Duration)
func (*ControlledNode) TimeoutOnRound ¶ added in v0.3.0
func (t *ControlledNode) TimeoutOnRound(round uint64)
TimeoutOnRound advances time until the node times out of the given round.
func (*ControlledNode) TriggerNewBlock ¶ added in v0.3.0
func (t *ControlledNode) TriggerNewBlock()
type EncodedTestBlock ¶ added in v0.1.1
type InMemStorage ¶ added in v0.3.0
type InMemStorage struct {
// contains filtered or unexported fields
}
func NewInMemStorage ¶ added in v0.3.0
func NewInMemStorage() *InMemStorage
func (*InMemStorage) Clone ¶ added in v0.3.0
func (mem *InMemStorage) Clone() *InMemStorage
func (*InMemStorage) CloneUntil ¶ added in v0.3.0
func (mem *InMemStorage) CloneUntil(stopSeq uint64) *InMemStorage
CloneUntil will copy the storage up until a given sequence(not including).
func (*InMemStorage) Compare ¶ added in v0.3.0
func (mem *InMemStorage) Compare(other *InMemStorage) error
func (*InMemStorage) EnsureNoBlockCommit ¶ added in v0.3.0
func (mem *InMemStorage) EnsureNoBlockCommit(t *testing.T, seq uint64)
func (*InMemStorage) Index ¶ added in v0.3.0
func (mem *InMemStorage) Index(ctx context.Context, block common.VerifiedBlock, certificate common.Finalization) error
func (*InMemStorage) NumBlocks ¶ added in v0.3.0
func (mem *InMemStorage) NumBlocks() uint64
func (*InMemStorage) Retrieve ¶ added in v0.3.0
func (mem *InMemStorage) Retrieve(seq uint64) (common.VerifiedBlock, common.Finalization, error)
func (*InMemStorage) WaitForBlockCommit ¶ added in v0.3.0
func (mem *InMemStorage) WaitForBlockCommit(seq uint64) common.VerifiedBlock
type InnerBlock ¶ added in v0.3.0
func (*InnerBlock) Bytes ¶ added in v0.3.0
func (i *InnerBlock) Bytes() []byte
func (*InnerBlock) Digest ¶ added in v0.3.0
func (i *InnerBlock) Digest() [32]byte
func (*InnerBlock) Height ¶ added in v0.3.0
func (i *InnerBlock) Height() uint64
func (*InnerBlock) Timestamp ¶ added in v0.3.0
func (i *InnerBlock) Timestamp() time.Time
type LogEntry ¶ added in v0.1.5
LogEntry is what an Intercept hook observes. It carries only the level and the message because that is all any caller reads — the fields stay with the formatted output.
type MessageFilter ¶ added in v0.3.0
MessageFilter is a function type that determines whether a message can be transmitted from one node to another. Parameters:
- msg: The message being evaluated for transmission
- from: The ID of the sending node
- to: The ID of the receiving node
Returns:
- bool: true if the message can be transmitted, false otherwise
type NoopComm ¶ added in v0.3.0
func NewNoopComm ¶ added in v0.3.0
func (NoopComm) Validators ¶ added in v0.3.0
type TestBlock ¶ added in v0.1.1
type TestBlock struct {
Data []byte
Metadata common.ProtocolMetadata
Digest [32]byte
OnVerify func()
VerificationDelay chan struct{}
VerificationError error
// SealingInfo, when non-nil, is returned by SealingBlockInfo() to mark this block as a sealing block.
SealingInfo *common.SealingBlockInfo
// contains filtered or unexported fields
}
func NewTestBlock ¶ added in v0.1.1
func NewTestBlock(metadata common.ProtocolMetadata, blacklist common.Blacklist) *TestBlock
func (*TestBlock) BlockHeader ¶ added in v0.1.1
func (t *TestBlock) BlockHeader() common.BlockHeader
func (*TestBlock) ComputeDigest ¶ added in v0.1.1
func (tb *TestBlock) ComputeDigest()
func (*TestBlock) SealingBlockInfo ¶ added in v0.3.0
func (tb *TestBlock) SealingBlockInfo() *common.SealingBlockInfo
type TestBlockBuilder ¶ added in v0.3.0
type TestBlockBuilder struct {
BlockShouldBeBuilt chan struct{}
// contains filtered or unexported fields
}
func NewTestBlockBuilder ¶ added in v0.3.0
func NewTestBlockBuilder() *TestBlockBuilder
func (*TestBlockBuilder) BuildBlock ¶ added in v0.3.0
func (t *TestBlockBuilder) BuildBlock(_ context.Context, metadata common.ProtocolMetadata, blacklist common.Blacklist) (common.VerifiedBlock, bool)
func (*TestBlockBuilder) GetBuiltBlock ¶ added in v0.3.0
func (t *TestBlockBuilder) GetBuiltBlock() *TestBlock
func (*TestBlockBuilder) SetBuiltBlock ¶ added in v0.3.0
func (t *TestBlockBuilder) SetBuiltBlock(block *TestBlock)
func (*TestBlockBuilder) WaitForPendingBlock ¶ added in v0.3.0
func (t *TestBlockBuilder) WaitForPendingBlock(ctx context.Context)
func (*TestBlockBuilder) WithBlockShouldBeBuiltBuffer ¶ added in v0.3.0
func (t *TestBlockBuilder) WithBlockShouldBeBuiltBuffer(buffer uint64) *TestBlockBuilder
func (*TestBlockBuilder) WithBuiltBuffer ¶ added in v0.3.0
func (t *TestBlockBuilder) WithBuiltBuffer(buffer uint64) *TestBlockBuilder
type TestComm ¶ added in v0.3.0
type TestComm struct {
// contains filtered or unexported fields
}
func NewTestComm ¶ added in v0.3.0
func NewTestComm(from common.NodeID, net *BasicInMemoryNetwork, messageFilter MessageFilter) *TestComm
func (*TestComm) SetFilter ¶ added in v0.3.0
func (c *TestComm) SetFilter(filter MessageFilter)
func (*TestComm) Validators ¶ added in v0.3.0
type TestLogger ¶
type TestLogger struct {
// contains filtered or unexported fields
}
TestLogger is the common.Logger a test wires into an instance. Every policy — level, keyword filter, hook, panic-on-warn/error — is applied in one place, emit, rather than layered as separate cores and encoders.
One funnel, but TWO gates, because reporting and writing are different questions. Whether an observer SEES an entry is decided by level and keywords; whether a sink RECORDS it additionally depends on which sink. The layered original expressed those at different depths of the stack — a level on the core, debug suppression in the encoder — so collapsing them into a single predicate silently blinds every Intercept hook the moment debug output is quieted, which is precisely the configuration the test script runs under.
func MakeLogger ¶
func MakeLogger(t *testing.T, node ...int) *TestLogger
func MakeLoggerWithFile ¶ added in v0.3.0
func MakeLoggerWithFile(t *testing.T, fileWriter io.Writer, writeStdout bool, node ...int) *TestLogger
MakeLoggerWithFile creates a TestLogger that can write to a file and optionally to stdout. - If writeStdout is true, logs may be written to stdout. - If fileWriter is non-nil, logs may be written to that fileWriter. - If both are enabled, logs go to both. - If neither is enabled, logs are discarded.
Concurrent writes are safe because emit serialises them; the writer itself needs no synchronisation of its own.
func (*TestLogger) Debug ¶ added in v0.1.5
func (tl *TestLogger) Debug(msg string, fields ...log.Field)
func (*TestLogger) Error ¶ added in v0.1.5
func (tl *TestLogger) Error(msg string, fields ...log.Field)
func (*TestLogger) Fatal ¶ added in v0.1.5
func (tl *TestLogger) Fatal(msg string, fields ...log.Field)
Fatal panics instead of exiting. The one production caller reports an impossible node role, so a test that reaches it has found a real defect — exiting the process would take the whole suite down with no attribution, while a panic fails the test that caused it and keeps the stack.
func (*TestLogger) Info ¶ added in v0.1.5
func (tl *TestLogger) Info(msg string, fields ...log.Field)
func (*TestLogger) Intercept ¶
func (tl *TestLogger) Intercept(hook func(entry LogEntry) error)
Intercept installs a hook that observes every entry that passes the level and keyword filters. Entries filtered out are not delivered, matching the order in which a level check precedes a write.
func (*TestLogger) SetLevel ¶ added in v0.3.0
func (tl *TestLogger) SetLevel(level log.Level)
func (*TestLogger) SetPanicOnError ¶ added in v0.3.0
func (tl *TestLogger) SetPanicOnError(panicOnError bool)
func (*TestLogger) SetPanicOnWarn ¶ added in v0.3.0
func (tl *TestLogger) SetPanicOnWarn(panicOnWarn bool)
func (*TestLogger) SilenceExceptKeywords ¶ added in v0.3.0
func (tl *TestLogger) SilenceExceptKeywords(keywords ...string)
SilenceExceptKeywords silences all logs EXCEPT those whose message contains at least one of the provided keywords.
Last call wins. The layered original nested a filtering core per call, so successive calls intersected their keyword sets; this replaces them. No caller invokes it twice — the sole caller is BasicNode.SilenceExceptKeywords — so the difference is recorded rather than preserved.
func (*TestLogger) Trace ¶
func (tl *TestLogger) Trace(msg string, fields ...log.Field)
Trace and Verbo both report at Debug so that a suite running at the default level sees them, which is the level the layered implementation routed them to.
They now also reach Intercept hooks. The layered original sent them through a second logger that never carried hooks, so hooks saw nothing from Trace or Verbo — except after SilenceExceptKeywords, which rebuilt that second logger from a hook-carrying core and started delivering them. This is uniform instead. No hook predicate in the tree matches any Trace or Verbo message, so nothing changes today; a future one would need to tolerate the delivery, since several hooks close channels or call WaitGroup.Done.
type TestNetworkCommunication ¶ added in v0.3.0
type TestNetworkCommunication interface {
common.Communication
SetFilter(filter MessageFilter)
}
type TestNodeConfig ¶ added in v0.3.0
type TestNodeConfig struct {
// optional
InitialStorage []common.VerifiedFinalizedBlock
Comm common.Communication
SigAggregatorCreator common.SignatureAggregatorCreator
ReplicationEnabled bool
BlockBuilder *testControlledBlockBuilder
// Long Running Tests
MaxRoundWindow uint64
Logger *TestLogger
WAL *TestWAL
Storage *InMemStorage
StartTime int64
RandomSeed *int64 // Optional seed for deterministic tests
}
NodeConfig
type TestSignatureAggregator ¶ added in v0.1.1
type TestSignatureAggregator struct {
Err error
N int
IsQuorumFunc func(signatures []common.NodeID) bool
}
func (*TestSignatureAggregator) Aggregate ¶ added in v0.1.1
func (t *TestSignatureAggregator) Aggregate(signatures []common.Signature) (common.QuorumCertificate, error)
func (*TestSignatureAggregator) AppendSignatures ¶ added in v0.3.0
func (t *TestSignatureAggregator) AppendSignatures(existing []byte, sigs ...[]byte) ([]byte, error)
type TestSigner ¶ added in v0.3.0
type TestSigner struct {
}
type TestVerifier ¶ added in v0.3.0
type TestVerifier struct {
}
func (*TestVerifier) VerifyBlock ¶ added in v0.3.0
func (t *TestVerifier) VerifyBlock(common.VerifiedBlock) error
func (*TestVerifier) VerifySignature ¶ added in v0.3.0
func (t *TestVerifier) VerifySignature(_ []byte, _ []byte, pk []byte) error
type TestWAL ¶ added in v0.3.0
type TestWAL struct {
common.WriteAheadLog
// contains filtered or unexported fields
}
func NewTestWAL ¶ added in v0.3.0
func (*TestWAL) AssertBlockProposal ¶ added in v0.3.0
func (*TestWAL) AssertEmptyVote ¶ added in v0.3.0
func (*TestWAL) AssertHealthy ¶ added in v0.3.0
func (tw *TestWAL) AssertHealthy(bd common.BlockDeserializer, qcd common.QCDeserializer)
AssertHealthy checks that the WAL has at most one of each record type per round.