Run NodesReferencevmsrpcchainvm

sender

Package sender provides p2p.Sender implementations over ZAP and gRPC transports.

import "github.com/luxfi/node/vms/rpcchainvm/sender"

Package sender provides p2p.Sender implementations over ZAP and gRPC transports.

ZAP is the default transport with zero-copy serialization and minimal overhead. gRPC support can be added with the grpc build tag for testing compatibility.

Build tags:

go build # ZAP only (default, production) go build -tags=grpc # gRPC support (for testing/compatibility)

Usage:

// ZAP transport (default) s := sender.ZAP(zapConn)

// gRPC transport (requires -tags=grpc) s := sender.GRPC(senderpb.NewSenderClient(grpcConn))

Both return p2p.Sender with identical behavior, just different wire protocol. ZAP provides ~5-10x faster serialization and ~30-50% lower CPU usage.

Functions

NewZAPClient

func NewZAPClient(conn *zapwire.Conn) p2p.Sender

NewZAPClient is an alias for ZAP for backwards compatibility. Deprecated: Use ZAP() instead.

ZAP

func ZAP(conn *zapwire.Conn) p2p.Sender

ZAP returns a p2p.Sender using ZAP transport.

Types

ZAPServer

ZAPServer handles incoming ZAP sender messages and forwards them to warp.Sender

func NewZAPServer(sender warp.Sender) *ZAPServer
func (s *ZAPServer) Handle(ctx context.Context, msgType zapwire.MessageType, payload []byte) error
func (s *ZAPServer) HandleSendError(ctx context.Context, payload []byte) error
func (s *ZAPServer) HandleSendGossip(ctx context.Context, payload []byte) error
func (s *ZAPServer) HandleSendRequest(ctx context.Context, payload []byte) error
func (s *ZAPServer) HandleSendResponse(ctx context.Context, payload []byte) error