Repository navigation
feat(dashpay): contested username cost follows the Platform protocol version - #1199
Conversation
…version Platform protocol version 14 halves the contest fund a contested DPNS name prefunds, 0.2 -> 0.1 DASH, so funding a new identity for one drops from 0.25 to 0.15 DASH. The app stated and funded 0.25 / 0.2 from two constants. ContestedUsernameFee resolves the pair from the protocol version the SDK reports for the running network: 14 and later -> 0.15 / 0.1, older or not known -> 0.25 / 0.2. The highest version seen is kept per network and only rises, so a figure the user confirmed cannot grow before it is paid. Every consumer reads the resolver: the create-username cost rule, balance checks and confirmation, the coordinator's funding amount and the existing-identity top-up, and the Username Marketplace request cost. Both constants are removed. Shielded keeps its 0.25 DASH exit denomination on every version, so the form and the confirmation state 0.25 for that source, Core and Platform are judged at their own figure, and a source settled after the confirmation cannot take more than the sheet showed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
✅ Final review complete — no blockers (commit 2397b36) |
…o" names the dearest route A plain name paid from Shielded leaves the pool as the 0.1 DASH exit denomination, but the form's cost rule stated 0.03. The per-source figure now lives in one place (ContestedUsernameFee.Amounts.newIdentityFundingDuffs) that the form and the coordinator both read, so the form states 0.1 for a plain name and 0.25 for a contested one when Shielded pays, and Core and Platform stay judged at their own figure. "Some usernames cost up to" names the larger of the Dash-balance and Shielded contested figures, as Android does: 0.25 DASH on either protocol version while Shielded's denomination is 0.25. Whether the line shows is still judged at what the Dash or Platform balance pays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Static verification at a6507e3 found no confirmed in-scope correctness or security blocker. The two test-coverage suggestions identify the same verified gap in the new confirmation-ceiling guard and are consolidated below. No builds or tests were run in this static lane; the supplied CI snapshot has no build/test results, and the author reports that paid protocol-14 registration remains unverified.
🟡 1 suggestion(s)
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-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The cross-cutting change introduces asynchronous, persisted network-version fee resolution and directly changes identity funding and top-up amounts in DWIdentityRegistrationCoordinator.swift, meeting both the intricacy and funds-movement criteria. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 14% left, 5h 100% left),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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-reviewer - Model comparison: every Phase-2 reviewer also ran on
gpt-6-astra; the verifier weighed both sets without knowing which model wrote which
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewModel.swift`:
- [SUGGESTION] DashWallet/Sources/UI/DashPay/Setup/CreateUsername/CreateUsernameViewModel.swift:434-442: Add regression coverage for the protocol-14 confirmation ceiling
This guard prevents a source selected after confirmation from spending Shielded's 25,000,000 duffs when the user confirmed only the protocol-14 Core/Platform amount of 15,000,000 duffs. No test calls `fundingExceedingConfirmation` or `captureConfirmedTopUp`; `testFormFigureFollowsItsSource` retains the preview model's legacy fee and checks only amount accessors. Add focused ViewModel tests with the reduced fee and a contested candidate: capture a 15,000,000-duff confirmation and assert that Shielded is rejected with the expected needed/confirmed amounts while Core and Platform are permitted, then capture 25,000,000 duffs and assert that Shielded is permitted. Cover both one-name submission and the companion-name path, including its zero-additional-cost confirmation, so the spending ceiling is tested independently of the amount table.
On protocol 14 the confirmation sheet states 0.15 DASH for the Dash or Platform balance while Shielded still leaves as a 0.25 DASH denomination. `fundingExceedingConfirmation` refuses a source settled after the sheet that would take more than it showed, and nothing tested it. The preview factory can now pose the contested fee, a contested candidate and an existing identity, so the tests run the guard itself: Shielded is refused after a 0.15 confirmation with and without a companion name, a 0.25 confirmation covers every source, and the guard stays out of the way for a plain name, an existing identity and an unconfirmed form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The new ViewModel tests address the prior confirmation-ceiling coverage finding. One introduced target-membership defect remains in the shared SDK host; the proposed DASHPAY guard would not fix it because both app targets define that flag. Verification was static at aa989dd: the supplied CI snapshot shows passing title/accessibility checks, pending CodeRabbit, and no app-build or XCTest results; successful paid registration on protocol 14 remains unverified.
🔴 1 blocking
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-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The cross-cutting protocol-dependent fee policy changes actual identity funding and existing-identity top-up requirements in DWIdentityRegistrationCoordinator.swift, alongside asynchronous updates and confirmed-spend ceilings across funding sources. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 14% left, 5h 100% left),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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-reviewer - Model comparison: every Phase-2 reviewer also ran on
gpt-6-astra; the verifier weighed both sets without knowing which model wrote which
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKHost.swift`:
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/SwiftDashSDKHost.swift:1717: Keep the shared SDK host independent of target-only fee code
SwiftDashSDKHost.swift is compiled into both dashwallet and dashpay, but ContestedUsernameFee.swift is added only to dashpay's Sources phase. This new reference and the runtimeDidStop() call at line 1025 therefore introduce unresolved ContestedUsernameFee symbols in dashwallet. Adding the resolver alone is insufficient because its PlatformPaymentIdentityFundingPolicy and ShieldedIdentityFundingReadiness dependencies also belong only to dashpay. Wrapping these calls in #if DASHPAY does not fix the mismatch: all four dashwallet configurations currently define DASHPAY, including through OTHER_SWIFT_FLAGS. Connect these lifecycle hooks through target-specific integration that leaves the shared host compilable, or align the resolver and its dependencies with the consuming targets. This finding concerns the two errors introduced by this PR, not repair of the documented pre-existing dashwallet build failures.
`SwiftDashSDKHost` and `UsernameMarketplaceScreen` are compiled into the dashwallet target as well as dashpay, and both now call `ContestedUsernameFee`, which was added to dashpay only: six references with nothing to resolve them in dashwallet. The resolver joins the dashwallet target. What tied it to DashPay-only code moves out with it: the funding figure per source reads the shielded readiness and the DashPay constants, so it becomes an extension in its own dashpay-only file, and the fund is converted with the resolver's own credits-per-duff constant instead of the registration coordinator's. No figure changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The exact head resolves both previously reported issues: the fee resolver is compiled into both app targets with DashPay-only funding helpers isolated, and the protocol-14 confirmation ceiling now has focused regression coverage. Two in-scope test/confirmation-state suggestions remain; no blocking correctness or security defect was found in the static trace.
🟡 2 suggestion(s)
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: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); 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:
criticalbygpt-6.1-sol(effort low) — The cross-cutting asynchronous fee policy and confirmation-ceiling changes directly alter identity funding and existing-identity top-up amounts in DWIdentityRegistrationCoordinator.swift, making this an intricate funds-movement change. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 14% left, 5h 100% left),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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `DashWallet/Sources/UI/DashPay/Setup/CreateUsername/ConfirmUsernameRequestSheet.swift`:
- [SUGGESTION] DashWallet/Sources/UI/DashPay/Setup/CreateUsername/ConfirmUsernameRequestSheet.swift:62-66: Reset acceptance when the displayed contest-fee amount changes
The sheet displays both `amountDuffs` and, for an existing identity, `identityPaidContestFeeDuffs`. The acceptance state currently resets only when `amountDuffs` changes. If the identity already has enough credits for both fee pairs, the top-up remains zero while the displayed contest fee changes after the resolver learns a new protocol version, leaving an existing “I accept” acknowledgement attached to a different irreversible spend. Observe the contest-fee value as well so every displayed amount change requires fresh acknowledgement.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift`:
- [SUGGESTION] DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift:771-774: Exercise the reduced fee in the actual identity-creation path
The new tests verify the amount table, registration-credit arithmetic, ViewModel confirmation ceiling, and source-specific helper calculations, but none drives `createFundedIdentity` through the Core or Platform branches. The production handoff computes the resolver value at lines 771–772, stores it in `IdentityCreationContext` at line 865, and passes it to both `registerIdentityWithFunding` and the Platform-payment conversion. A coordinator-level fake-wallet/FFI test, or a protocol-14 integration scenario, should assert 15,000,000 duffs reaches both transparent funding APIs while the Shielded path remains on its 25,000,000-duff denomination.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Track contender-count increases in the authoritative contested-name cost — Protocol 14 can increase the contest fund once a contest reaches 250 contenders and again for each additional 50 contenders. This PR intentionally resolves only the base fund, so a sufficiently large contest can leave the identity funded but cause the subsequent DPNS registration to fail for insufficient identity credits.
- Follow-up: Track separately and obtain the authoritative contest-specific required fund, including contender-count multipliers, before identity funding and revalidate it immediately before signing.
| let requiredIdentityFundingDuffs = ContestedUsernameFee.shared.amounts | ||
| .newIdentityFundingDuffs(isContested: isContestedSubmission, fromShielded: false) | ||
| Self.logger.info( | ||
| "🪪 IDENT-COORD :: contested=\(isContestedSubmission) identityFundingDuffs=\(requiredIdentityFundingDuffs)") |
There was a problem hiding this comment.
🟡 Suggestion: Exercise the reduced fee in the actual identity-creation path
The new tests verify the amount table, registration-credit arithmetic, ViewModel confirmation ceiling, and source-specific helper calculations, but none drives createFundedIdentity through the Core or Platform branches. The production handoff computes the resolver value at lines 771–772, stores it in IdentityCreationContext at line 865, and passes it to both registerIdentityWithFunding and the Platform-payment conversion. A coordinator-level fake-wallet/FFI test, or a protocol-14 integration scenario, should assert 15,000,000 duffs reaches both transparent funding APIs while the Shielded path remains on its 25,000,000-duff denomination.
source: gpt-6.1-sol (phase2-reviewer: general)
There was a problem hiding this comment.
Not adding a coordinator-level test in this PR. createFundedIdentity calls the concrete SDK wallet (registerIdentityWithFunding / registerIdentityFromAddresses, FFI-backed) and the coordinator has no seam for a fake one; introducing that abstraction into the code that moves funds is a larger change than this task. The figure itself is computed once by Amounts.newIdentityFundingDuffs(isContested:fromShielded:), which the unit tests cover for both fee pairs, and is passed to both calls unchanged through IdentityCreationContext.
The handoff is covered by the other route named here, the protocol-14 integration scenario: a paid contested request on devnet sakura (protocol 14), funded from the Dash Wallet balance and from the Platform balance, checking that 0.15 DASH is what leaves the wallet, and from Shielded, checking it stays on the 0.25 DASH denomination. That run is still open — it is listed as not yet verified in the description — and its result will be added there.
There was a problem hiding this comment.
I agree that introducing a fake-wallet abstraction solely for this test would be a larger change than this task, and the code shown does pass the computed amount unchanged into both transparent funding routes. However, the protocol-14 integration run is explicitly still unverified in the PR description, having stopped before the fee path, so it cannot yet serve as evidence for the handoff or the unchanged Shielded denomination. A successful run observing 0.15 DASH through the Core and Platform paths and 0.25 DASH through Shielded would resolve this suggestion; until that evidence is added, the finding remains pending on this head.
The finding stands on this commit until that change is pushed; the push gets a full review.
There was a problem hiding this comment.
The protocol-14 run this thread was waiting for, for the Dash-balance path. sakura devnet (protocol 14), build aa989ddae, 12 October 21:38 UTC:
- Asset lock
73c16d4d…629f: 0.16 DASH in, exactly 0.15 DASH burned, credit output 15,000,000 duffs, InstantLocked. That is the amount the coordinator handed toregisterIdentityWithFunding. - Identity
57oJVzTykxvVP9uyfzeMTgW3CvTAq6VcBunsr5iDpAqMwas created and the name went to the vote. It is left with 4,703,349,940 credits: 15,000,000,000 funded, 10,000,000,000 taken as the contest fund, the rest fees. - Control on the same devnet with a
developbuild (bcbb2e0bb): it funds 0.25 DASH (f0b694a7…9592) and the identity is left with 14,707,722,860 credits, so the network takes the 0.1 fund either way.
The two commits after aa989ddae do not change DWIdentityRegistrationCoordinator.swift: 1680972b3 moves newIdentityFundingDuffs into an extension file unchanged, d3ecb3915 is the sheet's acceptance reset. The scenarios have not been re-run on d3ecb3915 yet.
Still not run on protocol 14: a contested name paid from the Platform balance (0.15, registerIdentityFromAddresses) and from Shielded (0.25). Both are listed as not verified in the description, along with the six earlier attempts that broadcast the same 0.15 lock and then failed creating the identity on this devnet.
There was a problem hiding this comment.
Thanks—the reported 15,000,000-duff burn followed by successful identity creation and voting addresses the Core-path portion on aa989ddae. I checked the intervening diff: the coordinator is unchanged and the extracted funding helper preserves the amounts, although this is not a runtime run of the exact head. I should also correct my earlier shorthand: Platform funding converts the amount into credit-valued inputs rather than passing a duff amount unchanged, so the remaining Platform run should distinguish the 15,000,000,000-credit funding contribution from the additional transition fee. The suggestion remains open only for that route and the Shielded spend of the 25,000,000,000-credit denomination; I’m not asking for a new fake-wallet abstraction.
There was a problem hiding this comment.
QA ran the two remaining protocol-14 scenarios — a contested name paid from the Platform balance (0.15 DASH) and from Shielded (0.25 DASH denomination) — and both pass: the identity is created and the name goes to the vote. The description's testing section is updated. Today's push merges develop, which brings #1156's invitation-claim changes into DWIdentityRegistrationCoordinator.swift; this branch's own commits since that run do not change the coordinator.
There was a problem hiding this comment.
Still applies (re-reviewed at 4034a300): The Platform and Shielded reports close the route-specific behavior gap, but they identify no build SHA and the current head includes a coordinator merge. Please identify the exact-head artifact or rerun the focused scenarios on 4034a30.
There was a problem hiding this comment.
Ran on the reviewed head 2397b36fd (SDK 41b6acb39e, devnet sakura, protocol 14) through the pitcrew case scenarios, 2026-10-21:
- Dash balance (Core): asset lock
42c43dcc…burns exactly 0.15 DASH (credit output 15,000,000 duffs); the name goes to the vote, and the identity is left with 0.0471 after the 0.1 fund. - Platform balance: after Dash Wallet → Platform 0.2, the Platform balance falls by 0.15 plus a 0.0017 transition fee. The identity holds 0.0488 DASH, which is 15,000,000,000 credits less the 0.1 fund and fees. Name voted (3 runs).
- Shielded: this cannot be run on sakura. The request stops at "(1/3) Unable to process payment — the shared privacy pool is still growing (2 of 250 deposits)" with nothing spent. The 0.25 figures from Shielded do pass there (
shielded_source_figures). A testnet run is pending fix(wallet): pin testnet to Platform protocol 14 #1222. - Existing-identity top-up: not run. The state it needs, an identity with no name after an interrupted registration, takes a network cut to reproduce, and that scenario step needs a person at the terminal.
The confirmation sheet states two figures for an existing identity: the top-up and the contest fee paid from its credits. Only a change of the first cleared "I accept". An identity that already holds enough keeps the top-up at zero while the fee moves when the protocol version arrives, and the acknowledgement stayed attached to a figure no longer on screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Static review of the complete base-to-head diff at d3ecb39 found no blocking defects. The acceptance reset, shared-target membership, and confirmation-ceiling regression coverage are addressed; one suggestion remains for testing reduced-fee funding through the coordinator-to-SDK boundary. No builds or tests were run in this lane, and the supplied exact-head CI snapshot contains no build/test results, with accessibility and title checks queued.
🟡 1 suggestion(s)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
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); 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:
criticalbygpt-6.1-sol(effort low) — This is a large cross-cutting change that directly alters identity-registration funding and transaction amounts in DWIdentityRegistrationCoordinator and related payment flows. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 14% left, 5h 100% left),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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift`:
- [SUGGESTION] DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift:771-774: Exercise the reduced fee in the actual identity-creation path
(existing thread: https://github.com/dashpay/dashwallet-ios/pull/1199#discussion_r4250973626)
The reduced amount is correctly wired in the inspected source: this singleton read supplies `IdentityCreationContext.requiredIdentityFundingDuffs`, which becomes Core's `registerIdentityWithFunding(amountDuffs:)` argument or the Platform funding planner's credit target. However, `ContestedUsernameFeeTests` exercises resolver reads, amount helpers, registration-credit arithmetic, and the ViewModel ceiling—not either coordinator funding route. The documented protocol-14 smoke stopped during discovery before funding, while the successful paid registration used protocol 13 on an earlier head. Add a focused coordinator-to-SDK argument-capture regression with the reduced pair: assert 15,000,000 duffs for Core and a 15,000,000,000-credit funding target for Platform, with its fee reserve handled separately. This would catch wiring regressions that leave the displayed 0.15 DASH disconnected from the funding request; it is a coverage gap, not a demonstrated spending defect.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Track contest-size-dependent funding separately — The resolver supplies only the protocol's base fund, and the coordinator derives funding and existing-identity requirements without a contender-count adjustment. The PR explicitly excludes protocol-14 contest-size surcharges and documents that sufficiently large contests can refuse a base-funded request. This is a concrete follow-up because identity creation or a top-up can complete before username registration fails, leaving the user with funded identity credits but no successful request.
- Follow-up: Track authoritative contest-size-dependent funding separately, including how requirement changes are handled without exceeding the amount the user confirmed.
…rname-fees Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Static verification of the complete develop-to-head diff at 06b564a found no blocking defect and confirmed the target-membership, acceptance-reset, and confirmation-ceiling fixes. One non-blocking coverage suggestion remains for the actual protocol-14 Platform and Shielded identity-funding paths. No local builds or tests were run; the supplied exact-head CI snapshot shows title and accessibility checks passing and the dashpay build still in progress, while the reported successful Core integration run used aa989dd.
🟡 1 suggestion(s)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); 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:
criticalbygpt-6.1-sol(effort low) — The cross-cutting protocol-version resolver and confirmation/source handling are intricate and directly change funds movement in DWIdentityRegistrationCoordinator.swift by changing new-identity funding amounts and existing-identity top-up requirements. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 14% left, 5h 100% left),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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift`:
- [SUGGESTION] DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift:771-774: Exercise the reduced fee in the actual identity-creation path
(existing thread: https://github.com/dashpay/dashwallet-ios/pull/1199#discussion_r4250973626)
The reported sakura Core run supports the 0.15 DASH handoff on aa989ddae, and the coordinator is unchanged between that revision and this head. The remaining branches have different handoffs: Platform converts the resolved amount to credits, plans address inputs, and calls registerIdentityFromAddresses with output nil; Shielded calls its separate denomination-based API. The checked-in tests verify the amount policy and confirmation guard but do not execute either funding branch, and the PR description explicitly lists both protocol-14 paid scenarios as unverified. Close the remaining coverage with paid integration runs on this exact head showing Platform's 15,000,000,000-credit funding input total and Shielded's unchanged 25,000,000,000-credit exit denomination, distinguishing fees from funding amounts and confirming successful identity creation and contest submission. This does not require introducing a production SDK abstraction or treating the documented devnet quorum failure as an app defect.
The create-username onAppear conflict takes develop's order (invitation mode, then the recovery refresh) and keeps the contested-fee refresh after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cost #1156 compared the invitation amount with the fixed 0.25 DASH constant this branch removed; the tier now uses the same protocol-dependent figure a new identity is funded with for a contested name (0.15 on protocol 14), as Android's isInviteForContestedNames does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t before judging it The Home card judged an invitation's tier against the contested cost as it happened to stand, and the form kept that tier for the whole visit. A check that ran before the protocol version was read put a 0.15 DASH voucher on protocol 14 in the non-contested tier for good. The check now refreshes the cost before judging (injected into decide, so the policy stays testable), the form receives the voucher amount instead of a fixed tier and derives the tier from the cost it follows, and a new identity's contested confirmation states what the voucher funds. Drops a stale comment that said the amount is unknown before the claim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the contest fund on its confirmation The card never shows the tier and the form re-derives it from the voucher amount as the cost changes, so the check reads the cost as it stands instead of waiting for a protocol-version read on every validation. The form always gets the amount with the link. An invitation claim's contested confirmation states the contest fund, the only figure at stake there, instead of the whole voucher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m derives it Nothing read the verdict's or the card's tier once the form took the voucher amount, and a tier fixed at check time could disagree with the form's live one. The verdict carries the amount; the tier is InvitationValidationPolicy.tier against the cost the form follows. The contested confirmation keeps this branch's figure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A form opened in invitation mode without the voucher amount gates no name, as before; a voucher that falls short fails at claim time. Restores decide's signature layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The resolver is consistently used for the displayed and calculated base contested-name amounts, and three prior findings are fixed. One spend-safety defect remains: the registration calls do not constrain the SDK to the fund acknowledged by the user, so a large contest can authorize a higher protocol fund than the reduced amount shown. The simulator test check is still in progress; no completed code check currently fails.
🔴 1 blocking | 🟡 1 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Cap contested-name registration at the fund shown to the user
DashWallet/Sources/Infrastructure/SwiftDashSDK/UsernameMarketplaceService.swift:421-424
This call submits a contested name without passing the acknowledged contest-fund ceiling. In the SwiftDashSDK revision pinned by .platform-ref (41b6acb39e15dbaae64e1dc8386ad761d228486d), a nil maxContestFund lets the SDK query and authorize the current protocol fund, including the multiplied fund once a contest reaches the large-contest threshold. The Marketplace now displays only ContestedUsernameFee.shared.amounts.fundDuffs, so an identity with enough surplus credits can confirm the displayed reduced amount and then successfully lock the larger live amount. The coordinator's primary registerDpnsName call at DWIdentityRegistrationCoordinator.swift:1486 has the same omission. Pass the confirmed/base fund through maxContestFund, or obtain and explicitly display and confirm the live amount before authorizing the registration; add a boundary test showing that crossing the contender threshold cannot increase the acknowledged spend silently.
source: gpt-6.1-sol (phase2-reviewer: general, ffi-engineer, security-auditor)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: 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:
criticalbygpt-6.1-sol(effort low) — This is a large, cross-cutting change that alters identity registration and Marketplace funding amounts in DWIdentityRegistrationCoordinator and related payment flows, directly affecting funds movement. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(lane 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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/UsernameMarketplaceService.swift`:
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/UsernameMarketplaceService.swift:421-424: Cap contested-name registration at the fund shown to the user
This call submits a contested name without passing the acknowledged contest-fund ceiling. In the SwiftDashSDK revision pinned by `.platform-ref` (`41b6acb39e15dbaae64e1dc8386ad761d228486d`), a nil `maxContestFund` lets the SDK query and authorize the current protocol fund, including the multiplied fund once a contest reaches the large-contest threshold. The Marketplace now displays only `ContestedUsernameFee.shared.amounts.fundDuffs`, so an identity with enough surplus credits can confirm the displayed reduced amount and then successfully lock the larger live amount. The coordinator's primary `registerDpnsName` call at `DWIdentityRegistrationCoordinator.swift:1486` has the same omission. Pass the confirmed/base fund through `maxContestFund`, or obtain and explicitly display and confirm the live amount before authorizing the registration; add a boundary test showing that crossing the contender threshold cannot increase the acknowledged spend silently.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift`:
- [SUGGESTION] DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift:975-999: Exercise the reduced fee in the actual identity-creation path
(existing thread: https://github.com/dashpay/dashwallet-ios/pull/1199#discussion_r4250973626)
The newly reported Platform and Shielded scenarios close the two route-specific behavior gaps, but the report does not identify the build artifact used for those runs. The current head includes a develop merge that changes the coordinator, so stating that branch-owned commits did not change these handoff lines does not establish that `4034a3003d908ff6fdf0b85b1ea5251de4b1c5fd` was exercised. Attach an exact-head build SHA for the successful 0.15-DASH Platform and 0.25-DASH Shielded scenarios, or rerun those focused protocol-14 flows on this head.
…ocol 14 registerDpnsName left maxContestFund nil, so the SDK stated the fund to join read just before signing, which on protocol 14 doubles once a contest holds 250 contenders, and paid it while the user was shown 0.1. Both registration paths now state the reduced fund when protocol 14 is known: Platform then refuses such a contest instead of charging more. The legacy pair states none, as before: below 14 the fund never doubles and must be paid exactly, and legacy is also the pair of a version not read yet, whose 0.2 would require an identity funded at 0.15 to hold it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re the blocking "Cap contested-name registration at the fund shown to the user": fixed in 83cc2a0. Both
Not changed here: a refusal caused by a doubled fund shows up as the generic registration failure, and "Try again" makes the same refused (and charged) attempt again. It only happens in a contest of 250+ contenders, and the doubled fund is listed under "Not in this PR". |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The fee policy, target split, and confirmation regression tests match the stated change, but registration while the protocol version is unresolved still lacks a spending ceiling. Exact-head simulator, target-membership, and accessibility checks pass; the base's additional SPV-history commit neither supersedes this work nor has reported merge conflicts. Paid-flow integration evidence also remains incompletely tied to the reviewed head.
🔴 1 blocking | 🟡 1 suggestion(s)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-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:
criticalbygpt-6.1-sol(effort low) — The cross-cutting fee policy and asynchronous network-version resolution directly change identity funding, existing-identity top-ups, and the contest-fund spending ceiling in DWIdentityRegistrationCoordinator.swift. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(lane 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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/ContestedUsernameFee.swift`:
- [BLOCKING] DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/ContestedUsernameFee.swift:79-84: Cap contested-name registration at the fund shown to the user
The legacy pair also represents a version that has not been read, so returning nil here leaves an authorization gap on protocol-14 networks. With no cached version, runtimeDidStart() publishes the 0.2-DASH legacy fund while its read runs. The Marketplace's separate contest-precheck task can enable Request before that read finishes; both registration callers then forward this nil ceiling. At pinned Platform revision 41b6acb, nil makes the SDK fetch the contenders and calculate the fund using its then-current protocol version before signing. Its protocol-14 implementation requires 40,000,000,000 credits (0.4 DASH) for a contest holding 300 contenders, so an adequately funded existing identity can spend twice the displayed amount. A genuinely protocol-13 network has a fixed fund, but an unresolved app-side version does not establish that precondition. Preserve a separate authorization ceiling in the signing path, allowing the SDK's actual prefunded amount only when it does not exceed the confirmed ceiling, or fail closed until the applicable fee is resolved. This avoids forcing a 0.2-DASH prefunding statement on smaller invitation/recovery balances while still preventing an unlimited spend. Add a regression for the unresolved legacy display against a protocol-14 contest above the second doubling threshold.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift`:
- [SUGGESTION] DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift:823-826: Exercise the reduced fee in the actual identity-creation path
(existing thread: https://github.com/dashpay/dashwallet-ios/pull/1199#discussion_r4250973626)
The reported Core, Platform, and Shielded integration runs now cover the requested funding sources, but their provenance does not establish execution of this reviewed head. The traceable Core run identifies aa989ddae, and the Platform/Shielded QA report supplies no build SHA. The current-head tests exercise the amount policy and confirmation guard, but none invokes createFundedIdentity or its funding APIs. Attach a protocol-14 smoke record identifying build 83cc2a0d5ddd42496ee2d4a502512bb213d04aa8 and confirming the 15,000,000-duff Core funding amount, the 15,000,000,000-credit Platform funding target, and the unchanged 25,000,000-duff Shielded denomination. Alternatively, cover the production coordinator handoff with an executable test; introducing a fake-wallet abstraction is unnecessary if the exact-head integration record supplies this evidence.
…nothing 83cc2a0 left the legacy pair unstated, and legacy is also the pair of a version not read yet: on a protocol-14 network the SDK then stated the live fund to join, doubled past 250 contenders, unbounded. Every contested write now states the fund of the version known for its network (contestFundCeilingCredits), the pair the screens show: 0.1 from protocol 14, 0.2 below it, which is also the exact amount a protocol-13 contest takes. The version is read only when none is known; with still none, or another network running, the attempt fails before anything is signed. Resolved once per attempt, before the PIN prompt and the payment, and used for the identity funding, the existing-identity top-up and the write alike. Behind a recovered paid lock it is resolved at the name step, so the paid identity is recovered first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The exact-head static review finds no blocking correctness or security defects. Three non-blocking gaps remain: the production identity-funding handoff and existing-identity top-up paths lack focused coordinator-boundary coverage, and the app duplicates the protocol’s consensus contest-fund mapping. Simulator tests are still in progress; target-membership and accessibility checks passed.
🟡 3 suggestion(s)
2 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: 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:
criticalbygpt-6.1-sol(effort low) — The large cross-cutting diff changes identity registration and marketplace funding amounts in DWIdentityRegistrationCoordinator and related contested-username cost logic, directly affecting funds movement. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(lane 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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/ContestedUsernameFee.swift`:
- [SUGGESTION] DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/ContestedUsernameFee.swift:80-83: Obtain the protocol's base contest fund from Rust
`Amounts.forProtocolVersion` adds a second implementation of consensus fee selection in the app by mapping protocol versions to 20,000,000,000 or 10,000,000,000 credits. The Platform source owns these values in its versioned `vote_resolution_fund_fees` tables, while this app-side mapping now drives presentation, identity funding, and the explicit signing ceiling. If the Rust pricing policy changes for a later protocol version, the app can understate or overstate the amount while still compiling. Expose the Rust-resolved base contest fund through the Swift SDK/FFI and keep only app-specific headroom, presentation, and confirmation logic here.
In `DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift`:
- [SUGGESTION] DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift:837-839: Exercise the reduced fee in the actual identity-creation path
(existing thread: https://github.com/dashpay/dashwallet-ios/pull/1199#discussion_r4250973626)
The current head changed `IdentityCreationContext.requiredIdentityFundingDuffs` to use the asynchronously resolved contest-fund snapshot, which is then handed to both `registerIdentityWithFunding` and the Platform-payment conversion. The available protocol-14 smoke evidence predates this handoff change or does not identify the exact reviewed commit, and the unit tests cover the amount helpers rather than these production calls. Add a coordinator boundary test or exact-head integration coverage asserting 15,000,000 duffs on the Core path, 15,000,000,000 funding credits on the Platform path, the unchanged 25,000,000,000-credit Shielded denomination, and that an unresolved fund prevents either transparent funding call.
- [SUGGESTION] DashWallet/Sources/Infrastructure/SwiftDashSDK/Identity/DWIdentityRegistrationCoordinator.swift:1374-1389: Exercise the reduced fee in the existing-identity top-up path
(existing thread: https://github.com/dashpay/dashwallet-ios/pull/1199#discussion_r4250973626)
`fundExistingIdentityIfNeeded` now computes the required identity credits from the resolved protocol-specific contest fund, so the change affects the amount sent by both Core and Platform top-ups before the contested DPNS write. The added tests verify `requiredRegistrationCredits` arithmetic but do not drive this money-moving branch with an identity that is short of the contest requirement. Add a coordinator-level seam test or integration scenario covering protocol 14's 0.1-DASH contest requirement and protocol 13's 0.2-DASH requirement through the top-up API and subsequent contested registration.
| /// `nil` — version not known — resolves to the legacy pair. | ||
| static func forProtocolVersion(_ version: UInt32?) -> Amounts { | ||
| guard let version, version >= reducedFromProtocolVersion else { return .legacy } | ||
| return .reduced |
There was a problem hiding this comment.
🟡 Suggestion: Obtain the protocol's base contest fund from Rust
Amounts.forProtocolVersion adds a second implementation of consensus fee selection in the app by mapping protocol versions to 20,000,000,000 or 10,000,000,000 credits. The Platform source owns these values in its versioned vote_resolution_fund_fees tables, while this app-side mapping now drives presentation, identity funding, and the explicit signing ceiling. If the Rust pricing policy changes for a later protocol version, the app can understate or overstate the amount while still compiling. Expose the Rust-resolved base contest fund through the Swift SDK/FFI and keep only app-specific headroom, presentation, and confirmation logic here.
source: gpt-6.1-sol (phase2-reviewer: ffi-engineer)
There was a problem hiding this comment.
Agreed that the fund belongs in Rust, but the SDK doesn't give the app a way to read it yet. Neither the pinned 41b6acb39e nor v5.1-dev (033ecaee2f) exposes required_vote_resolution_fund or contest_fund_to_join through FFI or Swift. The only contact point is the stated-maximum maxContestFund. Filed as dashpay/platform#5510.
Until that lands, ContestedUsernameFee.Amounts mirrors vote_resolution_fund_fees for protocols 13 and 14. Its doc comment names the Rust source it has to follow. Once the getter exists, the app will read the fund from it and keep only the headroom, presentation and confirmation logic.
llbartekll
left a comment
There was a problem hiding this comment.
Reviewed at 2397b36f against the pinned SDK (41b6acb39e). Approving; two non-blocking notes.
What I checked
- The explicit ceiling is not a behavioural change for the normal case. At the pin,
with_contest_fund_to_joinpasses a statedcontest_fundinto the creation options verbatim, and the FFI maps0toNone. For a contest under 250 contenders the SDK would compute exactly 10,000,000,000 (protocol 14) or 20,000,000,000 (below), so the transition carries the same prefunded balance it did before; the ceiling only bites past the doubling threshold, where Platform refuses the join rather than charging it. - Ordering: on both the create and existing-identity paths the ceiling is resolved before
authorize(), so an unresolved version fails before the PIN and before any payment. With a recovered paid lock,requiredIdentityFundingDuffsis unused (createOrRecoverIdentityresumes from the lock) and the fund is resolved at the name step, as described. requiredRegistrationCreditstakes the fund from the caller, so the view model's top-up figure, the coordinator'sfundExistingIdentityIfNeeded, and the signedmaxContestFundall come from one snapshot per attempt.- Target split:
ContestedUsernameFee.swiftis in both app targets, the+IdentityFundingextension only indashpay; the test file is in the test target. No reference to the removed constants remains. - Tests: the 16 resolver tests use an injected defaults suite and read closure, and cover the version ratchet, per-network keys, runtime restart, the no-read-once-reduced case, and the confirmed-amount ceiling (Shielded refused after a 0.15 confirmation, with and without a companion). CI's
DashWalletTests on simulatorran green on this head.
Non-blocking
- The last commit (
2397b36f) changed what is signed, and every network run in the description (devnet Dash/Platform/Shielded, QA on 20 October) predates it. The unit tests drive the resolver with a fake read; nothing has exercisedregisterDpnsName(maxContestFund:)against a real network. The equivalence argument above makes me comfortable approving, but one contested paid request on the final head (sakura, or testnet once #1222 is in) would close the thread that is still open on this PR and is cheap insurance on the money path. - See the inline note on
record(_:scope:): the recorded version only rises and nothing in the app can lower it, which turns the SDK's per-network floor/pin into a safety invariant worth writing down next toplatformVersion(for:)in #1222.
The reuse of the DashSpend key "Network error. Please check your connection and try again." for UnresolvedProtocolVersion is fine (same key, one Transifex entry); just noting it is deliberate.
| /// A network's protocol version never goes down, so a lower read (the | ||
| /// SDK's floor, before it has a proof) does not replace a higher known one. | ||
| private func record(_ version: UInt32, scope: String) { | ||
| guard version > (knownProtocolVersion(scope: scope) ?? 0) else { return } |
There was a problem hiding this comment.
Non-blocking. record ratchets up and nothing in the app can bring a recorded version back down, so the SDK's per-network floor (and the testnet pin in platformVersion(for:)) becomes a safety invariant: if a build's floor for a network is ever ahead of what that network has activated, one read records it for good, and from then on every contested write on that network states the reduced fund against a network still taking the legacy one. Per the SDK's own note that is "refused, paid" (transition fees charged, nothing into the contest), and a new identity funded at 0.15 would be left holding its credits with the name unregistered until the network catches up or the app is reinstalled.
Two cheap mitigations, either or both: a doc comment on the pin in #1222 saying it must never run ahead of the network because of this ratchet, and clearing the ContestedUsernameFee.protocolVersion.* keys on wallet reset so a reinstall is not the only way out. A devnet re-genesis at a lower version hits the same path, but that is a devnet concern.
Issue being fixed or feature implemented
Platform protocol version 14 (4.2) halves the contest fund a contested DPNS name prefunds, 0.2 → 0.1 DASH (dashpay/platform#4634), so creating an identity for a contested name drops from 0.25 to 0.15 DASH. The app stated and funded 0.25 / 0.2 from two hard-coded constants.
The figure depends on the protocol version the network has activated, not on the build: sakura devnet is on 14, testnet and mainnet are on 13 today. Stating 0.15 to a network that still charges 0.2 gets the registration refused after the identity was paid for, so the app has to follow the network.
Android does the same in dashpay/dash-wallet#1583 and dashpay/dash-wallet#1584.
What was done?
ContestedUsernameFeeresolves the pair from the protocol version the SDK reports for the running network (refreshProtocolVersion(), no SDK change): 14 and later → 0.15 / 0.1 DASH, older or not known → 0.25 / 0.2. The version is read when the SDK runtime starts and when the create-username form or a contested Marketplace request opens.DWDP_MIN_BALANCE_FOR_CONTESTED_USERNAMEandUsernameMarketplaceService.contestedFundCreditsare removed: the form's cost rule and balance checks, the confirmation sheet, the coordinator's funding amount and the existing-identity top-up, the Marketplace request cost and its "not enough credits" gate.ContestedUsernameFee.Amounts.newIdentityFundingDuffs) read by both the form and the coordinator. A plain name paid from Shielded used to state 0.03 DASH on the form while the 0.1 denomination left the pool; the form now states 0.1 for that source.InvitationValidationPolicy.tier), so a version read after the form opened moves the gate too — on protocol 14 a 0.15 DASH voucher pays for a contested name, as Android'sisInviteForContestedNamesjudges it. The verdict no longer carries a tier fixed at check time.SwiftDashSDKHost.platformVersion(for:)) is bumped separately in fix(wallet): pin testnet to Platform protocol 14 #1222, which merges together with this PR. Until then testnet shows 0.25 / 0.2 even though it runs 14.Not in this PR:
How Has This Been Tested?
dashpayscheme, Debug, iOS Simulator (arm64): builds on currentdevelop.4034a3003):DashWalletTests, 1,279 tests on an iOS 27 simulator, 1 failure inString_DashWallet.testAssumptionThatCurrencySymbolIsEitherAtTheBeginningOrAtTheEnd(currency formatting, not touched here); includes the invitation tier tests inInvitationValidationPolicyTestsandPendingInvitationViewModelTests.d3ecb3915, 63 passing: newContestedUsernameFeeTests(16 — the figure per funding source, versions 13 / 14 / unknown, 13 → 14 activation, a lower or failed read never lowers a learned version, relaunch, per-network versions, runtime restart, no read once the reduced pair is known, the fund feeding the existing-identity requirement, and the confirmed-amount ceiling: Shielded refused after a 0.15 confirmation with and without a companion name), plusUsernameRegistrationRecoveryTests(23) andDWRegistrationPhaseAdapterTests(24).d3ecb3915), 13 October — 10 of 11 pass:developbuild on the devnet, then updated to this build: the fund moves from 0.2 to 0.1.Quorum not found for type 107for one quorum hash — which the same wallet had verified 79 proofs against four minutes earlier, before a relaunch re-read the devnet's quorum list. The devnet's quorum service had stopped listing a quorum Platform was still signing with.aa989ddae, 12 October 21:38 UTC; the two commits since do not touch the registration coordinator. 0.16 DASH in; asset lock73c16d4d8fedb293c6be36aaae693d751d91cb21e7584a3c38512e6e0e8e629fburns exactly 0.15 DASH (credit output 15,000,000 duffs); identity57oJVzTykxvVP9uyfzeMTgW3CvTAq6VcBunsr5iDpAqMis created and the name goes to the vote. The identity is left with 4,703,349,940 credits: 15,000,000,000 funded, 10,000,000,000 taken as the contest fund, the rest fees.developbuild (bcbb2e0bb) on the same devnet: it funds 0.25 DASH (f0b694a7117462053301be8d33cb8d244fae224ba2613cf564a93974955b9592) and the identity is left with 14,707,722,860 credits. The network takes the 0.1 fund either way;developstates 0.2 and over-funds by 0.1.Dapi client error: no available addresses to use. No SDK log was kept from those wallets; the error is the one the unlisted-quorum bans above end in.Breaking Changes
None.
Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes