Documentation
¶
Overview ¶
Package lp118 implements LP-118 message handling
Index ¶
- Constants
- func NewHandlerAdapter(handler Handler) p2p.Handler
- type CachedHandler
- type Handler
- type HandlerAdapter
- func (h *HandlerAdapter) CrossChainAppRequest(ctx context.Context, chainID ids.ID, deadline time.Time, requestBytes []byte) ([]byte, error)
- func (h *HandlerAdapter) Gossip(ctx context.Context, nodeID ids.NodeID, gossipBytes []byte)
- func (h *HandlerAdapter) Request(ctx context.Context, nodeID ids.NodeID, deadline time.Time, ...) ([]byte, *p2p.Error)
- type NoOpHandler
- type SignatureAggregator
- type Signer
- type Verifier
Constants ¶
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.56
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
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
type HandlerAdapter ¶ added in v1.16.56
type HandlerAdapter struct {
// contains filtered or unexported fields
}
HandlerAdapter adapts an lp118.Handler to p2p.Handler
func (*HandlerAdapter) CrossChainAppRequest ¶ added in v1.16.56
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
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