feat(truapi): development_createAccountProof for raw proof contexts - #457
Open
peetzweg wants to merge 8 commits into
Open
feat(truapi): development_createAccountProof for raw proof contexts#457peetzweg wants to merge 8 commits into
peetzweg wants to merge 8 commits into
Conversation
The chain checks a lite-alias proof's context against its own constants
(pop:polkadot.network/score for the game), and no blake2b("product/<id>/…")
can equal one, so the whole lite free-play flow is unrunnable end to end
before individuality#1247 aligns them. This lets a caller name the 32 bytes
directly, gated on an env var no released host sets and a product id dotNS
cannot issue.
Not for release: a host that honours it lets a product mint a proof in a
context it does not own, which is the property the derivation guarantees. It
exists so the flow could be run once, which it now has been - both legs land
on nextv2.
Wraps account.createAccountProof so a product can bind a ring-VRF proof to 32 verbatim bytes; the signing host honours it only under TRUAPI_RAW_PROOF_CONTEXT=1. Everything lives in development.ts so it can be deleted in one go.
peetzweg
marked this pull request as ready for review
August 27, 2026 14:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a development-only way (no opt-in needed) for a product to bind a ring-VRF proof to 32 bytes of its choosing, instead of the
blake2b("product/<id>/…")context the host derives for it.Why: the namespacing means a product can only ever prove into contexts under its own product id. That blocks two things we need right now: runtimes whose ring-VRF contexts are string literals (e.g.
pop:polkadot.network/score), which no product hash can equal, and one product (dim2.dot) proving into another product's context (people.dot). Both are needed to run the lite free-play flow end to end on nextv2 today.How: two small pieces, each isolated so the whole hatch can be deleted in one go once the real mechanism lands.
ring_vrf.rs):context_bytesis unchanged. Adevelopmentmodule addsdevelopment_context_bytes, which returns theRawsuffix verbatim when the request carries the product idraw:(a marker dotNS cannot issue, so no real product reaches it) and otherwise callscontext_bytes. The four proof/alias call sites insigning_host.rsandpairing_host.rsuse it. No build flag or environment variable; the hatch is on in every host until it is deleted.@parity/truapi):development_createAccountProof(client, request)takes the exact shape ofaccount.createAccountProofwithcontextas a 32-byte hex string, fills in theraw:marker and forwards the call. It lives entirely insrc/development.tsplus one re-export, carries aTODOand is documented as yet to be removed before a production release.Why a marker in the existing message and not a new wire method:
createAccountProofdoes not stop at the host; the request is forwarded over the SSO channel to whoever holds the key (phone app ortruapi-hostCLI). A dedicateddevelopment_create_account_proofwould therefore need a new#[wire(request_id)]in thetruapitrait, new request types and versioned envelopes, regenerated client and golden tests, aruntime.rshandler, anauthority.rsmethod on both backends, newRemoteMessagerequest/response variants in the SSO protocol, and matching handlers insigning_host.rs,sso_responder.rs,pairing_host.rsandsso_channel.rs— plus a phone build that understands the new variant, and the same list in reverse to remove it, with the wire id staying burned. Theraw:product id is a different value in a message all of those layers already carry, so nothing in between changes and deletion is local toring_vrf.rsanddevelopment.ts. It is not an opt-in or a gate, only the discriminator that tells the signing host which function was called. Right design for a permanent feature, wrong one for something we intend to delete.Tests: bun test for the request shape and hex validation; the Rust hatch is a single guarded early return in front of the existing, still-tested
context_bytes.