Skip to content

feat(individuality): Score.register builders and withScoreParticipant - #349

Merged
Imod7 merged 9 commits into
mainfrom
feat/individuality-score-register
Sep 2, 2026
Merged

feat(individuality): Score.register builders and withScoreParticipant#349
Imod7 merged 9 commits into
mainfrom
feat/individuality-score-register

Conversation

@peetzweg

@peetzweg peetzweg commented Aug 31, 2026

Copy link
Copy Markdown
Member

Follows #348, now merged. The registration piece of #354: what a product needs to turn a scored participant into a full person.

Why: dim2 hand-rolls the Score.register message and the ScoreAsParticipant extension today, and the personhood product needs the same builders for the cross-product handoff.

How: registerMessage(account) pins the byte-exact "pop register using" ++ account contract, a raw 50-byte concatenation, never SCALE. registerPersonhoodTx builds the call from a caller-supplied (memberKey, proofOfOwnership) pair, width-checked and opaque: only the personhood product's own host session can mint it, so the builder never tries, which lets the same code serve today's two-product handoff and a future single-product path. readRegistrationEligibility folds Score.Participants and Score.PersonhoodThreshold at one pinned block into a readyToRegister verdict. withScoreParticipant(signer) is the third signer on the shared origin-extension machinery: fee-free dispatch from a 0-balance participant account.

One judgment call: the proposal's caller-supplied nonce was dropped in favour of reading it back out of the CheckNonce slot PAPI filled, since the chain rejects any disagreement with nothing local to read.

From review: the two new chain contracts are asserted against the paseo, previewnet and devnet descriptors in packages/sdk, registerMessage rethrows a malformed address as ProductIndividualityError instead of PAPI's bare Invalid checksum, readRegistrationEligibility takes the account arm only, and the individuality skill doc gains a registration section.

Message bytes and flow verified live on previewnet (spec 1000036) on 2026-08-28. 520 package tests pass; workspace tests + typecheck + biome clean.

…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).
…igin

The PeopleLiteAuth sibling of withAsPerson, on the same metadata-driven
machinery: AliasWithAccount for calls signed by an account bound to the
lite alias (the free Game.sign_up_with_account_lite_invite leg),
AliasWithProof for the unsigned ring-VRF-authorized
PeopleLite.set_alias_account bind leg, and AliasWithAccountRevised to
refresh a stale binding over the pallet's (implication, "revise",
account, nonce) tuple.

The slot patching, nonce read-back, proof-request guards and pipeline
cache that as-person-signer.ts kept file-private move to an internal
origin-extension.ts both signers share; the codec's context and proof
width guards are exported for the second encoder. Proof-variant bytes
are pinned against the encoding verified live on previewnet, and the
devnet blob - whose PeopleLiteAuthData predates the RevisionIndex
field - is the negative case proving the round-trip guard rejects a
field-list mismatch loudly. No behaviour change for withAsPerson.
Full-personhood registration, the step after the score is in:
registerMessage pins the byte-exact proof-of-ownership contract (raw
"pop register using" ++ account, 50 bytes, never SCALE),
registerPersonhoodTx builds Score.register(Some((member_key, sig)))
from a caller-supplied, width-checked pair the SDK never mints — only
the personhood product's host session can — and
readRegistrationEligibility folds Score.Participants and the
session-scheduled Score.PersonhoodThreshold storage item at one pinned
block into readyToRegister, also exported as the pure predicate.

withScoreParticipant is the third signer on the shared origin-extension
machinery: RestrictOrigins true, nonce read back out of CheckNonce, and
ScoreAsParticipant(Some(nonce)) encoded through the chain's own
metadata — the newtype-over-Option-over-newtype unwraps to a bare
number, and the plausible { nonce } shape silently encodes Some(0),
which the round-trip guard turns into a thrown AsPersonError.

Mirrors the flow verified live on previewnet (spec 1000036,
individuality v0.12.1) on 2026-08-28.

@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 update the individuality skill doc in this PR. It has no registration section, so anyone building this flow from it hand-rolls the message, and the quoted line is now false since there are three exported signers.

Comment thread product-sdk/packages/individuality/src/register.ts
Comment thread product-sdk/packages/individuality/src/register.ts Outdated
Comment thread product-sdk/packages/individuality/src/register.ts Outdated
Comment thread product-sdk/packages/individuality/src/as-score-participant-signer.ts Outdated
Comment thread product-sdk/packages/individuality/src/register.ts Outdated
@Imod7
Imod7 changed the base branch from feat/individuality-with-lite-alias to main September 1, 2026 16:36
@Imod7

Imod7 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Please update the individuality skill doc in this PR.

Fixed in 9cad132.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

📦 Bundle size impact

Comparing 2026-09-02T10:52:41.733Z2026-09-02T10:52:39.225Z

Package Entry Bundled before Bundled after Δ Ship gzip Δ Shake ratio
🟢 @parity/product-sdk ./individuality 74.6 KB 76.0 KB +1.4 KB (+1.9%) 0 B

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 merged commit 9c58de7 into main Sep 2, 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