protocol: freeze minimal WWAR v1 wire conformance

This commit is contained in:
2026-08-11 19:37:30 +09:00
parent 3157e1d688
commit 7bc96b4e03
13 changed files with 7533 additions and 2 deletions

View File

@@ -0,0 +1,253 @@
{
"format": "wwar-v1-digest-schema",
"version": 1,
"domains": [
{
"name": "action-key",
"algorithm": "sha256",
"separator_utf8_hex": "57572d414354494f4e2d4b455900",
"input": {
"record": "ActionRecordV1",
"encoding": "WWAR"
},
"formula": [
"separator",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"kind": "bytes",
"scalar": "ActionKey"
}
},
{
"name": "blob",
"algorithm": "sha256",
"separator_utf8_hex": "57572d424c4f4200",
"input": {
"kind": "bytes"
},
"formula": [
"separator",
"u64be(input-length)",
"input-bytes"
],
"result": {
"record": "TypedDigestV1",
"domain": "blob",
"record-kind": 0,
"record-schema": 0
}
},
{
"name": "calling-conventions",
"algorithm": "sha256",
"separator_utf8_hex": "57572d43414c4c494e472d434f4e56454e54494f4e532d563100",
"input": {
"record": "CallingConventionTableProjectionV1",
"encoding": "WWAR"
},
"formula": [
"separator",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"kind": "bytes",
"length": 32
}
},
{
"name": "export-declaration-abi",
"algorithm": "sha256",
"separator_utf8_hex": "57572d4558504f52542d4445434c2d4142492d563100",
"input": {
"record": "ExportDeclarationABIProjectionV1",
"encoding": "WWAR"
},
"formula": [
"separator",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"kind": "bytes",
"length": 32
}
},
{
"name": "native-data-layout",
"algorithm": "sha256",
"separator_utf8_hex": "57572d4e41544956452d444154412d4c41594f55542d563100",
"input": {
"record": "NativeDataLayoutProjectionV1",
"encoding": "WWAR"
},
"formula": [
"separator",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"kind": "bytes",
"length": 32
}
},
{
"name": "native-header-contract",
"algorithm": "sha256",
"separator_utf8_hex": "57572d4e41544956452d4845414445522d434f4e54524143542d563100",
"input": {
"record": "NativeHeaderContractProjectionV1",
"encoding": "WWAR"
},
"formula": [
"separator",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"kind": "bytes",
"length": 32
}
},
{
"name": "native-type-contract",
"algorithm": "sha256",
"separator_utf8_hex": "57572d4e41544956452d545950452d434f4e54524143542d563100",
"input": {
"record": "NativeTypeContractProjectionV1",
"encoding": "WWAR"
},
"formula": [
"separator",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"kind": "bytes",
"length": 32
}
},
{
"name": "origin-type-contract",
"algorithm": "sha256",
"separator_utf8_hex": "57572d4f524947494e2d545950452d434f4e54524143542d563100",
"input": {
"record": "OriginTypeContractProjectionV1",
"encoding": "WWAR"
},
"formula": [
"separator",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"kind": "bytes",
"length": 32
}
},
{
"name": "public-abi",
"algorithm": "sha256",
"separator_utf8_hex": "57572d5055424c49432d4142492d563100",
"input": {
"record": "PublicABIProjectionV1",
"encoding": "WWAR"
},
"formula": [
"separator",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"kind": "bytes",
"length": 32
}
},
{
"name": "public-type",
"algorithm": "sha256",
"separator_utf8_hex": "57572d5055424c49432d545950452d563100",
"input": {
"record": "PublicTypeProjectionV1",
"encoding": "WWAR"
},
"formula": [
"separator",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"kind": "bytes",
"length": 32
}
},
{
"name": "record",
"algorithm": "sha256",
"separator_utf8_hex": "57572d5245434f524400",
"input": {
"record": "top-level record",
"encoding": "WWAR"
},
"formula": [
"separator",
"u32be(record-kind)",
"u32be(record-schema)",
"u64be(encoded-length)",
"encoded-bytes"
],
"result": {
"record": "TypedDigestV1",
"domain": "record",
"record-kind": "1..22",
"record-schema": 1
}
},
{
"name": "source-tree",
"algorithm": "sha256",
"separator_utf8_hex": "77772d736f757263652d747265652d763100",
"input": {
"record": "SourceTreeProjectionV1",
"encoding": "special-source-tree-v1"
},
"entry_encoding": {
"path": [
"u64be-byte-length",
"raw-nfc-utf8"
],
"type": {
"dir": 1,
"file": 2
},
"executable": {
"false": 0,
"true": 1,
"directory": 0
},
"content": {
"dir": [
"u64be",
0
],
"file": [
"u64be",
32,
"raw-sha256"
]
},
"order": "raw-utf8-path-bytes"
},
"formula": [
"separator",
"concatenate entry path,type,executable,content frames"
],
"result": {
"kind": "bytes",
"scalar": "SourceTreeDigest"
}
}
]
}

1958
protocol/schema/records.json Normal file

File diff suppressed because it is too large Load Diff

145
protocol/schema/wire.json Normal file
View File

@@ -0,0 +1,145 @@
{
"format": "wwar-v1-wire-schema",
"version": 1,
"magic_hex": "57574152",
"schema_version": 1,
"root": "one complete value; typed identities and wrappers additionally require their declared record",
"value_frame": {
"type": "u8",
"payload_length": "u64be",
"payload": "exactly payload_length bytes"
},
"container_frames": {
"list": {
"count": "u32be",
"members": "count repetitions of u64be(value_length) followed by exactly one complete value frame"
},
"map": {
"count": "u32be",
"members": "count repetitions of u64be(key_length), raw UTF-8 key, u64be(value_length), complete value frame"
},
"record": {
"count": "u32be",
"members": "count repetitions of u32be(field_tag), u64be(value_length), complete value frame"
}
},
"wire_types": [
{
"name": "bytes",
"code": 1,
"payload": {
"frame": "raw-bytes",
"canonical": [
"declared-limit",
"frame-available",
"exact-length"
]
}
},
{
"name": "string",
"code": 2,
"payload": {
"frame": "utf8",
"canonical": [
"declared-limit",
"frame-available",
"valid-utf8",
"no-nul-string",
"nfc-string",
"exact-length"
]
}
},
{
"name": "uint",
"code": 3,
"payload": {
"frame": "minimal-uint",
"canonical": [
"declared-limit",
"frame-available",
"uint-width",
"uint-minimal",
"exact-length"
]
}
},
{
"name": "bool",
"code": 4,
"payload": {
"frame": "byte",
"canonical": [
"declared-limit",
"frame-available",
"bool-00-or-01",
"exact-length"
]
}
},
{
"name": "list",
"code": 5,
"payload": {
"frame": "counted-values",
"canonical": [
"declared-limit",
"frame-available",
"declared-order",
"exact-length"
]
}
},
{
"name": "map",
"code": 6,
"payload": {
"frame": "counted-pairs",
"canonical": [
"declared-limit",
"frame-available",
"raw-utf8-key-order",
"exact-length"
]
}
},
{
"name": "record",
"code": 7,
"payload": {
"frame": "counted-fields",
"canonical": [
"declared-limit",
"frame-available",
"increasing-tag-order",
"exact-length"
]
}
}
],
"limits": {
"container_members_max": 16777215,
"nesting_depth_max": 64,
"string_or_bytes_length_max": 2147483647,
"uint_max": "18446744073709551615",
"wwar_payload_length_max": "18446744073709551615"
},
"unicode": {
"version": "16.0.0",
"form": "NFC",
"nul_forbidden": true,
"scalar_values_only": true,
"utf8": "RFC 3629 shortest form; surrogates and values above U+10FFFF are invalid",
"validation_order": [
"decode shortest-form UTF-8",
"reject NUL and non-scalar values",
"require exact NFC under Unicode 16.0.0"
]
},
"error_precedence": [
"declared limit before frame availability",
"frame truncation before type-specific or exact-length checks",
"fully framed child length mismatch before child interpretation"
]
}

View File

@@ -0,0 +1,3 @@
fd27eaf17bb8767f685bad4b4f577eb7521771f9ea58eeb4824a78a622664f4f wire.json
4b4d18f60de652831e16d4c34b6c291020991ba7e5493a25f9f28b11d14b3cba records.json
de722e871e3bb8c5801d94d214b3cbe03d111b3a53957ca95a876f53e11e58cc digests.json