Help us shape the future of Go! Take the 2026 Go Developer Survey

lp118

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	p2p.NoOpHandler
	// contains filtered or unexported fields
}

Handler signs warp messages

func NewCachedHandler

func NewCachedHandler(
	cacher cache.Cacher[ids.ID, []byte],
	verifier Verifier,
	signer warp.Signer,
) *Handler

NewCachedHandler returns an instance of Handler that caches successful signatures.

func NewHandler

func NewHandler(verifier Verifier, signer warp.Signer) *Handler

NewHandler returns an instance of Handler

func (*Handler) AppRequest

func (h *Handler) AppRequest(
	ctx context.Context,
	_ ids.NodeID,
	_ time.Time,
	requestBytes []byte,
) ([]byte, *core.AppError)

type SignatureAggregator

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

SignatureAggregator aggregates validator signatures for warp messages

func NewSignatureAggregator

func NewSignatureAggregator(log log.Logger, client *p2p.Client) *SignatureAggregator

NewSignatureAggregator returns an instance of SignatureAggregator

func (*SignatureAggregator) AggregateSignatures

func (s *SignatureAggregator) AggregateSignatures(
	ctx context.Context,
	message *warp.Message,
	justification []byte,
	validators []*warp.Validator,
	quorumNum uint64,
	quorumDen uint64,
) (
	_ *warp.Message,
	aggregatedStake *big.Int,
	totalStake *big.Int,
	_ error,
)

AggregateSignatures blocks until quorumNum/quorumDen signatures from validators are requested to be aggregated into a warp message or the context is canceled. Returns the signed message and the amount of stake that signed the message. Caller is responsible for providing a well-formed canonical validator set corresponding to the signer bitset in the message.

type Verifier

type Verifier interface {
	// Verify verifies that the provided message is valid for this node to sign
	// based on the provided justification.
	//
	// Implementations of Verify are not expected to verify the NetworkID or
	// SourceChainID fields of the message. Verification of these fields should
	// be performed externally to Verify.
	Verify(
		ctx context.Context,
		message *warp.UnsignedMessage,
		justification []byte,
	) *core.AppError
}

Verifier verifies that a warp message should be signed

Jump to

Keyboard shortcuts

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