Skip to content

feat(individuality): product proof contexts and personhood ring locations - #347

Merged
Imod7 merged 6 commits into
mainfrom
feat/individuality-lite-contexts
Sep 1, 2026
Merged

feat(individuality): product proof contexts and personhood ring locations#347
Imod7 merged 6 commits into
mainfrom
feat/individuality-lite-contexts

Conversation

@peetzweg

@peetzweg peetzweg commented Aug 31, 2026

Copy link
Copy Markdown
Member

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.

…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).
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown

📦 Bundle size impact

Comparing 2026-09-01T11:50:52.342Z2026-09-01T11:49:56.679Z

Package Entry Bundled before Bundled after Δ Ship gzip Δ Shake ratio
🟢 @parity/product-sdk . 8.56 MB 8.57 MB +4.4 KB (+0.1%) +13 B 0% (was 0%)
🟢 @parity/product-sdk ./chain 8.32 MB 8.33 MB +4.4 KB (+0.1%) 0 B 0% (was 0%)
🟢 @parity/product-sdk ./cloud-storage 8.50 MB 8.50 MB +4.4 KB (+0.1%) 0 B 2% (was 2%)
🟢 @parity/product-sdk ./core 8.56 MB 8.57 MB +4.4 KB (+0.1%) +11 B 0% (was 0%)
🟢 @parity/product-sdk ./host 93.7 KB 98.3 KB +4.6 KB (+4.9%) 0 B 8% (was 9%)
🟢 @parity/product-sdk ./individuality 69.8 KB 73.3 KB +3.4 KB (+4.9%) 0 B
🟢 @parity/product-sdk ./local-storage 60.1 KB 64.5 KB +4.4 KB (+7.3%) 0 B 100% (was 100%)
🟢 @parity/product-sdk ./react 8.57 MB 8.58 MB +4.4 KB (+0.1%) +12 B 0% (was 0%)
🟢 @parity/product-sdk ./testing 59.0 KB 59.1 KB +148 B (+0.2%) +24 B 26% (was 25%)
🟢 @parity/product-sdk ./wallet 190.5 KB 194.9 KB +4.4 KB (+2.3%) 0 B 1% (was 1%)
🟢 @parity/product-sdk-chain-client . 8.32 MB 8.33 MB +4.4 KB (+0.1%) 0 B 0% (was 0%)
🟢 @parity/product-sdk-cloud-storage . 8.50 MB 8.50 MB +4.4 KB (+0.1%) 0 B 2% (was 2%)
🟢 @parity/product-sdk-host . 93.7 KB 98.3 KB +4.6 KB (+4.9%) +36 B 8% (was 9%)
🟢 @parity/product-sdk-host ./testing 10.4 KB 10.5 KB +31 B (+0.3%) +39 B 65% (was 65%)
🟢 @parity/product-sdk-local-storage . 60.1 KB 64.5 KB +4.4 KB (+7.3%) 0 B 100% (was 100%)
🟢 @parity/product-sdk-signer . 190.5 KB 194.9 KB +4.4 KB (+2.3%) 0 B 1% (was 1%)
🟢 @parity/product-sdk-statement-store . 105.4 KB 110.0 KB +4.6 KB (+4.4%) 0 B 9% (was 10%)

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 Imod7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread product-sdk/packages/individuality/src/rings.ts
Comment thread product-sdk/packages/individuality/src/rings.ts Outdated
Comment thread product-sdk/packages/individuality/src/rings.ts Outdated
Comment thread product-sdk/packages/individuality/src/contexts.ts Outdated
@Imod7

Imod7 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Please add ScoreContextChain to packages/sdk/src/individuality/contract.test.ts, beside the existing IndividualityChain assertions.

Fixed in 2e5cead. All three suffix contracts are asserted per environment, both RingLocation directions are pinned, and ScoreContextChain joined FromPapiSatisfiesContracts.

Please add the new surface to product-sdk/skills/product-sdk-individuality/SKILL.md.

Fixed in b3e9386.

@Imod7
Imod7 merged commit 09e24c4 into main Sep 1, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants