aggregator

package
v0.13.8 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: GPL-3.0, LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package aggregator is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateSignatureResult

type AggregateSignatureResult struct {
	// Weight of validators included in the aggregate signature.
	SignatureWeight uint64
	// Total weight of all validators in the subnet.
	TotalWeight uint64
	// The message with the aggregate signature.
	Message *avalancheWarp.Message
}

type Aggregator

type Aggregator struct {
	// contains filtered or unexported fields
}

Aggregator requests signatures from validators and aggregates them into a single signature.

func New

func New(client SignatureGetter, validators []*avalancheWarp.Validator, totalWeight uint64) *Aggregator

New returns a signature aggregator that will attempt to aggregate signatures from [validators].

func (*Aggregator) AggregateSignatures

func (a *Aggregator) AggregateSignatures(ctx context.Context, unsignedMessage *avalancheWarp.UnsignedMessage, quorumNum uint64) (*AggregateSignatureResult, error)

Returns an aggregate signature over [unsignedMessage]. The returned signature's weight exceeds the threshold given by [quorumNum].

type MockSignatureGetter

type MockSignatureGetter struct {
	// contains filtered or unexported fields
}

MockSignatureGetter is a mock of SignatureGetter interface.

func NewMockSignatureGetter

func NewMockSignatureGetter(ctrl *gomock.Controller) *MockSignatureGetter

NewMockSignatureGetter creates a new mock instance.

func (*MockSignatureGetter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSignatureGetter) GetSignature

func (m *MockSignatureGetter) GetSignature(arg0 context.Context, arg1 ids.NodeID, arg2 *warp.UnsignedMessage) (*bls.Signature, error)

GetSignature mocks base method.

type MockSignatureGetterMockRecorder

type MockSignatureGetterMockRecorder struct {
	// contains filtered or unexported fields
}

MockSignatureGetterMockRecorder is the mock recorder for MockSignatureGetter.

func (*MockSignatureGetterMockRecorder) GetSignature

func (mr *MockSignatureGetterMockRecorder) GetSignature(arg0, arg1, arg2 interface{}) *gomock.Call

GetSignature indicates an expected call of GetSignature.

type NetworkClient

type NetworkClient interface {
	SendAppRequest(ctx context.Context, nodeID ids.NodeID, message []byte) ([]byte, error)
}

type NetworkSignatureGetter

type NetworkSignatureGetter struct {
	Client NetworkClient
}

NetworkSignatureGetter fetches warp signatures on behalf of the aggregator using VM App-Specific Messaging

func NewSignatureGetter

func NewSignatureGetter(client NetworkClient) *NetworkSignatureGetter

func (*NetworkSignatureGetter) GetSignature

func (s *NetworkSignatureGetter) GetSignature(ctx context.Context, nodeID ids.NodeID, unsignedWarpMessage *avalancheWarp.UnsignedMessage) (*bls.Signature, error)

GetSignature attempts to fetch a BLS Signature of [unsignedWarpMessage] from [nodeID] until it succeeds or receives an invalid response

Note: this function will continue attempting to fetch the signature from [nodeID] until it receives an invalid value or [ctx] is cancelled. The caller is responsible to cancel [ctx] if it no longer needs to fetch this signature.

type SignatureGetter

type SignatureGetter interface {
	// GetSignature attempts to fetch a BLS Signature from [nodeID] for [unsignedWarpMessage]
	GetSignature(ctx context.Context, nodeID ids.NodeID, unsignedWarpMessage *avalancheWarp.UnsignedMessage) (*bls.Signature, error)
}

SignatureGetter defines the minimum network interface to perform signature aggregation

Jump to

Keyboard shortcuts

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