Skip to main content

Module payload

Module payload 

Source
Expand description

The payload: one binary message per turn, each way.

An input is what a bot receives, an output is what it returns. Each is a short header, then one value per declared item, in declared order, with its byte length in front. Elements are little-endian.

"BSP" kind(u8: b'I' | b'O') payload_schema_version(u32)
repeat per declared value: byte_len(u32) elements…

check_output is the host’s one validity rule for an output: the header, every value’s exact length, and every element finite and inside its declared bounds. Anything else is rejected, and the seat gets the arena’s no-action. Nothing is clamped or corrected.

Enums§

Kind
Which way a payload goes.
PayloadError
Why a payload was rejected.
Values
One value’s elements, typed as declared.

Functions§

check
Decode and check a payload: structure, finiteness and bounds. This is the host’s whole validity rule.
check_output
The host’s check on one seat’s output.
decode
Decode a payload against its declaration, checking only its structure.
encode
Encode values, one per declared value, in declared order.
encoded_len
The exact encoded size of a payload of these values.
extremes
Every element at its lower or upper bound, chosen by pick: the bang-bang extremes fuzzing plays.
sample_uniform
Values drawn uniformly inside each element’s declared bounds, from a source of random u64s. What a random bot plays, and what fuzzing starts from.