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

lp118

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: BSD-3-Clause Imports: 17 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 ACP-118 messages

func NewCachedHandler

func NewCachedHandler(cache cache.Cacher[ids.ID, []byte], backend interface{}, signer warp.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) AppGossip added in v1.16.16

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

AppGossip is not supported by lp118 handlers

func (*HandlerAdapter) AppRequest added in v1.16.16

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

AppRequest forwards to the lp118 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

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 Verifier

type Verifier interface {
	// Verify verifies an unsigned warp message with justification
	Verify(ctx context.Context, unsignedMessage *warp.UnsignedMessage, justification []byte) *common.AppError
}

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