Files
zeekay 8005e1a29a The byte a warp reader dispatches on is a shape of its own
Both warp tables open with a kind byte and share nothing else, so reading it
meant wrapping the buffer as whichever answer the file listed first and asking
that one for its Kind. It gives the right byte and reads like a mistake — a
Conversion view over a message that is a Register.

`struct Tag` is that byte and nothing else: the question a reader asks before
it knows which answer it holds. Each arm then builds its own view over the
same object.

Where a shared PREFIX really does exist the code says so instead: every block
kind opens with the four fields a decided block is, and a proposal block's
transaction list sits at a standard block's offsets.
2026-09-06 13:24:17 -07:00

86 lines
2.0 KiB
Plaintext

# SPDX-License-Identifier: BSD-3-Clause-Eco
# What travels inside a warp message: the payload envelope, and the four
# things an L1 and the P-chain say to each other.
#
# Every one of them opens with a kind byte, which says which table to read.
package lux.platformvm.warpmsg.wire
type id32 = bytes_fixed[32]
type addr = bytes_fixed[20]
type key = bytes_fixed[48]
# The one byte both tables open with. It is a struct of its own because that
# is what it is — the question a reader asks before it knows which of the
# answers below it is holding — and reading it through whichever answer
# happens to be listed first would only look like an answer.
struct Tag {
Kind u8 @0
}
# ---- the payload envelope
struct Digest {
Kind u8 @0
Hash id32 @1
}
struct Call {
Kind u8 @0
Source bytes @1
Payload bytes @9
}
# ---- what an L1 says
struct Register {
Kind u8 @0
ChainID id32 @1
BLSKey key @33
Expiry u64 @81
Weight u64 @89
NodeID bytes @97
RemoveThreshold u32 @105
RemoveAddrs list<addr> @109
DisableThreshold u32 @117
DisableAddrs list<addr> @121
}
struct Registration {
Kind u8 @0
ValidationID id32 @1
Registered bool @33
}
struct Reweight {
Kind u8 @0
ValidationID id32 @1
Nonce u64 @33
Weight u64 @41
}
struct Conversion {
Kind u8 @0
ID id32 @1
}
# ---- the conversion preimage
#
# No kind byte: it is never dispatched, only hashed. Each validator names a
# run in one blob of node ids, whose lengths differ.
struct Validator {
NodeIDStart u32 @0
NodeIDLen u32 @4
BLSKey key @8
Weight u64 @56
}
struct Conversions {
ChainID id32 @0
ManagerChainID id32 @32
ManagerAddress bytes @64
Validators list<Validator> @72
NodeIDPool bytes @80
}