Skip to content

chore(deps)!: update Platform to v5.1-dev 063589bf and follow the network's protocol version - #1114

Merged
lklimek merged 23 commits into
v1.0-devfrom
chore/bump-platform-063589bf
Oct 26, 2026
Merged

lklimek merged 23 commits into
v1.0-devfrom
chore/bump-platform-063589bf

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: Moves Dash Evo Tool to the current Platform release candidate so it keeps working on mainnet (protocol 13) and on testnet, which has already moved to protocol 14. Existing wallets and identities carry over. No new features.

User story

As a wallet user, I want to keep using my existing wallets and identities on mainnet and testnet after the Platform upgrade.

Scenario

Actual behavior

Testnet runs protocol 14. The app is pinned to protocol 13, so it cannot follow the network: identity lookup and transactions use the old format.

Expected behavior

The app starts at the lowest protocol version the network still runs, learns the real version from signed network answers, and uses that version's format. Mainnet keeps working as before.

Detailed discussion

Dependency pin

  • dash-sdk, rs-sdk-trusted-context-provider, platform-wallet and platform-wallet-storage are pinned to Platform v5.1-dev 063589bf0adbe1a8823a943cee95385b423b0e3f (5.0.0-rc.8). check-pin-ancestry.sh passes.
  • Cargo.lock moves only Platform packages and their dependencies. That includes the new rust-dashcore cryptography stack: secp256k1 0.33, blst 0.3.17 and zeroize 1.9 come in; blsful and elliptic-curve leave.
  • The wallet-storage migration fingerprint is updated for upstream's new V019 (18 → 19 migrations; V001–V018 unchanged). The compatibility schema snapshot is platform_compatibility/fixtures/033ecae.sql.

API adaptations (needed to compile)

  • Cryptography: new ECDSA key types, Zeroizing secret bytes, no Secp256k1 context argument. Signatures stay byte-identical: RFC 6979 nonces as before, recoverable message signatures keep their header byte, and a test pins the BLS signature bytes through the identity signer. DetSigner erases the secp256k1 key it derives when it is dropped.
  • Documents: replace keeps the new moderated_at / moderated_by fields. The editor refuses the new typed-array field type instead of silently dropping its contents.
  • DPNS and contested documents: the request now states the protocol's base contest fund. Otherwise the new SDK picks its own contest fund, which could differ from the amount the user confirmed.
  • Votes: masternode vote reads use the SDK's ResourceVoteWithCount.
  • Tokens: the new shielded-pool token config items are listed read-only in group actions and refused before signing. A token failure from the platform-wallet runtime keeps its SDK cause and names the operation (TokenOperationKind); only shielded operations go through that runtime today.
  • Wallet events: the new ChainTruncated event is handled. An unverified local quorum is reported as a quorum-source problem (quorum_lookup_error), so DAPI nodes are not blamed for it.

Following the network's protocol version

  • The SDK is no longer pinned to protocol 13. It starts at upstream's per-network minimum (13 on mainnet, testnet and regtest; 14 on devnet) and moves up only on responses whose proof and quorum signature verified.
  • DET keeps no copy of the version. AppContext::platform_version() reads the SDK's current version. proven_protocol_version() reads the version from verified metadata and is None until a proof arrives.
  • Protocol-gated capabilities (known_protocol_version_at_least) stay closed until a version is proven, and for a version this build does not define.
  • System contracts are cached per protocol version. The context provider serves them at the version the proof verifier asks for, and fails rather than serve another version's set. User contracts stored locally are decoded at the SDK's current version.
  • A proved epoch read sets the fee multiplier. When the epoch cannot be read, the last known multiplier is kept and labelled as such. Rebuilding the connection reads the epoch again.
  • An epoch from a lagging node is not a concern here. The SDK refuses a proved response more than metadata_height_tolerance blocks below the highest height it has seen (StaleNodeError::Height) and bans that address. A protocol change while the app is running needs a restart.

Dedicated messages for new protocol refusals

New TaskError variants with actionable messages:

  • a full username contest;
  • a vote choice the contest does not allow;
  • a name someone else asked for first;
  • a token that cannot be moved;
  • a changed immutable document field;
  • a reference to a document type that cannot be deleted;
  • a moderators' fee on a contract without moderation;
  • an identity banned from, or suspended in, a moderated contract;
  • a fee sponsor without enough credits;
  • a fee payer the document type does not allow, or mixed payers in one batch;
  • one-time token distributions above the maximum.

Names supplied by the node stay in the typed error source and never appear in the message.

Mainnet compatibility

Upstream dashpay/platform#5515 is in this pin. Until a version that serves V1 is proven, the SDK sends the V0 non-unique identity lookup, which protocol 13 nodes answer with the two-proof response. Proof verification stays strict.

A read-only probe on 2026-10-23 at Platform 132ae31, which has the same SDK proof path, verified full proofs and quorum signatures on mainnet (V0) and testnet (V0 and V1). DET's own end-to-end discovery on mainnet, using quorum keys from SPV, was not run.

Existing data

  • Upstream V019 adds an asset-lock operation id column. It is forward only: an older build cannot open upgraded storage, so rolling back needs a copy of the data directory made before the upgrade.
  • Profiles that went through fix(wallet): surface unresolved Platform funding transfers #1028's side-branch dependency carry a different V019. They are refused as incompatible and left untouched.

Behaviour changes on existing flows

  • The fee multiplier is kept, not reset to the default, when the epoch cannot be read.
  • Capabilities are closed for an unknown protocol version.
  • Typed-array documents and shielded-pool token settings are refused instead of being edited lossily.

Not in this PR

Protocol 14 features build on this PR:

TODO(...) markers point at features DET does not offer yet: DashPay invitations (#1104), the DPNS marketplace (#1103) and shielded identity transfers (#1105).

Known limitations

  • The secp256k1 key is erased on drop only in DetSigner. The other signing sites (message signing, key info screen, DashPay encryption and auto-accept proof) still hold a plain secp256k1::SecretKey copy, as before this PR.
  • Some of the new cryptography comes from unreleased git revisions: dash-pkc at two base-sdk revisions, and rust-bitcoin from git. Advisory scanners do not cover them.

Testing

CI at 8a18bff passes:

  • Test Suite: 3769 library tests, 502 UI tests (kittest), 64 migration-matrix tests, plus the archived-profile migrations;
  • Clippy and cargo fmt --check;
  • the platform pin guard.

The tests added here cover:

  • the per-network starting version;
  • the proven version read from the current SDK (none at boot, none for a new SDK, none for an unknown version);
  • system contracts per version;
  • the fee multiplier from a proved epoch;
  • closed capabilities on an unknown version;
  • the contest fund;
  • the typed-array guard and moderation metadata;
  • read-only shielded token items;
  • each refusal mapping;
  • contracts saved at protocol 12 loading at 13 and 14, and contracts saved at 14 decoding at 13 and in full at 14.

No live funded tests or GUI network flows were run.

🤖 Co-authored by Claudius the Magnificent AI Agent

🤖 Generated with Claude Code

https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

PR Hygiene · 749f8bd

  • Bots — coderabbitai skipped by lklimek · thepastaclaw skipped by lklimek
  • Self-review — not asked of a bot author
  • Build green
  • Approvals
    • files with no dedicated owner (Cargo.lock, Cargo.toml, docs/ai-design/2026-10-24-platform-v5.1-dev-bump/README.md and 116 more) — approved by lklimek

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

lklimek and others added 7 commits October 24, 2026 18:21
Pin dash-sdk, rs-sdk-trusted-context-provider, platform-wallet and
platform-wallet-storage to dashpay/platform v5.1-dev 063589bf
(5.0.0-rc.8). The lockfile moves only the Platform packages.

The upstream V019 wallet-storage migration adds a nullable asset-lock
operation id; V001-V018 are unchanged. The compatibility bridge gets the
033ecae destination snapshot it compares against, and the pin guard
records the new revision with an unchanged migration fingerprint.

BREAKING CHANGE: the wallet storage upgrade to V019 is forward only. An
older build cannot open upgraded storage; going back needs a copy of the
data directory taken before the upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The new rust-dashcore wraps secp256k1 keys in EcdsaSecretKey and
EcdsaPublicKey, returns secret bytes as Zeroizing, and drops the
Secp256k1 context argument. Signers, single-key wallets, DashPay
derivation, address and QR handling, migrations and their tests follow
the new types. Signing stays on the non-grinding dpp::secp256k1 path,
and a parity test pins the BLS signature bytes the previous SDK made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Handle the dpp and SDK types the new pin adds, keeping today's behaviour:

- Document replace keeps moderated_at and moderated_by; new documents
  start without them.
- The document editor refuses typed-array fields instead of dropping
  their contents, and keeps referenced key ids as numbers.
- Shielded token events show read-only in group actions, and the
  shielded pool token settings are refused before anything is signed.
- Contested document creation states the protocol's base contest fund,
  so the SDK never auto-quotes a larger one.
- Masternode vote reads use ResourceVoteWithCount, the SDK's new vote
  type; the vote count is not used yet.
- New query fields, wallet events, wallet error variants and asset-lock
  funding modes are handled where the SDK now requires them.
- Entropy-only document ids are documented as placeholders from
  protocol 14, and deferred upstream features link to their issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The SDK was pinned to the protocol 13 table, so it could not build any
protocol 14 transition or follow the versioned identity lookup. It now
starts at upstream's per-network minimum and ratchets to what proven
responses report.

- System contracts are cached per protocol version and served through
  accessors. The context provider serves them at the version the proof
  verifier asks for and fails rather than serve another version's.
- A proved epoch sets the fee multiplier and raises the protocol version.
  An older epoch than the adopted one is ignored.
- Rebuilding the connection resets the protocol version, fee multiplier
  and adopted epoch under one lock before the new SDK is published, and
  drops reads begun on the old connection.
- Capabilities read the network's version through a helper that stays
  closed for a version this build does not define.
- Contest timing reads the live version; retired vote schedules keep the
  protocol 13 notice window they were created under.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Compare the protocol 13 client tables with a recorded snapshot, so an
upstream change to them is reviewed, and check that keys and documents
DET builds on a protocol 13 network use encodings protocol 13 decodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Map the refusals the new protocol adds to flows DET already offers to
dedicated TaskError variants: a full username contest, a vote choice the
contest does not allow, a name someone else asked for first, a token
that cannot be moved, a changed immutable document field, a reference to
a document type that cannot be deleted, and a moderators' fee on a
contract without moderation. Names supplied by the node stay in the
typed source only, never in the message.

Token operations that fail inside the wallet runtime keep their SDK
cause, so they are classified like any SDK error; an unclassified one
names the operation that did not complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Add a dated design note for the pin, the protocol version sources, the
connection state rules and the protocol 13 guards, and point AGENTS.md
at From<SdkError> for TaskError as the SDK error reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 118 files, which is 18 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4c38d4c and 749f8bd.

Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 118
  • Cargo.toml
  • docs/ai-design/2026-10-24-platform-v5.1-dev-bump/README.md
  • scripts/migration-fixtures/expected-migration-fingerprint.txt
  • src/backend_task/contested_names/mod.rs
  • src/backend_task/contested_names/query_dpns_contested_resources.rs
  • src/backend_task/contested_names/query_dpns_vote_contenders.rs
  • src/backend_task/contested_names/refresh_vote_states.rs
  • src/backend_task/contested_names/vote_on_dpns_name.rs
  • src/backend_task/contract.rs
  • src/backend_task/dashpay.rs
  • src/backend_task/dashpay/auto_accept_proof.rs
  • src/backend_task/dashpay/contact_info.rs
  • src/backend_task/dashpay/contact_requests.rs
  • src/backend_task/dashpay/contacts.rs
  • src/backend_task/dashpay/encryption.rs
  • src/backend_task/dashpay/errors.rs
  • src/backend_task/dashpay/payments.rs
  • src/backend_task/dashpay/profile.rs
  • src/backend_task/document.rs
  • src/backend_task/error.rs
  • src/backend_task/identity/add_key_to_identity.rs
  • src/backend_task/identity/dpns_usernames.rs
  • src/backend_task/identity/load_identity.rs
  • src/backend_task/identity/mod.rs
  • src/backend_task/identity/refresh_loaded_identities_dpns_names.rs
  • src/backend_task/identity/register_dpns_name.rs
  • src/backend_task/identity/top_up_identity.rs
  • src/backend_task/migration/finish_unwire.rs
  • src/backend_task/migration/legacy_restore.rs
  • src/backend_task/migration/single_key_restore.rs
  • src/backend_task/migration/v093_upgrade.rs
  • src/backend_task/mod.rs
  • src/backend_task/platform_info.rs
  • src/backend_task/shielded/mod.rs
  • src/backend_task/tokens/query_tokens.rs
  • src/backend_task/tokens/update_token_config.rs
  • src/backend_task/wallet/derive_identity_key_for_display.rs
  • src/backend_task/wallet/mod.rs
  • src/backend_task/wallet/rename_wallet.rs
  • src/backend_task/wallet/sign_message_with_identity_key.rs
  • src/backend_task/wallet/sign_message_with_key.rs
  • src/context/contested_names_db.rs
  • src/context/contract_token_db.rs
  • src/context/dpns_vote_state.rs
  • src/context/feature_gate.rs
  • src/context/legacy_scheduled_votes.rs
  • src/context/mod.rs
  • src/context/system_contracts.rs
  • src/context/test_support.rs
  • src/context/wallet_lifecycle/tests.rs
  • src/context_provider.rs
  • src/database/test_helpers.rs
  • src/database/wallet.rs
  • src/mcp/resolve.rs
  • src/mcp/tools/masternode.rs
  • src/model/address.rs
  • src/model/asset_lock.rs
  • src/model/dashpay.rs
  • src/model/dashpay_derivation/dip14.rs
  • src/model/dashpay_derivation/hd.rs
  • src/model/dashpay_derivation/mod.rs
  • src/model/fee_estimation.rs
  • src/model/key_input.rs
  • src/model/qualified_identity/mod.rs
  • src/model/qualified_identity/qualified_identity_public_key.rs
  • src/model/single_key.rs
  • src/model/token.rs
  • src/model/wallet/auth_pubkey_cache.rs
  • src/model/wallet/mod.rs
  • src/model/wallet/single_key.rs
  • src/sdk_wrapper.rs
  • src/ui/components/address_input.rs
  • src/ui/contracts_documents/contracts_documents_screen.rs
  • src/ui/contracts_documents/document_action_screen.rs
  • src/ui/contracts_documents/group_actions_screen.rs
  • src/ui/identity/add_new_identity_screen/mod.rs
  • src/ui/identity/funding_common.rs
  • src/ui/identity/keys/add_key_screen.rs
  • src/ui/identity/keys/key_info_screen.rs
  • src/ui/identity/mod.rs
  • src/ui/identity/register_dpns_name_screen.rs
  • src/ui/identity/usernames_card.rs
  • src/ui/state/account_summary.rs
  • src/ui/tokens/tokens_screen/mod.rs
  • src/ui/tokens/tokens_screen/my_tokens.rs
  • src/ui/tokens/update_token_config.rs
  • src/ui/tokens/view_token_claims_screen.rs
  • src/ui/wallets/send_screen.rs
  • src/ui/wallets/wallets_screen/address_table.rs
  • src/wallet_backend/auth_pubkey_cache.rs
  • src/wallet_backend/contact_profile_cache.rs
  • src/wallet_backend/dashpay.rs
  • src/wallet_backend/det_platform_signer.rs
  • src/wallet_backend/det_signer.rs
  • src/wallet_backend/event_bridge.rs
  • src/wallet_backend/mod.rs
  • src/wallet_backend/payments.rs
  • src/wallet_backend/platform_compatibility/engine.rs
  • src/wallet_backend/platform_compatibility/engine/tests.rs
  • src/wallet_backend/platform_compatibility/fixtures/033ecae.sql
  • src/wallet_backend/platform_compatibility/fixtures/README.md
  • src/wallet_backend/secret_access.rs
  • src/wallet_backend/sidecar.rs
  • src/wallet_backend/single_key.rs
  • src/wallet_backend/snapshot.rs
  • src/wallet_backend/wallet_context.rs
  • tests/backend-e2e/dashpay_tasks.rs
  • tests/backend-e2e/identity_in_vault_sign.rs
  • tests/backend-e2e/identity_tasks.rs
  • tests/backend-e2e/measure_dpns_registration.rs
  • tests/backend-e2e/platform_info.rs
  • tests/backend-e2e/wallet_reregistration.rs
  • tests/backend-e2e/z_broadcast_st_tasks.rs
  • tests/kittest/address_input.rs
  • tests/kittest/send_screen.rs
  • tests/kittest/top_up_identity_screen.rs
  • tests/migration-matrix/assertions.rs
  • tests/migration-matrix/public_identities.rs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 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

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress — actively reviewing now (commit 749f8bd) · triage: critical · Phase 2 only (no Phase 1 for this repository)
███████████░░░░░░░░░ 56% · about 30 min left · running for 35 min
✅ triage → ⏭️ Phase 1 → ✅ Phase 2 → ✅ verify 2 → ⏳ fresh Phase 2 (0/2 lanes) → ▫️ publish
Estimated from recent reviews of this tier · updated 11:17 UTC · live progress

…it refusals

Protocol version 14 refusals that flows already in DET can hit get
dedicated, actionable messages, each keeping the SDK error as its source:

- an identity banned or suspended (until when) on a moderated contract;
- a gas sponsor short of credits, a gas payer the document type does not
  offer, and mixed gas payers in one batch;
- pre-programmed token distributions of one time over the limit.

An overflowing shielded note total is logged at warn: it means corrupt or
hostile sync data, not routine noise.

Tests cover contracts saved at protocol 12 loading unchanged at 13 and 14,
and contracts saved at 14 decoding at 13 and in full again at 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai review

No review for 74695e7d yet, so PR Hygiene is asking once. If nothing arrives, the requirement is dropped for this commit and the pull request is labelled bot-review-skipped.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai skipped after its own rate limit · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@thepastaclaw review

No review for 74695e7d yet, so PR Hygiene is asking once. If nothing arrives, the requirement is dropped for this commit and the pull request is labelled bot-review-skipped.

@github-actions github-actions Bot added the bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. label Oct 25, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 2 only (no Phase 1 for this repository)

The connection rebuild can leave an initialized wallet backend and its SPV runtime connected to the previous SDK and DAPI endpoint set, so the new connection state is not applied consistently. Two additional versioning and synchronization issues remain: local user contracts are decoded with the active SDK version instead of the verifier-requested version, and protocol/fee state can be observed as a mixed snapshot. Test Suite and Clippy were still in progress in the supplied CI snapshot.

🔴 1 blocking | 🟡 2 suggestion(s)

2 finding(s) not shown inline (the lines are not part of this PR's diff)

🟡 Suggestion: Decode local user contracts with the verifier's requested protocol version
src/context_provider.rs:61-64

The system-contract path correctly resolves contracts at the platform_version supplied by the proof verifier, but the user-contract fallback calls get_contract_by_id, whose decoder uses AppContext::platform_version() instead. During the upgrade window described by this PR, the verifier can request protocol 14 while the SDK has not yet ratcheted beyond protocol 13. A locally stored protocol-14 user contract can then be returned with protocol-14 fields such as action-fee metadata omitted. That gives proof verification the wrong schema and can lose versioned fields if the decoded contract is subsequently persisted. Add a version-aware local lookup/decode path that passes the verifier's version, or preserve and reuse the original serialized bytes.

source: gpt-6.1-sol (phase2-reviewer: general, rust-quality)

🟡 Suggestion: Publish fee and protocol state as one readable snapshot
src/context/mod.rs:853-866

adopt_epoch and replace_connection_observed update the fee multiplier and protocol version while holding epoch_adoption, but the public readers load two independent Relaxed atomics without that lock. A reader can therefore observe the new protocol with the old fee multiplier, or the reset protocol value with the previous connection's fee, despite the reset/adoption comments describing the state as coordinated. Fee estimation and protocol-dependent capability or transition logic can transiently combine values from different epochs or connections. Store both values in one lock-free snapshot or have readers acquire the same synchronization mechanism before reading the pair.

source: gpt-6.1-sol (phase2-reviewer: rust-quality)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This large cross-cutting diff changes cryptography and signing/key handling in wallet and identity code, peer-facing protocol/version handling, and storage migration behavior, including files such as src/wallet_backend/det_signer.rs, src/context/mod.rs, and src/backend_task/migration/*.rs.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/context/mod.rs`:
- [BLOCKING] src/context/mod.rs:1363: Connection rebuild leaves WalletBackend bound to the old SDK
  `reinit_core_client_and_sdk` publishes a new `AppContext.sdk`, but an already-created `WalletBackend` retains the SDK clone held by its `PlatformWalletManager`. `ensure_wallet_backend` only captures the context SDK during first initialization, and `WalletBackend::sdk()` returns the manager's retained SDK; the manager also owns the SPV runtime and its connection state. Therefore, when DAPI discovery persists new addresses and schedules this rebuild, the regular SDK uses the new endpoints while wallet operations and SPV continue using the old endpoint set. Rebind or rebuild the wallet backend and SPV runtime while preserving wallet storage and runtime state, or make the backend use a connection handle that follows the current SDK.
- [SUGGESTION] src/context/mod.rs:853-866: Publish fee and protocol state as one readable snapshot
  `adopt_epoch` and `replace_connection_observed` update the fee multiplier and protocol version while holding `epoch_adoption`, but the public readers load two independent `Relaxed` atomics without that lock. A reader can therefore observe the new protocol with the old fee multiplier, or the reset protocol value with the previous connection's fee, despite the reset/adoption comments describing the state as coordinated. Fee estimation and protocol-dependent capability or transition logic can transiently combine values from different epochs or connections. Store both values in one lock-free snapshot or have readers acquire the same synchronization mechanism before reading the pair.

In `src/context_provider.rs`:
- [SUGGESTION] src/context_provider.rs:61-64: Decode local user contracts with the verifier's requested protocol version
  The system-contract path correctly resolves contracts at the `platform_version` supplied by the proof verifier, but the user-contract fallback calls `get_contract_by_id`, whose decoder uses `AppContext::platform_version()` instead. During the upgrade window described by this PR, the verifier can request protocol 14 while the SDK has not yet ratcheted beyond protocol 13. A locally stored protocol-14 user contract can then be returned with protocol-14 fields such as action-fee metadata omitted. That gives proof verification the wrong schema and can lose versioned fields if the decoded contract is subsequently persisted. Add a version-aware local lookup/decode path that passes the verifier's version, or preserve and reuse the original serialized bytes.

Comment thread src/context/mod.rs Resolved
@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Oct 25, 2026
lklimek and others added 5 commits October 25, 2026 10:42
A lookup at another version, as the proof verifier makes at a response's
version, swapped out the app's set, so each such lookup reloaded the
system contracts and the next app read reloaded them again. Each
version now keeps its own set; the app's reads keep the set they last
got for a failed reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…poch

When the epoch cannot be read, the proved DPNS fallback confirmed the
SDK's version, which starts at the network's upstream minimum (14 on
devnet), as the network's. It now confirms the version of the responses
the SDK verified, and nothing before any.

Restores the completed-withdrawal status list with the reason sending
FAILED to a protocol 13 network is safe, and its test, now comparing the
protocol 13 schema with the latest one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The derived key DET signs with is copied into secp256k1's own type,
which keeps its bytes after use. Wrap it so it is erased on drop, as the
derived key it comes from would be; signatures stay byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
… protocol 13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The new refusals sent users to another document editor or token client.
They now say the app cannot edit this field type, sign this action or
change this token setting yet, in one wording, and the shielded setting
refusal sits with the token contract errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
lklimek and others added 2 commits October 26, 2026 09:21
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
A released protocol's tables and each network's minimum version are
upstream's to keep fixed; DET's start is covered by
platform_version_starts_at_the_network_minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw 1 thread unresolved — resolve it. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

lklimek and others added 3 commits October 26, 2026 09:59
The proof verifier asks for contracts at the version it verifies with,
which can be newer than the SDK's. System contracts were already served
at that version; a saved user contract was decoded at the SDK's version
instead, dropping newer-protocol settings such as action fees. The
fallback now decodes it at the version asked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…king

Building the recoverable-signature envelope returns an error upstream;
it is now reported as the existing message-signing failure, with the
detail logged, instead of aborting the signing path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Oct 26, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)

The dependency and protocol-version migration is mostly coherent, and the protocol metadata tests now cover both verified and unverified responses. However, the wallet backend retains the SDK captured at construction across connection rebuilds, which can leave wallet and shielded operations using stale DAPI and protocol state; two additional non-blocking correctness issues remain.

🔴 1 blocking | 🟡 2 suggestion(s)

1 finding(s) not shown inline (the lines are not part of this PR's diff)

🟡 Suggestion: Decode local user contracts with the verifier's requested protocol version
src/context_provider.rs:61-66

The provider receives the exact platform_version used by proof verification, but the non-system fallback calls get_contract_by_id, whose decode_stored_contract decodes the stored bytes using self.platform_version(). During a protocol transition, a verifier operating at protocol 14 can therefore receive a locally stored protocol-14 contract decoded with the SDK's current protocol-13 rules, potentially losing fields or failing before verification completes. Thread the requested PlatformVersion through the local lookup and decode path so the stored bytes are decoded with the same version that verifies the response.

source: gpt-6.1-sol (phase2-reviewer: rust-quality)

2 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — This is a large, intricate cross-cutting diff that changes cryptographic signing and key-handling code, peer-facing protocol/version behavior, and storage migration compatibility.
  • Phase 1 reviewers: not run (disabled for this repository)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `src/context_provider.rs`:
- [SUGGESTION] src/context_provider.rs:61-66: Decode local user contracts with the verifier's requested protocol version
  The provider receives the exact `platform_version` used by proof verification, but the non-system fallback calls `get_contract_by_id`, whose `decode_stored_contract` decodes the stored bytes using `self.platform_version()`. During a protocol transition, a verifier operating at protocol 14 can therefore receive a locally stored protocol-14 contract decoded with the SDK's current protocol-13 rules, potentially losing fields or failing before verification completes. Thread the requested `PlatformVersion` through the local lookup and decode path so the stored bytes are decoded with the same version that verifies the response.

In `src/context/mod.rs`:
- [BLOCKING] src/context/mod.rs:1223: Connection rebuild leaves WalletBackend bound to the old SDK
  (existing thread: https://github.com/dashpay/dash-evo-tool/pull/1114#discussion_r4370532700)
  `reinit_core_client_and_sdk` replaces `AppContext::sdk`, but an already-created `WalletBackend` is unchanged. `WalletBackend::new` passes a cloned SDK into `PlatformWalletManager`, and `WalletBackend::sdk()` continues returning that manager-owned SDK. Wallet and shielded tasks use it directly, so after DAPI or connection reconfiguration they can continue using the old DAPI addresses, protocol state, and client settings while the rest of the app uses the new SDK. The existing comment at `shield_from_core_protocol_version` explicitly acknowledges that the two SDKs can diverge. Rebuild must stop and recreate the wallet backend and its SPV runtime, or use an upstream-supported SDK replacement mechanism, before reporting the new connection as active.

In `src/backend_task/error.rs`:
- [SUGGESTION] src/backend_task/error.rs:4121-4126: Unmapped token broadcast rejections still lose the operation name
  (existing thread: https://github.com/dashpay/dash-evo-tool/pull/1114#discussion_r4371072554)
  `from_token_operation_failure` preserves the token operation only when `TaskError::from(source)` returns `TaskError::SdkError`. An otherwise-unclassified `StateTransitionBroadcastError` is converted to `TaskError::PlatformRejected` at lines 4641-4643, so wallet-runtime failures on that path produce the generic platform-rejected message and lose whether the failed operation was a claim, transfer, mint, unfreeze, or another token action. Preserve the operation for both the generic SDK fallback and the generic platform-rejection classification, while retaining dedicated consensus mappings when available.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. labels Oct 26, 2026
@lklimek
lklimek dismissed thepastaclaw’s stale review October 26, 2026 10:49

all issues handled in separate PRs

@lklimek

lklimek commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

/skip-bots

@github-actions github-actions Bot added bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Policy satisfied — this can merge.
Full checklist in the description.

@lklimek
lklimek merged commit 7a2ab86 into v1.0-dev Oct 26, 2026
19 checks passed
@lklimek
lklimek deleted the chore/bump-platform-063589bf branch October 26, 2026 11:17
lklimek added a commit that referenced this pull request Oct 26, 2026
…transfer (#1118)

* build(deps)!: update Platform to v5.1-dev 063589bf

Pin dash-sdk, rs-sdk-trusted-context-provider, platform-wallet and
platform-wallet-storage to dashpay/platform v5.1-dev 063589bf
(5.0.0-rc.8). The lockfile moves only the Platform packages.

The upstream V019 wallet-storage migration adds a nullable asset-lock
operation id; V001-V018 are unchanged. The compatibility bridge gets the
033ecae destination snapshot it compares against, and the pin guard
records the new revision with an unchanged migration fingerprint.

BREAKING CHANGE: the wallet storage upgrade to V019 is forward only. An
older build cannot open upgraded storage; going back needs a copy of the
data directory taken before the upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor: adapt to the rust-dashcore cryptography API

The new rust-dashcore wraps secp256k1 keys in EcdsaSecretKey and
EcdsaPublicKey, returns secret bytes as Zeroizing, and drops the
Secp256k1 context argument. Signers, single-key wallets, DashPay
derivation, address and QR handling, migrations and their tests follow
the new types. Signing stays on the non-grinding dpp::secp256k1 path,
and a parity test pins the BLS signature bytes the previous SDK made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix: adapt to protocol version 14 upstream types

Handle the dpp and SDK types the new pin adds, keeping today's behaviour:

- Document replace keeps moderated_at and moderated_by; new documents
  start without them.
- The document editor refuses typed-array fields instead of dropping
  their contents, and keeps referenced key ids as numbers.
- Shielded token events show read-only in group actions, and the
  shielded pool token settings are refused before anything is signed.
- Contested document creation states the protocol's base contest fund,
  so the SDK never auto-quotes a larger one.
- Masternode vote reads use ResourceVoteWithCount, the SDK's new vote
  type; the vote count is not used yet.
- New query fields, wallet events, wallet error variants and asset-lock
  funding modes are handled where the SDK now requires them.
- Entropy-only document ids are documented as placeholders from
  protocol 14, and deferred upstream features link to their issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(sdk): follow the network's protocol version

The SDK was pinned to the protocol 13 table, so it could not build any
protocol 14 transition or follow the versioned identity lookup. It now
starts at upstream's per-network minimum and ratchets to what proven
responses report.

- System contracts are cached per protocol version and served through
  accessors. The context provider serves them at the version the proof
  verifier asks for and fails rather than serve another version's.
- A proved epoch sets the fee multiplier and raises the protocol version.
  An older epoch than the adopted one is ignored.
- Rebuilding the connection resets the protocol version, fee multiplier
  and adopted epoch under one lock before the new SDK is published, and
  drops reads begun on the old connection.
- Capabilities read the network's version through a helper that stays
  closed for a version this build does not define.
- Contest timing reads the live version; retired vote schedules keep the
  protocol 13 notice window they were created under.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(platform): guard the protocol 13 tables and transitions

Compare the protocol 13 client tables with a recorded snapshot, so an
upstream change to them is reviewed, and check that keys and documents
DET builds on a protocol 13 network use encodings protocol 13 decodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(errors): explain protocol 14 refusals that existing actions can hit

Map the refusals the new protocol adds to flows DET already offers to
dedicated TaskError variants: a full username contest, a vote choice the
contest does not allow, a name someone else asked for first, a token
that cannot be moved, a changed immutable document field, a reference to
a document type that cannot be deleted, and a moderators' fee on a
contract without moderation. Names supplied by the node stay in the
typed source only, never in the message.

Token operations that fail inside the wallet runtime keep their SDK
cause, so they are classified like any SDK error; an unclassified one
names the operation that did not complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* docs: record the Platform v5.1-dev bump and protocol tracking

Add a dated design note for the pin, the protocol version sources, the
connection state rules and the protocol 13 guards, and point AGENTS.md
at From<SdkError> for TaskError as the SDK error reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* feat(tokens): create non-transferable tokens and stop offering their transfer

Protocol version 14 lets a token configuration make a token
non-transferable, and Platform refuses every transfer of such a token.

- My Tokens no longer offers Transfer for a token that cannot be
  transferred; the disabled button says why.
- The token creator offers "Holders can send this token to other
  identities", on by default. Turning it off uses upstream
  TokenConfiguration::set_transferable, which moves to a version 1
  configuration only for a non-transferable token, so a transferable
  token keeps the version 0 format older networks accept.
- The option is gated on a new NonTransferableTokens capability: the
  connected protocol version must decode version 1 token configurations.
  The creator and the backend both refuse a non-transferable token on a
  network that does not, before anything is signed.
- Platform's refusal of a tradeable non-transferable token maps to a
  dedicated, actionable error.
- User story TOK-020.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(errors): explain moderation, gas sponsorship and distribution limit refusals

Protocol version 14 refusals that flows already in DET can hit get
dedicated, actionable messages, each keeping the SDK error as its source:

- an identity banned or suspended (until when) on a moderated contract;
- a gas sponsor short of credits, a gas payer the document type does not
  offer, and mixed gas payers in one batch;
- pre-programmed token distributions of one time over the limit.

An overflowing shielded note total is logged at warn: it means corrupt or
hostile sync data, not routine noise.

Tests cover contracts saved at protocol 12 loading unchanged at 13 and 14,
and contracts saved at 14 decoding at 13 and in full again at 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(context): keep one system contract set per protocol version

A lookup at another version, as the proof verifier makes at a response's
version, swapped out the app's set, so each such lookup reloaded the
system contracts and the next app read reloaded them again. Each
version now keeps its own set; the app's reads keep the set they last
got for a failed reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(platform): confirm only a verified protocol version without the epoch

When the epoch cannot be read, the proved DPNS fallback confirmed the
SDK's version, which starts at the network's upstream minimum (14 on
devnet), as the network's. It now confirms the version of the responses
the SDK verified, and nothing before any.

Restores the completed-withdrawal status list with the reason sending
FAILED to a protocol 13 network is safe, and its test, now comparing the
protocol 13 schema with the latest one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(wallet): erase the secp256k1 signing key after use

The derived key DET signs with is copied into secp256k1's own type,
which keeps its bytes after use. Wrap it so it is erased on drop, as the
derived key it comes from would be; signatures stay byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(protocol): guard a contested name built with the contest fund at protocol 13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(ui): say plainly what the app cannot edit or sign yet

The new refusals sent users to another document editor or token client.
They now say the app cannot edit this field type, sign this action or
change this token setting yet, in one wording, and the shielded setting
refusal sits with the token contract errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* chore: keep AGENTS.md and the marketplace comment as on v1.0-dev

Also corrects the platform compatibility fixtures README: no code reads
e3cd7cf.sql any more; it is the V001-V018 checksum reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): gate non-transferable tokens on protocol 14 like the rest

Capability::NonTransferableTokens opens from protocol version 14 through
known_protocol_version_at_least, like every other protocol capability,
instead of probing the token configuration format version (which
feature_gate.rs itself warns against). The token creator's local refusal
and disabled-checkbox hint reuse
TaskError::NonTransferableTokenNotSupported's text instead of copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(test): prove the protocol version the headless refresh learns

The protocol version fallback takes only a version the SDK verified, and
a mock expectation's metadata is never recorded as verified, so the three
headless refresh tests saw the version stay unconfirmed. The mock now has
the SDK accept the version from metadata treated as proved, as after a
live network's signed response, and a new test pins that a response the
SDK never verified leaves the version unconfirmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test: drop the protocol 13 transition encoding tests

The SDK picks each transition's encoding from the platform version DET
passes in, so these tests checked dpp's version tables rather than DET.
The mainnet start version and the contest fund cap stay covered by the
platform_info and fee_estimation tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor(context): read the network's protocol version from the SDK

The SDK at this pin already tracks the version the network has proven:
it records the version of every response whose proof and quorum
signature it verified, and a rebuilt connection is a new SDK that starts
from nothing. DET's own copy, raised from proved epochs and DPNS reads
and reset on every rebuild, duplicated that state. The app now reads the
current SDK's verified version; capabilities still stay closed before a
version is proven and for one this build does not define, and network
info shows the proven number or says none is confirmed. Proved epochs
still set the fee multiplier, in epoch order and only on the current
connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor(context): set the fee multiplier from each proved epoch read

A connection rebuild never changes the chain, the multiplier changes once
per epoch and feeds only fee estimates, so ordering epoch reads and
dropping those begun before a rebuild guarded against nothing worth the
machinery. A proved epoch read sets the multiplier directly again; an
unavailable epoch still keeps the last known value and labels it as
such. A rebuild still reads the epoch, so the new SDK proves the
network's version again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* docs(context): say why proved epochs need no ordering

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test: drop the protocol 13 client tables snapshot

A released protocol's tables and each network's minimum version are
upstream's to keep fixed; DET's start is covered by
platform_version_starts_at_the_network_minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(context): decode saved contracts at the proof verifier's version

The proof verifier asks for contracts at the version it verifies with,
which can be newer than the SDK's. System contracts were already served
at that version; a saved user contract was decoded at the SDK's version
instead, dropping newer-protocol settings such as action fees. The
fallback now decodes it at the version asked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(wallet): report a failed signed-message envelope instead of panicking

Building the recoverable-signature envelope returns an error upstream;
it is now reported as the existing message-signing failure, with the
detail logged, instead of aborting the signing path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* style: drop blank lines left by the removed secp256k1 context

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): prove protocol versions through the SDK in the non-transferable tests

#1114 removed DET's protocol version copy. The tests prove versions
through the SDK, which only raises them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): never hide or silently flip the transferability choice

A choice to make a token non-transferable could be made in Advanced mode,
stay hidden in Simple mode, and be signed without the confirmation saying so.
And whenever the network's support was not confirmed yet, the creator
silently flipped the choice back to transferable on that frame.

- The "Holders can send this token to other identities" checkbox is shown in
  Simple mode too, so nothing hidden is submitted.
- The choice is kept while the network does not (yet) accept non-transferable
  tokens; allowing transfers again stays possible. The existing
  NonTransferableTokenNotSupported reason shows next to the checkbox and
  blocks "Create Token" and "Register Token Contract" (with the reason next
  to and on hover over the blocked button). The backend still refuses it too.
- The confirmation states what gets signed: "Holders can send this token to
  other identities." or "Holders cannot send this token to other identities.
  This cannot be changed later."
- The Simple-mode hint below "Create Token" is now one complete sentence per
  case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

---------

Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
lklimek added a commit that referenced this pull request Oct 26, 2026
…eate Token shortcut (#1129)

* build(deps)!: update Platform to v5.1-dev 063589bf

Pin dash-sdk, rs-sdk-trusted-context-provider, platform-wallet and
platform-wallet-storage to dashpay/platform v5.1-dev 063589bf
(5.0.0-rc.8). The lockfile moves only the Platform packages.

The upstream V019 wallet-storage migration adds a nullable asset-lock
operation id; V001-V018 are unchanged. The compatibility bridge gets the
033ecae destination snapshot it compares against, and the pin guard
records the new revision with an unchanged migration fingerprint.

BREAKING CHANGE: the wallet storage upgrade to V019 is forward only. An
older build cannot open upgraded storage; going back needs a copy of the
data directory taken before the upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor: adapt to the rust-dashcore cryptography API

The new rust-dashcore wraps secp256k1 keys in EcdsaSecretKey and
EcdsaPublicKey, returns secret bytes as Zeroizing, and drops the
Secp256k1 context argument. Signers, single-key wallets, DashPay
derivation, address and QR handling, migrations and their tests follow
the new types. Signing stays on the non-grinding dpp::secp256k1 path,
and a parity test pins the BLS signature bytes the previous SDK made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix: adapt to protocol version 14 upstream types

Handle the dpp and SDK types the new pin adds, keeping today's behaviour:

- Document replace keeps moderated_at and moderated_by; new documents
  start without them.
- The document editor refuses typed-array fields instead of dropping
  their contents, and keeps referenced key ids as numbers.
- Shielded token events show read-only in group actions, and the
  shielded pool token settings are refused before anything is signed.
- Contested document creation states the protocol's base contest fund,
  so the SDK never auto-quotes a larger one.
- Masternode vote reads use ResourceVoteWithCount, the SDK's new vote
  type; the vote count is not used yet.
- New query fields, wallet events, wallet error variants and asset-lock
  funding modes are handled where the SDK now requires them.
- Entropy-only document ids are documented as placeholders from
  protocol 14, and deferred upstream features link to their issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(sdk): follow the network's protocol version

The SDK was pinned to the protocol 13 table, so it could not build any
protocol 14 transition or follow the versioned identity lookup. It now
starts at upstream's per-network minimum and ratchets to what proven
responses report.

- System contracts are cached per protocol version and served through
  accessors. The context provider serves them at the version the proof
  verifier asks for and fails rather than serve another version's.
- A proved epoch sets the fee multiplier and raises the protocol version.
  An older epoch than the adopted one is ignored.
- Rebuilding the connection resets the protocol version, fee multiplier
  and adopted epoch under one lock before the new SDK is published, and
  drops reads begun on the old connection.
- Capabilities read the network's version through a helper that stays
  closed for a version this build does not define.
- Contest timing reads the live version; retired vote schedules keep the
  protocol 13 notice window they were created under.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(platform): guard the protocol 13 tables and transitions

Compare the protocol 13 client tables with a recorded snapshot, so an
upstream change to them is reviewed, and check that keys and documents
DET builds on a protocol 13 network use encodings protocol 13 decodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(errors): explain protocol 14 refusals that existing actions can hit

Map the refusals the new protocol adds to flows DET already offers to
dedicated TaskError variants: a full username contest, a vote choice the
contest does not allow, a name someone else asked for first, a token
that cannot be moved, a changed immutable document field, a reference to
a document type that cannot be deleted, and a moderators' fee on a
contract without moderation. Names supplied by the node stay in the
typed source only, never in the message.

Token operations that fail inside the wallet runtime keep their SDK
cause, so they are classified like any SDK error; an unclassified one
names the operation that did not complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* docs: record the Platform v5.1-dev bump and protocol tracking

Add a dated design note for the pin, the protocol version sources, the
connection state rules and the protocol 13 guards, and point AGENTS.md
at From<SdkError> for TaskError as the SDK error reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* feat(tokens): create non-transferable tokens and stop offering their transfer

Protocol version 14 lets a token configuration make a token
non-transferable, and Platform refuses every transfer of such a token.

- My Tokens no longer offers Transfer for a token that cannot be
  transferred; the disabled button says why.
- The token creator offers "Holders can send this token to other
  identities", on by default. Turning it off uses upstream
  TokenConfiguration::set_transferable, which moves to a version 1
  configuration only for a non-transferable token, so a transferable
  token keeps the version 0 format older networks accept.
- The option is gated on a new NonTransferableTokens capability: the
  connected protocol version must decode version 1 token configurations.
  The creator and the backend both refuse a non-transferable token on a
  network that does not, before anything is signed.
- Platform's refusal of a tradeable non-transferable token maps to a
  dedicated, actionable error.
- User story TOK-020.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(errors): explain moderation, gas sponsorship and distribution limit refusals

Protocol version 14 refusals that flows already in DET can hit get
dedicated, actionable messages, each keeping the SDK error as its source:

- an identity banned or suspended (until when) on a moderated contract;
- a gas sponsor short of credits, a gas payer the document type does not
  offer, and mixed gas payers in one batch;
- pre-programmed token distributions of one time over the limit.

An overflowing shielded note total is logged at warn: it means corrupt or
hostile sync data, not routine noise.

Tests cover contracts saved at protocol 12 loading unchanged at 13 and 14,
and contracts saved at 14 decoding at 13 and in full again at 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(context): keep one system contract set per protocol version

A lookup at another version, as the proof verifier makes at a response's
version, swapped out the app's set, so each such lookup reloaded the
system contracts and the next app read reloaded them again. Each
version now keeps its own set; the app's reads keep the set they last
got for a failed reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(platform): confirm only a verified protocol version without the epoch

When the epoch cannot be read, the proved DPNS fallback confirmed the
SDK's version, which starts at the network's upstream minimum (14 on
devnet), as the network's. It now confirms the version of the responses
the SDK verified, and nothing before any.

Restores the completed-withdrawal status list with the reason sending
FAILED to a protocol 13 network is safe, and its test, now comparing the
protocol 13 schema with the latest one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(wallet): erase the secp256k1 signing key after use

The derived key DET signs with is copied into secp256k1's own type,
which keeps its bytes after use. Wrap it so it is erased on drop, as the
derived key it comes from would be; signatures stay byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(protocol): guard a contested name built with the contest fund at protocol 13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(ui): say plainly what the app cannot edit or sign yet

The new refusals sent users to another document editor or token client.
They now say the app cannot edit this field type, sign this action or
change this token setting yet, in one wording, and the shielded setting
refusal sits with the token contract errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* chore: keep AGENTS.md and the marketplace comment as on v1.0-dev

Also corrects the platform compatibility fixtures README: no code reads
e3cd7cf.sql any more; it is the V001-V018 checksum reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): gate non-transferable tokens on protocol 14 like the rest

Capability::NonTransferableTokens opens from protocol version 14 through
known_protocol_version_at_least, like every other protocol capability,
instead of probing the token configuration format version (which
feature_gate.rs itself warns against). The token creator's local refusal
and disabled-checkbox hint reuse
TaskError::NonTransferableTokenNotSupported's text instead of copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(test): prove the protocol version the headless refresh learns

The protocol version fallback takes only a version the SDK verified, and
a mock expectation's metadata is never recorded as verified, so the three
headless refresh tests saw the version stay unconfirmed. The mock now has
the SDK accept the version from metadata treated as proved, as after a
live network's signed response, and a new test pins that a response the
SDK never verified leaves the version unconfirmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test: drop the protocol 13 transition encoding tests

The SDK picks each transition's encoding from the platform version DET
passes in, so these tests checked dpp's version tables rather than DET.
The mainnet start version and the contest fund cap stay covered by the
platform_info and fee_estimation tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor(context): read the network's protocol version from the SDK

The SDK at this pin already tracks the version the network has proven:
it records the version of every response whose proof and quorum
signature it verified, and a rebuilt connection is a new SDK that starts
from nothing. DET's own copy, raised from proved epochs and DPNS reads
and reset on every rebuild, duplicated that state. The app now reads the
current SDK's verified version; capabilities still stay closed before a
version is proven and for one this build does not define, and network
info shows the proven number or says none is confirmed. Proved epochs
still set the fee multiplier, in epoch order and only on the current
connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor(context): set the fee multiplier from each proved epoch read

A connection rebuild never changes the chain, the multiplier changes once
per epoch and feeds only fee estimates, so ordering epoch reads and
dropping those begun before a rebuild guarded against nothing worth the
machinery. A proved epoch read sets the multiplier directly again; an
unavailable epoch still keeps the last known value and labels it as
such. A rebuild still reads the epoch, so the new SDK proves the
network's version again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* docs(context): say why proved epochs need no ordering

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test: drop the protocol 13 client tables snapshot

A released protocol's tables and each network's minimum version are
upstream's to keep fixed; DET's start is covered by
platform_version_starts_at_the_network_minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(context): decode saved contracts at the proof verifier's version

The proof verifier asks for contracts at the version it verifies with,
which can be newer than the SDK's. System contracts were already served
at that version; a saved user contract was decoded at the SDK's version
instead, dropping newer-protocol settings such as action fees. The
fallback now decodes it at the version asked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(wallet): report a failed signed-message envelope instead of panicking

Building the recoverable-signature envelope returns an error upstream;
it is now reported as the existing message-signing failure, with the
detail logged, instead of aborting the signing path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* style: drop blank lines left by the removed secp256k1 context

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): prove protocol versions through the SDK in the non-transferable tests

#1114 removed DET's protocol version copy. The tests prove versions
through the SDK, which only raises them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): keep token action forms under their heading and add a Create Token shortcut

The shared token action scaffold (mint, burn, freeze, unfreeze,
destroy frozen funds, pause, resume) placed its "Advanced Options"
checkbox in a bare right-to-left layout inside the top-down central
panel. egui gives such a layout all remaining height and centres the
checkbox vertically in it, so the form started at the bottom of the
window. The checkbox now shares the heading's row, as on the transfer,
claim, purchase, set price and update config screens.

My Tokens gains a "Create Token" toolbar button that switches to the
Token Creator through a new typed DesiredAppAction::SetMainScreen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): never hide or silently flip the transferability choice

A choice to make a token non-transferable could be made in Advanced mode,
stay hidden in Simple mode, and be signed without the confirmation saying so.
And whenever the network's support was not confirmed yet, the creator
silently flipped the choice back to transferable on that frame.

- The "Holders can send this token to other identities" checkbox is shown in
  Simple mode too, so nothing hidden is submitted.
- The choice is kept while the network does not (yet) accept non-transferable
  tokens; allowing transfers again stays possible. The existing
  NonTransferableTokenNotSupported reason shows next to the checkbox and
  blocks "Create Token" and "Register Token Contract" (with the reason next
  to and on hover over the blocked button). The backend still refuses it too.
- The confirmation states what gets signed: "Holders can send this token to
  other identities." or "Holders cannot send this token to other identities.
  This cannot be changed later."
- The Simple-mode hint below "Create Token" is now one complete sentence per
  case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

---------

Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
lklimek added a commit that referenced this pull request Oct 27, 2026
…1119)

* build(deps)!: update Platform to v5.1-dev 063589bf

Pin dash-sdk, rs-sdk-trusted-context-provider, platform-wallet and
platform-wallet-storage to dashpay/platform v5.1-dev 063589bf
(5.0.0-rc.8). The lockfile moves only the Platform packages.

The upstream V019 wallet-storage migration adds a nullable asset-lock
operation id; V001-V018 are unchanged. The compatibility bridge gets the
033ecae destination snapshot it compares against, and the pin guard
records the new revision with an unchanged migration fingerprint.

BREAKING CHANGE: the wallet storage upgrade to V019 is forward only. An
older build cannot open upgraded storage; going back needs a copy of the
data directory taken before the upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor: adapt to the rust-dashcore cryptography API

The new rust-dashcore wraps secp256k1 keys in EcdsaSecretKey and
EcdsaPublicKey, returns secret bytes as Zeroizing, and drops the
Secp256k1 context argument. Signers, single-key wallets, DashPay
derivation, address and QR handling, migrations and their tests follow
the new types. Signing stays on the non-grinding dpp::secp256k1 path,
and a parity test pins the BLS signature bytes the previous SDK made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix: adapt to protocol version 14 upstream types

Handle the dpp and SDK types the new pin adds, keeping today's behaviour:

- Document replace keeps moderated_at and moderated_by; new documents
  start without them.
- The document editor refuses typed-array fields instead of dropping
  their contents, and keeps referenced key ids as numbers.
- Shielded token events show read-only in group actions, and the
  shielded pool token settings are refused before anything is signed.
- Contested document creation states the protocol's base contest fund,
  so the SDK never auto-quotes a larger one.
- Masternode vote reads use ResourceVoteWithCount, the SDK's new vote
  type; the vote count is not used yet.
- New query fields, wallet events, wallet error variants and asset-lock
  funding modes are handled where the SDK now requires them.
- Entropy-only document ids are documented as placeholders from
  protocol 14, and deferred upstream features link to their issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(sdk): follow the network's protocol version

The SDK was pinned to the protocol 13 table, so it could not build any
protocol 14 transition or follow the versioned identity lookup. It now
starts at upstream's per-network minimum and ratchets to what proven
responses report.

- System contracts are cached per protocol version and served through
  accessors. The context provider serves them at the version the proof
  verifier asks for and fails rather than serve another version's.
- A proved epoch sets the fee multiplier and raises the protocol version.
  An older epoch than the adopted one is ignored.
- Rebuilding the connection resets the protocol version, fee multiplier
  and adopted epoch under one lock before the new SDK is published, and
  drops reads begun on the old connection.
- Capabilities read the network's version through a helper that stays
  closed for a version this build does not define.
- Contest timing reads the live version; retired vote schedules keep the
  protocol 13 notice window they were created under.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(platform): guard the protocol 13 tables and transitions

Compare the protocol 13 client tables with a recorded snapshot, so an
upstream change to them is reviewed, and check that keys and documents
DET builds on a protocol 13 network use encodings protocol 13 decodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(errors): explain protocol 14 refusals that existing actions can hit

Map the refusals the new protocol adds to flows DET already offers to
dedicated TaskError variants: a full username contest, a vote choice the
contest does not allow, a name someone else asked for first, a token
that cannot be moved, a changed immutable document field, a reference to
a document type that cannot be deleted, and a moderators' fee on a
contract without moderation. Names supplied by the node stay in the
typed source only, never in the message.

Token operations that fail inside the wallet runtime keep their SDK
cause, so they are classified like any SDK error; an unclassified one
names the operation that did not complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* docs: record the Platform v5.1-dev bump and protocol tracking

Add a dated design note for the pin, the protocol version sources, the
connection state rules and the protocol 13 guards, and point AGENTS.md
at From<SdkError> for TaskError as the SDK error reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* feat(tokens): create and claim once-per-identity token distributions

Protocol version 14 adds a once-per-identity distribution: every identity
may claim a fixed amount of a token exactly once.

- The token creator offers the distribution with the amount each identity
  can claim, gated on a new OncePerIdentityDistribution capability. Without
  it the rules stay version 0, the format older networks accept. The
  creator and the backend both refuse it on a network that does not accept
  it, before anything is signed. The registration estimate prices every
  term, including the distribution's extra fee, from the fee table of the
  network's confirmed protocol version.
- The Claim screen and My Tokens show the distribution. The claim
  confirmation names the distribution (and, for this one, the amount), and
  confirming sends exactly the claim that was shown.
- A successful claim records an advisory hint per identity and token, at
  the proved claim's block time. The Claim screen shows it without ever
  blocking a claim, and dismissing it is saved through a backend task. A
  node's unproven "already claimed" refusal is never recorded. A claim that
  succeeded but could not be recorded is reported as made, so the user is
  not invited to claim again.
- Platform's refusals (already claimed, invalid amount) map to dedicated,
  actionable errors.
- A protocol 13 guard checks the distribution is never silently dropped
  when encoded for protocol 13.
- User story TOK-019.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(errors): explain moderation, gas sponsorship and distribution limit refusals

Protocol version 14 refusals that flows already in DET can hit get
dedicated, actionable messages, each keeping the SDK error as its source:

- an identity banned or suspended (until when) on a moderated contract;
- a gas sponsor short of credits, a gas payer the document type does not
  offer, and mixed gas payers in one batch;
- pre-programmed token distributions of one time over the limit.

An overflowing shielded note total is logged at warn: it means corrupt or
hostile sync data, not routine noise.

Tests cover contracts saved at protocol 12 loading unchanged at 13 and 14,
and contracts saved at 14 decoding at 13 and in full again at 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(context): keep one system contract set per protocol version

A lookup at another version, as the proof verifier makes at a response's
version, swapped out the app's set, so each such lookup reloaded the
system contracts and the next app read reloaded them again. Each
version now keeps its own set; the app's reads keep the set they last
got for a failed reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(platform): confirm only a verified protocol version without the epoch

When the epoch cannot be read, the proved DPNS fallback confirmed the
SDK's version, which starts at the network's upstream minimum (14 on
devnet), as the network's. It now confirms the version of the responses
the SDK verified, and nothing before any.

Restores the completed-withdrawal status list with the reason sending
FAILED to a protocol 13 network is safe, and its test, now comparing the
protocol 13 schema with the latest one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(wallet): erase the secp256k1 signing key after use

The derived key DET signs with is copied into secp256k1's own type,
which keeps its bytes after use. Wrap it so it is erased on drop, as the
derived key it comes from would be; signatures stay byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(protocol): guard a contested name built with the contest fund at protocol 13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(ui): say plainly what the app cannot edit or sign yet

The new refusals sent users to another document editor or token client.
They now say the app cannot edit this field type, sign this action or
change this token setting yet, in one wording, and the shielded setting
refusal sits with the token contract errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* chore: keep AGENTS.md and the marketplace comment as on v1.0-dev

Also corrects the platform compatibility fixtures README: no code reads
e3cd7cf.sql any more; it is the V001-V018 checksum reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): stop retrying a refused once-per-identity claim

After the network refuses a second once-per-identity claim, the Claim
screen turns Claim off for that distribution while it is open and says
why, so a retry is not charged again. The refusal is unproven node
output, so it is never saved as the claim hint.

The token creator's registration estimate moves into
model::fee_estimation, the local refusal and the disabled-checkbox hint
reuse TaskError::TokenOncePerIdentityNotSupported's text, and the claim
reuses its token id instead of computing it twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(errors): word the once-per-identity refusal like the non-transferable one

Both refusals describe the same situation, a network below protocol 14,
so they now open the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(test): prove the protocol version the headless refresh learns

The protocol version fallback takes only a version the SDK verified, and
a mock expectation's metadata is never recorded as verified, so the three
headless refresh tests saw the version stay unconfirmed. The mock now has
the SDK accept the version from metadata treated as proved, as after a
live network's signed response, and a new test pins that a response the
SDK never verified leaves the version unconfirmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test: drop the protocol 13 transition encoding tests

The SDK picks each transition's encoding from the platform version DET
passes in, so these tests checked dpp's version tables rather than DET.
The mainnet start version and the contest fund cap stay covered by the
platform_info and fee_estimation tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor(context): read the network's protocol version from the SDK

The SDK at this pin already tracks the version the network has proven:
it records the version of every response whose proof and quorum
signature it verified, and a rebuilt connection is a new SDK that starts
from nothing. DET's own copy, raised from proved epochs and DPNS reads
and reset on every rebuild, duplicated that state. The app now reads the
current SDK's verified version; capabilities still stay closed before a
version is proven and for one this build does not define, and network
info shows the proven number or says none is confirmed. Proved epochs
still set the fee multiplier, in epoch order and only on the current
connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor(context): set the fee multiplier from each proved epoch read

A connection rebuild never changes the chain, the multiplier changes once
per epoch and feeds only fee estimates, so ordering epoch reads and
dropping those begun before a rebuild guarded against nothing worth the
machinery. A proved epoch read sets the multiplier directly again; an
unavailable epoch still keeps the last known value and labels it as
such. A rebuild still reads the epoch, so the new SDK proves the
network's version again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* docs(context): say why proved epochs need no ordering

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test: drop the protocol 13 client tables snapshot

A released protocol's tables and each network's minimum version are
upstream's to keep fixed; DET's start is covered by
platform_version_starts_at_the_network_minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(context): decode saved contracts at the proof verifier's version

The proof verifier asks for contracts at the version it verifies with,
which can be newer than the SDK's. System contracts were already served
at that version; a saved user contract was decoded at the SDK's version
instead, dropping newer-protocol settings such as action fees. The
fallback now decodes it at the version asked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(wallet): report a failed signed-message envelope instead of panicking

Building the recoverable-signature envelope returns an error upstream;
it is now reported as the existing message-signing failure, with the
detail logged, instead of aborting the signing path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* style: drop blank lines left by the removed secp256k1 context

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): read the protocol version from the SDK after the Platform bump merge

#1114 removed DET's protocol version copy. The token registration fee
estimate reads the SDK's version, and the once-per-identity tests prove
versions through the SDK, which only raises them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

---------

Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
lklimek added a commit that referenced this pull request Oct 28, 2026
… it shows (#1130)

* build(deps)!: update Platform to v5.1-dev 063589bf

Pin dash-sdk, rs-sdk-trusted-context-provider, platform-wallet and
platform-wallet-storage to dashpay/platform v5.1-dev 063589bf
(5.0.0-rc.8). The lockfile moves only the Platform packages.

The upstream V019 wallet-storage migration adds a nullable asset-lock
operation id; V001-V018 are unchanged. The compatibility bridge gets the
033ecae destination snapshot it compares against, and the pin guard
records the new revision with an unchanged migration fingerprint.

BREAKING CHANGE: the wallet storage upgrade to V019 is forward only. An
older build cannot open upgraded storage; going back needs a copy of the
data directory taken before the upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor: adapt to the rust-dashcore cryptography API

The new rust-dashcore wraps secp256k1 keys in EcdsaSecretKey and
EcdsaPublicKey, returns secret bytes as Zeroizing, and drops the
Secp256k1 context argument. Signers, single-key wallets, DashPay
derivation, address and QR handling, migrations and their tests follow
the new types. Signing stays on the non-grinding dpp::secp256k1 path,
and a parity test pins the BLS signature bytes the previous SDK made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix: adapt to protocol version 14 upstream types

Handle the dpp and SDK types the new pin adds, keeping today's behaviour:

- Document replace keeps moderated_at and moderated_by; new documents
  start without them.
- The document editor refuses typed-array fields instead of dropping
  their contents, and keeps referenced key ids as numbers.
- Shielded token events show read-only in group actions, and the
  shielded pool token settings are refused before anything is signed.
- Contested document creation states the protocol's base contest fund,
  so the SDK never auto-quotes a larger one.
- Masternode vote reads use ResourceVoteWithCount, the SDK's new vote
  type; the vote count is not used yet.
- New query fields, wallet events, wallet error variants and asset-lock
  funding modes are handled where the SDK now requires them.
- Entropy-only document ids are documented as placeholders from
  protocol 14, and deferred upstream features link to their issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(sdk): follow the network's protocol version

The SDK was pinned to the protocol 13 table, so it could not build any
protocol 14 transition or follow the versioned identity lookup. It now
starts at upstream's per-network minimum and ratchets to what proven
responses report.

- System contracts are cached per protocol version and served through
  accessors. The context provider serves them at the version the proof
  verifier asks for and fails rather than serve another version's.
- A proved epoch sets the fee multiplier and raises the protocol version.
  An older epoch than the adopted one is ignored.
- Rebuilding the connection resets the protocol version, fee multiplier
  and adopted epoch under one lock before the new SDK is published, and
  drops reads begun on the old connection.
- Capabilities read the network's version through a helper that stays
  closed for a version this build does not define.
- Contest timing reads the live version; retired vote schedules keep the
  protocol 13 notice window they were created under.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(platform): guard the protocol 13 tables and transitions

Compare the protocol 13 client tables with a recorded snapshot, so an
upstream change to them is reviewed, and check that keys and documents
DET builds on a protocol 13 network use encodings protocol 13 decodes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(errors): explain protocol 14 refusals that existing actions can hit

Map the refusals the new protocol adds to flows DET already offers to
dedicated TaskError variants: a full username contest, a vote choice the
contest does not allow, a name someone else asked for first, a token
that cannot be moved, a changed immutable document field, a reference to
a document type that cannot be deleted, and a moderators' fee on a
contract without moderation. Names supplied by the node stay in the
typed source only, never in the message.

Token operations that fail inside the wallet runtime keep their SDK
cause, so they are classified like any SDK error; an unclassified one
names the operation that did not complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* docs: record the Platform v5.1-dev bump and protocol tracking

Add a dated design note for the pin, the protocol version sources, the
connection state rules and the protocol 13 guards, and point AGENTS.md
at From<SdkError> for TaskError as the SDK error reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* feat(tokens): create non-transferable tokens and stop offering their transfer

Protocol version 14 lets a token configuration make a token
non-transferable, and Platform refuses every transfer of such a token.

- My Tokens no longer offers Transfer for a token that cannot be
  transferred; the disabled button says why.
- The token creator offers "Holders can send this token to other
  identities", on by default. Turning it off uses upstream
  TokenConfiguration::set_transferable, which moves to a version 1
  configuration only for a non-transferable token, so a transferable
  token keeps the version 0 format older networks accept.
- The option is gated on a new NonTransferableTokens capability: the
  connected protocol version must decode version 1 token configurations.
  The creator and the backend both refuse a non-transferable token on a
  network that does not, before anything is signed.
- Platform's refusal of a tradeable non-transferable token maps to a
  dedicated, actionable error.
- User story TOK-020.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(errors): explain moderation, gas sponsorship and distribution limit refusals

Protocol version 14 refusals that flows already in DET can hit get
dedicated, actionable messages, each keeping the SDK error as its source:

- an identity banned or suspended (until when) on a moderated contract;
- a gas sponsor short of credits, a gas payer the document type does not
  offer, and mixed gas payers in one batch;
- pre-programmed token distributions of one time over the limit.

An overflowing shielded note total is logged at warn: it means corrupt or
hostile sync data, not routine noise.

Tests cover contracts saved at protocol 12 loading unchanged at 13 and 14,
and contracts saved at 14 decoding at 13 and in full again at 14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(context): keep one system contract set per protocol version

A lookup at another version, as the proof verifier makes at a response's
version, swapped out the app's set, so each such lookup reloaded the
system contracts and the next app read reloaded them again. Each
version now keeps its own set; the app's reads keep the set they last
got for a failed reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(platform): confirm only a verified protocol version without the epoch

When the epoch cannot be read, the proved DPNS fallback confirmed the
SDK's version, which starts at the network's upstream minimum (14 on
devnet), as the network's. It now confirms the version of the responses
the SDK verified, and nothing before any.

Restores the completed-withdrawal status list with the reason sending
FAILED to a protocol 13 network is safe, and its test, now comparing the
protocol 13 schema with the latest one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(wallet): erase the secp256k1 signing key after use

The derived key DET signs with is copied into secp256k1's own type,
which keeps its bytes after use. Wrap it so it is erased on drop, as the
derived key it comes from would be; signatures stay byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test(protocol): guard a contested name built with the contest fund at protocol 13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(ui): say plainly what the app cannot edit or sign yet

The new refusals sent users to another document editor or token client.
They now say the app cannot edit this field type, sign this action or
change this token setting yet, in one wording, and the shielded setting
refusal sits with the token contract errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* chore: keep AGENTS.md and the marketplace comment as on v1.0-dev

Also corrects the platform compatibility fixtures README: no code reads
e3cd7cf.sql any more; it is the V001-V018 checksum reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): gate non-transferable tokens on protocol 14 like the rest

Capability::NonTransferableTokens opens from protocol version 14 through
known_protocol_version_at_least, like every other protocol capability,
instead of probing the token configuration format version (which
feature_gate.rs itself warns against). The token creator's local refusal
and disabled-checkbox hint reuse
TaskError::NonTransferableTokenNotSupported's text instead of copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(test): prove the protocol version the headless refresh learns

The protocol version fallback takes only a version the SDK verified, and
a mock expectation's metadata is never recorded as verified, so the three
headless refresh tests saw the version stay unconfirmed. The mock now has
the SDK accept the version from metadata treated as proved, as after a
live network's signed response, and a new test pins that a response the
SDK never verified leaves the version unconfirmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test: drop the protocol 13 transition encoding tests

The SDK picks each transition's encoding from the platform version DET
passes in, so these tests checked dpp's version tables rather than DET.
The mainnet start version and the contest fund cap stay covered by the
platform_info and fee_estimation tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor(context): read the network's protocol version from the SDK

The SDK at this pin already tracks the version the network has proven:
it records the version of every response whose proof and quorum
signature it verified, and a rebuilt connection is a new SDK that starts
from nothing. DET's own copy, raised from proved epochs and DPNS reads
and reset on every rebuild, duplicated that state. The app now reads the
current SDK's verified version; capabilities still stay closed before a
version is proven and for one this build does not define, and network
info shows the proven number or says none is confirmed. Proved epochs
still set the fee multiplier, in epoch order and only on the current
connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* refactor(context): set the fee multiplier from each proved epoch read

A connection rebuild never changes the chain, the multiplier changes once
per epoch and feeds only fee estimates, so ordering epoch reads and
dropping those begun before a rebuild guarded against nothing worth the
machinery. A proved epoch read sets the multiplier directly again; an
unavailable epoch still keeps the last known value and labels it as
such. A rebuild still reads the epoch, so the new SDK proves the
network's version again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* docs(context): say why proved epochs need no ordering

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* test: drop the protocol 13 client tables snapshot

A released protocol's tables and each network's minimum version are
upstream's to keep fixed; DET's start is covered by
platform_version_starts_at_the_network_minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(context): decode saved contracts at the proof verifier's version

The proof verifier asks for contracts at the version it verifies with,
which can be newer than the SDK's. System contracts were already served
at that version; a saved user contract was decoded at the SDK's version
instead, dropping newer-protocol settings such as action fees. The
fallback now decodes it at the version asked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(wallet): report a failed signed-message envelope instead of panicking

Building the recoverable-signature envelope returns an error upstream;
it is now reported as the existing message-signing failure, with the
detail logged, instead of aborting the signing path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* style: drop blank lines left by the removed secp256k1 context

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): prove protocol versions through the SDK in the non-transferable tests

#1114 removed DET's protocol version copy. The tests prove versions
through the SDK, which only raises them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): build exactly the preset the Token Creator shows

Leaving the Token Creator (subscreen tab, left panel, or "Back" after a
successful creation) reset every action rule to "no one" but kept the
previously chosen preset on screen. Coming back, the creator still showed
"All Allowed" and let the user create the token, which was then registered
with no actions allowed at all - permanently, since a token's rules can only
be changed by whoever the rules authorize.

- One preset-to-rules mapping (`PresetRules`) now both applies a preset and
  checks that the rules on screen still match it.
- The shown preset is reconciled against the rules every frame, so a reset
  form shows "Select a preset..." and an Advanced-mode rule edit shows
  "Custom" instead of a preset that will not be built.
- The form reset also clears the preset, the cached build arguments and the
  cached confirmation dialog, and restores the defaults it missed (transfers
  to frozen identities, minting to the contract owner, distribution unit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): keep the Token Creator form across navigation

Leaving the Token Creator to do something else (top up the identity, check
My Tokens) and coming back used to wipe the whole form. The form, the chosen
preset and its rules now survive navigation; the creator starts over only
after a finished creation or a network switch (its identity belongs to the
previous network).

The preset selector now has three explicit states: "Select a preset..." for a
creator where no preset or rule was chosen yet (Simple mode keeps "Create
Token" disabled), the preset's name while the rules match it, and "Custom" as
soon as they do not. "Custom" is shown in both Simple and Advanced mode, is a
valid choice to create the token from, and picking a preset again re-applies
its rules. The "Create Token" hint is now a complete sentence per case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): require a preset choice before registering in Advanced mode

Advanced mode's "Register Token Contract" now stays blocked until a preset or
individually chosen ("Custom") rules are picked, the same as Simple mode's
"Create Token", and shows the same "Select a token preset to continue." hint.
An untouched creator therefore never registers its all-"no one" starting
rules by accident.

The navigation kittest now checks the "Create Token" gate through its hint:
the primary-button helper does not mark a blocked button as disabled for
accessibility, so the previous check could not fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): say next to the create buttons why they are blocked

The reason "Create Token" or "Register Token Contract" is blocked is now a
visible hint right next to the button, and the same text is its hover
tooltip (`disabled_tooltip`), so it no longer depends on hovering.

- Simple mode, no preset yet: "Choose a preset to create the token."
- Advanced mode, no preset yet: "Choose a preset, or Custom to use the
  rules below."
- Simple mode still names a missing token name or initial supply first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): presets build Platform's full preset configuration

The Token Creator presets now take every value from Platform's own
`TokenConfigurationPreset::token_configuration_v0` (with direct pricing)
instead of a hand-written mapping, which had drifted:

- Minting may choose the destination identity (`minting_allow_choosing_destination`)
  was never turned on; Platform's presets turn it on, so "All Allowed" now lets
  the owner mint to a chosen identity.
- Marketplace trade-mode and direct-purchase-pricing change rules used the
  "advanced" rules; Platform uses the "basic" ones. This only changes
  "Minting and Burning", whose owner can now manage both.

The choosing-destination switch counts when matching rules to a preset, so
turning it off after picking a preset shows "Custom". New tokens still go to
the contract owner by default, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): never hide or silently flip the transferability choice

A choice to make a token non-transferable could be made in Advanced mode,
stay hidden in Simple mode, and be signed without the confirmation saying so.
And whenever the network's support was not confirmed yet, the creator
silently flipped the choice back to transferable on that frame.

- The "Holders can send this token to other identities" checkbox is shown in
  Simple mode too, so nothing hidden is submitted.
- The choice is kept while the network does not (yet) accept non-transferable
  tokens; allowing transfers again stays possible. The existing
  NonTransferableTokenNotSupported reason shows next to the checkbox and
  blocks "Create Token" and "Register Token Contract" (with the reason next
  to and on hover over the blocked button). The backend still refuses it too.
- The confirmation states what gets signed: "Holders can send this token to
  other identities." or "Holders cannot send this token to other identities.
  This cannot be changed later."
- The Simple-mode hint below "Create Token" is now one complete sentence per
  case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* perf(tokens): derive each preset's rules once, not every frame

The preset selector reconciles against the rules every frame, and deriving a
preset's rules builds Platform's whole token configuration. The creator's
presets and its starting rules are now derived once (`LazyLock`) and compared
by reference; applying a preset is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): close the wallet unlock popup on a network switch

The Token Creator's network-switch reset dropped the selected wallet but left
the wallet unlock popup open, so it came back for the next wallet the user
selected on the new network. The reset now closes it, which also clears its
passphrase dialog state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): ignore a registration result from before a network switch

A token registration sent on one network could finish after a switch and,
with the Token Creator in view, show its success screen (or mark it failed)
on the new network. The creator now accepts a registration's success or
failure only while it is waiting for one; the network-switch reset clears
that, so a late result is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

* fix(tokens): close the contract JSON popup when the creator resets

Advanced mode's "View JSON" popup survived the Token Creator reset, so after
a network switch (or a finished creation) it could still show the contract
built from the previous form. The reset now closes it and drops its text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q

---------

Co-authored-by: Lukasz Klimek <842586+lklimek@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-skipped A required review bot did not report; it was skipped by the window or by a person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants