aggregator

package
v0.5.2-warp-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: GPL-3.0, LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateSignatureResult

type AggregateSignatureResult struct {
	SignatureWeight uint64
	TotalWeight     uint64
	Message         *avalancheWarp.Message
}

type Aggregator

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

Aggregator fulfills requests to aggregate signatures of a subnet's validator set for Avalanche Warp Messages.

func NewAggregator

func NewAggregator(subnetID ids.ID, state validators.State, client SignatureBackend) *Aggregator

NewAggregator returns a signature aggregator, which will aggregate Warp Signatures for the given [

func (*Aggregator) AggregateSignatures

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

type NetworkClient

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

type NetworkSigner

type NetworkSigner struct {
	Client NetworkClient
}

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

func (*NetworkSigner) FetchWarpSignature

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

FetchWarpSignature 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 SignatureBackend

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

SignatureBackend 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