aggregator

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 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 added in v0.5.7

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

New returns a signature aggregator for the chain with the given [state] on the given [subnetID], and where [client] can be used to fetch 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 added in v0.5.7

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

MockSignatureGetter is a mock of SignatureGetter interface.

func NewMockSignatureGetter added in v0.5.7

func NewMockSignatureGetter(ctrl *gomock.Controller) *MockSignatureGetter

NewMockSignatureGetter creates a new mock instance.

func (*MockSignatureGetter) EXPECT added in v0.5.7

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

func (*MockSignatureGetter) GetSignature added in v0.5.7

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

GetSignature mocks base method.

type MockSignatureGetterMockRecorder added in v0.5.7

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

MockSignatureGetterMockRecorder is the mock recorder for MockSignatureGetter.

func (*MockSignatureGetterMockRecorder) GetSignature added in v0.5.7

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 added in v0.5.7

type NetworkSignatureGetter struct {
	Client NetworkClient
}

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

func NewSignatureGetter added in v0.5.7

func NewSignatureGetter(client NetworkClient) *NetworkSignatureGetter

func (*NetworkSignatureGetter) GetSignature added in v0.5.7

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 added in v0.5.7

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