Skip to content

fix(tokens): keep the Token Creator's identity current and its registration state reliable - #1168

Draft
Claudius-Maginificent wants to merge 5 commits into
v1.0-devfrom
fix/token-creator-stale-identity
Draft

Claudius-Maginificent wants to merge 5 commits into
v1.0-devfrom
fix/token-creator-stale-identity

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR

The Token Creator now always works with up-to-date information about the identity you picked. Keys you add elsewhere show up when you come back, and after importing a wallet it no longer says there are no identities while the list shows them. Everything you typed into the form stays. A failed token registration now shows as failed instead of waiting forever, and you can't accidentally pay for a second registration while the first is still running.

User story

As a token creator, I want the Token Creator to reflect my identity's current keys and the identities I can actually use, so that I can register a token without restarting the app or re-picking my identity.

Scenario

Steps to reproduce

  1. Open Tokens → Token Creator in Simple mode with an identity that has no suitable key; the screen says "No eligible key found…".
  2. Add a suitable key to that identity, then return to Token Creator.
  3. Separately: start the app, import a wallet during the session, then open Token Creator.
  4. Register a token that Platform rejects; or, while a registration is running, click Create Token and Confirm again.

Actual behavior

  • After step 2 the screen still says "No eligible key found…" until the app restarts or another identity is picked.
  • After step 3 it shows "No identities found" and "No eligible key found for this identity" while the identity dropdown already lists identities.
  • After a rejected registration (step 4) the creator keeps waiting for a result that never comes. Create Token stays enabled during a registration, so a second Confirm pays a second registration fee.

Expected behavior

  • The newly added key is used as soon as you come back.
  • Only identities the Token Creator can use are ever selected, and the first usable one is picked automatically.
  • The form inputs are kept.
  • A failed registration puts the creator in its error state.
  • Create Token and Register Token Contract are disabled while a registration is in flight, with the hint "Your token is being created. Wait for the result before creating another token."

Detailed discussion

  • Since fix(tokens): keep the Token Creator form and build exactly the preset it shows #1130 the Token Creator form survives navigation, and so did its snapshot of the selected identity (TokensScreen.selected_identity). That snapshot was only replaced on a manual selection.
  • A new refresh_token_creator_identity() replaces the selection with the stored copy (keys and balance). It runs from refresh_on_arrival, refresh and cached_data_changed (Identities/All).
  • A selected key is kept only if the refreshed identity still holds it (same id and data). An identity that is no longer stored is deselected.
  • A shared offered_by_token_creator() (User type with private keys) now drives the dropdown filter, the new() seed and the refresh. An ineligible selection, such as a masternode or a keyless identity seeded at startup, is cleared so IdentitySelector picks the first offered identity.
  • reload_identities() refreshes the selection only when loading succeeds. On failure it keeps the user's selection.
  • Kittest fixture seed_token_identity now gives identities a placeholder private key generated at runtime, because the creator never offers keyless identities.
  • Registration failure is now detected structurally.
    • The confirm handler dispatches Register and QueryMyTokenBalances as BackendTasksWithContexts, and the Register context is stored in token_registration_context.
    • display_backend_task_error ends the wait only for that context.
    • The msg.contains(...) match in display_message is removed. It was dead code: no error produces those strings, and it violated AGENTS.md's no-string-parsing rule.
  • simple_mode_blocked_reason and advanced_mode_blocked_reason return REGISTRATION_IN_FLIGHT_HINT while awaits_token_registration().

Testing

  • New tests in src/ui/tokens/tokens_screen/mod.rs, including:
    • a_failed_registration_ends_the_wait_in_the_error_state
    • create_token_is_blocked_while_a_registration_is_in_flight
    • confirming_registration_waits_for_the_registration_dispatch, which drives the real Confirm and was mutation-checked
  • Kittest request_routing::a_failed_registration_puts_the_token_creator_in_its_error_state.
  • The new behaviour tests failed before the change.
  • cargo test --lib --all-features tokens_screen: 54 passed.
  • cargo test --test kittest --all-features token: 16 passed.
  • Clippy (lib, tests, kittest) is clean with -D warnings.
  • Found during the 2026-11-10 weekly release review; an independent review found no open issues after two rounds.

🤖 Co-authored by Claudius the Magnificent AI Agent

🤖 Generated with Claude Code

lklimek and others added 2 commits November 10, 2026 09:14
… to the Token Creator

The Token Creator form survives navigation, and so did its copy of the
selected identity. A key added on the identity's key screen never reached
it, so Simple mode kept reporting that no eligible key exists.

Arrival, refresh and identity cache updates now replace the creator's
identity with the stored one. A selected key the identity no longer holds
is dropped, and an identity that is no longer stored is deselected. The
form inputs are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Token Creator offers user identities that hold private keys, but it
picked its starting identity from every stored identity. With a
masternode or keyless identity selected, for example one stored before a
wallet import, the selector showed "No identities found" next to a list of
identities and Simple mode reported a missing key.

The starting identity and the refreshed selection now come from the
identities the creator offers. An identity it does not offer is
deselected, so the selector picks one it does offer. A failed read of
stored identities no longer drops the user's selection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@thepastaclaw

thepastaclaw commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

🕓 Review not started yet because this PR is a draft.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit c007ad0. Normal review starts when eligible; priority review starts as soon as a slot is available.

lklimek and others added 3 commits November 10, 2026 10:37
A failed registration was detected by matching banner text that no
TaskError produces, so the creator stayed in its waiting state. The
creator now sends the registration under its own dispatch context and
leaves the wait in its error state, dropping the progress banner, when
a failure arrives for that context. Failures of other tasks, and late
failures from before a network switch, leave it alone.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Create Token (and Register Token Contract under Advanced) stayed
enabled while a registration was waiting for its result, so creating
and confirming again paid a second registration fee. Both buttons are
now disabled while the creator waits, with a visible explanation, and
are enabled again once the registration succeeds or fails.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…asks

Clicking Confirm must send the registration and the balance refresh,
each under a context of its own, and leave the creator waiting for the
registration's context, so that only the registration's own failure
ends the wait.

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Claudius-Maginificent Claudius-Maginificent changed the title fix(tokens): keep the Token Creator's identity current and eligible fix(tokens): keep the Token Creator's identity current and its registration state reliable Nov 10, 2026
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.

3 participants