Repository navigation
feat(swift-sdk): default SDK to the adaptive context provider in Auto mode - #5883
Conversation
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
✅ Final review complete — no blockers (commit e5efba7) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Verified the findings against head 0e19667 and the surrounding Rust provider and manager-lifecycle code. No blocking defects were confirmed; one stale test-documentation comment remains. Validation was static only: current code checks pass, but no Swift build/test result is available, and the automated review check remains pending.
💬 1 nitpick(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
1 finding(s) not shown inline (the lines are not part of this PR's diff)
💬 Nitpick: Update the test's description of the default provider
packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Platform/TestnetIdentityFetchTests.swift:4-5
This test constructs SDK(network: .testnet) without selecting a provider, so the new default makes it adaptive in Auto rather than a fixed trusted provider. It still obtains trusted quorum keys because no wallet manager serves it, but the parenthetical now names the wrong provider. Update the comment to distinguish the provider configuration from the source supplying its keys.
/// Live read of a known testnet identity through the default testnet SDK
/// (adaptive context provider in Auto, using trusted quorum keys without a
/// wallet manager, and seed DAPI nodes). It depends on testnet being
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: architecture-layering); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — The default-provider change affects proof trust selection and wallet-manager lifecycle compatibility, but the diff is neither large nor intricate enough to qualify as critical. - 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 quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Platform/TestnetIdentityFetchTests.swift`:
- [NITPICK] packages/swift-sdk/SwiftTests/SwiftDashSDKIntegrationTests/Platform/TestnetIdentityFetchTests.swift:4-5: Update the test's description of the default provider
This test constructs `SDK(network: .testnet)` without selecting a provider, so the new default makes it adaptive in Auto rather than a fixed trusted provider. It still obtains trusted quorum keys because no wallet manager serves it, but the parenthetical now names the wrong provider. Update the comment to distinguish the provider configuration from the source supplying its keys.
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The Swift SDK default now selects the existing Rust adaptive provider in Auto mode, with routing and manager ownership remaining Rust-owned. The documentation and targeted tests match the constructor behavior, trusted fallback, and explicit trusted opt-out; no actionable in-scope issues were found. This was a static review of e5efba7: current CI reports no failed checks, while the Swift SDK build-and-test check remains pending.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(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: architecture-layering); 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: 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 an intricate cross-language change that changes the default proof-verification trust root and runtime quorum-key source between the trusted service and an SPV wallet manager in SDK.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(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; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (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 the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
|
Non-inline nitpick (TestnetIdentityFetchTests.swift:4-5): Fixed in e5efba7: the description now says the default testnet SDK is the |
|
/self-reviewed |
… mode `SDK(network:)` built the trusted context provider, so every consumer that did not choose a provider verified proofs with the trusted quorum service's keys, even while a wallet manager on the same SDK ran a synced SPV client. `contextProvider` now defaults to `.adaptive`, which Rust builds in Auto mode: the trusted service's keys until a wallet manager configured with the SDK serves a synced SPV client, then SPV's, and the trusted service's for any key SPV cannot serve. An SDK no manager serves verifies exactly as before. Only one wallet manager serves an SDK, so configuring a second on the same default SDK while the first holds it now throws. The init doc and the CHANGELOG entry say so, with `.trusted` as the way back. The SwiftDashSDKIntegrationTests env replaces its manager, and tests build throwaway managers, on one SDK while another manager is alive; it now builds that SDK `.trusted` explicitly, so those opt-in tests run as before. Docs: `QuorumMode.auto` states that Auto is only as strong as the trusted service, and `quorumSource` reports the source asked first. Tests (SwiftDashSDKTests): testShouldBuildAnAdaptiveSdkInAutoByDefault fails on the old default, whose trusted SDK refuses `setQuorumMode`, and testShouldRefuseAModeChangeOnAnExplicitTrustedSdk pins the opt-out. No Xcode on the machine this was written on, so neither red nor green was run locally; CI's swift-sdk-build runs them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…om the trusted service The quorum mode picker's help, the indicator's help and AppState's mode docs described Auto as switching wholesale from trusted to SPV once SPV synced. Auto now asks the trusted service for any key SPV cannot serve, and the indicator shows the source asked first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…m mode A fresh AppState reads the mode saved in UserDefaults and builds its SDKs in it, so a user who chose SPV is not dropped back to Auto on restart. The parity manifest's restart coverage for the quorum mode cites this test. It passes on the base (no behaviour change); run by CI's SwiftExampleApp scheme. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-ups. In Auto, a key SPV cannot serve comes from the trusted service while the source reads SPV, so: - `SDKStatus.quorumSource`, the example app's AppState docs and the Options help say "the source asked first" rather than the live choice or "what is actually active"; - the indicator reads "SPV", not "SPV (trustless)"; - the help points at the Sync tab, where SPV starts; - `addContractToContext` adds to the SDK's context provider, which is no longer the trusted one by default. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…daptive `SDK(network: .testnet)` now builds the adaptive provider in Auto, which takes trusted quorum keys while no wallet manager serves it SPV; the test's description still named a fixed trusted provider. Co-Authored-By: Claude Opus 5.5 <[email protected]>
e5efba7 to
946f651
Compare
Merge v5.1-dev at d9d5689, which carries the squashed lifecycle PR (#4657) and the adaptive context provider work (#5882, #5883, #5884) plus #5830. Merge attributes were disabled; the merge is clean. Audit: the merge delta onto 1073d2e is byte-identical to the v5.1-dev delta onto the merged lifecycle head 84ac1e7 (47 files), so the squash reproduces the lifecycle content exactly and nothing of the mobile delta changes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Middle of GitHub Stack #5885 (#5882 → this → #5884)
Issue being fixed or feature implemented
SDK(network:)built the trusted context provider. So every SwiftDashSDK consumer that did not choose a provider verified Platform proofs with the trusted quorum service's keys. That includes dashwallet-ios, which buildsSDK(network:platformVersion:)and configures onePlatformWalletManageron it, and it held even while the manager ran a synced SPV client. With #5882, Auto mode is a safe default: SPV keys once SPV has synced, the trusted service before that and for any key SPV cannot serve.What was done?
SDK.init'scontextProviderdefaults to.adaptive. Rust builds it in Auto mode, so Swift sets no mode.PlatformWalletManagerserves (none configured withconfigure(sdk:)) verifies exactly as before, with the same trusted provider, quorum prefetch and contract cache. The observable differences are:setQuorumModenow succeeds;dash_sdk_get_statusreports a mode.await shutdown()the old manager first, or pass.trusted. dashwallet-ios builds a fresh SDK per manager, so it is not affected by the one-manager rule. Its proofs move to SPV keys on its next Platform pin bump.ContextProviderKind,QuorumMode.auto(only as strong as the trusted service; use.spvto fail closed) andquorumSource(the source asked first);[Unreleased]migration entry.SwiftDashSDKIntegrationTests' env builds its SDK.trustedexplicitly. It replaces its manager, and tests build throwaway managers, on that one SDK while another manager is alive.How Has This Been Tested?
SDKQuorumSourceTests.testShouldBuildAnAdaptiveSdkInAutoByDefault: the default SDK reports trusted, then SPV and trusted as the mode changes. It fails on the old default, whose trusted SDK refusessetQuorumMode.testShouldRefuseAModeChangeOnAnExplicitTrustedSdkpins the opt-out.AppStateQuorumModeTests.testShouldRestoreTheSavedQuorumModeOnLaunchchecks that a relaunch restores the saved mode. The parity manifest in feat(kotlin-sdk): bridge the adaptive context provider and build it by default #5884 cites it for restart coverage.swift-sdk-build).Breaking Changes
Source-compatible: only a default argument value changes. Behaviour changes for callers that relied on the default:
The CHANGELOG entry describes both and the way back (
contextProvider: .trusted). There is no!: the repository reserves!for consensus-breaking changes (coding conventions).Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
Summary by CodeRabbit