feat(individuality): product proof contexts and personhood ring locations - #347
Conversation
…ions Pure helpers consolidating what dim2 and humanity each hand-roll: productContext / contextSuffixBytes (the RFC-0024 Index/Raw expansion), personhoodContext with the peopl context index map, ringCollectionId with peopleRing / litePeopleRing, and readScoreContext, which checks that Score.score_context is the product derivation of peopl.<Score.Suffix>/Index(0) and reports a literal (non-host-mintable) context as NotProductDerived on the ok channel. Product ids are always full DotNS ids; the TLD is never defaulted. Pinned in-source against previewnet's published constants (spec 1000036), both collection ids, and the dim2/game context vectors. Part of the lite personhood sign-up flow (product-sdk#286).
📦 Bundle size impactComparing
Thresholds — 🟡 ≥10% or ≥5.0 KB · 🟠 ≥20% or ≥15.0 KB (bundled). Percentage only applies once the baseline is ≥ 10 KB. Informational — this check never blocks merge. |
Imod7
left a comment
There was a problem hiding this comment.
Please add ScoreContextChain to packages/sdk/src/individuality/contract.test.ts, beside the existing IndividualityChain assertions.
Please add the new surface to product-sdk/skills/product-sdk-individuality/SKILL.md.
Fixed in
Fixed in |
First piece of the lite-personhood sign-up flow (#354): pure helpers for the proof contexts and ring locations that dim2 and humanity each hand-roll today.
Why: every context a host signs under is blake2b-256("product/" ++ productId ++ "/" ++ suffix) with the RFC-0024 Index/Raw expansion, and two of the personhood product's five contexts never reach metadata, so consumers have to derive them client-side.
What: productContext / contextSuffixBytes / personhoodContext(tld, name) as pure functions; peopleRing / litePeopleRing build the two RingLocations, structurally compatible with product-sdk-host without depending on it; readScoreContext checks Score.score_context is the product derivation of peopl./Index(0) and answers NotProductDerived on the ok channel, so proof flows stop before the chain rejects with nothing local to read. Product ids are always full DotNS ids with no TLD default; a tld must be a single lower-case label inside the runtime's 16-byte bound, and a suffix that is not valid UTF-8 errors instead of becoming replacement characters in a product id.
The suffix source is typed, not probed. individuality-community#20 deleted the Score.Suffix constant in favour of Root-settable NetworkSuffix.NetworkSuffix storage, and that pallet is testnet-only, so there are three narrow contracts: NetworkSuffixChain (storage, read at a pinned block), LegacySuffixChain (the constant, previewnet only), or neither, where the caller passes tld. readScoreContext is overloaded across them, so a chain that can resolve no suffix fails to compile rather than at runtime. Separate contracts rather than one with optional members, because an optional member constrains nothing structurally and the umbrella guard would stop separating environments. runScoreContextRead is the throwing variant, for a composed read that already pinned a block.
Tests pin previewnet's constants (spec 1000036), both collection ids and the Index(0) vector. contract.test.ts asserts the three contracts per environment and both RingLocation directions, with the negatives checked by flipping them. 424 package tests, umbrella typecheck and tests clean. The individuality skill documents the new surface.
Stack: #350 consumes ScoreContextChain and calls readScoreContext inside a composed read, so it needs a suffix contract (or a tld) and runScoreContextRead with its own snapshot. #352 references readScoreContext in JSDoc only.