Repository navigation
UTB parity 2/4: V2 trust-base entry codec, strict signatures, bounded CBOR - #2
Conversation
…res, bounded CBOR; shared entry and max-entry vectors TrustBaseEntry: exact 10-field array, deterministic re-encoding check, entry id = SHA-256(sigBytes), unsigned-64 epochs and weights, UTF-8 byte-order member sort, structure rules, exact threshold, strict 65-byte low-S recoverable signatures, successor check. Bounds: 128 KiB, 256 members, 256 signatures, 128-byte node ids; counts are checked from the array and map headers before any element is read (CborDeserializer.decodeArrayAtMost/decodeMapAtMost). decodeTextString is strict UTF-8 (was platform default, replacement). Vendored byte for byte: bft-go-base c32454f vectors (dfcf63a0) and 81ee667 max-entry (c4c59703).
|
java#2 at 7147e87: no blockers. APPROVE once CI is green. Vectors: |
|
APPROVE at 7147e87, for the owner's list. CI |
Owner §51, plan briefs/java-utb-parity-plan.md, PR 2 (stacked on #1). Mirrors JS
RootTrustBaseV2.ts+MaxEntryTest, Rusttrust_base_entry.rs+tests/trust_base_{entry_vectors,entry_max,signature_limits}.rs(Rust dev2/upstream-utb 7a6f11a as the reference for the §49 limits).TrustBaseEntry(packageorg.unicitylabs.sdk.api.bft.trustbase): tag 39000, version 2, exact 10-field array, deterministic re-encode check,entryId = SHA-256(sigBytes)(signature field CBOR null), unsigned-64 epoch/round/weight aslongbit patterns, structure rules, exact thresholdfloor(2W/3)+1, genesis/non-genesis shape, strict 65-byte low-S recoverable signatures bound to the member key (64-byte compact form refused),verifySuccessor.TrustBaseEncodingException,TrustBaseInvalidException,TrustBaseChainException,TrustBaseSignatureException(baseTrustBaseException, unchecked).CborDeserializer:decodeArrayAtMost/decodeMapAtMost(header-count bound),decodeTextStringis now strict UTF-8 (was platform default charset with replacement).vectors.json(dfcf63a0) and 81ee667max-entry.json(c4c59703). Entries and decode verdicts/error classes match; the 95,365-byte max entry decodes, re-encodes equal, is signed by all 256 genesis members and verifies as successor.Mutants (each caught): byte cap +1, members 257, signatures 257, node id 129, weight 2^40+1, quorum signature cap removed, lenient UTF-8, array/map header bounds removed, empty-hash allowed, 64-byte signature padded, recovery unbound, duplicate key allowed, member order
>=->>, threshold unchecked. Equivalent: dropping the explicit 0x02/0x03 prefix test (BouncyCastle refuses a 33-byte uncompressed prefix anyway).Evidence:
./gradlew test checkstyleMain animalsnifferMainunder Temurin 11 green. Not merged by me; owner list.