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

lp118

package
v1.22.34 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package lp118 implements LP-118 message handling

Index

Constants

View Source
const HandlerID = 0x12345678 // Implementation note

HandlerID is the protocol ID for LP-118

Variables

This section is empty.

Functions

func NewHandlerAdapter added in v1.16.16

func NewHandlerAdapter(handler Handler) p2p.Handler

NewHandlerAdapter creates a new adapter

Types

type CachedHandler added in v1.11.14

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

CachedHandler implements a cached handler for LP-118

func (*CachedHandler) AppRequest added in v1.11.14

func (h *CachedHandler) AppRequest(ctx context.Context, nodeID ids.NodeID, deadline time.Time, request []byte) ([]byte, error)

AppRequest handles an incoming request with caching

type Handler

type Handler interface {
	// AppRequest handles an incoming request
	AppRequest(ctx context.Context, nodeID ids.NodeID, deadline time.Time, request []byte) ([]byte, error)
}

Handler handles LP-118 messages

func NewCachedHandler

func NewCachedHandler(cache cache.Cacher[ids.ID, []byte], backend interface{}, signer Signer) Handler

NewCachedHandler creates a new cached handler

type HandlerAdapter added in v1.16.16

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

HandlerAdapter adapts an lp118.Handler to p2p.Handler

func (*HandlerAdapter) CrossChainAppRequest added in v1.16.16

func (h *HandlerAdapter) CrossChainAppRequest(ctx context.Context, chainID ids.ID, deadline time.Time, requestBytes []byte) ([]byte, error)

CrossChainAppRequest is not supported by lp118 handlers

func (*HandlerAdapter) Gossip added in v1.16.56

func (h *HandlerAdapter) Gossip(ctx context.Context, nodeID ids.NodeID, gossipBytes []byte)

Gossip is not supported by lp118 handlers

func (*HandlerAdapter) Request added in v1.16.56

func (h *HandlerAdapter) Request(ctx context.Context, nodeID ids.NodeID, deadline time.Time, requestBytes []byte) ([]byte, *p2p.Error)

Request forwards to the lp118 handler

type NoOpHandler added in v1.11.14

type NoOpHandler struct{}

NoOpHandler is a no-op implementation of Handler

func (NoOpHandler) AppRequest added in v1.11.14

func (NoOpHandler) AppRequest(context.Context, ids.NodeID, time.Time, []byte) ([]byte, error)

AppRequest returns an empty response

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 Signer added in v1.16.56

type Signer interface {
	// Sign signs an unsigned warp message and returns the signature bytes
	Sign(msg *warp.UnsignedMessage) ([]byte, error)
}

Signer signs warp messages and returns the signature bytes

type Verifier

type Verifier interface {
	// Verify verifies an unsigned warp message with justification
	// Returns an error if verification fails, nil otherwise
	Verify(ctx context.Context, unsignedMessage *warp.UnsignedMessage, justification []byte) error
}

Verifier verifies warp messages according to LP-118

Jump to

Keyboard shortcuts

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