Documentation
¶
Index ¶
- func ComputeMasterPublicKey(cluster *TestCluster) types.G2Point
- func CreateTestAcknowledgements(t *testing.T, n int, epoch int64, dealerID int64) []*types.Acknowledgement
- func CreateTestCommitments(t *testing.T, n int) []types.G2Point
- func CreateTestOperators(t *testing.T, numOperators int) []*peering.OperatorSetPeer
- func CreateTestShare(value uint64) *fr.Element
- func WaitForDKGCompletion(cluster *TestCluster, timeout time.Duration) bool
- func WaitForReshare(cluster *TestCluster, initialVersions map[int]int64, timeout time.Duration) bool
- type MockChainPoller
- func (m *MockChainPoller) EmitBlock() error
- func (m *MockChainPoller) EmitBlockAtNumber(blockNumber uint64) error
- func (m *MockChainPoller) GetCurrentBlock() uint64
- func (m *MockChainPoller) SetCurrentBlock(blockNumber uint64)
- func (m *MockChainPoller) Start(ctx context.Context) error
- func (m *MockChainPoller) Stop()
- type TestCluster
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeMasterPublicKey ¶
func ComputeMasterPublicKey(cluster *TestCluster) types.G2Point
ComputeMasterPublicKey computes the master public key from all node commitments
func CreateTestAcknowledgements ¶
func CreateTestAcknowledgements(t *testing.T, n int, epoch int64, dealerID int64) []*types.Acknowledgement
CreateTestAcknowledgements creates n test acknowledgements with specified epoch and dealer
func CreateTestCommitments ¶
CreateTestCommitments creates n test commitments (G2 points)
func CreateTestOperators ¶
func CreateTestOperators(t *testing.T, numOperators int) []*peering.OperatorSetPeer
CreateTestOperators creates test operators from ChainConfig data
func CreateTestShare ¶
CreateTestShare creates a test share with a specific value
func WaitForDKGCompletion ¶
func WaitForDKGCompletion(cluster *TestCluster, timeout time.Duration) bool
WaitForDKGCompletion polls nodes until all have completed DKG
func WaitForReshare ¶
func WaitForReshare(cluster *TestCluster, initialVersions map[int]int64, timeout time.Duration) bool
WaitForReshare waits for nodes to complete a reshare (key version change) It automatically emits a block to trigger the reshare
Types ¶
type MockChainPoller ¶
type MockChainPoller struct {
// contains filtered or unexported fields
}
MockChainPoller implements IChainPoller for testing It broadcasts blocks to multiple handlers without actually polling the chain
func NewMockChainPoller ¶
func NewMockChainPoller( blockHandlers []blockHandler.IBlockHandler, blockInterval uint64, logger *zap.Logger, ) *MockChainPoller
NewMockChainPoller creates a new mock chain poller that broadcasts to multiple handlers blockInterval determines how many blocks to skip per emission (e.g., 5 for every 5th block)
func (*MockChainPoller) EmitBlock ¶
func (m *MockChainPoller) EmitBlock() error
EmitBlock emits a single block to all registered block handlers The block number is automatically incremented based on blockInterval
func (*MockChainPoller) EmitBlockAtNumber ¶
func (m *MockChainPoller) EmitBlockAtNumber(blockNumber uint64) error
EmitBlockAtNumber emits a block with a specific block number to all handlers This is useful for testing specific interval boundaries
func (*MockChainPoller) GetCurrentBlock ¶
func (m *MockChainPoller) GetCurrentBlock() uint64
GetCurrentBlock returns the current block number
func (*MockChainPoller) SetCurrentBlock ¶
func (m *MockChainPoller) SetCurrentBlock(blockNumber uint64)
SetCurrentBlock sets the current block number (useful for test setup)
type TestCluster ¶
type TestCluster struct {
Nodes []*node.Node
Servers []*httptest.Server
ServerURLs []string
NumNodes int
MasterPubKey types.G2Point
MockPoller *MockChainPoller // Exposed for test control
}
TestCluster represents a cluster of KMS nodes for testing
func NewTestCluster ¶
func NewTestCluster(t *testing.T, numNodes int) *TestCluster
NewTestCluster creates a test cluster of KMS nodes with completed DKG
func (*TestCluster) GetMasterPublicKey ¶
func (c *TestCluster) GetMasterPublicKey() types.G2Point
GetMasterPublicKey returns the master public key
func (*TestCluster) GetServerURLs ¶
func (c *TestCluster) GetServerURLs() []string
GetServerURLs returns the list of server URLs