code wiki / (root) / nx_cbor_decode.nx

nx_cbor_decode.nx

buildroot/runtime/nx_cbor_decode.nx

7819 B218 linesdepth 3pulls 3 transitivereach 5 importersview sourcekind librarytopic cbor
docsdependenciesstructsconstsfunctions

about

nx_cbor_decode.nx -- RFC 8949 decoder, inverse of nx_cbor.nx. Closes the storage roundtrip: spans encoded via nx_cbor_emit_span land in nx_log_chunked, then come back through this decoder when nx_trace_query (or any downstream consumer) walks the log. Same major-type subset as the encoder: 0 unsigned integer 1 negative integer 4 array 5 map Decoder is push-style: caller passes (buf, pos), each read returns (value, new_pos). No malloc, no internal state. Out-of-bounds reads are NOT bounds-checked here -- caller is responsible for staying within the chunk_pos limit recorded in the manifest. genealogy_id: rfc_8949_section_3 lineage_id: substrate_native_cbor_decoder_v1

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_cbor.nx nx_cbor_decode.nx nx_cbor_decode_test.nx nx_trace_query.nx

imports: nx_syscalls.nxnx_tier.nxnx_cbor.nx

imported by: nx_cbor_decode_test.nxnx_trace_query.nx

structs

none

consts

36const NX_CBOR_DK_UINT: nx_int = 0
37const NX_CBOR_DK_NINT: nx_int = 1
38const NX_CBOR_DK_ARRAY: nx_int = 2
39const NX_CBOR_DK_MAP: nx_int = 3
40const NX_CBOR_DK_OTHER: nx_int = 4 // major 2/3/6/7 -- not yet supported
41const NX_CBOR_DK_N_KINDS: nx_int = 5

functions

43func nx_cbor_dk_is_valid(k: nx_int) -> nx_int
called by 1: main
53func nx_cbor_peek_kind(buf: *u8, pos: nx_int) -> nx_int
74func nx_cbor_read_length(buf: *u8, pos: nx_int, new_pos: *i64) -> nx_int
117func nx_cbor_read_i64(buf: *u8, pos: nx_int, new_pos: *i64) -> nx_int
130func nx_cbor_read_array_header(buf: *u8, pos: nx_int, new_pos: *i64) -> nx_int
134func nx_cbor_read_map_header(buf: *u8, pos: nx_int, new_pos: *i64) -> nx_int
148func nx_cbor_read_span(buf: *u8, pos: nx_int, new_pos: *i64,