Repository navigation
feat(documents): let the user skip an optional token cost - #1124
Conversation
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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Automatic key choice keeps only keys that are live (not disabled, not expired), held on this device, in scope for the action's contract or document type, and at a security level the action accepts. Among those it prefers a key without limits, and a document type takes a stronger key than the one it requires when that is all the identity holds. Keys are judged as the identity holds them now: a key whose limits were raised on the network is still the same key, so its stored private half stays matched to it, while a key that gains or loses a limit is not. An explicitly chosen DPNS key may have expired; the chooser warns and Platform decides by network time. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Map the refusals Platform gives for a signing key that expired, used up its spending limit, cannot pay for the action, or is bound to another contract or to batch actions only, to dedicated TaskError variants with a message that says what to do. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…t that holds it Every screen and backend task that picks a signing key now asks for the action's scope: the contract or document type for document and token actions, none for identity and contract transitions. DashPay documents use the levels each document type accepts. The manual key chooser leaves out keys bound to another contract or document type, keeps expired and limited keys with a warning, and judges the key the identity holds now. A document action with no usable key says why the form stops. The wallet to unlock, and the owner of an identity stored without a wallet link, follow the key that is actually used. Lookups that only point the user at a key, such as Check Owner Key, do not require the private half on this device. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…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 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…efusals from the Platform bump Merges 74695e7 from chore/bump-platform-063589bf. The conflict in src/backend_task/error.rs keeps both sides: the signing key refusals and the moderation and gas sponsorship refusals each keep their own section, match arms and test cases. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
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 <[email protected]> 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 <[email protected]> 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 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
… protocol 13 Co-Authored-By: Claude Opus 5.5 <[email protected]> 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 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
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 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…ey branch Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The username screen offered the unlock, and gated paying, on the wallet of the automatically picked key, although a key chosen under Advanced signs the registration. The wallet now follows the key the registration is signed with, and is picked again when that key changes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The document action and DashPay selectors offered every accepted level at once, so a CRITICAL key could sign where a key at the required level was held. Every document key is now chosen like the username key: each accepted level from the weakest up, unlimited keys first within a level. Also puts the scope and wallet doc comments of the document action screen back on their functions, and builds its test keys and identities from the shared test helpers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Each key chooser entry with a caveat is one complete template instead of a label plus a concatenated tag. The spending limit warning no longer points at a remaining budget the key details do not show, and IDN-024 names the key chooser, not the key list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
When a document type marks an action's token cost as optional (protocol version 14), the document action screen offers "Pay the token cost". With it off, the action carries no token payment and the identity pays the network fee in credits; a required token cost is always paid. Adds user story DOC-011. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…onal token cost branch Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
✅ Final review complete — no blockers (commit 8af761e) · triage: normal · Phase 2 only (no Phase 1 for this repository) |
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 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
…/document-optional-token-cost Conflict resolution: - src/ui/contracts_documents/document_action_screen.rs: kept the PR's optional token-cost payment (token_payment helper and its test) on top of #1117's signing-key refresh, price reads without a signing key and its tests; both test sets kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…to feat/document-optional-token-cost Co-Authored-By: Claude Opus 5.5 <[email protected]>
… already here via a2ad67f Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ional-token-cost Co-Authored-By: Claude Opus 5.5 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)
Changes requested: 2 blockers
- Reset the optional token-cost choice when starting a new action —
src/ui/contracts_documents/document_action_screen.rs:373-384(carried)
Impact: A user who opts out once can spend identity credits on a later action that offers fee sponsorship without opting out again. - Show the credit-fee outcome when an optional token cost is disabled —
src/ui/contracts_documents/document_action_screen.rs:1038-1052(thread, carried)
Impact: A user who turns off an optional payment sponsored by the contract owner is still told the owner will pay, even though the fee is deducted from the user's identity credits.
New on this head: This head brings in signing-key and document-form updates that clear stale selections and pending requests, while leaving the optional token-payment logic unchanged. The branch conflicts with the current v1.0-dev, which already includes #1117. Test Suite and Clippy were skipped, no code check reported a failure, and PR Hygiene is pending.
🔴 2 blocking
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Reset the optional token-cost choice when starting a new action
Impact: A user who opts out once can spend identity credits on a later action that offers fee sponsorship without opting out again.
src/ui/contracts_documents/document_action_screen.rs:373-384
After creating a document with the token payment turned off, a user can click “Back to Create Document,” select a type with a sponsored optional cost, and send the next document with the old opt-out still active. reset_screen() clears the selections but not pay_optional_token_cost, and the empty form returns before the no-cost branch can restore the default. Switching directly between two optional-cost types also leaves the choice unchanged: signing_scope_changed() clears fetched state but not the checkbox. In either case, token_payment_for() omits the payment and the identity pays the network fee in credits. Restore the default on form reset and contract or type change, and cover both paths with a regression test.
source: gpt-6.2-astra (phase2-reviewer: general, rust-quality)
Still open from earlier rounds (1)
- 🔴 Blocking: Show the credit-fee outcome when an optional token cost is disabled —
src/ui/contracts_documents/document_action_screen.rs:1038-1052(thread)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The full diff against v1.0-dev includes intricate changes to identity signing-key eligibility and selection insrc/model/qualified_identity/mod.rs, includingwithdrawal_signing_keyandtransfer_signing_key, beyond the optional token-cost checkbox. - Phase 1 reviewers: not run (disabled for this repository)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `src/ui/contracts_documents/document_action_screen.rs`:
- [BLOCKING] src/ui/contracts_documents/document_action_screen.rs:373-384: Reset the optional token-cost choice when starting a new action
Impact: A user who opts out once can spend identity credits on a later action that offers fee sponsorship without opting out again.
After creating a document with the token payment turned off, a user can click “Back to Create Document,” select a type with a sponsored optional cost, and send the next document with the old opt-out still active. `reset_screen()` clears the selections but not `pay_optional_token_cost`, and the empty form returns before the no-cost branch can restore the default. Switching directly between two optional-cost types also leaves the choice unchanged: `signing_scope_changed()` clears fetched state but not the checkbox. In either case, `token_payment_for()` omits the payment and the identity pays the network fee in credits. Restore the default on form reset and contract or type change, and cover both paths with a regression test.
- [BLOCKING] src/ui/contracts_documents/document_action_screen.rs:1038-1052: Show the credit-fee outcome when an optional token cost is disabled
(carried; thread: https://github.com/dashpay/dash-evo-tool/pull/1124#discussion_r4381859134)
|
Waiting for bot review — coderabbitai not yet · thepastaclaw requested changes — dismiss the review or push a fix, 1 thread unresolved — resolve it. Wait for the missing reviews, or a writer can post |
The cost summary ignored the "Pay the token cost" choice and could still say tokens would be paid and the contract owner would pay gas. It now follows the same decision as the submitted action: with the optional cost unchecked, it says no tokens will be paid and you pay the network fee in credits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)
Changes requested: 2 blockers
- Reset the optional token-cost choice when starting a new action —
src/ui/contracts_documents/document_action_screen.rs:363-386(carried)
Impact: A user who skips a sponsored token cost and starts another action on the same form can pay the next network fee from their identity credits without opting out for that action. - Show the credit-fee outcome when an optional token cost is disabled —
src/ui/contracts_documents/document_action_screen.rs:1070-1084(thread, carried)
Impact: A user who unchecks an optional token cost sponsored by the contract owner still sees the owner named as the fee payer, but submitting the action debits the user's identity credits.
New on this head: This head retargets the optional token-cost feature to v1.0-dev after #1117 merged and picks up the signing-key refresh and wallet-unlock updates. All six document actions use the shared payment choice, and required token costs remain mandatory. Test Suite and Clippy passed; PR Hygiene and PastaClaw review are pending.
🔴 2 blocking
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Reset the optional token-cost choice when starting a new action
Impact: A user who skips a sponsored token cost and starts another action on the same form can pay the next network fee from their identity credits without opting out for that action.
src/ui/contracts_documents/document_action_screen.rs:363-386
A new action can spend the user's credits instead of using the default token payment and its sponsorship. After creating a document with “Pay the token cost” unchecked, click “Back to Create Document” and select the same optional-cost type again. reset_screen clears the contract and type but leaves pay_optional_token_cost false. With either selection missing, render_main_content returns before the cost renderer can reset the flag. Reselecting an optional-cost type therefore shows the checkbox unchecked, and token_payment_for omits the payment on submission. Switching directly between two optional-cost types also retains the flag. Restore the default on form reset and when the contract or type changes, while preserving the choice when retrying the same draft.
source: gpt-6.2-sol (phase2-reviewer: general, rust-quality)
Still open from earlier rounds (1)
- 🔴 Blocking: Show the credit-fee outcome when an optional token cost is disabled —
src/ui/contracts_documents/document_action_screen.rs:1070-1084(thread)
Review provenance
Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.2-sol(effort low) — The behavior change is contained to one screen, where a default-on checkbox and a shared helper let users omit optional token payments while preserving required payments across all six document actions. - Phase 1 reviewers: not run (disabled for this repository)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `src/ui/contracts_documents/document_action_screen.rs`:
- [BLOCKING] src/ui/contracts_documents/document_action_screen.rs:363-386: Reset the optional token-cost choice when starting a new action
Impact: A user who skips a sponsored token cost and starts another action on the same form can pay the next network fee from their identity credits without opting out for that action.
A new action can spend the user's credits instead of using the default token payment and its sponsorship. After creating a document with “Pay the token cost” unchecked, click “Back to Create Document” and select the same optional-cost type again. `reset_screen` clears the contract and type but leaves `pay_optional_token_cost` false. With either selection missing, `render_main_content` returns before the cost renderer can reset the flag. Reselecting an optional-cost type therefore shows the checkbox unchecked, and `token_payment_for` omits the payment on submission. Switching directly between two optional-cost types also retains the flag. Restore the default on form reset and when the contract or type changes, while preserving the choice when retrying the same draft.
- [BLOCKING] src/ui/contracts_documents/document_action_screen.rs:1070-1084: Show the credit-fee outcome when an optional token cost is disabled
(carried; thread: https://github.com/dashpay/dash-evo-tool/pull/1124#discussion_r4381859134)
Skipping an optional token cost carried over to the next action on the same form: after "Back to Create Document", or when switching to another contract or document type, the cost stayed unpaid without the user opting out again. The choice now returns to paying on a form reset or a contract or type change, and is kept when retrying the same draft. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
PastaClaw review item: Reset the optional token-cost choice when starting a new action ( Fixed in 8af761e: the choice returns to paying the token cost when the form is reset or the selected contract or document type changes, and is kept when retrying the same draft. Covered by 🤖 Generated with Claude Code |
|
Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)
New on this head: Since the previous review, the follow-up resets the optional-payment flag when the form or selection changes, preserves it for retries, and makes the token-cost summary use the same payment decision as dispatch; it also adds regression coverage. At the captured CI state, the Test Suite was queued and Clippy was still in progress, with no failed code check reported.
🟡 1 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Review provenance
Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — This changes document-action UI state and token-payment construction across six actions, affecting fee/payment behavior but not directly changing consensus, signing, key handling, or storage. - Phase 1 reviewers: not run (disabled for this repository)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `src/ui/contracts_documents/document_action_screen.rs`:
- [SUGGESTION] src/ui/contracts_documents/document_action_screen.rs:3289-3300: The retry test can pass even if the retried action includes a token payment
Impact: A regression could attach a token payment when a user retries a failed optional-cost action with the checkbox unchecked, without failing this test.
The retry test only verifies that `pay_optional_token_cost` remains false after the broadcast error and after starting another broadcast. Because the fixture starts with `BackendTask::None`, it never calls `create_document_action`, where the checkbox state is converted into `token_payment_info`, so the test would still pass if retry construction attached a token payment. Configure the fixture with an optional-cost document type and valid selections, build the retry through `create_document_action`, and assert that the resulting `DocumentTask::DeleteDocument` contains `token_payment_info: None`; this remains a local unit test with no network call.
|
Ready for review — files with no dedicated owner: lklimek. |
|
Policy satisfied — this can merge. |
TL;DR: When a contract marks a document action's token cost as optional (protocol 14), the document action screen offers "Pay the token cost". With it turned off, the action carries no token payment and the identity pays the network fee in credits. A required token cost is always paid, as before.
Stacked atop #1117.
User story
As a user, when a document action's token cost is optional, I want to choose not to pay it, so that I can pay the network fee in credits instead (DOC-011).
Scenario
Base flow
Actual
The screen always attached the token payment. An optional token cost could not be left out.
Expected
Detailed discussion
src/ui/contracts_documents/document_action_screen.rs):token_paymentbuilds the token payment for a cost. It returns none without a cost, and none for an optional cost the user chose not to pay.pay_optional_token_costbacks the "Pay the token cost" checkbox inrender_token_cost_info. It resets to on whenever the selected action has no token cost.DocumentActionTokenCost::optionalcomes from the Platform pin in chore(deps)!: update Platform to v5.1-dev 063589bf and follow the network's protocol version #1114. Only protocol 14 contracts can declare it, so the option never appears for older contracts and needs no capability gate.Testing
ui::contracts_documents::document_action_screen::tests::an_optional_token_cost_is_paid_only_when_the_user_chooses_to. A required cost is always paid; an optional cost only while the option is on; no cost means no payment.document_action_screentests: 8 passed.cargo clippy --all-features --lib --tests -- -D warningsandcargo fmt --allpass.🤖 Co-authored by Claudius the Magnificent AI Agent
🤖 Generated with Claude Code
https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
PR Hygiene ·
8af761edocs/user-stories.md,src/ui/contracts_documents/document_action_screen.rs) — approved by lklimekWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit