Skip to content

fix(dot init): show full addresses, fix username lookup, trim docs#185

Merged
UtkarshBhardwaj007 merged 1 commit into
mainfrom
fix/dot-init-identity-lines
May 19, 2026
Merged

fix(dot init): show full addresses, fix username lookup, trim docs#185
UtkarshBhardwaj007 merged 1 commit into
mainfrom
fix/dot-init-identity-lines

Conversation

@UtkarshBhardwaj007
Copy link
Copy Markdown
Member

Summary

Three independent fixes to the dot init identity block + a stale-docs refresh, all triggered by one round of testing.

1. Print the full product-account address

Before:

✓ product account 5DHk4g...CzE1 (0x8849...29dc)

After:

✓ product account <full ss58> (<full 0x h160>)

identityLine.ts::productAccountDisplay was running both addresses through truncateAddress(..., 6, 4). Users couldn't copy either form — any downstream flow that needed the address (manual funding, block explorer lookup, faucet) required guessing the missing characters. The truncation didn't add UX value; SS58s are long, but two lines of long text are easier to deal with than two unusable ellipses.

2. Fix username (lookup failed)

The username row was failing for every account, even ones we knew had no on-chain identity. Expected behaviour was (no username set on chain); actual was always (lookup failed).

Root cause: lookupUsername prepared the storage key with AccountId().dec(rootAccountSs58). The polkadot-api AccountId() codec's .dec is for byte / 0x-hex input — under the hood scale-ts's fromHex reads char-pairs via HEX_MAP[ch]. Most SS58 chars (G, H, J, K, P, U, p, r, …) aren't in the map; undefined << 4 | undefined coerces to 0. Result: a mostly-zero 24-byte buffer that re-encodes into a malformed SS58, which getSs58AddressInfo then rejects deep inside PAPI's storage encoder. Our catch block surfaced this as kind: "error"(lookup failed).

Cross-checked with polkadot-desktop (peerResolver.ts: api.query.Resources.Consumers.getValue(address) — SS58 string, no codec), dotli (packages/auth/src/auth.ts: passes 0x-hex pubkey, so the codec round-trip is correct for them), and triangle-js-sdks (the source of createIdentityRpcAdapter — its callers are expected to pass 0x-hex, hence the .dec). Fix: pass the SS58 straight to getValues([[ss58]]).

Verified live against wss://paseo-people-next-system-rpc.polkadot.io: a previously-failing account now returns {kind: "none"} in ~1s, rendered as (no username set on chain). Added a regression test that mocks polkadot-api's createClient and asserts getValues is called with [[ss58]] verbatim — fails if anyone re-introduces a codec round-trip. Also bumped the lookup timeout 5s → 10s for cold WS connects on slow conference networks.

3. Trim CLAUDE.md, refresh CLAUDE.md + README

CLAUDE.md was 65k chars — over the 40k Claude Code performance warning. Trimmed to 36.3k:

  • The bulletin-deploy version-history paragraph (a 20k-char inline changelog from 0.7.0 → 0.7.20) collapsed into just the current load-bearing rules.
  • The "product-sdk 0.5.0" transition section folded into the relevant invariants now that the changes are integrated.
  • Refreshed stale version pins (e.g. @parity/product-sdk-host 0.3.00.4.0, dropped from the doc since not actually imported).
  • Added one new invariant: the SS58 / AccountId().dec gotcha that bit us here, so it doesn't regress.

README updates:

  • Dependency notes were stale: bulletin-deploy 0.7.130.7.24, novasamatech 0.7.8-20.7.9-4, @dotdm/contracts dev-tag pin → ^2.0.x, polkadot-api ^2.1.2^2.1.x.
  • --env flag description: was claiming testnet default and mainnet (not yet supported) — real default is paseo-next-v2 and the option accepts the bulletin-deploy env IDs plus the legacy aliases.
  • Architecture note on the session signer: updated for product-sdk-terminal@0.2.1+'s PAPI-native signer (no <Bytes> envelope on tx payloads, so AsPgas survives).

Test plan

  • pnpm format:check
  • pnpm lint:license
  • pnpm test — 536 tests pass (was 532; +4 from the new lookupUsername regression block)
  • Live verification: lookupUsername("5GGpUaN7XNaUp3nEVDPBSR4SQLxFxQsiPHbFwf69Apr3HgDZ") against wss://paseo-people-next-system-rpc.polkadot.io returns {kind: "none"} in <1s
  • Manual dot init after merge: confirm both addresses print in full and the username row no longer shows (lookup failed)

The identity block after a successful `dot init` had three issues this
commit addresses:

1. The product account was rendered as `5DHk4g...CzE1 (0x8849...29dc)`
   — abbreviated SS58 + H160. Users couldn't copy either, so any
   downstream flow that needed the address (faucet, explorer, manual
   funding) required guessing the missing characters. Now prints both
   in full.

2. Username always rendered as `(lookup failed)`. Root cause:
   `lookupUsername` was running the SS58 string through
   `AccountId().dec(...)` to prepare the storage key, but PAPI's
   `AccountId` codec's `.dec` is for byte/hex input — under the hood
   scale-ts's `fromHex` reads char-pairs via `HEX_MAP`, most SS58
   chars aren't in that map, so the resulting buffer is mostly zeros
   and re-encodes into a malformed SS58 that `getSs58AddressInfo`
   rejects deep inside PAPI's storage encoder. Cross-checked with
   polkadot-desktop, dotli, and triangle-js-sdks: the lookup should
   pass the SS58 directly to `getValues([[ss58]])` (the upstream
   `createIdentityRpcAdapter` only does the codec round-trip because
   its callers pass `0x`-hex pubkeys). Added a regression test that
   asserts the storage call shape.

3. CLAUDE.md was 65k chars — over Claude Code's 40k warning. Trimmed
   the historical bulletin-deploy version changelog (0.7.0 → 0.7.20)
   into just the current load-bearing rules, dropped the
   product-sdk 0.5.0 transition section now that the rules are
   integrated, refreshed stale version pins. CLAUDE.md is now 36.3k.
   README's dependency notes and `--env` flag description were also
   stale (bulletin-deploy 0.7.13 → 0.7.24; novasamatech 0.7.8-2 →
   0.7.9-4; `@dotdm/contracts` dev-tag → `^2.0.x`; env default is
   `paseo-next-v2`, not `testnet`).

Bumped the username-lookup timeout from 5s to 10s to absorb cold-
start latency on slow conference networks; success path stays sub-
second on a healthy WS.
@UtkarshBhardwaj007 UtkarshBhardwaj007 merged commit 7db7e98 into main May 19, 2026
19 checks passed
@UtkarshBhardwaj007 UtkarshBhardwaj007 deleted the fix/dot-init-identity-lines branch May 19, 2026 16:51
@github-actions
Copy link
Copy Markdown
Contributor

Dev build ready — try this branch:

curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | VERSION=dev/fix/dot-init-identity-lines bash

@github-actions
Copy link
Copy Markdown
Contributor

E2E Test Pass · ✅ PASS

Tag: e2e-ci-pr · Branch: fix/dot-init-identity-lines · Commit: 99c017e · Run logs

Cell Result Time
pr-init-session ✅ PASS 1m45s
pr-deploy-cdm ✅ PASS 2m27s
pr-preflight ✅ PASS 1m40s
pr-deploy-foundry ✅ PASS 1m18s
pr-deploy-frontend ✅ PASS 3m17s
pr-install ✅ PASS 0m43s
pr-mod ✅ PASS 1m20s
${{ matrix.cell }} ⏭️ SKIP 0m-1s
${{ matrix.cell }} ⏭️ SKIP 0m-1s

Sentry traces: view spans for this run

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.

1 participant