Documentation
¶
Overview ¶
Package lp118 implements the Lux Protocol 118 (LP118) for warp message handling. This is the Lux-native equivalent of ACP118.
Index ¶
Constants ¶
const HandlerID = p2p.SignatureRequestHandlerID
HandlerID is the protocol identifier for LP118 warp message handlers. This corresponds to SignatureRequestHandlerID in the p2p package.
Variables ¶
This section is empty.
Functions ¶
func NewHandlerAdapter ¶
NewHandlerAdapter creates a p2p.Handler from an LP118 Handler. Since LP118 Handler already implements p2p.Handler interface, this is a simple cast.
Types ¶
type CachedHandler ¶
type CachedHandler struct {
// contains filtered or unexported fields
}
CachedHandler is a handler that caches responses.
func NewCachedHandler ¶
func NewCachedHandler(cache Cache, verifier Verifier, signer Signer) *CachedHandler
NewCachedHandler creates a new cached handler.
type Client ¶
type Client interface {
// Request sends a request to a specific peer and returns the response.
Request(ctx context.Context, nodeID ids.NodeID, request []byte) ([]byte, error)
}
Client is the interface for making requests to peers.
type Handler ¶
type Handler interface {
// Request handles an incoming application request.
Request(ctx context.Context, nodeID ids.NodeID, deadline time.Time, requestBytes []byte) ([]byte, *p2p.Error)
// Gossip handles gossip messages (no-op for LP118).
Gossip(ctx context.Context, nodeID ids.NodeID, gossipBytes []byte)
}
Handler handles LP118 warp message requests.
type SignatureAggregator ¶
type SignatureAggregator struct {
// contains filtered or unexported fields
}
SignatureAggregator aggregates warp message signatures from validators.
func NewSignatureAggregator ¶
func NewSignatureAggregator(logger log.Logger, client Client) *SignatureAggregator
NewSignatureAggregator creates a new SignatureAggregator.
func (*SignatureAggregator) AggregateSignatures ¶
func (a *SignatureAggregator) AggregateSignatures( ctx context.Context, msg *warp.UnsignedMessage, justification []byte, quorumNum uint64, quorumDen uint64, ) (*warp.Message, error)
AggregateSignatures collects signatures for the given unsigned message from validators.
func (*SignatureAggregator) RequestSignature ¶
func (a *SignatureAggregator) RequestSignature( ctx context.Context, nodeID ids.NodeID, msg *warp.UnsignedMessage, ) ([]byte, error)
RequestSignature requests a signature from a specific node.
type Signer ¶
type Signer interface {
// Sign signs the unsigned message and returns the signature bytes.
Sign(msg *warp.UnsignedMessage) ([]byte, error)
}
Signer signs warp messages.
type Verifier ¶
type Verifier interface {
// Verify verifies the unsigned message with the given justification.
// Returns nil if verification succeeds, or an AppError if it fails.
Verify(ctx context.Context, msg *warp.UnsignedMessage, justification []byte) *core.AppError
}
Verifier verifies warp messages.