Files
zeekay fb2b7f6d5c zip declares its ops in Rust, and projects them with the Go one's projector
A Rust developer writes Rust handlers, with Rust types and Rust doc comments,
and gets every projection from that source — the same deal a Go developer has
had. No .zap is written by hand and no Go program declares a Rust service's
ops.

The split falls on a measured seam. What is native per language is DECLARING an
op and RUNNING it; what is shared is the projection logic, driven from a neutral
description of the registry.

  Manifest      the registry with the Go taken out: ops, types, fields, wire
                names, prose. App.Manifest fills one in by reflection; a
                proc-macro fills one in as a Rust crate compiles.
  Project*      the OpenAPI document, the MCP tool list, the CLI and the ZAP
                IDL, read off a Manifest. Go's own three now go through them —
                the whole existing suite is the oracle — so Go keeps no private
                path for them and the other languages cannot rot.
  cmd/zipc      the build-time projector. It reads a manifest, or the fragments
                a compiler wrote, and writes the four documents.
  rust/         zip in Rust: #[zip::ops] on an impl block, #[derive(zip::Wire)]
                on a type, a router, a JSON binder, an HTTP door and a ZAP door.
                The wire is generated by zapgen from wire.zap; nothing here
                spells a byte offset by hand and nothing links Go.

The layout rule moved out of the manifest and into the projector, so the offsets
in a .zap are derived once for all three languages rather than three times;
TestProjectZAPMatchesRegistry pins that derivation against the layout the Go
encoder actually writes.

One service, written twice — corpus/info in Go and rust/examples/info in Rust,
fourteen ops each — is the gate. The OpenAPI document, the MCP tool list and the
CLI command tree come out byte-identical, and the ZAP schema agrees on every
struct, type and offset; it differs only where a field carries the declaring
language's own case convention and where the ledger names a type the way the
person who must change it would grep for it.
2026-09-15 11:41:56 -07:00

142 lines
8.1 KiB
Go

// Code generated by zipdoc; DO NOT EDIT.
package info
import (
"encoding/json"
"github.com/zap-proto/zip"
)
func init() {
zip.Describe("github.com/zap-proto/zip/corpus/info GET /chain/bootstrapped", zip.Doc{
Description: "Bootstrapped reports whether a chain has finished bootstrapping on this node.",
Fields: map[string]string{
"Bootstrapped.isBootstrapped": "IsBootstrapped is true once the chain has caught up.",
"BootstrappedArgs.chain": "Chain is the alias or id of the chain to ask about.",
},
Example: json.RawMessage(`{"chain":"X"}`),
Response: json.RawMessage(`{"isBootstrapped":true}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /chain/id", zip.Doc{
Description: "ChainID resolves a chain's alias to the id it names.",
Fields: map[string]string{
"ChainAlias.alias": "Alias is the name the chain answers to, such as \"X\".",
"ChainID.blockchainID": "BlockchainID is the chain's id.",
},
Example: json.RawMessage(`{"alias":"X"}`),
Response: json.RawMessage(`{"blockchainID":"2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM"}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /chains", zip.Doc{
Description: "Chains are the chains this node is running, which is a subset of the chains\nthe P-Chain knows about.",
Fields: map[string]string{
"Chain.bootstrapped": "Bootstrapped is whether this node has caught the chain up.",
"Chain.id": "ID is the chain's id.",
"Chain.name": "Name is the chain's name.",
"Chain.vmID": "VMID is the id of the virtual machine the chain runs.",
"Chains.chains": "Chains are the chains this node is running.",
},
Response: json.RawMessage(`{"chains":[{"id":"11111111111111111111111111111111LpoYY","name":"P-Chain","vmID":"11111111111111111111111111111111LpoYY","bootstrapped":true}]}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /fees", zip.Doc{
Description: "Fees are the transaction fees this node charges, in nLUX.",
Fields: map[string]string{
"Fees.createAssetTxFee": "CreateAssetTxFee is the fee to create an asset.",
"Fees.createChainTxFee": "CreateChainTxFee is the fee to create a chain.",
"Fees.txFee": "TxFee is the fee for an ordinary transaction.",
},
Response: json.RawMessage(`{"txFee":"1000000","createAssetTxFee":"10000000","createChainTxFee":"1000000000"}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /lps", zip.Doc{
Description: "LPs is where the network's stake stands on every current Lux Proposal.",
Fields: map[string]string{
"LP.abstainWeight": "AbstainWeight is the stake that has not said.",
"LP.objectWeight": "ObjectWeight is the stake against.",
"LP.supportWeight": "SupportWeight is the stake in favour.",
"LPs.lps": "LPs are the proposals, by number.",
},
Response: json.RawMessage(`{"lps":{"23":{"supportWeight":"0","objectWeight":"0","abstainWeight":"1000000000000"}}}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /network/id", zip.Doc{
Description: "NetworkID is the number of the network this node is on.",
Fields: map[string]string{
"NetworkID.networkID": "NetworkID is the network's number.",
},
Response: json.RawMessage(`{"networkID":96369}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /network/name", zip.Doc{
Description: "NetworkName is the name of the network this node is on.",
Fields: map[string]string{
"NetworkName.networkName": "NetworkName is the network's name.",
},
Response: json.RawMessage(`{"networkName":"mainnet"}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /node/id", zip.Doc{
Description: "Identity is this node's id, with the proof it holds the staking key that id is\nderived from.",
Fields: map[string]string{
"NodeID.nodeID": "NodeID is the id peers know this node by.",
"NodeID.nodePOP": "NodePOP is the proof this node holds the key its id is derived from.",
"ProofOfPossession.proofOfPossession": "ProofOfPossession is the signature over that key, hex encoded.",
"ProofOfPossession.publicKey": "PublicKey is the BLS public key, hex encoded.",
},
Response: json.RawMessage(`{"nodeID":"NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg","nodePOP":{"publicKey":"0x8f95","proofOfPossession":"0x86a3"}}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /node/ip", zip.Doc{
Description: "Address is where this node tells its peers to reach it.",
Fields: map[string]string{
"NodeIP.ip": "IP is the address and port peers dial.",
},
Response: json.RawMessage(`{"ip":"203.0.113.9:9651"}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /node/version", zip.Doc{
Description: "NodeVersion is what this node is running: its own release, the database format\nit reads, and the VM protocol it speaks.",
Fields: map[string]string{
"NodeVersion.databaseVersion": "DatabaseVersion is the database format this node reads.",
"NodeVersion.gitCommit": "GitCommit is the commit this node was built from.",
"NodeVersion.rpcProtocolVersion": "RPCProtocolVersion is the VM protocol this node speaks.",
"NodeVersion.version": "Version is the node's own release.",
},
Response: json.RawMessage(`{"version":"luxd/1.36.178","databaseVersion":"v1.4.5","rpcProtocolVersion":39,"gitCommit":""}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /peers", zip.Doc{
Description: "Peers are the nodes this one is connected to. A list of node ids narrows the\nanswer to those, and no list asks for all of them.",
Fields: map[string]string{
"Peer.ip": "IP is the address this node reaches the peer at.",
"Peer.nodeID": "NodeID is the peer's id.",
"Peer.observedUptime": "ObservedUptime is the share of time this node has seen the peer up.",
"Peer.publicIP": "PublicIP is the address the peer tells others to use.",
"Peer.trackedChains": "TrackedChains are the chains the peer is following.",
"Peer.version": "Version is the release the peer is running.",
"Peers.numPeers": "NumPeers is how many connections this node holds.",
"Peers.peers": "Peers are the connections themselves.",
"PeersArgs.nodeIDs": "NodeIDs are the peers to answer for; none asks for all of them.",
},
Example: json.RawMessage(`{"nodeIDs":[]}`),
Response: json.RawMessage(`{"numPeers":"1","peers":[{"ip":"203.0.113.9:9651","publicIP":"203.0.113.9:9651","nodeID":"NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg","version":"luxd/1.36.178","observedUptime":99,"trackedChains":[]}]}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /upgrades", zip.Doc{
Description: "Upgrades is the upgrade schedule this node runs.",
Fields: map[string]string{
"Upgrades.epochDuration": "EpochDuration is how long one epoch lasts, in nanoseconds.",
"Upgrades.stopVertexID": "StopVertexID is the vertex the linearisation stopped at.",
},
Response: json.RawMessage(`{"stopVertexID":"jrGWDh5Po9FMj54depyunNixpia5PN4aAYxfmNzU8n752Rjga","epochDuration":"300000000000"}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /uptime", zip.Doc{
Description: "Uptime is how much of the network, by stake, reports having seen this node up.",
Fields: map[string]string{
"Uptime.rewardingStakePercentage": "RewardingStakePercentage is the share of stake that would reward this node.",
"Uptime.weightedAveragePercentage": "WeightedAveragePercentage is the stake-weighted average uptime.",
},
Response: json.RawMessage(`{"rewardingStakePercentage":"100.0000","weightedAveragePercentage":"99.9999"}`),
})
zip.Describe("github.com/zap-proto/zip/corpus/info GET /vms", zip.Doc{
Description: "VMs are the virtual machines installed on this node, and the feature\nextensions its UTXO chains understand.",
Fields: map[string]string{
"VMs.fxs": "Fxs are the feature extensions the UTXO chains understand, by id.",
"VMs.vms": "VMs are the installed machines, by id, each with the names it answers to.",
},
Response: json.RawMessage(`{"vms":{"mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6":["platformvm"]},"fxs":{"spqBHsy2UBGpjaQJezEywUy1AB98eVjJ3WQ38x1vpjsx4xPkY":"secp256k1fx"}}`),
})
}