qkc/slave 03: define message structs and protocol factory#31
Conversation
|
Overall, this PR is not ready yet. The three inline P1s are all deterministic byte-level incompatibilities with pyquarkchain: QKC These issues were found by Codex 5.5 Extra High without any task-specific prompt or hints. Before submitting wire/serialization code, please run a Codex scan against the Python source and include Python-compatible golden vectors so this class of mismatch is caught before review. |
|
Additional testing note: the current tests did not catch these issues because they mostly prove Go-side self-consistency, not Python wire compatibility. A Go encode/decode/encode round trip will still pass when both sides share the same wrong assumptions, such as The hand-computed vectors have the same weakness: they can encode the reviewer/author assumption instead of the pyquarkchain contract. For this layer, please add Python-generated golden vectors for representative messages and primitives, including |
Define the wire protocol message layer for slave↔master and peer↔slave
communication, byte-for-byte aligned with pyquarkchain:
This PR establishes a complete opcode → message struct mapping for all
ClusterOp and CommandOp messages.
Changes
types.go
Custom wire types:
Implements Python-style 4-byte length-prefixed serialization for
nested slices and hash lists, with basic safety constraints.
rawbytes_placeholder.go
RawBytes is a temporary schema placeholder.
Current goal:
RawBytes is not intended to provide semantic deserialization of the underlying Python types.
Review focus should be on:
not on placeholder limitations.
messages.go
94 message structs covering all ClusterOp and CommandOp messages.
protocol.go
Opcode dispatch layer:
Provides strict opcode → struct mapping (fail-fast on unknown opcodes)
Test coverage includes:
Notes
all Python complex types are ported.
with Python Serializable behavior.