Skip to content

Fix RFC10 allowance init handling#186

Merged
charlesHetterich merged 8 commits into
mainfrom
fix/rfc10-allowance-init
May 19, 2026
Merged

Fix RFC10 allowance init handling#186
charlesHetterich merged 8 commits into
mainfrom
fix/rfc10-allowance-init

Conversation

@charlesHetterich

@charlesHetterich charlesHetterich commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remove BulletInAllowance from the dot init mobile resource-allocation request
  • create or reuse a locally cached Bulletin slot account and show a non-fatal Bulletin authorization needed warning with the env-configured faucet URL and account to authorize
  • make metadata upload use that same cached Bulletin slot account and fail with the faucet instruction when the account is not authorized or has insufficient quota
  • keep RFC10 mobile allocation for Statement Store and Smart Contract resources, including batched slot-key persistence for successful allocation outcomes
  • retain the stale-session guard so dot logout can still recover when an old stored session is missing rootAccountId

Main Merge Reconciliation

This branch is merged with current main through #188 and #189.

Kept from #188:

  • logged in shows the SSO root address
  • username lookup is keyed on the root address
  • product account shows the derived product SS58 and matching H160
  • the obsolete identityLine.ts helper stays deleted

Kept from #189:

  • QrLogin no longer calls parent state updates from inside a setStatus updater
  • Bulletin authorization URL lives in chain config as bulletinAuthorizationUrl
  • storeSlotAccountKeysFromOutcomes uses one batched read-modify-write and preserves sibling slot keys
  • faucet helper tests cover configured and no-faucet cases

Intentionally changed from #189:

  • BulletInAllowance is not requested from mobile during dot init
  • deploy does not fall back to requesting Bulletin allowance from mobile
  • the CLI uses a locally cached Bulletin slot account and asks the user to authorize that exact account through the faucet

User-Visible Behavior

When the cached Bulletin slot account has no usable Bulletin authorization, dot init completes setup and prints:

Bulletin authorization needed
Open the Bulletin authorization faucet at https://paritytech.github.io/polkadot-bulletin-chain/authorizations
and authorize account <slot account>, then re-run dot init.

The allowances row is no longer failed solely because Bulletin authorization is missing.

Verification

  • pnpm format:check
  • pnpm lint:license
  • pnpm test
  • pnpm build

@github-actions

github-actions Bot commented May 19, 2026

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/rfc10-allowance-init bash

@github-actions

github-actions Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

E2E Test Pass · ✅ PASS

Tag: e2e-ci-pr · Branch: fix/rfc10-allowance-init · Commit: ed15fa7 · Run logs

Cell Result Time
pr-deploy-frontend ✅ PASS 3m42s
pr-deploy-foundry ✅ PASS 1m39s
pr-init-session ✅ PASS 1m41s
pr-install ✅ PASS 0m50s
pr-mod ✅ PASS 1m17s
pr-deploy-cdm ✅ PASS 2m14s
pr-preflight ✅ PASS 1m31s
${{ matrix.cell }} ⏭️ SKIP 0m00s
${{ matrix.cell }} ⏭️ SKIP 0m00s

Sentry traces: view spans for this run

…ce-init

# Conflicts:
#	src/commands/init/IdentityLines.tsx
#	src/commands/init/identityLine.test.ts
#	src/commands/init/identityLine.ts
#	src/utils/auth.ts
#	src/utils/sessionSigner.ts
…ce-init

# Conflicts:
#	src/commands/init/AccountSetup.tsx
#	src/utils/allowances/bulletin.test.ts
#	src/utils/allowances/bulletin.ts
#	src/utils/allowances/slotKeys.ts
@charlesHetterich charlesHetterich merged commit cfc4570 into main May 19, 2026
20 checks passed
shawntabrizi pushed a commit to shawntabrizi/playground-cli that referenced this pull request May 27, 2026
The mobile app (Polkadot Android NIGHTLY) submits the RFC-0010
`Resources::claim_long_term_storage` extrinsic on the People parachain
and then waits 30 s for the authorization to propagate to Bulletin
Chain. That wait is .logFailure()-wrapped — failures are swallowed and
the slot key is returned regardless. The CLI then polls Bulletin via
`checkAuthorization` from @parity/product-sdk-bulletin for 75 s; if
propagation lags, the poll throws "Mobile returned Bulletin allowance
key X, but it is not authorized on Bulletin yet" and `dot init`
aborts before even running funding/mapping.

Verified end-to-end against the polkadot-app-android-v2 source
(`RealTransactionStorageSlotAllocator.kt:53-114`, AWAIT_BULLETIN_TIMEOUT
= 30s, `.logFailure(...)` at the `awaitAllocationVisibleOnBulletIn`
call site) and RFC-0010's "Bulletin submission — implicit allocation"
flow. The host has no on-chain step to add here — RFC-0010 puts all
the chain-side work on the mobile. The CLI's only correct move is to
be resilient to the propagation lag.

Four fixes in this PR, plus a React warning from paritytech#188:

1. `BULLETIN_AUTHORIZATION_URL` + `bulletinAuthorizationHelp(slot)`
   in `src/config.ts` and `src/utils/allowances/bulletin.ts`. Both
   `waitForBulletinSlotAuthorization`'s timeout error and the
   cached-key-not-authorized error now print the slot SS58 + the
   manual-faucet URL
   (`https://paritytech.github.io/polkadot-bulletin-chain/authorizations`).
   Pattern lifted from PR paritytech#186.

2. `requestAndStoreBulletinAllowanceSigner` now persists the slot
   key + marker BEFORE the propagation wait. A 75 s timeout no
   longer throws away a perfectly valid key the mobile derived
   from `mnemonic + //allowance//bulletin//<productId>` — the
   key will still be valid the moment the chain catches up.

3. `AccountSetup` makes a Bulletin propagation timeout a SOFT
   failure rather than aborting `dot init`. The row shows the
   help string + slot SS58; funding + Revive auto-map mapping
   still run because they depend on the product account on
   Asset Hub, not on Bulletin authorization. The final
   `setup complete some account setup steps failed` warning
   surfaces correctly.

4. `storeSlotAccountKeysFromOutcomes` is now a single
   read-modify-write so two slot keys returned in one
   `requestResourceAllocation` call (e.g. `BulletInAllowance` +
   `StatementStoreAllowance`) can't race-clobber each other.
   The previous `Promise.all(...storeSlotAccountKey)` had each
   call load the JSON, mutate one resource, save the JSON;
   interleaved writes would drop the second sibling's key.

Also fixes a React "Cannot update a component while rendering a
different component" warning introduced in paritytech#188 (the account-
derivation PR). `QrLogin` was calling `onDone(...)` from inside a
`setStatus(updater)` callback — which runs during React's render
phase, so the parent's `setAddresses` / `setAuthResolved` triggered
mid-render of QrLogin. Now snapshots the resolved `SessionAddresses`
in a `useRef` inside the `onStatus` callback and calls `onDone` after
the promise resolves, outside any updater.

Why this slipped past CI: `vitest.config.ts` only picks up
`*.test.ts`, not `*.tsx`, so React-strict-mode warnings never fire
in the test suite.

Tests: 538 pass + 1 skipped (was 536). Two new regression tests:
the help helper formats SS58 + URL correctly, and
`storeSlotAccountKeysFromOutcomes` preserves sibling keys.
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