Skip to content

feat(voting): request dates, the links filter and Quick voting - #1366

Merged
romchornyi merged 17 commits into
feat/voting-vote-from-pillsfrom
feat/voting-quick-voting
Nov 16, 2026
Merged

romchornyi merged 17 commits into
feat/voting-vote-from-pillsfrom
feat/voting-quick-voting

Conversation

@romchornyi

@romchornyi romchornyi commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Stacked on the stage 4 PR (#1347, vote from the pills), the last stage of the username voting redesign. A masternode owner now sees each request's date and link, can keep only the requests with links, and can approve every shown username at once with Quick voting. This PR also carries the review fixes to stage 4 made since it was published. Feature summary: docs/features/username-voting/README.md.

What was done?

  • Request dates and links. Each request in an expanded row shows its request date and "Link included" when it has a link; Request details shows the voting period from the earliest request date to the voting end, "Not provided" when a date or link is missing. The dates come from SwiftDashSDK (platform#5718, already in the platform pin on develop); a request whose document cannot be read comes back without a date and the read still succeeds.
  • "Only requests with links" can be ticked. Links are looked up once per name through one store-wide queue (at most 4 at a time; an expanded row and Request details go to the front). While links load the list shows loading; when a link cannot be told it says "Can't filter by links right now" with "Reset filters", and applying the filter again retries the failed lookups.
  • Quick voting. "Quick voting" in the list's "…" menu (as on Android) opens QuickVotingSheet, sized to its content: how many of the shown usernames will be approved and how many are skipped, and "One vote left" once for the whole run. QuickVotePlan plans every name with the same gates as a single vote, in the same order (ADR-0035, Deviation): a name is skipped when it has closed or ended, its voting end or the order of its requests cannot be told (no date, or a tie to the millisecond), any masternode of this wallet blocked it, or no ticked masternode has a vote left; an existing block or approve is never replaced.
  • The run (castRun, ADR-0037): one PIN prompt, then name by name and masternode by masternode, recording each landed vote before the next; progress toast and VoiceOver announcement once the PIN is passed. A run with failures opens a result sheet listing the usernames not voted for, with "Try again" for those only; every vote failing is an error toast. Leaving the screen or sending the app to the background stops the run; a stopped run or Try again asks for no PIN and sends nothing.
  • 16 new strings, English in every locale; counted phrases worded without plurals. Two stage 4 toast texts are shortened so they fit the bar ("Already voted this way on %@").
  • Every toast of the list (vote, error, Quick voting progress) sits over the list just above the "Filtered by" bar and wraps, so an error reason is never cut; success toasts have no close button and hide after 3 s, as in the design, error toasts keep it.
  • With no masternode and no imported key, the key flow opens on "Enter voting key".
  • ADR-0037 added to the decision log as Proposed; the feature summary grows with stage 5b.

Security Lead: please review the Quick voting run (spec §6.1 — one confirmation for many votes): QuickVotePlan, MasternodeVoteCaster.castRun, VotingStore run / Try again.

How Has This Been Tested?

  • DashWalletTests (scheme dashwallet-dashpay, Debug, iPhone 17 simulator, iOS 26.5) on the tip (2026-11-11, after the live-run fixes): 2058 tests, 0 failures, 1 skipped. New tests: QuickVotePlanTests (every skip, mutation-checked), QuickVotingViewModelTests, the store's run / Try again / link-queue cases, VotingFilterTests for links, the caster's run in MasternodeVoteCasterTests, and the request-date cases in VotingStoreTests (AC-22; the decoder itself is covered by platform#5718).
  • Live run on testnet (2026-11-11, a masternode and an evonode voting key, six contested names from nine requester wallets): request dates and "Link included" on a 3-request name; a vote and a block that replaced an approve made from another device; Quick voting approved the earliest request of the 3-request name and skipped two names (sheet: 4 voted, 2 skipped). Quick voting only knows the votes this device recorded (AC-19); a vote made only on another device is not known here (feat(voting): read this wallet's masternode votes from Platform, not only the device's history #1377). The UI differences it found against the design are fixed in this PR.
  • scripts/a11y_audit.py --check: no new findings; test-target membership check: ok.
  • After the rebase onto develop cb5ab12ee and the latest review fixes (2026-11-13): DashWalletTests on every stage branch — feat(voting): restyle the username voting list #1326 2231 (1 failure in CoinbaseTransferAmountTests, from develop, passes alone), feat(voting): filter and sort the username voting list #1327 2239, feat(voting): expand duplicates in place, open Request details from a row, keep contests until voting ends #1328 2379, feat(voting): vote from the pills, with the vote-limit and block confirmations and Add your voting keys #1347 2519, this PR 2632 tests, 1 skipped each, no other failures (iPhone 17 simulator, iOS 26.5); Release build (simulator) of every stage succeeded.
  • Not checked on a device after the review fixes: a wallet with no voting node waits for the wallet sync before the key flow opens on "Enter voting key"; back from "Enter voting key" returns to the key list once it was shown; the list scrolls clear of a toast; the per-masternode result report scrolls. Unit tests cover the logic of each.
  • Maestro flows: the three no-keys flows (username_voting_pill_before_setup, voting_key_validation, username_voting_manage_voting_keys) still expect "Add your voting keys" and the old field label, and the request date/time row, the "Quick voting" menu entry and the toasts over the list have no flows yet. They follow in a separate change.

Screenshots

To add with the live run: a request with its date and "Link included", Request details with the voting period, "Only requests with links" (loading and can't-filter), the Quick voting sheet, the progress toast, and the result sheet.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • ADR (ADR-0001): ADR-0037 added
  • Nothing in this PR holds customer data, unfixed vulnerability detail, secrets, or step-by-step attack detail against keys, PIN or encryption (ADR-0001, rule 2)

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 126 files, which is 26 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8d430290-3741-44bf-93b9-3b18ad75920f
Commits

Reviewing files that changed from the base of the PR and between 9dbff43 and b27c934.

Files selected for processing: 126

  • DashWallet.xcodeproj/project.pbxproj
  • DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/IdentityVerifyService.swift
  • DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift
  • DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoterRegistry.swift
  • DashWallet/Sources/UI/DashPay/Voting/Details/RequestDetailsScreen.swift
  • DashWallet/Sources/UI/DashPay/Voting/Details/RequestDetailsViewModel.swift
  • DashWallet/Sources/UI/DashPay/Voting/Keys/VotingKeyInputScreen.swift
  • DashWallet/Sources/UI/DashPay/Voting/Keys/VotingKeysScreen.swift
  • DashWallet/Sources/UI/DashPay/Voting/Keys/VotingKeysViewModel.swift
  • DashWallet/Sources/UI/DashPay/Voting/List/VotingListViewModel.swift
  • DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift
  • DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotingFlow.swift
  • DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotingSheet.swift
  • DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotingViewModel.swift
  • DashWallet/Sources/UI/DashPay/Voting/Store/VoteErrorMessage.swift
  • DashWallet/Sources/UI/DashPay/Voting/Store/VoteLimit.swift
  • DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift
  • DashWallet/Sources/UI/DashPay/Voting/UsernameVotingScreen.swift
  • DashWallet/Sources/UI/DashPay/Voting/VoteAttempt/VoteAttemptDialogs.swift
  • DashWallet/Sources/UI/DashPay/Voting/VoteAttempt/VoteResultSheet.swift
  • DashWallet/Sources/UI/DashPay/Voting/VotingContestCard.swift
  • DashWallet/Sources/UI/DashPay/Voting/VotingFilter.swift
  • DashWallet/Sources/UI/DashPay/Voting/VotingFiltersSheet.swift
  • DashWallet/Sources/UI/DashPay/Voting/VotingViewModel.swift
  • DashWallet/Sources/UI/Menu/Main/MainMenuViewController.swift
  • DashWallet/ar.lproj/Localizable.strings
  • DashWallet/ar.lproj/Localizable.stringsdict
  • DashWallet/bg.lproj/Localizable.strings
  • DashWallet/bg.lproj/Localizable.stringsdict
  • DashWallet/ca.lproj/Localizable.strings
  • DashWallet/ca.lproj/Localizable.stringsdict
  • DashWallet/cs.lproj/Localizable.strings
  • DashWallet/cs.lproj/Localizable.stringsdict
  • DashWallet/da.lproj/Localizable.strings
  • DashWallet/da.lproj/Localizable.stringsdict
  • DashWallet/de.lproj/Localizable.strings
  • DashWallet/de.lproj/Localizable.stringsdict
  • DashWallet/el.lproj/Localizable.strings
  • DashWallet/el.lproj/Localizable.stringsdict
  • DashWallet/en.lproj/Localizable.strings
  • DashWallet/en.lproj/Localizable.stringsdict
  • DashWallet/eo.lproj/Localizable.strings
  • DashWallet/eo.lproj/Localizable.stringsdict
  • DashWallet/es.lproj/Localizable.strings
  • DashWallet/es.lproj/Localizable.stringsdict
  • DashWallet/et.lproj/Localizable.strings
  • DashWallet/et.lproj/Localizable.stringsdict
  • DashWallet/fa.lproj/Localizable.strings
  • DashWallet/fa.lproj/Localizable.stringsdict
  • DashWallet/fi.lproj/Localizable.strings
  • DashWallet/fi.lproj/Localizable.stringsdict
  • DashWallet/fil.lproj/Localizable.strings
  • DashWallet/fil.lproj/Localizable.stringsdict
  • DashWallet/fr.lproj/Localizable.strings
  • DashWallet/fr.lproj/Localizable.stringsdict
  • DashWallet/hr.lproj/Localizable.strings
  • DashWallet/hr.lproj/Localizable.stringsdict
  • DashWallet/hu.lproj/Localizable.strings
  • DashWallet/hu.lproj/Localizable.stringsdict
  • DashWallet/id.lproj/Localizable.strings
  • DashWallet/id.lproj/Localizable.stringsdict
  • DashWallet/it.lproj/Localizable.strings
  • DashWallet/it.lproj/Localizable.stringsdict
  • DashWallet/ja.lproj/Localizable.strings
  • DashWallet/ja.lproj/Localizable.stringsdict
  • DashWallet/ko.lproj/Localizable.strings
  • DashWallet/ko.lproj/Localizable.stringsdict
  • DashWallet/mk.lproj/Localizable.strings
  • DashWallet/mk.lproj/Localizable.stringsdict
  • DashWallet/ms.lproj/Localizable.strings
  • DashWallet/ms.lproj/Localizable.stringsdict
  • DashWallet/nb.lproj/Localizable.strings
  • DashWallet/nb.lproj/Localizable.stringsdict
  • DashWallet/nl.lproj/Localizable.strings
  • DashWallet/nl.lproj/Localizable.stringsdict
  • DashWallet/pl.lproj/Localizable.strings
  • DashWallet/pl.lproj/Localizable.stringsdict
  • DashWallet/pt.lproj/Localizable.strings
  • DashWallet/pt.lproj/Localizable.stringsdict
  • DashWallet/ro.lproj/Localizable.strings
  • DashWallet/ro.lproj/Localizable.stringsdict
  • DashWallet/ru.lproj/Localizable.strings
  • DashWallet/ru.lproj/Localizable.stringsdict
  • DashWallet/sk.lproj/Localizable.strings
  • DashWallet/sk.lproj/Localizable.stringsdict
  • DashWallet/sl.lproj/Localizable.strings
  • DashWallet/sl.lproj/Localizable.stringsdict
  • DashWallet/sl_SI.lproj/Localizable.strings
  • DashWallet/sl_SI.lproj/Localizable.stringsdict
  • DashWallet/sq.lproj/Localizable.strings
  • DashWallet/sq.lproj/Localizable.stringsdict
  • DashWallet/sr.lproj/Localizable.strings
  • DashWallet/sr.lproj/Localizable.stringsdict
  • DashWallet/sv.lproj/Localizable.strings
  • DashWallet/sv.lproj/Localizable.stringsdict
  • DashWallet/th.lproj/Localizable.strings
  • DashWallet/th.lproj/Localizable.stringsdict
  • DashWallet/tr.lproj/Localizable.strings
  • DashWallet/tr.lproj/Localizable.stringsdict
  • DashWallet/uk.lproj/Localizable.strings
  • DashWallet/uk.lproj/Localizable.stringsdict
  • DashWallet/vi.lproj/Localizable.strings
  • DashWallet/vi.lproj/Localizable.stringsdict
  • DashWallet/zh-Hans.lproj/Localizable.strings
  • DashWallet/zh-Hans.lproj/Localizable.stringsdict
  • DashWallet/zh-Hant-TW.lproj/Localizable.strings
  • DashWallet/zh-Hant-TW.lproj/Localizable.stringsdict
  • DashWallet/zh.lproj/Localizable.strings
  • DashWallet/zh.lproj/Localizable.stringsdict
  • DashWallet/zh_TW.lproj/Localizable.strings
  • DashWallet/zh_TW.lproj/Localizable.stringsdict
  • DashWalletTests/MasternodeVoteCasterTests.swift
  • DashWalletTests/QuickVotePlanTests.swift
  • DashWalletTests/QuickVotingViewModelTests.swift
  • DashWalletTests/RequestDetailsViewModelTests.swift
  • DashWalletTests/VoteAttemptTests.swift
  • DashWalletTests/VotingFilterTests.swift
  • DashWalletTests/VotingKeysViewModelTests.swift
  • DashWalletTests/VotingListSectionTests.swift
  • DashWalletTests/VotingListViewModelTests.swift
  • DashWalletTests/VotingStoreTests.swift
  • docs/adr/0035-run-every-vote-through-a-pure-vote-attempt-state-machine.md
  • docs/adr/0037-cast-quick-voting-sequentially-under-one-authentication.md
  • docs/adr/README.md
  • docs/features/username-voting/README.md
  • scripts/a11y_baseline.json

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

Pre-merge checks: Passed 1 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Passed Passed checks: 1 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
  • 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

@romchornyi
romchornyi added this pull request to stack #1329 November 11, 2026 10:27
@thepastaclaw

thepastaclaw commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ Final review complete — no blockers (commit b27c934) · triage: critical

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Final validation — Phase 1 + Phase 2

Verified the findings against head 8aa78bd, its base diff, and the pinned SwiftDashSDK source. Five blocking issues remain in build correctness and Quick voting execution/planning, plus two non-blocking documentation and error-reporting issues; the link-filter targeting and multi-row history claims were not substantiated. Exact-head CI fails while compiling VotingContestCard.swift before tests execute; no local builds or tests were run in this static review.

🔴 5 blocking | 🟡 1 suggestion(s) | 💬 1 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The intricate batch-voting flow changes authorization for signed vote broadcasts in MasternodeVoteCaster.castRun and castAuthenticated, extending one authentication across multiple names and voting keys with cancellation and retry handling.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • 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 — security-auditor (completed, effort xhigh); agent phase2-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 `DashWallet/Sources/UI/DashPay/Voting/VotingContestCard.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/VotingContestCard.swift:282-286: Break up the preview expression that fails the Debug build
  The exact-head “DashWalletTests on simulator” check fails during Build for testing in run 43003653458. Its log reports VotingContestCard.swift:284:47: “the compiler is unable to type-check this expression in reasonable time,” pointing into this map closure after the new conditional createdAt calculation was added. This code is compiled under DEBUG even when previews are not being displayed, so the failure prevents the test suite from running. Give the closure explicit input/result types and split the tally and date calculations into typed local values, then validate the same Debug configuration in CI.

In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift`:
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:283-286: Use an off-main SDK broadcast path for the bulk run
  Each iteration eventually reaches the production send closure at lines 172–181. In pinned platform commit 1721ca7a8bc962c5c1e1559f65ff433454f57619, castContestedResourceVote is declared inside the @MainActor SDK extension in PlatformQueryExtensions.swift and calls dash_sdk_contested_resource_cast_vote directly without suspending. The Rust implementation synchronously calls runtime.block_on(voter.put_vote(...)). Each broadcast therefore blocks the UI thread, freezing progress and preventing navigation/background cancellation from being handled during that network call, repeatedly across a potentially hundreds-of-votes run. The off-main preflight reads do not solve this. Add a lifetime-safe off-main broadcast API in the owning dashpay/platform SwiftDashSDK implementation and await it here while preserving sequential sends; detaching an app task around the existing actor-isolated method would still hop back to the main actor.
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:309-315: Check cancellation after the history read and before sending
  This guard checks cancellation before calling the shared castAuthenticated(choice:...) implementation, but that implementation then awaits history.votes at line 338 and proceeds to key derivation and send without checking again. The production history DAO is an actor, and cancelling the caller does not automatically abort its non-throwing read. If the owner leaves or backgrounds the screen while that await is suspended, the read can return and a new vote can still be signed and broadcast. That is not the documented allowance for completing an already-submitted broadcast: no broadcast had started when cancellation occurred. Check cancellation at the final pre-send boundary, report an unsent node as stopped, and continue recording broadcasts that were already submitted. Add a regression test that suspends the history read, cancels the run, then releases the read and asserts that send was not called.
- [NITPICK] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:249-251: Update stale feature-local ADR numbers
  This comment cites ADR-0004, but the published Quick voting execution decision is ADR-0037. The same stale execution reference appears in VotingStore, VotingViewModel, and UsernameVotingScreen, and QuickVotePlan cites ADR-0003 instead of ADR-0035. Update these references to the central log numbers so readers can find the decisions and reference searches remain accurate.

In `DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:772-780: Require complete wallet-node ownership for the block check
  QuickVotePlan treats walletNodes as every wallet masternode when checking whether any of them blocked the name, but this passes only votableNodeIDs even when nodeListMayBeIncomplete is true. MasternodeVoterRegistry sets that flag when the provider voting pool is unavailable and active wallet registrations could not all be resolved. A missing wallet node A can therefore have a recorded block while resolved node B has votes left: the planner checks only B and approves the name despite A's block. Neither the Quick voting entry button nor retry planning guards this state. Supply a complete owned-node set independently of currently resolved signing keys, or pause initial planning and retry while completeness is unknown. The existing my-votes filter already treats this flag as unknown rather than treating the resolved subset as exhaustive.
- [SUGGESTION] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:976-985: Keep unknown request dates distinct from ended voting on retry
  retryReason maps unknownVotingEnd and undatedRequest to “Voting has ended,” along with genuinely ended voting. A request that was dated in the original run can lose its date on a later best-effort Platform read while the contest remains open; retry then tells the owner that voting ended instead of explaining that the required date could not be read. Return distinct localized reasons for an unknown voting end and an unknown request order, reserving “Voting has ended” for votingEnded. Add a retry case where a failed request's refreshed createdAt is nil.

In `DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:148-155: Require a complete contender read before choosing the first request
  The planner verifies dates only for the supplied contenders, but an unfiltered store contest can already contain a silently truncated read. In the pinned SDK, active-contest loading uses the paginated get_contested_dpns_vote_state(..., None), while ContestedNamesService.voteState calls dpnsContestVoteStateOffMain with its default limit of 100. That latter route calls the generic vote-state FFI, which performs one fetch_many with no continuation. After a single vote, VotingStore.performRefreshContest replaces the complete contender array with that response. For a contest with more than 100 requests, the earliest requester can disappear outside the identity-ordered page and Quick voting can approve a later requester as first; the new request-details period can also acquire an incorrect start. Expose/use the paginated single-contest read through dashpay/platform SwiftDashSDK, or propagate incomplete-read state and disable ordering-dependent decisions until the read is complete. Add coverage for planning after a capped contest refresh.

Comment on lines +283 to +286
var reports: [VoteCastReport] = []
for (index, cast) in casts.enumerated() {
reports.append(await castAuthenticated(cast))
if authenticated { progress(index + 1) }

@thepastaclaw thepastaclaw Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚖️ Disputed (left to the maintainers; not blocking) at 0aa57410; see the replies below.

🔴 Blocking: Use an off-main SDK broadcast path for the bulk run

Each iteration eventually reaches the production send closure at lines 172–181. In pinned platform commit 1721ca7a8bc962c5c1e1559f65ff433454f57619, castContestedResourceVote is declared inside the @mainactor SDK extension in PlatformQueryExtensions.swift and calls dash_sdk_contested_resource_cast_vote directly without suspending. The Rust implementation synchronously calls runtime.block_on(voter.put_vote(...)). Each broadcast therefore blocks the UI thread, freezing progress and preventing navigation/background cancellation from being handled during that network call, repeatedly across a potentially hundreds-of-votes run. The off-main preflight reads do not solve this. Add a lifetime-safe off-main broadcast API in the owning dashpay/platform SwiftDashSDK implementation and await it here while preserving sequential sends; detaching an app task around the existing actor-isolated method would still hop back to the main actor.

source: gpt-6.1-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deferred: the pinned SwiftDashSDK has no off-main cast (the single vote has the same path on develop), tracked in dashpay/platform#5875; the caster switches once it lands.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still applies (re-reviewed at 8b7ba3a8): Your platform#5875 tracks the appropriate SDK fix, and I confirmed that the current pin still performs the synchronous network broadcast on the main actor. Although a single vote uses the same path, the new bulk loop repeats that blocking operation across the run and depends on responsive progress and cancellation, so the linked follow-up alone does not make the new workflow ready.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deferred: the pinned SwiftDashSDK has no off-main cast API, and the single vote takes the same path; tracked in dashpay/platform#5875.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still applies (re-reviewed at 1fb48768): I also checked the current pin dabbec09c90354fa42b508f7ff97b4bdecf3a816 rather than relying on the older dependency evidence: it still runs the broadcast synchronously on the main actor. The previously answered disagreement remains unresolved; dashpay/platform#5875 tracks the fix, but this head still repeats that blocking call throughout the bulk run.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Still deferred: the pinned SDK casts only on the main actor, and the app cannot move it without the SDK change tracked in dashpay/platform#5875.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Disputed (re-reviewed at 0aa57410): We still disagree on this one, and my answer is above, so I'm leaving the call to the maintainers. It no longer blocks this pull request, and I won't raise it again unless a later change brings the problem back.

@romchornyi
romchornyi marked this pull request as ready for review November 11, 2026 13:16

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

The latest commits refine request-date styling, key-entry presentation, and list toasts without changing bulk-vote planning or execution. Verification confirms an additional issue: Quick voting can replace choices made on another installation because its no-replacement gate reads only local history. This was a static review of the exact head; current checks show no build/test result, and the claimed Debug preview failure could not be substantiated.

🔴 5 blocking | 🟡 1 suggestion(s) | 💬 1 nitpick(s)

Still open from earlier rounds (6)

  • 🔴 Blocking: Require a complete contender read before choosing the first request — DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:148-155 (thread)
  • 🔴 Blocking: Require complete wallet-node ownership for the block check — DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:774-778 (thread)
  • 🔴 Blocking: Check cancellation after the history read and before sending — DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:309-315 (thread)
  • 🔴 Blocking: Use an off-main SDK broadcast path for the bulk run — DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:283-286 (thread)
  • 🟡 Suggestion: Keep unknown request dates distinct from ended voting on retry — DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:976-983 (thread)
  • 💬 Nitpick: Update stale feature-local ADR numbers — DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:249-251 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The intricate Quick voting flow changes authorization for multiple signed voting operations in MasternodeVoteCaster.castRun and castAuthenticated, extending one authentication across sequential key-backed broadcasts, cancellation, and retries.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Code unchanged since the last final review (8aa78bd8): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed
  • 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 — security-auditor (completed, effort xhigh); agent phase2-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 `DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:133-136: Read Platform's existing choices before bulk approval
  The no-replacement gate uses only this installation's SQLite history. VotingViewModel.reloadVoteHistory calls store.loadAllVoteHistory, which reads VoteHistoryDAO; importing a voting key does not reconcile its Platform choices. A key previously used elsewhere therefore receives a known-empty VoteLimit, allowing Quick voting to replace an existing approve or block with its automatically selected approval. Platform permits vote changes, so broadcast validation does not enforce this bulk-only rule. The documented local-history limitation does not make automatic replacement safe. The pinned SDK exposes identity votes with resource_vote_choice and vote_count: add the required typed, paginated, off-main read in SwiftDashSDK and fail closed when authoritative choices cannot be established.

  _Raised on code unchanged since the last review, and confirmed by an independent pass: Import an active masternode voting key that has already blocked an open contest or approved its later request on another device, with casts still available and no history on this installation. With dated requests and a known future voting end, confirming Quick voting sends approval for the earliest request and replaces that existing Platform choice instead of skipping it._
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:148-155: Require a complete contender read before choosing the first request
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926169)

In `DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:774-778: Require complete wallet-node ownership for the block check
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926160)
- [SUGGESTION] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:976-983: Keep unknown request dates distinct from ended voting on retry
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926179)

In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift`:
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:309-315: Check cancellation after the history read and before sending
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926152)
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:283-286: Use an off-main SDK broadcast path for the bulk run
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926136)
- [NITPICK] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:249-251: Update stale feature-local ADR numbers
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926187)

Comment on lines +133 to +136
let senders = tickedNodes.filter { node in
guard (history.votesLeft(node) ?? 0) > 0 else { return false }
if case .towards = history.liveChoice(of: node) { return false }
return true

@thepastaclaw thepastaclaw Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚖️ Disputed (left to the maintainers; not blocking) at 0aa57410; see the replies below.

🔴 Blocking: Read Platform's existing choices before bulk approval

The no-replacement gate uses only this installation's SQLite history. VotingViewModel.reloadVoteHistory calls store.loadAllVoteHistory, which reads VoteHistoryDAO; importing a voting key does not reconcile its Platform choices. A key previously used elsewhere therefore receives a known-empty VoteLimit, allowing Quick voting to replace an existing approve or block with its automatically selected approval. Platform permits vote changes, so broadcast validation does not enforce this bulk-only rule. The documented local-history limitation does not make automatic replacement safe. The pinned SDK exposes identity votes with resource_vote_choice and vote_count: add the required typed, paginated, off-main read in SwiftDashSDK and fail closed when authoritative choices cannot be established.

Raised on code unchanged since the last review, and confirmed by an independent pass: Import an active masternode voting key that has already blocked an open contest or approved its later request on another device, with casts still available and no history on this installation. With dated requests and a known future voting end, confirming Quick voting sends approval for the earliest request and replaces that existing Platform choice instead of skipping it.

source: gpt-6.1-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not changing this in this stack: the vote history stays local by design (spec non-goal, as on Android). Reading this wallet's votes from Platform is tracked in #1377.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still applies (re-reviewed at 8b7ba3a8): Your #1377 tracks the missing reconciliation, but the new planner still converts an empty device-local DAO result into permission to replace a choice held on Platform. Keeping remote history out of display scope does not make that automatic replacement safe; the new action must fail closed until its no-replacement precondition can be established.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not changing this: vote history is local to this device by design (spec non-goal, as on Android); reading Platform's existing choices before Quick voting is tracked in #1377.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still applies (re-reviewed at 1fb48768): Your local-history policy remains explicit, but loadAllVoteHistory still assigns known-empty history to imported keys without querying Platform. The previously answered disagreement remains unresolved on this head; #1377 is tracked, but the bulk no-replacement gate is unchanged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Keeping this for the maintainer's decision: Quick voting uses this device's history by design; reading Platform's existing choices first is tracked in #1377.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Disputed (re-reviewed at 0aa57410): We still disagree on this one, and my answer is above, so I'm leaving the call to the maintainers. It no longer blocks this pull request, and I won't raise it again unless a later change brings the problem back.

@romchornyi
romchornyi force-pushed the feat/voting-quick-voting branch from 2cf49ed to 282dd07 Compare November 11, 2026 20:00

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

Verified head 282dd07 against the stacked base and the exact pinned Platform sources: the ADR references are corrected, the required SDK APIs are present, and the link-queue task inherits main-actor isolation. Six carried findings remain, including five blockers. This was static-only; current workflow lint, test-target membership, and accessibility checks pass, while simulator tests remain pending.

🔴 5 blocking | 🟡 1 suggestion(s)

Still open from earlier rounds (6)

  • 🔴 Blocking: Read Platform's existing choices before bulk approval — DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:133-136 (thread)
  • 🔴 Blocking: Require a complete contender read before choosing the first request — DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:148-155 (thread)
  • 🔴 Blocking: Require complete wallet-node ownership for the block check — DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:816-824 (thread)
  • 🔴 Blocking: Check cancellation after the history read and before sending — DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:345-353 (thread)
  • 🔴 Blocking: Use an off-main SDK broadcast path for the bulk run — DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:290-293 (thread)
  • 🟡 Suggestion: Keep unknown request dates distinct from ended voting on retry — DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:1023-1030 (thread)
Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The large, intricate diff changes MasternodeVoteCaster.castRun and VotingStore quick-voting execution, a funds-adjacent signing and vote-authorization path involving authentication, key handling, sequential network submissions, and concurrency/state-stop behavior.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • 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 — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-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 `DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:133-136: Read Platform's existing choices before bulk approval
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4540273164)
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:148-155: Require a complete contender read before choosing the first request
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926169)

In `DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:816-824: Require complete wallet-node ownership for the block check
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926160)
- [SUGGESTION] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:1023-1030: Keep unknown request dates distinct from ended voting on retry
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926179)

In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift`:
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:345-353: Check cancellation after the history read and before sending
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926152)
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:290-293: Use an off-main SDK broadcast path for the bulk run
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926136)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 (queue backlog)

The exact-head review confirms the cancellation and unknown-date retry fixes, but the new node-completeness guards cover only part of the ownership problem. Four blocking findings remain after independently checking the complete production diff, relevant tests, and pinned SwiftDashSDK source; linked follow-ups do not remove defects exposed by the new automatic voting flow. Validation was static only: simulator tests remain pending, while target-membership, accessibility, and workflow-lint checks passed.

🔴 4 blocking

Still open from earlier rounds (4)

  • 🔴 Blocking: Read Platform's existing choices before bulk approval — DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:123-136 (thread)
  • 🔴 Blocking: Require complete wallet-node ownership for the block check — DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:825-833 (thread)
  • 🔴 Blocking: Require a complete contender read before choosing the first request — DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:148-155 (thread)
  • 🔴 Blocking: Use an off-main SDK broadcast path for the bulk run — DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:291-293 (thread)
Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a large, cross-cutting voting UI and workflow change, but it does not modify funds movement, consensus, cryptography, key handling, network deserialization, or storage migrations.
  • Phase 1 reviewers: not run (skipped for throughput: 13 PRs queued, above the 10 limit)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-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 `DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:123-136: Read Platform's existing choices before bulk approval
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4540273164)
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:148-155: Require a complete contender read before choosing the first request
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926169)

In `DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:825-833: Require complete wallet-node ownership for the block check
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926160)

In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift`:
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:291-293: Use an off-main SDK broadcast path for the bulk run
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926136)

@romchornyi
romchornyi force-pushed the feat/voting-quick-voting branch from 8b7ba3a to 973821c Compare November 11, 2026 23:57

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

Quick voting still has three correctness/performance blockers: it can make replacement decisions from local-only history, choose a first request from a silently capped contender set, and run every bulk broadcast through the main-actor SDK path. Exact-head CI also fails while compiling the DEBUG card preview because the inferred contender-map expression exceeds the Swift type-checker budget.

🔴 4 blocking

Still open from earlier rounds (3)

  • 🔴 Blocking: Read Platform's existing choices before bulk approval — DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:133-136 (thread)
  • 🔴 Blocking: Require a complete contender read before choosing the first request — DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:148-155 (thread)
  • 🔴 Blocking: Use an off-main SDK broadcast path for the bulk run — DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:290-293 (thread)
Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The large, intricate diff changes the Quick voting execution path in MasternodeVoteCaster.castRun and VotingStore, which moves vote-bearing keys and signs/broadcasts peer-facing governance votes, meeting the critical key-handling and funds-adjacent security surface bar.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • 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 — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-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 `DashWallet/Sources/UI/DashPay/Voting/VotingContestCard.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/VotingContestCard.swift:298-302: Break up the preview expression that fails the Debug build
  Fresh exact-head CI run 43123690017 fails during Build for testing with `VotingContestCard.swift:300:47: the compiler is unable to type-check this expression in reasonable time`. The DEBUG-only preview helper chains two inferred `map` closures and performs string interpolation, `UInt32` arithmetic, `Double` date arithmetic, and a conditional inside the `DPNSContender` initializer. Because this code is compiled under DEBUG even when previews are not displayed, the failure prevents the host app and test target from building. Split the expression into explicitly typed closure parameters and local values, then validate the required Debug configuration.

In `DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:133-136: Read Platform's existing choices before bulk approval
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4540273164)
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:148-155: Require a complete contender read before choosing the first request
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926169)

In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift`:
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:290-293: Use an off-main SDK broadcast path for the bulk run
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926136)

@romchornyi
romchornyi force-pushed the feat/voting-quick-voting branch from 973821c to 0d52228 Compare November 12, 2026 10:20
@romchornyi
romchornyi force-pushed the feat/voting-quick-voting branch from 0d52228 to 1fb4876 Compare November 12, 2026 10:59

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-review — Preliminary review — Phase 1 blocker gate

Verified head 1fb4876: the preview expression, cancellation boundary, node-completeness gates, capped-contender handling, retry messages, and ADR references address six prior findings. Two previously disputed blockers remain. Current checks show PR-title validation and CodeRabbit passing with the review pending; no exact-head build or test check is reported, and no local builds or tests were run in this static lane.

Validated blockers were found by the Phase-1 review and confirmed by a fresh verifier. Phase 2 is deferred until a fresh same-head revalidation clears the blocker gate.

🔴 2 blocking

Still open from earlier rounds (2)

  • 🔴 Blocking: Read Platform's existing choices before bulk approval — DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:133-146 (thread)
  • 🔴 Blocking: Use an off-main SDK broadcast path for the bulk run — DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:179-189 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-gate-verifier, role: verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The change is intricate and cross-cutting, but MasternodeVoteCaster.castRun orchestrates authentication and existing vote signing/broadcast paths rather than changing cryptography, signatures, key handling, consensus rules or funds movement.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.1-sol — verifier; agent sol-gate-verifier
  • Phase 2 reviewers: not run (deferred by blocker gate)
🤖 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 `DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:133-146: Read Platform's existing choices before bulk approval
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4540273164)

In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift`:
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:179-189: Use an off-main SDK broadcast path for the bulk run
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926136)

@romchornyi
romchornyi force-pushed the feat/voting-quick-voting branch from 1fb4876 to 0aa5741 Compare November 12, 2026 15:27

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

At 0aa5741, the preview expression, final pre-broadcast cancellation check, retry explanations, and ADR references are addressed. Two completeness fixes remain partial: retry planning can lose its complete-node precondition across an await, and Request details still derives a definite voting-period start from a capped read. This was static-only; current checks show successful title and CodeRabbit checks with the review pending, but no exact-head build or XCTest result.

🔴 1 blocking | 🟡 1 suggestion(s)

Still open from earlier rounds (1)

  • 🔴 Blocking: Require complete wallet-node ownership for the block check — DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:1071-1074 (thread)

Disputed — left to maintainers (2)

  • 🔴 Blocking: Read Platform's existing choices before bulk approval — DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotePlan.swift:133-136 (thread)
  • 🔴 Blocking: Use an off-main SDK broadcast path for the bulk run — DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:283-286 (thread)
Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The large, intricate diff changes funds-adjacent signing and sequential vote authorization behavior in MasternodeVoteCaster.castRun and the QuickVotePlan/VotingStore run, including authentication, key handling, and network-submitted signatures.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • 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 — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-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 `DashWallet/Sources/UI/DashPay/Voting/Details/RequestDetailsViewModel.swift`:
- [SUGGESTION] DashWallet/Sources/UI/DashPay/Voting/Details/RequestDetailsViewModel.swift:84: Require a complete contender read before choosing the first request
  Quick voting and Try again now correctly skip requestsMayBeCut, but the original finding's date-display consequence remains. performRefreshContest replaces the contender array with the single-contest response and marks a full 100-request page as potentially incomplete. This property ignores that marker and takes the minimum date of the replacement array. When the earliest requester is outside that page, Request details displays an incorrect later voting-period start after a vote. Return unknown for marked labels so the existing 'Not provided' presentation is used until a complete refresh arrives, and cover Request details after a capped refresh. The paginated SDK read remains tracked in dashpay/platform#5876.

In `DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:1071-1074: Require complete wallet-node ownership for the block check
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4537926160)

@romchornyi-pitcrew romchornyi-pitcrew left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 1 major (inline) · 8 non-blocking recommendations · no blockers — reviewed at 0aa5741052

Level Verdict
1 · Idea ✅ valid Request dates, the links filter and Quick voting are what spec AC-07b, AC-18–AC-20 and AC-22 ask for; AC-18 itself says the links filter makes Quick voting approve the earliest linked request
2 · Architecture ✅ right layer A pure QuickVotePlan (its deviation from VoteAttempt recorded in ADR-0035) plus a sequential run in the caster (ADR-0037). The main-actor broadcast is the SDK's to fix (dashpay/platform#5875)
3 · Completeness 🟡 untracked gaps Follow-ups #1377, platform#5875 and platform#5876 are tracked. The Maestro flows and the screenshots are not (below)
4 · Code 🟡 1 major The wallet-wide block check still misses some of this wallet's masternodes. This is the open thread r4537926160, with a second path to it

Major (inline)

Untracked gaps (level 3)

  • Maestro flows. The description says username_voting_pill_before_setup, voting_key_validation and username_voting_manage_voting_keys still expect "Add your voting keys" and the old field label, so they break once this lands. Request dates, "Link included", the links filter, the "Quick voting" menu entry and the toasts over the list have no flows. Please file an issue or a backlog row before the merge.
  • Screenshots. The Screenshots section is still "to add". This PR changes six screens or states.
8 non-blocking recommendations
  1. The bulk run blocks the main thread (disputed thread r4537926136) — MasternodeVoteCaster.swift:390 — Confirmed at the pin dabbec09: castContestedResourceVote sits in the @MainActor SDK extension and calls the FFI synchronously. This is a tracked SDK limitation, and a single vote has it too, so it is not a blocker here. But ADR-0037 "Consequences" should say what it means for a run: the progress toast, Back and the background stop respond only between broadcasts, and a run of many votes freezes the screen for each one.
  2. Choices made on another device (disputed thread r4540273164) — QuickVotePlan.swift:133 — This is the maintainers' call (#1377). If the stack ships as it is, please narrow AC-19 to "an existing block or approve known on this device", so the spec does not promise what local history cannot see. A key imported from another device starts with an empty history here.
  3. Voting period start from a cut read — RequestDetailsViewModel.swift:84 — This is still valid (pastaclaw's open suggestion). votingPeriodStart ignores requestsMayBeCut, so after a vote on a name with 100+ requests, Request details can show a later start than the real one.
  4. hasNoVotesLeft matches a localized string — MasternodeVoteCaster.swift:84 — Whether "Try again" is offered depends on the failure text being equal to NSLocalizedString("No votes left"). A typed failure kind on VoteOutcome would survive a copy change.
  5. A run that does not start is silent — VotingStore.swift:915 — When runQuickVoting returns nil (another vote in flight, or the node list became incomplete after the sheet opened), the sheet has already closed and nothing is shown. This is rare, but a toast would explain it. (reachability not verified)
  6. Run-level log lines — MasternodeVoteCaster.swift:264 — Each cast is logged, but the run is not: nothing records its start (names and votes), a refused or cancelled prompt, or its end, which a QA report would need (.claude/rules/app-logging.md). A failed link lookup is also swallowed by try? at VotingStore.swift:712 with no DWLogger line, so "Can't filter by links right now" has nothing behind it in the log bundle.
  7. Exact-head CI — Only title validation, CodeRabbit and PastaClaw run on this stacked PR. DashWalletTests was last reported on 2026-11-11, before 0d52228 and 1fb4876. Please run it once on this tip before the stack merges.
  8. Live-run claim — The description says Quick voting "skipped … the one already approved elsewhere". The planner reads only this device's history (VoteHistoryDAO), so a vote made only on another device would not be skipped. Was that approve also recorded here? (question, not verified)
Review details

Layered review (idea → architecture → completeness → code) of git diff feat/voting-vote-from-pills…0aa5741052 only. The PR is stacked on #1347, whose diff was not reviewed here. Tier: critical, because it adds bulk signing under one authentication. The lanes were done inline: security (auth, key lifetime, logs), funds-adjacent vote safety (vote limit, no replacement, cancellation before each broadcast), concurrency (main actor, cancellation, link-lookup queue and waiters) and UI (states, strings, a11y).

  • Security: keys are derived only after the prompt passes. A run cancelled before the prompt asks for no PIN and sends nothing. New log lines carry the username, the short pro_tx_hash and plain reasons, never keys or raw Platform text. Only http/https links are opened.
  • Strings: all 16 keys are in English in every locale, the counted ones through .stringsdict, and no existing format string changed its argument order.
  • Verification: every major-or-higher point was checked against the code at this head, and the SDK claim against the platform pin. No build was run.
  • Earlier threads: five are resolved (preview expression, final cancellation check, retry reasons, ADR numbers, capped first request), two are disputed, and one is open (the major above).

🤖 Reviewed with Claude Code

return QuickVotePlan(
contests: shown,
tickedNodes: tickedNodeIDs ?? [],
walletNodes: votableNodeIDs,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major — the wallet-wide block check misses this wallet's inactive or key-less masternodes (extends thread r4537926160)

walletNodes is votableNodeIDs: only active wallet registrations whose voting key resolves, plus imported nodes with an attached key (registry L136, L199). A masternode of this wallet that blocked a name and has since dropped out of that set leaves its block in this device's history, but QuickVotePlan no longer looks at it (L133). Two examples: it was PoSe-banned, or its imported key was removed. The run then approves the name from another ticked node, against AC-19 ("a name that any masternode of this wallet blocked — ticked or not — gets no vote"). nodeListMayBeIncomplete is false in both cases, so the guards from 8b7ba3a do not stop it. Try again has the same input at L1082.

Suggested fix: build the block check's set from every masternode of this wallet (all registrations, whatever their status, plus tracked nodes), or from every node in this contest's local history on this network, not from the votable subset. Add a QuickVotePlanTests case: a block held by a node outside tickedNodes and outside the votable set.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e890365. The block check now reads every node in this name's vote history on this device, which holds only this wallet's votes because a wipe clears it. A banned node or a removed key still keeps the name out, for the run and for Try again. Test added.

@thepastaclaw

Copy link
Copy Markdown
Contributor

@romchornyi on it — I've queued this as job cj-20261113-215405-9e7b and will reply here or link a PR when there's something to look at.

@thepastaclaw

Copy link
Copy Markdown
Contributor

Thanks — reviewsys handles code review for PRs not opened by PastaClaw. It will answer on finding threads and re-review on push; drafts once the PR is marked ready.

@romchornyi
romchornyi marked this pull request as ready for review November 14, 2026 01:31
@romchornyi

Copy link
Copy Markdown
Contributor Author

Decision revised: this PR goes ahead with the current Quick voting guards and is ready for review again. The run-coordinator redesign stays tracked in #1417 and lands as a follow-up after this merges, not as a precondition.

@thepastaclaw please cancel job cj-20261113-215405-9e7b: nothing is needed from it, the earlier mention was only meant to resume the review.

@thepastaclaw

Copy link
Copy Markdown
Contributor

@romchornyi on it — I've queued this as job cj-20261114-013205-c76a and will reply here or link a PR when there's something to look at.

…he PIN prompt can show

Vote for all closed the Quick voting sheet and asked for the PIN in the same
turn. UIKit rejects a modal presented while a sheet is leaving, so on a Release
build the PIN prompt never showed and every run ended with "Authentication
failed". The run now starts from the sheet's (or "One vote left"'s) onDismiss,
as the single vote already does. Found in the live testnet check before the merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDD-Published-From: c96362c2cd5a719402f2b565efa62bc4da93ad42
romchornyi added a commit that referenced this pull request Nov 15, 2026
@romchornyi

Copy link
Copy Markdown
Contributor Author

Found in a live testnet check of the whole stack before the merge, fixed in 21fa52d: on a Release build, Vote for all never showed the PIN prompt and every run ended with "Authentication failed". The sheet was still closing when the run asked for the PIN, and UIKit rejected the PIN modal. The run now starts once the Quick voting sheet (or "One vote left") is gone, as the single vote already does. Checked live on testnet after the fix: PIN prompt, run done, tally updated. DashWalletTests 2659, 0 failures apart from the known CoinbaseTransferAmountTests flake (passes alone).

@romchornyi

Copy link
Copy Markdown
Contributor Author

@thepastaclaw review

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDD-Published-From: a40f76197e91f2340f39484092d510674a6b208e
@romchornyi

Copy link
Copy Markdown
Contributor Author

@thepastaclaw review

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

The exact-head CI snapshot shows the simulator tests, target-membership check, workflow lint, and accessibility audit passing; the separate PastaClaw review gate failure is not a code check. Quick voting still has three blocking correctness issues—lifecycle cancellation, history-load serialization, and loss of the planned deadline—and one retryability issue for deterministic already-present refusals.

Step back: this PR keeps drawing new blockers

This is review round 14, and the PR has drawn 16 blocking findings so far. The review of 202a05bb named these causes and the decision that would settle it; this round found 2 more finding(s) from the same place. Fixing them one at a time is not converging, so this review asks for that decision before another round.

1. Device-local history is still the vote authority (2 earlier finding(s))

QuickVotePlan and the retry paths take live choice, count, and blocking state from VoteHistoryDAO, which records only this installation and is not scoped to the active wallet. A vote made on another device, before a restore, or by another wallet can therefore change whether the same node appears eligible or blocked; another local-history guard cannot establish the current Platform state.

Already tracked: #1377

2. Vote outcomes have no settlement state (3 earlier finding(s))

VoteOutcome has special flags for no votes left and unconfirmed broadcasts, but retry and result construction still treat other SDK refusals as ordinary failures. There is no durable state distinguishing definitely unsent, definitely accepted, and possibly accepted transitions, so each new SDK result requires another exception in MasternodeVoteCaster and VotingStore.

Already tracked: #1417

3. Quick voting has no complete snapshot or validity boundary (9 earlier finding(s))

QuickVotePlan captures contests, requests, nodes, history, and deadlines at different times, while runQuickVoting later reconstructs QuickVoteCast from mutable VotingStore state and the caster performs further independent reads. Without one complete snapshot and an explicit validity boundary, truncated request pages, partial node resolution, disappearing nodes, and expired contests are handled by scattered guards that keep moving the failure point.

Already tracked: #1417

4. The run lifecycle and serialization are split across four owners (2 new in this round, 4 earlier finding(s))

QuickVotingViewModel owns modal state and pending plans, VotingViewModel owns the run task and cancellation, VotingStore owns busy state and history queues, and MasternodeVoteCaster owns authentication and final cancellation checks. These owners share no run identity or reservation, so a deferred dismissal can outlive the screen, openings can race, and a history reload can overlap a single vote; each await or modal boundary then needs another guard.

Already tracked: #1417

In this round: Cancel deferred Quick voting plans during lifecycle shutdown; Treat Quick voting history reload as a busy vote operation

Requested decision (redesign the component): Redesign Quick voting around the one run coordinator tracked in issue 1417 before landing this feature. The coordinator must own the complete plan snapshot and validity boundary, wallet-scoped Platform vote state, settlement or reconciliation state, authentication, cancellation, modal handoff, duplicate prevention, and SDK execution as one operation. Keep Quick voting out of this PR, or gate it, until that coordinator replaces the QuickVotingViewModel/VotingStore/MasternodeVoteCaster patchwork.

Automatic re-review is paused until then: later pushes keep this review's verdict and are not reviewed on their own. Comment @thepastaclaw review once the decision is made: that resumes automatic re-review, and reviews the current commit if it has not been reviewed.

🔴 3 blocking

Still open from earlier rounds (1)

  • 🔴 Blocking: Recheck contest deadlines before each Quick voting cast — DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:972-978 (thread)
Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Make already-present vote refusals non-retryable
DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:458-464

Consensus code 40304 is mapped to the message that the masternode already holds the requested vote, but the per-node catch converts it into an ordinary VoteOutcome. Its isRetryable flag therefore remains true, so VotingStore.retryRun and single-vote retry can submit the same deterministic request again and offer Try again repeatedly. Preserve an explicit terminal already-present outcome, or reconcile it as the desired state, and exclude it from retry candidates.

source: gpt-6.1-sol (phase2-reviewer: general, ffi-engineer, security-auditor)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); 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 change that alters the masternode vote-signing and key-handling paths in MasternodeVoteCaster and VotingStore while introducing sequential multi-vote execution.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Code unchanged since the last final review (202a05bb): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed; 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • 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 — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
Before fixing anything, read the review's "Step back" section. This PR keeps drawing new blocking findings from the same underlying causes, and patching the findings below one at a time is not converging. The review asks for this decision first (redesign the component): Redesign Quick voting around the one run coordinator tracked in issue 1417 before landing this feature. The coordinator must own the complete plan snapshot and validity boundary, wallet-scoped Platform vote state, settlement or reconciliation state, authentication, cancellation, modal handoff, duplicate prevention, and SDK execution as one operation. Keep Quick voting out of this PR, or gate it, until that coordinator replaces the QuickVotingViewModel/VotingStore/MasternodeVoteCaster patchwork. Raise that decision with the PR's author or maintainer instead of only patching; if it is theirs to make, stop and ask them.

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 `DashWallet/Sources/UI/DashPay/Voting/VotingViewModel.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/VotingViewModel.swift:197-201: Cancel deferred Quick voting plans during lifecycle shutdown
  `QuickVotingViewModel.run` clears the modal state and stores the plan in `planToRun` until `modalDidClose()` runs after the sheet dismissal animation. `VotingViewModel.stopQuickVoting()` only cancels `quickVotingRun`, which is still `nil` during that window. If the app backgrounds or the screen is torn down while the sheet is dismissing, the later `modalDidClose()` still calls `startQuickVoting`, presenting authentication and potentially sending votes after the user has left. Lifecycle cancellation must also clear the Quick voting view model's pending plan.

  _Raised on code unchanged since the last review, and confirmed by an independent pass: After Vote for all is tapped, QuickVotingViewModel.run clears the modal and stores the plan in planToRun while quickVotingRun is still nil. If the app backgrounds or the screen is popped during dismissal, stopQuickVoting does nothing; the later confirmDismissed/onDismiss calls modalDidClose, which starts authentication and can broadcast the planned votes after the user has left._

In `DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:463-465: Treat Quick voting history reload as a busy vote operation
  `QuickVotingViewModel.openSheetOrKeys()` calls `reloadVoteHistory()`, which reaches `loadAllVoteHistory()` without incrementing `voteReads`. During this await, `isVoteBusy` remains false and a pill tap can start a single vote concurrently with the Quick plan snapshot. The plan may then be based on history from before that vote, while the Quick caster only rechecks the cast count and can replace the newly recorded choice. Count the full history reload in the existing vote slot while it is queued and running.
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:972-978: Recheck contest deadlines before each Quick voting cast
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1366#discussion_r4565185387)

…s the vote slot while its history loads, keeps the planned deadline

- The app going to the background or the screen leaving also drops a run
  that waits for its sheet to be gone: no PIN prompt or vote follows.
- Quick voting's history reload holds the vote slot, so no single vote
  starts while the plan's history is read.
- Each planned name carries its voting end and the run passes it to the
  caster, instead of looking it up in a list a refresh may have dropped
  the name from.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDD-Published-From: 88db1dce028ad344f48a8e121167aa43a59e2491
@romchornyi

Copy link
Copy Markdown
Contributor Author

Round at 21ced7b: the two new blockers and the reopened deadline thread are fixed in 144b63c (answered on their threads). The follow-up candidate "Make already-present vote refusals non-retryable" (40304) is deferred to #1417 with the other settlement-state items. The "Step back" decision stands as given earlier: Quick voting merges with these guards, and the run coordinator follows in #1417.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

The exact head includes the latest fixes for Quick voting history serialization, deferred-run cancellation, and preservation of the planned voting deadline. Simulator tests, accessibility, and target-membership checks pass; one retry-state suggestion remains because Quick retry reconstruction drops the terminal closed-contest marker.

🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a large, intricate voting feature spanning UI, state management, asynchronous queues, authentication flow, and sequential vote casting, but it does not change funds movement, cryptography, consensus, key handling, peer-facing deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-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 `DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift`:
- [SUGGESTION] DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:1131-1135: Preserve terminal closed-contest state when merging Quick voting retries
  This reconstruction drops `VoteCastReport.contestClosed` from every report. A concrete sequence is: a Quick run sends one node successfully, the contest reaches its known end before another node, and the result records `contestClosed`; the user then taps Try again. `replan` returns a non-sending "Voting has ended" outcome for that label, but this merge replaces the original report with one whose `contestClosed` is false and whose plain `VoteOutcome` remains retryable. `QuickVoteRunReport.offersTryAgain` therefore continues to offer Try again, causing repeated no-op retries and PIN prompts for a contest the store already knows is closed. Preserve the existing closed flag through the merge and propagate `contestClosed` from any reports produced by the retry cast so closed names remain terminal and excluded from Try again.

Not approved: 2 blocking finding(s) are disputed and left to the maintainers.

Comment on lines +1131 to +1135
let merged = QuickVoteRunReport(reports: run.reports.map { report in
VoteCastReport(
normalizedLabel: report.normalizedLabel, choice: report.choice,
outcomes: report.outcomes.map { updated[report.normalizedLabel]?[$0.node.proTxHash] ?? $0 })
})

@thepastaclaw thepastaclaw Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Resolved at 8b52cf38; see the replies below.

🟡 Suggestion: Preserve terminal closed-contest state when merging Quick voting retries

This reconstruction drops VoteCastReport.contestClosed from every report. A concrete sequence is: a Quick run sends one node successfully, the contest reaches its known end before another node, and the result records contestClosed; the user then taps Try again. replan returns a non-sending "Voting has ended" outcome for that label, but this merge replaces the original report with one whose contestClosed is false and whose plain VoteOutcome remains retryable. QuickVoteRunReport.offersTryAgain therefore continues to offer Try again, causing repeated no-op retries and PIN prompts for a contest the store already knows is closed. Preserve the existing closed flag through the merge and propagate contestClosed from any reports produced by the retry cast so closed names remain terminal and excluded from Try again.

source: gpt-6.1-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 8b52cf3. The merged report keeps contestClosed from the first run, from the retry's own reports and from a replan that finds the voting ended, and VoteCastReport.offersTryAgain is false on a closed report; covered by testANameTheRunFoundClosedStaysClosedThroughTryAgain and testANameThatClosedBeforeTryAgainOffersNoFurtherTryAgain.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Resolved (re-reviewed at 8b52cf38): The merged Quick voting report now preserves closed state from the original run, replanning, and retry reports, and closed reports no longer offer Try again.

…n; take in the stage below

- The retry's merged report kept no contestClosed, so a closed name kept
  offering Try again. The flag now carries over from the first run, the
  retry's own reports and a replan that finds the voting ended; a report on
  a closed contest offers no Try again.
- Takes in the stage below (Try again holds the vote slot until its outcome).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SDD-Published-From: bbf25807ca43afd78168675333faeab929de4ed5

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

The exact head preserves closed-contest state through Quick voting retries, and the previously reviewed lifecycle, deadline, cancellation, node-resolution, and terminal-outcome fixes remain present. One in-scope retry issue remains: a 40304 already-present refusal is represented as an ordinary retryable failure, so Try again can rebroadcast the same vote indefinitely. The simulator test check is still in progress; target membership, accessibility, workflow lint, title validation, and CodeRabbit checks passed.

🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a large, cross-cutting voting UI and application-logic change, but it does not directly modify consensus, funds movement, cryptography, key handling, network deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-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 `DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift`:
- [SUGGESTION] DashWallet/Sources/Infrastructure/SwiftDashSDK/Voting/MasternodeVoteCaster.swift:458-464: Do not offer Try again for already-present vote refusals
  The 40304 `voteAlreadyPresent` refusal is converted only to display text by `VoteErrorMessage.plain(for:)`, then recorded as a plain `VoteOutcome`. Its `hasNoVotesLeft` and `mayHaveLanded` flags remain false, so `isRetryable` is true. Both Quick-run retry and single-vote retry select it again with `failed.filter(\.isRetryable)` and resend the same choice, which receives the same refusal and continues to offer Try again. Add a typed terminal outcome for 40304, or otherwise exclude it from retry candidates, so a vote already held by that masternode cannot be rebroadcast indefinitely.

Not approved: 2 blocking finding(s) are disputed and left to the maintainers.

Comment on lines +458 to +464
if VoteErrorMessage.isNoVotesLeft(error) {
outcomes.append(.noVotesLeft(node))
} else if VoteErrorMessage.isUnconfirmed(error) {
outcomes.append(.unconfirmed(node))
} else {
outcomes.append(VoteOutcome(node: node, failure: VoteErrorMessage.plain(for: error)))
}

@thepastaclaw thepastaclaw Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⏭️ Deferred (maintainer decision; not blocking) at 84fd09eb; see the replies below.

🟡 Suggestion: Do not offer Try again for already-present vote refusals

The 40304 voteAlreadyPresent refusal is converted only to display text by VoteErrorMessage.plain(for:), then recorded as a plain VoteOutcome. Its hasNoVotesLeft and mayHaveLanded flags remain false, so isRetryable is true. Both Quick-run retry and single-vote retry select it again with failed.filter(\.isRetryable) and resend the same choice, which receives the same refusal and continues to offer Try again. Add a typed terminal outcome for 40304, or otherwise exclude it from retry candidates, so a vote already held by that masternode cannot be rebroadcast indefinitely.

source: muse-spark-1.3-contributor (phase1-reviewer: general)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deferred, as in the earlier round: a typed terminal outcome for 40304 belongs to the vote-attempt model tracked in #1417.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deferred (re-reviewed at 84fd09eb): The 40304 refusal is still represented as a retryable plain outcome, but the tracked vote-attempt model in #1417 is the agreed owner for settlement-state typing rather than this caster patch.

SDD-Published-From: 6930b22c9aad4ab561a2e8b5b732c20f3615ad87
SDD-Published-From: 14ce34f4728b3eefeb29fc949c2c3a594d303972

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

The exact-head CI snapshot shows the simulator tests, target-membership, accessibility, and lint checks passing; the queued review job is not a code failure. The Quick voting implementation still has one blocking wallet/network authorization race, plus three non-blocking lifecycle, SDK-boundary, and preference-refresh issues introduced or exposed by this change.

Step back: this PR keeps drawing new blockers

This is review round 17, and the PR has drawn 17 blocking findings so far. The review of 21ced7b5 named these causes and the decision that would settle it; this round found 1 more finding(s) from the same place. Fixing them one at a time is not converging, so this review asks for that decision before another round.

1. Device-local history remains the vote authority (2 earlier finding(s))

QuickVotePlan takes existing choices, vote counts, and blocking state from VoteHistoryDAO, whose records are local to the installation and are not scoped to the active wallet. A vote made on another device, before restore, or by another wallet can therefore change whether a node appears eligible or blocked; another local-history guard cannot establish the current Platform state.

Already tracked: #1377

2. Vote outcomes still lack settlement state (4 earlier finding(s))

VoteOutcome distinguishes only a few special cases, while SDK refusals such as an unconfirmed broadcast, a closed poll, or an already-present vote are still reconstructed as ordinary retryable failures. Retry selection and report merging therefore need another exception whenever a new SDK result can mean definitely unsent, definitely accepted, or possibly accepted.

Already tracked: #1417

3. Quick voting has no complete snapshot or validity boundary (8 earlier finding(s))

The plan is formed from contest pages, node resolution, history, and deadlines, but runQuickVoting later rebuilds casts from mutable store state and the caster performs further independent reads. There is no single complete snapshot that proves the request set, wallet-node set, history, and contest validity remain authoritative, so pagination, sync completion, disappearing nodes, and elapsed deadlines keep producing new guards at later await points.

Already tracked: #1417

4. Run lifecycle and serialization are split across independent owners (1 new in this round, 5 earlier finding(s))

QuickVotingViewModel owns modal and pending-plan state, VotingViewModel owns the task, VotingStore owns busy/history state, and MasternodeVoteCaster owns authentication and execution, but no shared run identity or reservation spans them. Deferred dismissal, concurrent opening, cancellation, and an active-wallet or network switch can therefore outlive one owner's guard and continue with a stale plan or a newly active context.

Already tracked: #1417

In this round: Cancel Quick voting when the wallet or network context changes

Requested decision (redesign the component): Redesign Quick voting around one run coordinator before landing this feature. That owner must hold the immutable wallet/network context and complete plan snapshot, own authentication, cancellation, duplicate prevention, modal handoff, and vote settlement or reconciliation; QuickVotingViewModel, VotingViewModel, VotingStore, and MasternodeVoteCaster should no longer independently own those transitions. Until that coordinator exists, keep Quick voting out of this PR or gate it off instead of adding another lifecycle- or refusal-specific guard.

Automatic re-review is paused until then: later pushes keep this review's verdict and are not reviewed on their own. Comment @thepastaclaw review once the decision is made: that resumes automatic re-review, and reviews the current commit if it has not been reviewed.

🔴 1 blocking

Follow-up candidates (optional) (3)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Invalidate Quick voting opening when lifecycle stops
DashWallet/Sources/UI/DashPay/Voting/QuickVoting/QuickVotingViewModel.swift:158-176

openSheetOrKeys() awaits reloadVoteHistory() while isOpening remains set, but VotingViewModel.stopQuickVoting() only drops planToRun and cancels an already-created run. If the screen is backgrounded or removed while that history read is suspended, the continuation can resume later and publish plan plus .confirm without checking that the opening was invalidated. This allows a stale Quick voting sheet to appear after the user returns. Retain an opening task or generation token, clear/cancel it from the lifecycle stop path, and re-check it after the history await before publishing the plan and step.

source: gpt-6.1-sol (phase2-reviewer: general)

🟡 Suggestion: Move document queries off the actor-isolated SDK boundary
DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/IdentityVerifyService.swift:311-317

The new link-filter queue can start up to four labelDocuments calls, but the detached task does not guarantee off-main execution when sdk.documentList(...) is declared on the actor-isolated SwiftDashSDK boundary in the pinned platform dependency. The call hops back to the main actor before synchronously entering the blocking FFI query, so concurrent link lookups can serialize on and block the UI actor, preventing scrolling, cancellation, and lifecycle handling while links are fetched. Add or consume a nonisolated/off-main document-query API in the owning SwiftDashSDK implementation, using its worker-queue pattern, rather than wrapping the actor-isolated method in Task.detached.

source: gpt-6.1-sol (phase2-reviewer: ffi-engineer)

🟡 Suggestion: Re-read the remembered ticks when the active wallet or network changes
DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:252-253

The new VotingPrefs owner is evaluated on every preference access, but VotingStore.selectedNodeIDs is initialized only once and its didSet writes to whichever scoped preference owner is active at that moment. If the store survives a wallet or network transition, it continues carrying the old wallet's selection; refreshing or settling the node list can then write that stale intersection into the new wallet's scoped key. Re-read the selection when the active wallet/network changes, or recreate/invalidate the store on that transition before any refresh or selection write.

source: muse-spark-1.3-contributor (phase1-reviewer: general)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); 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 change whose diff modifies the security-sensitive Quick voting authorization and sequential vote-casting path in MasternodeVoteCaster.castRun, QuickVotePlan, and VotingStore, including one-confirmation multi-vote behavior and voting-key handling.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Code unchanged since the last final review (8b52cf38): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed; 3 new suggestion(s) listed as follow-up candidates, not posted inline
  • 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 — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
Before fixing anything, read the review's "Step back" section. This PR keeps drawing new blocking findings from the same underlying causes, and patching the findings below one at a time is not converging. The review asks for this decision first (redesign the component): Redesign Quick voting around one run coordinator before landing this feature. That owner must hold the immutable wallet/network context and complete plan snapshot, own authentication, cancellation, duplicate prevention, modal handoff, and vote settlement or reconciliation; QuickVotingViewModel, VotingViewModel, VotingStore, and MasternodeVoteCaster should no longer independently own those transitions. Until that coordinator exists, keep Quick voting out of this PR or gate it off instead of adding another lifecycle- or refusal-specific guard. Raise that decision with the PR's author or maintainer instead of only patching; if it is theirs to make, stop and ask them.

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 `DashWallet/Sources/UI/DashPay/Voting/VotingViewModel.swift`:
- [BLOCKING] DashWallet/Sources/UI/DashPay/Voting/VotingViewModel.swift:197-203: Cancel Quick voting when the wallet or network context changes
  `stopQuickVoting()` is connected to backgrounding and screen removal, but not to active-wallet or network changes. `MasternodeVoteCaster.castRun` authenticates once and then processes names sequentially, while its production `votingKey` and `send` closures resolve the registry and `SwiftDashSDKHost.shared.sdk` at each node. During `switchWallet(to:)`, the runtime repoints the active wallet before publishing the wallet-change notification, so an in-flight run can continue across that transition and derive or broadcast remaining votes using the new wallet or network against a plan created from the old context. Bind the run to an immutable wallet/network identity and reject it when the context changes, or cancel it before the runtime rebinds and re-check the binding before every key derivation and send.

  _Raised on code unchanged since the last review, and confirmed by an independent pass: While a Quick voting run for wallet/network A is awaiting a vote, switching the active wallet or network can complete and rebind the SDK without cancelling the run. The run then continues with its A-derived plan, but its per-node key derivation, vote history scope, and SDK broadcast resolve the new wallet/network, potentially casting remaining votes in the wrong context._

Comment on lines +197 to +203
/// Stops the run in flight: nothing more is sent, and the votes not sent
/// are reported as not cast, for Try again. A run still waiting for its
/// sheet to be gone is dropped and never starts.
func stopQuickVoting() {
quickVoting.dropPendingRun()
quickVotingRun?.cancel()
}

@thepastaclaw thepastaclaw Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⏭️ Deferred (maintainer decision; not blocking) at d5bd7491; see the replies below.

🔴 Blocking: Cancel Quick voting when the wallet or network context changes

stopQuickVoting() is connected to backgrounding and screen removal, but not to active-wallet or network changes. MasternodeVoteCaster.castRun authenticates once and then processes names sequentially, while its production votingKey and send closures resolve the registry and SwiftDashSDKHost.shared.sdk at each node. During switchWallet(to:), the runtime repoints the active wallet before publishing the wallet-change notification, so an in-flight run can continue across that transition and derive or broadcast remaining votes using the new wallet or network against a plan created from the old context. Bind the run to an immutable wallet/network identity and reject it when the context changes, or cancel it before the runtime rebinds and re-check the binding before every key derivation and send.

Raised on code unchanged since the last review, and confirmed by an independent pass: While a Quick voting run for wallet/network A is awaiting a vote, switching the active wallet or network can complete and rebind the SDK without cancelling the run. The run then continues with its A-derived plan, but its per-node key derivation, vote history scope, and SDK broadcast resolve the new wallet/network, potentially casting remaining votes in the wrong context.

source: gpt-6.1-sol (phase2-reviewer: security-auditor)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Deferred: binding a run to one SDK, wallet and network context is already tracked in #1417, together with the rest of the run coordinator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Deferred (re-reviewed at d5bd7491): The exact head still resolves the registry, SDK, network scope, and history dynamically during the run, so the context-binding gap remains. The deferral is reasonable and tracked in #1417 as part of the run-coordinator work.

…allet split

SDD-Published-From: e8ac1d409b638421c1f661fcda8a298cb886d44a

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

Static verification of the exact head found one new in-scope performance defect in the link lookup queue: requests for a second identity of a label already being fetched can start a duplicate Platform lookup. No new blocking issues were confirmed; title checks and CodeRabbit passed, while the review check remains queued.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Coalesce link requests for a label already being looked up
DashWallet/Sources/UI/DashPay/Voting/Store/VotingStore.swift:715-720

When a label's lookup starts, startWaitingLinkLookups() removes its identity set from waitingLinkIdentities at line 728 while the asynchronous request is still running. If another request for a different identity of that label arrives during this interval, waitingLinkIdentities[key.normalizedLabel] is nil here, so the label is appended to asked and queued again. The store can therefore issue two publishedLinks requests for the same name, potentially returning inconsistent snapshots and consuming one of the four lookup slots unnecessarily. Track in-flight labels separately and merge or defer newly requested identities instead of enqueueing a duplicate label.

source: gpt-6.1-sol (phase2-reviewer: general)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); 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 change that directly modifies masternode vote casting and the sequential QuickVoting run in MasternodeVoteCaster.castRun and VotingStore, which handles authenticated, signed peer-facing governance votes.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Code unchanged since the last final review (84fd09eb): 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • 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 — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

Not approved: 2 blocking finding(s) are disputed and left to the maintainers.

SDD-Published-From: 7645b35554b3296bddec80e83da627dabb5e0d32

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

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 1 + Phase 2

The exact head contains no independently actionable defect introduced by this PR. The only new Phase 1 claim concerns VotingPrefs code that is unchanged from the PR base, while CI shows no failed code checks; the simulator test remains in progress and the target-membership and accessibility checks have passed.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); 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 change that modifies the Quick voting execution path in MasternodeVoteCaster.castRun and VotingStore, including sequential signing and broadcasting of multiple peer-facing votes under one authentication flow.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • 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 — ffi-engineer (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

Not approved: 2 blocking finding(s) are disputed and left to the maintainers.

@romchornyi
romchornyi merged commit 4ebcc71 into develop Nov 16, 2026
0 checks passed
@romchornyi
romchornyi deleted the feat/voting-quick-voting branch November 16, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants