mirror of
https://github.com/zap-proto/go.git
synced 2026-10-30 15:05:00 +00:00
Generating C++ is a claim. This runs it. Both probes build the same cases from the same inputs — every type the dialect has, plus the request and response envelopes the generated client and dispatch produce — and print the hex; the two outputs are the same file. Then each probe reads both probes' bytes with its own generated accessors, four crossings, all agreeing. Then both read a corpus of real P-chain transactions produced by the Go chain implementation, 134 vectors of which 44 are truncated or malformed on purpose, and answer the same fields in the same places. Neither probe decides anything: every value printed comes from a generated accessor or a generated builder, so a disagreement between the probes is a disagreement between the backends and nowhere else. It earned its keep immediately. Five corpus vectors separated a Go [N]byte accessor answering zeros from a C++ span answering empty, and the round trip found the zero Object panicking in the Go runtime where C++ answered zero. Both are fixed; neither was visible by reading. list<T> carries a pointer and a count and nothing about elements — the dialect cannot state a stride — so both languages agree on the count, which is all either can say. That gap is in the dialect, in both backends at once.
30 lines
1.1 KiB
Plaintext
30 lines
1.1 KiB
Plaintext
# The P-chain spending envelope, as the corpus at
|
|
# node2/conformance/corpus/vectors.tsv carries it: the root object of the
|
|
# unsigned message that leads every signed P transaction.
|
|
#
|
|
# Offsets are the ones the hand-written readers use (node2
|
|
# chains/cpp/platformvm txs.hpp kOff*, chains/rust platformvm txs.rs). The
|
|
# fixed section is 77 bytes.
|
|
#
|
|
# The four list fields are records of a fixed stride laid down back to back —
|
|
# 72 bytes per output, 96 per input, 20 per address, 4 per signature index.
|
|
# The dialect cannot say a stride yet, so `list<u8>` here carries what it can
|
|
# say: the pointer and the element count. Reading an element is the gap
|
|
# reported alongside this backend, and it is a gap in the DIALECT, in both
|
|
# languages at once, not in either emitter.
|
|
|
|
package pchain
|
|
|
|
type id32 = bytes_fixed[32]
|
|
|
|
struct Spend {
|
|
Kind u8 @0
|
|
NetworkID u32 @1
|
|
BlockchainID id32 @5
|
|
Outs list<u8> @37
|
|
OwnerAddrs list<u8> @45
|
|
Ins list<u8> @53
|
|
SigIndices list<u8> @61
|
|
Memo bytes @69
|
|
}
|