fix(dot init): show full addresses, fix username lookup, trim docs#185
Merged
Conversation
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.
Contributor
|
Dev build ready — try this branch: |
Contributor
E2E Test Pass · ✅ PASSTag:
Sentry traces: view spans for this run |
5 tasks
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.
Summary
Three independent fixes to the
dot initidentity block + a stale-docs refresh, all triggered by one round of testing.1. Print the full product-account address
Before:
After:
identityLine.ts::productAccountDisplaywas running both addresses throughtruncateAddress(..., 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:
lookupUsernameprepared the storage key withAccountId().dec(rootAccountSs58). The polkadot-apiAccountId()codec's.decis for byte /0x-hex input — under the hood scale-ts'sfromHexreads char-pairs viaHEX_MAP[ch]. Most SS58 chars (G,H,J,K,P,U,p,r, …) aren't in the map;undefined << 4 | undefinedcoerces to0. Result: a mostly-zero 24-byte buffer that re-encodes into a malformed SS58, whichgetSs58AddressInfothen rejects deep inside PAPI's storage encoder. Ourcatchblock surfaced this askind: "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: passes0x-hex pubkey, so the codec round-trip is correct for them), and triangle-js-sdks (the source ofcreateIdentityRpcAdapter— its callers are expected to pass0x-hex, hence the.dec). Fix: pass the SS58 straight togetValues([[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 mockspolkadot-api'screateClientand assertsgetValuesis 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:
@parity/product-sdk-host0.3.0→0.4.0, dropped from the doc since not actually imported).AccountId().decgotcha that bit us here, so it doesn't regress.README updates:
0.7.13→0.7.24, novasamatech0.7.8-2→0.7.9-4,@dotdm/contractsdev-tag pin →^2.0.x, polkadot-api^2.1.2→^2.1.x.--envflag description: was claimingtestnetdefault andmainnet (not yet supported)— real default ispaseo-next-v2and the option accepts the bulletin-deploy env IDs plus the legacy aliases.product-sdk-terminal@0.2.1+'s PAPI-native signer (no<Bytes>envelope on tx payloads, soAsPgassurvives).Test plan
pnpm format:checkpnpm lint:licensepnpm test— 536 tests pass (was 532; +4 from the newlookupUsernameregression block)lookupUsername("5GGpUaN7XNaUp3nEVDPBSR4SQLxFxQsiPHbFwf69Apr3HgDZ")againstwss://paseo-people-next-system-rpc.polkadot.ioreturns{kind: "none"}in <1sdot initafter merge: confirm both addresses print in full and the username row no longer shows(lookup failed)