RFC: Redesign RingLocation in host_account_create_proof#18
Open
filvecchiato wants to merge 2 commits into
Open
RFC: Redesign RingLocation in host_account_create_proof#18filvecchiato wants to merge 2 commits into
filvecchiato wants to merge 2 commits into
Conversation
Incorporate feedback from triangle-js-sdks#81 (@Zebedeusz): - Remove RingIndex from RingLocationJunction (no longer an input) - Add ring_index and ring_revision (non-optional) to RingVrfProof so products can pass them to downstream precompiles (e.g. personhoodInfoByProof from individuality#891) without extra queries - Add "Abstraction-friendly" rationale addressing whether products should need to know ring location details at all - Add unresolved question about a well-known default RingLocation - Reference individuality#878, #891, and the original review thread
4 tasks
pgherveou
added a commit
that referenced
this pull request
May 17, 2026
…tform (#18) UniFFI already gives Kotlin (Android) and Swift (iOS) trait surfaces straight from `truapi-platform`. Web hosts had hand-written TS types in `@parity/truapi-host-shared/src/runtime.ts` that mirrored the Rust traits manually — drift hazard. Codegen now covers TS too so all three platforms track the same Rust source. What's new: - `truapi-codegen` gains a platform-crate rustdoc parser (`src/platform.rs`, ~470 LOC). Walks each `pub trait`, classifies method return types (`Unit` / `Result<...>` / `BoxStream` / `Box<dyn T>` / plain), records `impl Future + Send` returns as async. Detects the `Platform` super-trait (method-less, composed of other local traits) and preserves the composition order. - New TS emitter `src/ts/host_callbacks.rs` (~250 LOC) emits one `export interface` per Rust capability trait plus a composite `HostCallbacks extends Storage, Navigation, ...` interface that mirrors `Platform`. Types resolve to existing imports from `@parity/truapi`. - CLI flags `--platform-input` and `--platform-ts-output` wire the emitter into the workflow. Existing `--input`/`--output`/`--host-output`/ `--rust-output` flags are unchanged. - `scripts/codegen.sh` runs `cargo +nightly rustdoc -p truapi-platform` alongside the existing `-p truapi` step and emits to `js/packages/truapi-host-shared/src/generated/host-callbacks.ts`. Consumer integration in `@parity/truapi-host-shared`: - `src/generated/` and `dist/generated/` added to `.gitignore` (matches the `@parity/truapi` policy). - `runtime.ts` re-exports the typed surface (`HostCallbacks`, `Storage`, `Navigation`, ...) from the generated file. `WasmRawCallbacks` stays in place — it's the byte-level WASM bridge surface and additionally covers core-internal account/sign/statement- store callbacks that aren't part of `truapi-platform`. A short doc-block makes the typed-vs-raw layering explicit. Bridging the two via a SCALE adapter is a deliberate follow-up. Tests: - `golden_host_callbacks_ts` integration test pairs rustdoc-of-both- crates with the codegen binary and diffs against a checked-in golden. - 178 workspace tests passing (was 177; +1 for the new golden). - wasm32 target builds clean. - `npm install && npm run build && npm test` clean in `@parity/truapi-host-shared`.
pgherveou
added a commit
that referenced
this pull request
May 17, 2026
…emitter The new TS HostCallbacks emitter from #18 hand-chained 15 writeln! calls to build the output. CLAUDE.md (this commit also) now requires codegen modules to prefer indoc::writedoc! / formatdoc! over writeln! chains so the emitted shape stays visible in source. Switched host_callbacks.rs to: - writedoc! for the header + import block (two multi-line writes) - formatdoc! returning strings for trait interfaces, methods, and the super-interface; the parent function joins them - render_jsdoc returns a String instead of writing through a sink writeln! count: 15 → 2 (both inside writedoc! invocations themselves). Golden test rebuilt clean; workspace tests all pass.
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.
RFC: Redesign RingLocation in host_account_create_proof
Summary
Redesigns the
RingLocationparameter inhost_account_create_proofto better support the evolving ring membership model.Checklist
docs/rfcs/0004-ringlocation-redesign.mdwith completed frontmatterdocs/rfcs/_index.mdwith a link to the new RFCrfc,proposalMotivation
The current
RingLocationdesign does not adequately support the proof-of-personhood ring membership model. Migrated from paritytech/triangle-js-sdks#81.