From 00afb51b94512c9ca033278e6b8a298fc772a06a Mon Sep 17 00:00:00 2001 From: pgherveou Date: Fri, 17 Jul 2026 18:36:51 +0200 Subject: [PATCH] fix(dev): prevent stale generated bindings Regenerate before dev and dotli E2E startup so ignored outputs always match the Rust API. Pin dotli RFC 0004 confirmation support and use the live People collection in account examples. --- Makefile | 3 +-- README.md | 1 + hosts/dotli | 2 +- js/packages/truapi/scripts/ensure-generated.sh | 3 ++- rust/crates/truapi/src/api/account.rs | 16 ++++++++++++++-- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 956c1a59..35f26bc0 100644 --- a/Makefile +++ b/Makefile @@ -111,8 +111,7 @@ dev-bootstrap: ## Prepare ignored generated/build artifacts needed by dotli prev # --ignore-scripts: the workspace `prepare` builds need generated sources # that only exist after codegen.sh, which also builds the packages. if [ ! -d node_modules ]; then npm ci --ignore-scripts; fi - if [ ! -f "$(HOST_CALLBACKS_GENERATED)" ] || [ ! -f "$(HOST_WASM_ADAPTER_GENERATED)" ] || [ ! -f "$(HOST_WASM_WORKER_CALLBACKS_GENERATED)" ]; then ./scripts/codegen.sh; fi - cd $(TRUAPI_PKG) && npm run build + ./scripts/codegen.sh cd $(HOST_WASM_PKG) && npm run build TRUAPI_WASM_PROFILE=dev $(MAKE) wasm cd $(PLAYGROUND) && yarn install --frozen-lockfile diff --git a/README.md b/README.md index a5c38f00..56b74bd1 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ make playground # rebuild the playground against the refreshed snapshot ``` This repopulates the ignored generated TS under `js/packages/truapi/`, including the playground metadata. +`make dev` and `make e2e-dotli` run this generation step unconditionally before starting their local stacks. ## Protocol versions diff --git a/hosts/dotli b/hosts/dotli index 9f27a073..29d89b32 160000 --- a/hosts/dotli +++ b/hosts/dotli @@ -1 +1 @@ -Subproject commit 9f27a0731d81bb00bf6b6afd25e09202073d9c0a +Subproject commit 29d89b322324b5224cdb3be7ddc387b0a9b626ce diff --git a/js/packages/truapi/scripts/ensure-generated.sh b/js/packages/truapi/scripts/ensure-generated.sh index 43c4d9a2..807c0716 100755 --- a/js/packages/truapi/scripts/ensure-generated.sh +++ b/js/packages/truapi/scripts/ensure-generated.sh @@ -23,7 +23,8 @@ for path in "${codegen_required[@]}"; do fi done -if [ "$missing" -eq 1 ] || ! find playground/test/generated/examples -name '*.ts' -print -quit >/dev/null 2>&1; then +example_file="$(find playground/test/generated/examples -type f -name '*.ts' -print -quit 2>/dev/null || true)" +if [ "$missing" -eq 1 ] || [ -z "$example_file" ]; then if [ "${TRUAPI_REQUIRE_GENERATED:-0}" = "1" ]; then echo "ensure-generated: generated files are missing and TRUAPI_REQUIRE_GENERATED=1, so codegen will not run." >&2 echo "These files are expected to be restored from the 'codegen-output' CI artifact." >&2 diff --git a/rust/crates/truapi/src/api/account.rs b/rust/crates/truapi/src/api/account.rs index 788070a1..3e1f25d0 100644 --- a/rust/crates/truapi/src/api/account.rs +++ b/rust/crates/truapi/src/api/account.rs @@ -67,11 +67,17 @@ pub trait Account: Send + Sync { /// ```ts /// import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi"; /// + /// const PEOPLE_COLLECTION_ID = + /// "0x706f703a706f6c6b61646f742e6e6574776f726b2f70656f706c652020202020"; + /// /// const result = await truapi.account.getAccountAlias({ /// context: { productId: "truapi-playground.dot", suffix: "0x00" }, /// ringLocation: { /// chainId: PASEO_NEXT_V2_ASSET_HUB.genesis, - /// junctions: [{ tag: "PalletInstance", value: 42 }], + /// junctions: [ + /// { tag: "PalletInstance", value: 97 }, + /// { tag: "CollectionId", value: PEOPLE_COLLECTION_ID }, + /// ], /// }, /// }); /// assert(result.isOk(), "getAccountAlias failed:", result); @@ -91,11 +97,17 @@ pub trait Account: Send + Sync { /// ```ts /// import { PASEO_NEXT_V2_ASSET_HUB } from "@parity/truapi"; /// + /// const PEOPLE_COLLECTION_ID = + /// "0x706f703a706f6c6b61646f742e6e6574776f726b2f70656f706c652020202020"; + /// /// const result = await truapi.account.createAccountProof({ /// context: { productId: "truapi-playground.dot", suffix: "0x00" }, /// ringLocation: { /// chainId: PASEO_NEXT_V2_ASSET_HUB.genesis, - /// junctions: [{ tag: "PalletInstance", value: 42 }], + /// junctions: [ + /// { tag: "PalletInstance", value: 97 }, + /// { tag: "CollectionId", value: PEOPLE_COLLECTION_ID }, + /// ], /// }, /// message: "0x48656c6c6f", /// });