Documentation
¶
Overview ¶
Package zap provides ZAP transport implementation for VM RPC.
Index ¶
- Variables
- func Dial(ctx context.Context, addr string, config *zapwire.Config) (*zapwire.Conn, error)
- func NewListener() (net.Listener, error)
- type Client
- func (c *Client) BuildBlock(ctx context.Context) (block.Block, error)
- func (c *Client) Close() error
- func (c *Client) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error
- func (c *Client) CreateHandlers(ctx context.Context) (map[string]http.Handler, error)
- func (c *Client) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (c *Client) GetBlock(ctx context.Context, blkID ids.ID) (block.Block, error)
- func (c *Client) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (c *Client) HealthCheck(ctx context.Context) (block.HealthCheckResult, error)
- func (c *Client) Initialize(ctx context.Context, init block.Init) error
- func (c *Client) LastAccepted(ctx context.Context) (ids.ID, error)
- func (c *Client) LastQuasarHeight() uint64
- func (c *Client) NewHTTPHandler(ctx context.Context) (http.Handler, error)
- func (c *Client) ParseBlock(ctx context.Context, blockBytes []byte) (block.Block, error)
- func (c *Client) SetLastQuasarFinalized(height uint64)
- func (c *Client) SetPreference(ctx context.Context, blkID ids.ID) error
- func (c *Client) SetState(ctx context.Context, state uint32) error
- func (c *Client) Shutdown(ctx context.Context) error
- func (c *Client) SupportsQuasarExport() bool
- func (c *Client) Version(ctx context.Context) (string, error)
- func (c *Client) WaitForEvent(ctx context.Context) (block.Message, error)
- type Sender
- func (s *Sender) SendError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, ...) error
- func (s *Sender) SendGossip(ctx context.Context, config p2p.SendConfig, msg []byte) error
- func (s *Sender) SendRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, ...) error
- func (s *Sender) SendResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, response []byte) error
- type Server
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotConnected = errors.New("zap: not connected") ErrInvalidResponse = errors.New("zap: invalid response") )
Functions ¶
func NewListener ¶
NewListener creates a new TCP listener on an available port. This is used for the ZAP handshake during VM subprocess bootstrap.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements chain.ChainVM over ZAP transport
func (*Client) BuildBlock ¶ added in v1.23.4
BuildBlock implements chain.ChainVM
func (*Client) Connected ¶ added in v1.23.4
func (c *Client) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error
Connected implements chain.ChainVM
func (*Client) CreateHandlers ¶ added in v1.23.4
CreateHandlers calls the VM's CreateHandlers and returns reverse proxy handlers
func (*Client) Disconnected ¶ added in v1.23.4
Disconnected implements chain.ChainVM
func (*Client) GetBlockIDAtHeight ¶ added in v1.23.4
GetBlockIDAtHeight implements chain.ChainVM
func (*Client) HealthCheck ¶ added in v1.23.4
HealthCheck implements chain.ChainVM
func (*Client) Initialize ¶
Initialize implements chain.ChainVM
func (*Client) LastAccepted ¶
LastAccepted implements chain.ChainVM. Returns the cache refreshed on every Accept (NOT a frozen Initialize snapshot) under the read lock.
func (*Client) LastQuasarHeight ¶ added in v1.36.1
LastQuasarHeight returns the plugin VM's accept-tip-CLAMPED Quasar EXPORT-FINAL height across the ZAP boundary (0 before the first export forms). Returns 0 if the plugin did not advertise CapQuasarExport or if the call fails — so the chain manager's boot re-seed of the consensus export frontier treats an unavailable/absent height as "empty" (advance-only; a fresh cert refines it).
func (*Client) NewHTTPHandler ¶ added in v1.23.4
NewHTTPHandler implements chain.ChainVM
func (*Client) ParseBlock ¶
ParseBlock implements chain.ChainVM
func (*Client) SetLastQuasarFinalized ¶ added in v1.36.1
SetLastQuasarFinalized forwards a new Quasar (⅔-by-stake) EXPORT-FINAL height to the plugin VM across the ZAP boundary so the plugin's `finalized`/`safe` tags and warp export gate track ⅔-stake finality, not the reorgable Nova tip. No-op (no RPC) if the plugin did not advertise CapQuasarExport — so the chain manager can wire this unconditionally. Fire-and-forget: a transport error is logged, not returned, because the sole caller is the consensus export-frontier observer, which has no error channel (the durable height is re-seeded on boot).
func (*Client) SetPreference ¶
SetPreference implements chain.ChainVM
func (*Client) SupportsQuasarExport ¶ added in v1.36.1
SupportsQuasarExport reports whether the plugin advertised the Quasar (⅔-by-stake) EXPORT capability at Initialize. The chain manager gates the consensus export-frontier observer on this: false → the plugin is a generic VM with no export surface and the chain runs Nova-only (no cross-process no-op spam per finalization).
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender implements p2p.Sender over ZAP transport
func (*Sender) SendError ¶
func (s *Sender) SendError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error
SendError sends an error response to a previous request
func (*Sender) SendGossip ¶
SendGossip sends a gossip message