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) GetLastStateSummary(ctx context.Context) (chain.StateSummary, error)
- func (c *Client) GetOngoingSyncStateSummary(ctx context.Context) (chain.StateSummary, error)
- func (c *Client) GetStateSummary(ctx context.Context, height uint64) (chain.StateSummary, 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) ParseStateSummary(ctx context.Context, summaryBytes []byte) (chain.StateSummary, 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) StateSyncEnabled(ctx context.Context) (bool, 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 the listener a plugin VM dials back on during ZAP handshake bootstrap.
The same-host fast path is a unix-domain socket — no TCP/UDP stack, no ephemeral-port exhaustion, filesystem-namespaced. The api/zap Dial infers "unix" from the socket-path addr, so a plugin rebuilt against that api connects back over the socket with zero code change on its side.
The node and the plugins it runs are one build and ship together, so both sides move at once. Windows has no unix sockets and gets TCP; so does a host where the socket cannot be bound, because a chain that will not start is worse than one on a slower transport.
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) GetLastStateSummary ¶ added in v1.36.126
GetLastStateSummary names the most recent summary the plugin holds. This is what a node offers when a peer asks what it can serve.
func (*Client) GetOngoingSyncStateSummary ¶ added in v1.36.126
GetOngoingSyncStateSummary names the summary of a sync already under way, so a node that was interrupted resumes the one it started rather than beginning again at whatever the network now offers.
func (*Client) GetStateSummary ¶ added in v1.36.126
GetStateSummary names the summary at a height, which is how a node checks whether it holds the summary its peers have settled on.
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) ParseStateSummary ¶ added in v1.36.126
func (c *Client) ParseStateSummary(ctx context.Context, summaryBytes []byte) (chain.StateSummary, error)
ParseStateSummary reads summary bytes received from a peer. The plugin decides whether the bytes name a summary it can serve; a summary comes back only if they do.
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) StateSyncEnabled ¶ added in v1.36.126
StateSyncEnabled reports whether the plugin syncs state. A plugin that cannot answer has not answered false — the error travels and the caller decides.
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