Repository navigation
feat: raise an identity key's budget or expiry from SwiftExampleApp - #6054
Conversation
`raised_key_limits` now refuses a disabled key, which Platform would refuse and charge for (40208). A key cannot be enabled again, so a held copy that shows it disabled is never too old to trust. `signing_key_for_key_limits_update` becomes public so a wallet can report which key would sign before it asks for a signature. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`IdentityWallet::preview_identity_key_limits_update` answers, without signing or sending anything, whether a key's limits can be raised, which key would sign, the limits the key carries and the ones a change would set. It refuses a missing or disabled key, a key without limits, a change that is not a raise, and a signer that holds no key allowed to sign. The update runs the same preview and signs with the key it picked, so the two cannot disagree. Exposed as `platform_wallet_preview_identity_key_limits_update` (plain data out, nothing to free) and `ManagedPlatformWallet .previewIdentityKeyLimitsUpdate` in Swift. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds an Update Limits sheet for keys that carry a budget or an expiry, opened from the key detail screen, a leading swipe on the keys list, and Settings > Platform State Transitions > Identity. Whether a key can be raised, which key signs and what a change would set all come from the wallet's preview; the sheet only parses the DASH amount and the picked date. A refusal from Platform is shown with its consensus code. After an update the detail screen shows the new limits and re-reads the remaining budget. A key refresh now keeps each key's contract bounds, which the refresh does not parse and which never change after registration. TEST_PLAN row ID-17. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
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 4 minutes. View limit details
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. |
|
📖 Book Preview built successfully. Download the preview from the workflow artifacts. Updated at 2026-11-22T18:19:32.008Z |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
⛔ Final review complete — 2 blocking finding(s) (commit 3ee0530) · triage: critical |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The PR leaves consensus unchanged, but the new Swift flow can sign a higher spending cap than the user reviewed, retry a raise that may already have landed, and overwrite confirmed limits with an older snapshot. On head 843c8b0, Rust workspace, wasm32, JS, Kotlin, and Platform test-suite checks passed; the Swift SDK build and tests were still pending, and no code check had failed. Six lower-priority findings were omitted under the comment budget.
🔴 9 blocking | 🟡 1 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Do not mix a new total with a pre-update remaining budget
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift:215-245
The total now follows currentKey, but the Remaining and Spent rows can still use the previous budget reading. For a key with 1,000 total and 400 remaining, raising the total to 1,500 can display 1,100 spent even though the raise does not change spending. Spent uses the old reading during loading, and a query failure leaves that reading in place. The sheet callback and keyed task can also race, and KeysListView keeps its previous reading on failure. Invalidate the old reading when the limits change, discard superseded completions, and only compute Spent from a reading that corresponds to the displayed total.
source: gpt-6.2-sol (phase2-reviewer: general)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 9: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 10: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 11: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 12: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The change spans the SDK, wallet, FFI, and Swift UI, but the submission path reuses the existing signer-selection rules and adds client-side preflight without changing signature construction, private-key handling, or consensus. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (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.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-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/rs-platform-wallet/src/wallet/identity/network/key_limits.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:159-172: Bind submission to the absolute limits and signer the user saw
The sheet checks that the form inputs still match its preview, but sends only the budget increment and requested expiry. The wallet then reads a new identity snapshot and computes the absolute limits and signer again. If the user reviewed 1,000 + 500 → 1,500 and a refresh raises the cached total to 1,200 before Submit, this path signs a cap of 1,700 without showing it. The signer can change too, and the sheet's “Signed by” row comes from the opening gate rather than the preview for the submitted inputs. Have Rust accept the reviewed absolute limits and signer, check them against the snapshot it will sign with, and return a stale-preview result before nonce acquisition or signing if they differ.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:159-169: Enforce nonempty updates in the Rust wallet, not only in FFI
The shared preview intentionally accepts `(None, None)` as an eligibility query. The submit method forwards that result to the SDK, which can fetch a nonce, sign, and send it: DPP reports identity-based structure validation as unsupported at that SDK check, and the SDK lets that result through. The node then rejects the empty transition with 10539. The existing Swift and FFI guards keep this off the new screen, but direct Rust callers can still violate the wallet method's documented contract. Keep the eligibility query and the submit requirement separate in Rust, and reject an empty submission before nonce acquisition while preserving the existing FFI invalid-parameter result.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:333-364: Prevent a second submission while the first raise is in flight or unconfirmed
The button is disabled while submitting, but `submit()` itself does not check `isSubmitting`, so a second queued task can still enter while the first awaits Rust. The catch also re-enables the same preview after every error, including `.transactionBroadcastUnconfirmed`, which already reaches Swift as a typed result. A new submission uses a fresh nonce and can incur a paid refusal against the old total or add the increment again if the cache has caught up. There is also a confirmed case: `replace_key` updates the cached key before the fallible store, and the resulting persistence error reaches Swift as a generic failure. Guard entry in `submit()`, and have the wallet distinguish and reconcile unresolved broadcasts and confirmed-but-not-persisted updates without sending a replacement, including after the sheet is reopened.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:367-375: Do not overwrite confirmed wallet key rows from a Swift refresh
The successful wallet call has already persisted the proved key through a targeted upsert. This follow-up fetches an independent identity snapshot and replaces every linked key row. A node one block behind can return the old limits at the same identity revision, so the refresh can persist and display the pre-raise cap or expiry after success. The replacement also omits `walletId` and `identityDerivationPath`, which the Rust-driven upsert preserves and mnemonic-only signers need. Read back the wallet's confirmed state instead. If a full refresh is needed, use `IdentityWallet::refresh_identity`; its fold already has a regression test for this same-revision lagging response.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:274-282: Refresh the wallet cache for keys discovered on another client
The app's Refresh Identity Data action calls `IdentityKeyRefresher`, which updates SwiftData but not the Rust wallet. A limited key added by another client, as suggested in ID-17, can therefore appear in the list while this preview rejects it as missing from `held_identity`. Repeating the app refresh or reopening the sheet does not synchronize that cache. The same row rebuild also writes a first-seen bound key as unbound: it parses `contractBounds` as nil and only restores bounds from rows it already knows. Route the managed-identity refresh through the wallet's proved `refresh_identity` path so the rows and the local preview use the same state, including bounds on newly discovered keys.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:239-246: Do not silently omit an expiry the user asked to extend
`millis(from:)` returns nil for a pre-1970 date, and the date picker supplies no lower bound. With Extend expiry on and a valid budget increment entered, nil crosses FFI exactly as it would with the toggle off. Rust can then preview and submit a paid budget-only change even though the user requested both. Track an enabled but unrepresentable date separately from an absent expiry and block preview and submission until it can be represented. Rust should still decide whether that date extends the existing limit.
In `packages/rs-platform-wallet-ffi/src/identity_key_limits.rs`:
- [BLOCKING] packages/rs-platform-wallet-ffi/src/identity_key_limits.rs:106-115: Release the wallet registry lock before invoking the host signer
`HandleStorage::with_item` holds the process-wide read guard while `block_on_worker` waits for the preview. The preview synchronously calls the host's `can_sign_with`; if that callback destroys even an unrelated wallet handle, it waits for the registry write guard while the preview waits for the callback. The callback contract does not exclude this, and the guard also unnecessarily spans the wallet-manager read. Clone the identity wallet under the guard and run the worker outside it, as `platform_wallet_pending_contact_crypto_count` does.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift:215-245: Do not mix a new total with a pre-update remaining budget
The total now follows `currentKey`, but the Remaining and Spent rows can still use the previous budget reading. For a key with 1,000 total and 400 remaining, raising the total to 1,500 can display 1,100 spent even though the raise does not change spending. Spent uses the old reading during loading, and a query failure leaves that reading in place. The sheet callback and keyed task can also race, and `KeysListView` keeps its previous reading on failure. Invalidate the old reading when the limits change, discard superseded completions, and only compute Spent from a reading that corresponds to the displayed total.
In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/ManagedPlatformWallet.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/ManagedPlatformWallet.swift:4155-4171: Keep the Swift signer alive through the Rust preview callback
The detached task passes a raw signer handle after `_ = signer`. That no-op is not a lifetime guarantee through the native call. `KeychainSigner` registers an unretained Swift context and destroys the native handle in `deinit`, while Rust uses both to call back from a worker. Pin the signer with `withExtendedLifetime` around the synchronous FFI call. Pin the wallet too: the closure retains only its numeric handle, which the wallet destroys in `deinit`. Apply the same lifetime guarantee to the adjacent update wrapper used by the new sheet.
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/ManagedPlatformWallet.swift:4148-4152: Throw for malformed identity IDs before marshalling them
`Identifier` is a `Data` alias, so the new public throwing API can receive a value of any length. `withFFIBytes` traps unless it has exactly 32 bytes, aborting the host before the method can throw. Rust cannot validate the supplied length because the ABI takes only a pointer. Validate the transport length in Swift, as `refreshIdentityBalance` already does.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
- The wallet's key limits update takes the reviewed preview and refuses, before a nonce is taken, to sign another total, expiry or signing key. It also refuses an update that raises nothing. - The FFI preview and update run outside the wallet registry guard, as both call back into the host signer. - New `platform_wallet_refresh_identity` / `refreshIdentity` folds a proved fetch into the wallet; the sheet and the key screen use it so a key added on another client is known to the preview. - Swift wrappers check the identity id length and pin the wallet and the signer through the native call. - The sheet guards against a second submission, offers none after an unconfirmed result, refuses an expiry it cannot send, and no longer re-fetches the identity after success (a lagging node could undo the raise on screen). The key screen shows a remaining budget only next to the total it was read for. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Re the review-level finding on |
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The new commit binds submission to the reviewed limits and signing key before nonce acquisition. It also changes a shipped C function’s signature in place, and the new refresh flow can report success after a failed store or let a delayed update overwrite newer wallet state. The Kotlin SDK build and emulator tests passed on this head; no end-to-end Swift result was available.
🔴 7 blocking | 🟡 2 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Do not let a delayed update proof roll back a newer key
packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:219-231
The new refresh path can fold a further raise or disable at H+1 after the update receives its proof at H but before it acquires this write lock. replace_key then persists the whole key from H, lowering the cached limit or marking the key enabled again. The lock orders writes, not proofs. Merge the proved result into the current key in ManagedIdentity, keeping higher limits and a later disable, and persist the merged row.
source: gpt-6.2-astra (phase2-reviewer: general)
Still open from earlier rounds (1)
- 🔴 Blocking: Prevent a second submission while the first raise is in flight or unconfirmed —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:409-424(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: Apply the known-disabled check to absolute SDK submissions
packages/rs-sdk/src/platform/transition/update_identity_key_limits.rs:96-103
The new disabled-target preflight applies to callers that use raised_key_limits, but a native caller supplying absolute limits to update_key_limits still goes straight to signer selection and nonce acquisition even when its identity contains the disabled target. The constructor checks the signing key, not the target, so this path can still send a paid refusal. Share the SDK’s known-disabled check with the absolute path without requiring the target to be present in a documented signer-only identity.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — Inpackages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs, the update path now selects the signing key and checks that the limits it is about to sign still match the user's reviewed preview, making this an intricate change to signing authorization even though consensus rules are unchanged. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (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)
- Code unchanged since the last final review (
843c8b02): 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— 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/rs-platform-wallet-ffi/src/identity_key_limits.rs`:
- [BLOCKING] packages/rs-platform-wallet-ffi/src/identity_key_limits.rs:160-169: Keep the shipped C signature for key-limit updates
The base revision and v5.0.2 export this same symbol with `signer_handle` as the eighth and final argument. A caller built against that signature passes its signer where the new function reads `reviewed_preview`, and never supplies the new signer argument. This can cause an invalid memory access; nullability only helps callers that actually pass the ninth argument. Keep the original export forwarding without a preview, add a separately named reviewed-update export, and preserve the existing public Rust method as a forwarding method rather than adding a required `Option` argument.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift:399-406: Do not mix a new total with a pre-update remaining budget
`forTotal` records the row’s total at request start, not the total at the block that proved the remaining balance. After a raise changes total/remaining from 1,000/400 to 1,500/900, a newly started query can still get a valid proof for 400 from the previous block: this query uses the SDK’s default one-block height tolerance, and its FFI result carries no height or corresponding total. The guard accepts it and shows 1,100 spent instead of 600. Have Rust provide a coherent proved reading, and leave remaining and spent unknown until it does. Use that reading in the list too; its current task key only tracks budgeted key IDs, so a refresh that changes a total can leave an old remaining amount on the row.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:113-122: Refresh the wallet cache for keys discovered on another client
A successful opening refresh fixes the wallet lookup, but the changed Swift row writer still copies bounds only for keys it already knows. A first-seen bound key is saved with `contractBounds: nil`, and cold restore passes that row back to Rust as unbound. The new sheet uses that restored identity for signer selection when its best-effort refresh fails, so Rust can offer a bound CRITICAL key as an unbound signer. Even a successful fetch only upserts keys that differ from the cache, not rows changed independently by Swift. Use the proved wallet refresh for managed-identity discovery rather than reconstructing those rows from JSON and old bounds.
In `packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:156-162: Fence limit updates to the wallet handle’s generation
`held_identity` looks up by wallet ID alone, and the post-broadcast write at lines 222–230 does the same. Removing a wallet and reimporting the same seed on the same network reuses the ID but creates a new generation. A retained handle can read the replacement’s identity or apply a delayed result to it through the old handle’s persister. Use `current_wallet_info` and `current_wallet_info_mut` under the respective manager locks, while keeping the FFI registry guard out of signer and network calls.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:219-231: Do not let a delayed update proof roll back a newer key
The new refresh path can fold a further raise or disable at H+1 after the update receives its proof at H but before it acquires this write lock. `replace_key` then persists the whole key from H, lowering the cached limit or marking the key enabled again. The lock orders writes, not proofs. Merge the proved result into the current key in `ManagedIdentity`, keeping higher limits and a later disable, and persist the merged row.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:68-76: Distinguish a present limit from one that can still be raised
The no-change preview enables the action based on `has_limits()`. A budget-only key at `u64::MAX` therefore passes even though every positive top-up overflows and it cannot acquire an expiry. The same applies to an expiry-only key at the maximum timestamp. Have the Rust eligibility check refuse when no present limit can be raised, and cover the case where one limit is maximal but the other can still increase.
In `packages/rs-platform-wallet-ffi/src/wallet.rs`:
- [BLOCKING] packages/rs-platform-wallet-ffi/src/wallet.rs:46-52: Do not report synchronized key rows after a failed refresh store
The new refresh API promises to deliver changed key rows, but `fetch_and_fold_identity` logs a failed `store_fetched_identity` and returns success. SwiftData can reject the changeset at commit, after the Rust cache has already advanced. A second refresh of the identical proof then sees no key diff and sends no key upsert, so the persisted row can stay stale even after a retry. Have the Rust refresh path report the failure and retain the failed upsert for local retry before reporting that the rows are synchronized.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:420-424: Do not replace a newer edit with the failed submission’s preview
The form stays editable during submit. If the user submits A, edits to B, and B’s preview finishes before A gets a definitive rejection, the catch manually previews A. That call is outside the keyed task, so its cancellation check cannot protect B. A’s result can displace B’s and leave Submit disabled until the next edit. On a safe-to-retry failure, preview only the live inputs and discard any result whose inputs no longer match the form.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:409-424: Prevent a second submission while the first raise is in flight or unconfirmed
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4657941808)
…the proved key - `platform_wallet_update_identity_key_limits_with_signer` and the wallet method keep the signature v5.0.2 shipped. Signing a reviewed preview is a separate export and method (`..._as_reviewed_...`), which derives the change from the preview and signs exactly it or nothing. The Kotlin JNI caller is back to its original form. - The update reads and writes only this handle's wallet generation, and merges the proved key into the held one (higher limits, a later disable kept) instead of overwriting a newer state a refresh took in. - The sheet offers nothing until a proved refresh of the identity succeeds, and drops a preview that no longer matches the form. - The key screen no longer derives a "spent" figure from a total and a remaining budget that may come from different blocks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
|
Re the review-level finding "Do not let a delayed update proof roll back a newer key" ( |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head restores the shipped C signature, but the new reviewed API does not bind the target identity and key, and the Settings picker can crash on a valid key ID. Static review and git diff --check are complete; Kotlin SDK build/tests and the book preview passed, while review and PR Hygiene checks remain pending. One lower-priority suggestion was omitted under the 10-finding cap.
🔴 7 blocking | 🟡 2 suggestion(s)
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Keep one persisted row per key when refreshing a managed identity
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:123-126
publicKeys.removeAll() unlinks the original rows without deleting them, then the refresher appends replacements with the same (identityId, keyId). The documented Bluetooth setup path does this after the wallet has already persisted the limited key. When a raise later succeeds, persistIdentityKeys takes the first matching row with no uniqueness constraint or parent filter, and only links rows on insertion. It can update the detached original while the detail view continues showing the linked replacement's old limit. Use the wallet's refresh for managed identities and verify registration, refresh, and a limits upsert leave one linked row with the confirmed values, including cleanup of duplicates already in the store.
Raised on code unchanged since the last review, and confirmed by an independent pass: Register a Bluetooth login key with a 0.01 DASH budget, let the post-registration refresh complete, then use Update Limits to raise it to 0.02 DASH. If the persistence fetch returns the detached registration row first, Platform confirms the raise and the sheet closes, but Key Detail still reads 0.01 DASH from the linked replacement, even after relaunch.
source: gpt-6.2-astra (phase2-reviewer: general)
🔴 Blocking: Do not mix a new total with a pre-update remaining budget
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeysListView.swift:281-294
The list still renders “X of Y DASH left,” but it caches X by key ID and its task only observes the IDs of budgeted keys. A refresh that raises an existing key's total does not invalidate that reading, so the list can keep showing the pre-raise balance against the new cap. Detail's forTotal guard rejects responses started under a different local total, but it cannot detect a pre-raise proof returned by a new request: the FFI provides neither proof height nor the corresponding total. Invalidate list readings on total changes, discard superseded responses, and show remaining as unknown or explicitly historical when it cannot be ordered against the raise.
source: muse-spark-1.3-contributor (phase1-reviewer: general, rust-quality); gpt-6.2-astra (phase2-reviewer: general, ffi-engineer)
Still open from earlier rounds (2)
- 🔴 Blocking: Do not report synchronized key rows after a failed refresh store —
packages/rs-platform-wallet-ffi/src/wallet.rs:52-54(thread) - 🔴 Blocking: Refresh the wallet cache for keys discovered on another client —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:113-122(thread)
Disputed — left to maintainers (1)
- 🔴 Blocking: Prevent a second submission while the first raise is in flight or unconfirmed —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:333-364(thread)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The wallet’s intricateupdate_identity_key_limits_as_reviewed_with_external_signerpath changes which identity key signs, binds the signed limits to what the user reviewed, and merges the proved key into wallet state after signing. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (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)
- Code unchanged since the last final review (
20b91230): 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.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— 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/rs-platform-wallet/src/wallet/identity/network/key_limits.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:219-229: Bind the reviewed preview to the target identity and key
The new API takes the target separately from the reviewed value. The equality check compares the current and proposed limits and signer ID, but neither target identifier. Two limited keys with identical limits and the same MASTER signer produce equal previews, so a client that changes selection can submit a preview for one key and grant spending authority to the other. The example sheet keeps its target fixed, but the public Rust, C, and Swift interfaces do not enforce that. Carry both target identifiers in the preview and verify them before nonce acquisition; cover two otherwise identical keys in the regression test.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:320-324: Do not let a delayed update proof roll back a newer key
The merge preserves a cached disable when the proved key has no timestamp, but not when both keys are disabled. The affected-state verifier checks the requested limits, not `disabled_at`, and Drive can stamp the key again on a later disable. If a delayed proof carries the first disable and the cache has already folded the second, `replace_key` persists the earlier timestamp. Preserve the later timestamp and add a test with two non-`None` timestamps; the current test only covers a proved key with no disable.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:459-467: Preserve unsigned key IDs when building the all-identities picker
The new Settings picker projects every key for each managed identity before filtering for limits. The wallet persists a protocol `UInt32` key ID as `Int32(bitPattern:)`, but `PersistentPublicKey.toIdentityPublicKey()` reads it with `KeyID(keyId)`, which traps when the stored high bit is set. A valid high-bit ID on an unlimited key in an unrelated managed identity can therefore crash the picker before the user selects anything. Use bit-pattern conversion in both model directions and cover a high-bit persisted row alongside another identity's limited key.
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:102-105: Display current and proposed limits from the same preview
The “now” section uses the opening gate while the result uses the concrete preview. If the sheet opens at 1,000 credits and the wallet learns of a raise to 1,200 before previewing a 500-credit top-up, the form shows 1,000 now, 500 added, and 1,700 after. The two signer labels can also disagree. When a concrete preview matches the live inputs, render its current limits and signer alongside its proposed values; use the opening gate as the fallback.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:123-126: Keep one persisted row per key when refreshing a managed identity
`publicKeys.removeAll()` unlinks the original rows without deleting them, then the refresher appends replacements with the same `(identityId, keyId)`. The documented Bluetooth setup path does this after the wallet has already persisted the limited key. When a raise later succeeds, `persistIdentityKeys` takes the first matching row with no uniqueness constraint or parent filter, and only links rows on insertion. It can update the detached original while the detail view continues showing the linked replacement's old limit. Use the wallet's refresh for managed identities and verify registration, refresh, and a limits upsert leave one linked row with the confirmed values, including cleanup of duplicates already in the store.
_Raised on code unchanged since the last review, and confirmed by an independent pass: Register a Bluetooth login key with a 0.01 DASH budget, let the post-registration refresh complete, then use Update Limits to raise it to 0.02 DASH. If the persistence fetch returns the detached registration row first, Platform confirms the raise and the sheet closes, but Key Detail still reads 0.01 DASH from the linked replacement, even after relaunch._
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:113-122: Refresh the wallet cache for keys discovered on another client
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4658019529)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeysListView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeysListView.swift:281-294: Do not mix a new total with a pre-update remaining budget
The list still renders “X of Y DASH left,” but it caches X by key ID and its task only observes the IDs of budgeted keys. A refresh that raises an existing key's total does not invalidate that reading, so the list can keep showing the pre-raise balance against the new cap. Detail's `forTotal` guard rejects responses started under a different local total, but it cannot detect a pre-raise proof returned by a new request: the FFI provides neither proof height nor the corresponding total. Invalidate list readings on total changes, discard superseded responses, and show remaining as unknown or explicitly historical when it cannot be ordered against the raise.
In `packages/rs-platform-wallet-ffi/src/wallet.rs`:
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/wallet.rs:50-52: Check the wallet generation before the refresh membership lookup
The new export reaches `fetch_and_fold_identity`, whose initial read looks up the wallet by ID alone. Manager removal does not revoke a retained wallet wrapper. After reimport under the same ID, the old wrapper returns `IdentityNotFound` for an identity absent from the replacement but starts a DAPI request for one present in it. The generation check before applying the result prevents a stale write, not the membership check or outbound query. Use `current_wallet_info` for the initial read as well.
- [BLOCKING] packages/rs-platform-wallet-ffi/src/wallet.rs:52-54: Do not report synchronized key rows after a failed refresh store
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4658019537)
…ity and key - The preview carries the identity and key it raises, and the reviewed update takes only the preview, so a preview for one key cannot raise another with the same limits. - Merging a delayed proof keeps the later of two disable stamps. - The identity refresh checks the handle's wallet generation before it sends a query. - Swift: persisted key ids round-trip as their UInt32 bit pattern, the key refresher deletes the rows it replaces instead of leaving them unlinked in the store, the keys list shows a remaining budget only next to the total it was read for, and the sheet shows current and new limits from the same preview. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
|
Re the review-level finding "Keep one persisted row per key when refreshing a managed identity" ( |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Reviewed submission now binds the target identity and key without changing the shipped C ABI. This head’s Swift refresh deletes metadata needed by mnemonic-backed signers, and the new Limits entry points can still trap on high-bit key IDs. The Kotlin emulator build and tests passed; review and hygiene checks are pending, and the funded iOS flow has not been exercised.
A pattern across this PR's review rounds
This is review round 4, and the PR has drawn 20 blocking findings so far. 11 of them share 4 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. Two writers for managed keys (1 new in this round, 4 earlier finding(s))
IdentityKeyRefresher rebuilds PersistentPublicKey rows from a separate fetch, while the Rust wallet folds proved keys into its cache and upserts those same rows. Removing the sheet’s post-submit refresh stopped one stale overwrite, but manual refresh and ShareLoginKeyView still use the other writer. Deleting the old rows avoids leaving a detached duplicate for the wallet upsert to find, but now the replacement can lose the walletId and identityDerivationPath that KeychainSigner needs.
In this round: Preserve mnemonic signing metadata when refreshing keys
2. A proved key is not necessarily a saved key (2 earlier finding(s))
Both store_fetched_identity and replace_key advance the wallet cache before the host store commits. Refresh logs a failed store and computes its next upsert against the already-advanced cache, so fetching the same proof again need not repair the row. After a confirmed raise, a failed store reaches the sheet as a generic error rather than a landed change that needs local repair.
Already tracked: #5542
3. Key IDs are converted at each call site (1 new in this round, 1 earlier finding(s))
Protocol key IDs are UInt32, but SwiftData and the legacy Keychain lookup carry them as Int32, and each caller handles that conversion itself. PersistentPublicKey now preserves the bit pattern for the Settings picker, but KeysListView and KeyDetailView still use trapping numeric conversions before reaching the Limits action.
In this round: Handle unsigned key IDs on the list and detail Limits entry points
4. Remaining budget has no shared snapshot (1 new in this round, 2 earlier finding(s))
The views read the total from a key row and the remaining amount from fetchKeysRemainingBudgets, which returns neither the corresponding total nor the proof height. Tagging a response with the total visible when the request started cannot identify a lagging proof, and the list’s sheet callback and keyed task can still publish their results out of order.
In this round: Let the total-keyed task own the remaining-budget reload
Suggested decision (land the prerequisite first): Land one wallet-owned path for reconciling managed identity keys into SwiftData before shipping the Limits screen. That path must preserve local signing metadata, distinguish a proved change from a committed row, and let the host retry a failed write without submitting another transition. If that prerequisite does not land first, leave the SwiftExampleApp Limits flow out of this PR.
🔴 6 blocking | 🟡 2 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Return IdentityNotFound if the identity disappears during refresh
packages/rs-platform-wallet/src/wallet/identity/network/loading.rs:530-532
Removing an identity from a live wallet’s manager does not change the wallet generation. If that happens during the fetch, the second generation check passes, managed_identity_mut returns None, and the new export reports success without folding anything into the wallet. Recheck identity membership under the write lock and return IdentityNotFound, as refresh_identity_balance does.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
Still open from earlier rounds (3)
- 🔴 Blocking: Refresh the wallet cache for keys discovered on another client —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:113-122(thread) - 🔴 Blocking: Do not report synchronized key rows after a failed refresh store —
packages/rs-platform-wallet-ffi/src/wallet.rs:50-54(thread) - 🔴 Blocking: Do not mix a new total with a pre-update remaining budget —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift:393-396(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: Apply the known-disabled refusal to absolute SDK updates too
packages/rs-sdk/src/platform/transition/update_identity_key_limits.rs:192-200
The new preflight check protects relative raises, but a direct UpdateIdentityKeyLimits::update_key_limits call still obtains a nonce and signs even when the supplied identity contains a disabled target. The DPP constructor resolves only the signing key, so it does not catch that target before broadcast. Reuse the known-disabled check in the absolute path before nonce acquisition, while continuing to allow partial identities that do not contain the target at all.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The wallet'supdate_identity_key_limits_as_reviewed_with_external_signerchanges a signature and key-handling path by binding the identity, target key, signer, and exact spending limits to the reviewed preview across concurrent wallet updates. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (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)
- Code unchanged since the last final review (
480fea41): 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
Several findings on this PR share an underlying cause (the review's "pattern" section): Two writers for managed keys; A proved key is not necessarily a saved key; Key IDs are converted at each call site; Remaining budget has no shared snapshot. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land one wallet-owned path for reconciling managed identity keys into SwiftData before shipping the Limits screen. That path must preserve local signing metadata, distinguish a proved change from a committed row, and let the host retry a failed write without submitting another transition. If that prerequisite does not land first, leave the SwiftExampleApp Limits flow out of this PR. If that decision is not yours to make, say so to the PR's author or maintainer.
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/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:127-131: Preserve mnemonic signing metadata when refreshing keys
The new deletion removes the old key row, but its replacement copies only the Keychain identifier and contract bounds, not `walletId` or `identityDerivationPath`. For a mnemonic-backed MASTER key with no stored scalar, `KeychainSigner.canSign` needs both fields to use the seed. `ShareLoginKeyView` runs this refresh immediately after delivering a limited key, so the MASTER that just authorized registration can become unavailable for raising or revoking that key. A proved refresh cannot reconstruct the missing path: unchanged keys emit no upsert, and refresh upserts carry no derivation indices. Update the existing row in place or preserve both fields for the same public key, and test the registration-to-refresh path with a mnemonic-only signer.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:123-130: Keep one persisted row per key when refreshing a managed identity
Deleting the linked rows stops this refresh from leaving new orphans, but `identity.publicKeys` cannot see rows an older build already unlinked. `PlatformWalletPersistenceHandler.persistIdentityKeys` updates the first `(identityId, keyId)` match and only attaches a parent when inserting. On an upgraded store, a confirmed raise can therefore update an orphan while `KeyDetailView.currentKey` continues to read the old limit from the linked row. The upsert only needs to prefer the owning identity’s linked row; it does not need a store-wide cleanup. Cover an upsert with both a linked row and a pre-existing orphan.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:113-122: Refresh the wallet cache for keys discovered on another client
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4658019529)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeysListView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeysListView.swift:62-64: Handle unsigned key IDs on the list and detail Limits entry points
The model now projects a stored high-bit key ID correctly, but the list calls `hasPrivateKey(for:)` before rendering the new Limits swipe. That helper at line 334 still uses `Int32(publicKey.id)`, which traps for a valid `UInt32` ID above `Int32.max`; one such row can prevent access to the entire list. `KeyDetailView.hasPrivateKey` has the same conversion. Use `Int32(bitPattern:)` wherever these views pass a protocol ID into the signed storage or Keychain carrier, and cover rendering a list with a high-bit key.
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeysListView.swift:141-143: Let the total-keyed task own the remaining-budget reload
A successful raise can start both this unstructured reload and the `.task(id:)` reload when the new total appears. If a load captures the old rows and finishes after the new load, its unconditional dictionary assignment replaces the new reading; the total guard then hides the stale entry and leaves the current row without a reading. Remove the redundant success callback and discard cancelled or superseded keyed loads before they publish.
In `packages/rs-platform-wallet/src/wallet/identity/network/loading.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/loading.rs:530-532: Return IdentityNotFound if the identity disappears during refresh
Removing an identity from a live wallet’s manager does not change the wallet generation. If that happens during the fetch, the second generation check passes, `managed_identity_mut` returns `None`, and the new export reports success without folding anything into the wallet. Recheck identity membership under the write lock and return `IdentityNotFound`, as `refresh_identity_balance` does.
In `packages/rs-platform-wallet-ffi/src/wallet.rs`:
- [BLOCKING] packages/rs-platform-wallet-ffi/src/wallet.rs:50-54: Do not report synchronized key rows after a failed refresh store
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4658019537)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift:393-396: Do not mix a new total with a pre-update remaining budget
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4658019525)
…dentity's key rows - `IdentityKeyRefresher` refreshes an identity a wallet holds through the wallet's proved refresh, which upserts the changed rows and keeps each row's wallet id, derivation path and Keychain reference. It rebuilds rows from a plain fetch only for identities no wallet holds. Every caller passes the wallet. - The persister updates the row linked to its identity when an older refresh left an unlinked copy with the same key id. - The keys list and key detail screens convert key ids by bit pattern, and the list's remaining-budget reload runs only from its keyed task. - The wallet's identity refresh returns IdentityNotFound if the identity was removed while the fetch was in flight. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Round 4 follow-ups at 258ca06:
|
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
At 258ca06, the loaded-wallet refresh now uses Rust, and the list no longer launches a competing reload after a raise. The revised key-row upsert still treats a failed lookup as an empty result, which can commit a duplicate after a confirmed raise. This was a static review: Kotlin CI and the SwiftData model-coverage check passed, review and PR Hygiene remain pending, and no end-to-end Swift run with the new native symbols was reported.
A pattern across this PR's review rounds
This is review round 5, and the PR has drawn 21 blocking findings so far. 6 of them share 3 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. A proved key is not necessarily a saved key (2 earlier finding(s))
Both store_fetched_identity and replace_key advance the Rust cache before SwiftData commits, but the wallet does not retain the failed key write for retry. Refresh logs the failure and can skip the key on the next identical fetch; a confirmed raise instead reaches the sheet as an error that can lead to another submission rather than local repair.
Already tracked: #5542
2. One writer does not guarantee one key row (1 new in this round, 1 earlier finding(s))
persistIdentityKeys looks up (identityId, keyId), but SwiftData does not enforce that pair as unique. Routing managed refreshes through the wallet stops the old row rebuild, and preferring an attached row avoids updating a detached copy, but a failed lookup can still insert a second attached row and leave Key Detail reading the old one.
In this round: Do not insert a key row when the lookup for its existing row fails
3. Remaining budget has no shared snapshot (2 earlier finding(s))
KeysListView and KeyDetailView read the total from the saved key, while fetchKeysRemainingBudgets returns neither a matching total nor a proof height. Tagging the response with the total visible when the request started filters out superseded loads, but it cannot tell whether a new request got a pre-raise answer.
Suggested decision (land the prerequisite first): Land the wallet-owned SwiftData reconciliation path separately before shipping the SwiftExampleApp Limits flow. That path must keep one attached row per managed key without losing signing metadata, distinguish a proved change from a saved row, and let the app retry a failed local write without signing another raise. If that prerequisite stays out of scope, leave the Limits flow out of this PR.
🔴 5 blocking
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Handle unsigned key IDs on the list and detail Limits entry points
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/IdentitiesView.swift:34
The conversions inside Keys List and Key Detail are fixed. The mounted identities tab renders IdentityRow.hasAnyPrivateKey before the user can navigate to either screen, and that check still uses Int32(publicKey.id). If no earlier Keychain lookup succeeds, a valid ID above Int32.max traps while rendering the identity row. Preserve the bit pattern at this lookup too, and test navigation with a high-bit key and no earlier Keychain hit.
if km.hasPrivateKey(identityId: identity.identityId, keyIndex: Int32(bitPattern: publicKey.id)) {
source: gpt-6.2-astra (phase2-reviewer: general)
Still open from earlier rounds (2)
- 🔴 Blocking: Preserve mnemonic signing metadata when refreshing keys —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:47-54(thread) - 🔴 Blocking: Do not report synchronized key rows after a failed refresh store —
packages/rs-platform-wallet-ffi/src/wallet.rs:44-54(thread)
Disputed — left to maintainers (1)
- 🔴 Blocking: Do not mix a new total with a pre-update remaining budget —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift:399-406(thread)
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: Document buffer and callback lifetimes for C callers
packages/rs-platform-wallet-ffi/src/identity_key_limits.rs:109-112
The new preview export describes ownership of the output but not the requirements for supplying it. It reads 32 bytes from identity_id, writes an aligned preview struct, and borrows the signer and host callback context while the Rust worker runs. Swift satisfies those requirements, but the generated header does not tell direct C callers about them. Document those preconditions for the preview, and document the readable preview pointer and signer lifetime on the reviewed-update export.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
🟡 Suggestion: Share the monotonic limit merge with identity refresh
packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:325-329
managed_identity/identity_ops.rs already implements the same higher-budget and later-expiry rule in with_raised_limits. Reuse that helper for the confirmed-key fold so the two wallet paths cannot drift on how they preserve limits. Keep the disable policy separate: a full identity refresh can reflect Core re-enabling a masternode key, while a delayed limits-update proof must not replace a newer disable.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
🟡 Suggestion: Use the validated preview as the sole submission target
packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:241-247
The public reviewed API takes its target from the preview, but submit_key_limits_update still accepts separate identity and key IDs and uses those for the SDK call and cache lookup. Both callers currently pass matching values. Removing the redundant parameters and using preview.identity_id and preview.key_id makes that invariant explicit at the point of signing and persistence.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The change is intricate and directly alters signing and key handling inupdate_identity_key_limits_as_reviewed_with_external_signerand the wallet’s post-proof key merge, even though it does not change consensus rules. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (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)
- Code unchanged since the last final review (
b86a993f): 3 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
Several findings on this PR share an underlying cause (the review's "pattern" section): A proved key is not necessarily a saved key; One writer does not guarantee one key row; Remaining budget has no shared snapshot. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land the wallet-owned SwiftData reconciliation path separately before shipping the SwiftExampleApp Limits flow. That path must keep one attached row per managed key without losing signing metadata, distinguish a proved change from a saved row, and let the app retry a failed local write without signing another raise. If that prerequisite stays out of scope, leave the Limits flow out of this PR. If that decision is not yours to make, say so to the PR's author or maintainer.
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/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletPersistenceHandler.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletPersistenceHandler.swift:4265-4271: Keep one persisted row per key when refreshing a managed identity
The linked-row preference only runs on rows whose stored identity string matches Base58. `LoadIdentityView` can reload an existing wallet-linked identity, unlink its old Base58 rows, and attach replacements tagged with the hex identity ID. The next confirmed raise can then update the Base58 orphan while Key Detail and cold restore continue to read the stale attached row. Resolve the parent by its binary identity ID and match its related key by protocol key ID before consulting the legacy string lookup. Cover a store with a Base58 orphan and a hex-tagged attached row; no store-wide cleanup is needed.
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletPersistenceHandler.swift:4269-4272: Do not insert a key row when the lookup for its existing row fails
`(try? backgroundContext.fetch(descriptor)) ?? []` treats a read error as proof that the key does not exist. If the subsequent parent lookup and save succeed, a confirmed raise can append a second attached row for the same key ID and report success. Key Detail can keep reading the old row, and cold restore receives both. Insert only after a successful lookup finds no match; propagate a lookup error through `persistIdentityKeysCallback` so the existing changeset rollback runs. This is distinct from retrying a store that was correctly reported as failed.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/IdentitiesView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/IdentitiesView.swift:34: Handle unsigned key IDs on the list and detail Limits entry points
The conversions inside Keys List and Key Detail are fixed. The mounted identities tab renders `IdentityRow.hasAnyPrivateKey` before the user can navigate to either screen, and that check still uses `Int32(publicKey.id)`. If no earlier Keychain lookup succeeds, a valid ID above `Int32.max` traps while rendering the identity row. Preserve the bit pattern at this lookup too, and test navigation with a high-bit key and no earlier Keychain hit.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Services/IdentityKeyRefresher.swift:47-54: Preserve mnemonic signing metadata when refreshing keys
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4658281340)
In `packages/rs-platform-wallet-ffi/src/wallet.rs`:
- [BLOCKING] packages/rs-platform-wallet-ffi/src/wallet.rs:44-54: Do not report synchronized key rows after a failed refresh store
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4658019537)
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.
- Preserve high-bit key IDs in legacy private-key import and reveal —
PrivateKeyViewstill traps on a high-bit ID when revealing or forgetting a private key, andLoadIdentityViewstill traps when matching such an ID to a supplied scalar. These conversions predate the PR and are outside the Limits navigation and submission paths.- Follow-up: Use
Int32(bitPattern:)for the legacy signed Keychain carrier and row matching in both workflows, and cover import, reveal, and forget with a high-bit key.
- Follow-up: Use
…aded wallet's rows - `persistIdentityKeys` skips an upsert whose lookup fails instead of inserting a second row for the key. - `IdentityKeyRefresher` refuses to rebuild rows for an identity held by a wallet that is not loaded, since the rebuild would drop the wallet id and derivation path the signer needs. - The identities tab converts key ids by bit pattern. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
…r a refusal After Platform refuses a submission, the sheet offers the reviewed preview again, with its absolute limits unchanged, instead of a fresh preview that could read a copy a refresh moved meanwhile and offer the increment on top of it. Rust refuses the reviewed preview before a nonce if the copy moved. The wallet's error for an identity that left the wallet during the proof wait now says the requested limits were proved on Platform, rather than that this update landed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
The sheet now restores the reviewed preview directly after a refusal, and the wallet no longer attributes an affected-state proof to this particular submission. Four blockers remain: an independent preview task can replace the restored offer, the sheet treats known pre-signing refusals as uncertain outcomes, store-writing calls can outlive manager shutdown, and preflight can approve an expiry already past at a proved block. The Kotlin emulator build and tests passed in live CI; only review gates remained pending, this review was static, and one lower-priority suggestion was omitted for the comment budget.
A pattern across this PR's review rounds
This is review round 11, and the PR has drawn 34 blocking findings so far. 19 of them share 4 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.
1. Key reconciliation stops at the Rust cache (1 new in this round, 5 earlier finding(s))
replace_key and store_fetched_identity advance the Rust cache before SwiftData commits, but neither retains a failed key upsert, so refreshing the same proof can leave the saved row stale. Keeping the sheet on the handle it refreshed closes one gap, but PlatformWalletManager.shutdown does not drain that handle's refresh and update calls. The monotonic merge protects one manager's cache, not the SwiftData rows an outgoing manager can still write after its replacement restores them.
Already tracked: #5542
In this round: Drain key-limit writes before restoring a replacement manager
2. The sheet reconstructs the submission outcome (2 new in this round, 3 earlier finding(s))
The reviewed-update FFI maps both a stale preview rejected before signing and a proved raise that could not be applied locally to ErrorUnknown, so UpdateKeyLimitsView uses a consensus code and another cache read to decide whether to offer a retry. The recovery handler and the debounced form task can both replace inputPreview, so restoring the exact reviewed offer in one path does not stop the other from publishing a larger raise. The submission lock belongs to the sheet and is lost when it closes.
Already tracked: #6063
In this round: Prevent an in-flight form preview from replacing the reviewed retry; Carry the wallet’s submission disposition through FFI
3. Managed key rows still have two writers (7 earlier finding(s))
IdentityKeyRefresher now delegates held identities to the wallet, but LoadIdentityView can still unlink and rebuild their PersistentPublicKey rows without the wallet ID and derivation path used for signing. The parent-first lookup in persistIdentityKeys repairs which row receives an upsert, but it cannot stop the next reload from replacing that row or recover signing metadata the reload discarded.
Already tracked: #6074
4. Total and remaining budget have no shared proof (2 earlier finding(s))
KeyDetailView and KeysListView take the total from the saved key, while fetchKeysRemainingBudgets returns neither the matching total nor the proof height. Tagging a reading with the total at request time rejects superseded requests, but cannot tell whether a new response was proved before the raise.
Already tracked: #6064
Suggested decision (land the prerequisite first): The discussion kept Update Limits and deferred wallet reconciliation; the latest patches did not change that decision. Land wallet-owned managed-key reconciliation separately before enabling Update Limits in SwiftExampleApp. It must carry the reviewed attempt's outcome through FFI and reconcile the attached key row across manager replacement, so a failed local write can be retried without signing another raise. If reconciliation remains deferred, leave Update Limits out of this PR.
🔴 4 blocking | 🟡 1 suggestion(s)
Follow-up candidates (optional) (5)
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: Recheck detail-screen eligibility when the wallet or signer changes
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/KeyDetailView.swift:277-281
LimitsTaskKey includes only the target key’s fields, but the eligibility result depends on the loaded wallet and the identity’s other signing keys. If a refresh adds a usable CRITICAL signer without changing the target, the task does not rerun and the detail button remains disabled. The reverse can leave the button enabled until the sheet refuses. Give the eligibility check its own invalidation key that follows the wallet instance and signing-state changes, without reloading the remaining budget on a signer-only change.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
🟡 Suggestion: Apply the known-disabled check to absolute-limit submissions too
packages/rs-sdk/src/platform/transition/update_identity_key_limits.rs:96-101
The public absolute-limit Identity::update_key_limits API bypasses the disabled-target check in raised_key_limits. When the identity contains a disabled target and a separate eligible authorizing key, this method still requests a nonce and signs: the DPP constructor looks up the authorizing key, not the target. Share the SDK preflight and reject a known-disabled target before acquiring a nonce. Preserve the documented signer-only snapshot path: a target missing from the local snapshot is not evidence that it is disabled.
source: gpt-6.2-astra (phase2-reviewer: architecture-layering)
🟡 Suggestion: Direct preview consumers to the reviewed submission export
packages/rs-platform-wallet-ffi/src/identity_key_limits.rs:7-10
The module overview directs callers to the increment-based export and says it cannot disagree with the preview. It uses a new wallet snapshot: if the caller showed 1,000 + 500 and the cache advances to 1,200, that export can sign 1,700. The function-level documentation already distinguishes the two exports; give callers the same contract in the overview.
//! given change would set. Pass the displayed preview to
//! [`platform_wallet_update_identity_key_limits_as_reviewed_with_signer`] to sign exactly
//! those limits or refuse. [`platform_wallet_update_identity_key_limits_with_signer`]
//! instead computes the raise from the wallet's copy at submission time.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
🟡 Suggestion: Document the C buffer and callback lifetime requirements
packages/rs-platform-wallet-ffi/src/identity_key_limits.rs:109
The preview documents that its output needs no free, but not that it reads 32 bytes from identity_id, writes to aligned caller-provided storage, and borrows the signer on a worker. The reviewed-update export likewise dereferences a caller-provided preview struct and borrows the signer. Swift pins its objects, but direct C callers need an explicit safety contract: keep the signer and its callback context alive until return, and be prepared for callbacks on a Rust worker even when only previewing.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
🟡 Suggestion: Keep the shared signer’s lifecycle state private
packages/rs-platform-wallet/src/wallet/identity/network/contact_requests.rs:7702-7705
The new caller needs to construct a GatedSigner, not initialize its lifecycle state. hold_gate_after_signing trusts an existing Gated state without rechecking the wallet generation, so correct initialization is part of the gate’s invariant. A GatedSigner::new(wallet, signer) constructor can start every caller in Unsigned while keeping the mutex and SigningGate private.
source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, rust-quality, security-auditor)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 8: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 9: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 10: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 11: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 12: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The wallet’s key_limits.rs changes a signing-critical path by binding the selected signer and exact user-reviewed limits to the update and coordinating signature release and broadcast with concurrent wallet removal. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (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 final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Code unchanged since the last final review (
0b0676a7): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed; 5 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
Several findings on this PR share an underlying cause (the review's "pattern" section): Key reconciliation stops at the Rust cache; The sheet reconstructs the submission outcome; Managed key rows still have two writers; Total and remaining budget have no shared proof. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): The discussion kept Update Limits and deferred wallet reconciliation; the latest patches did not change that decision. Land wallet-owned managed-key reconciliation separately before enabling Update Limits in SwiftExampleApp. It must carry the reviewed attempt's outcome through FFI and reconcile the attached key row across manager replacement, so a failed local write can be retried without signing another raise. If reconciliation remains deferred, leave Update Limits out of this PR. If that decision is not yours to make, say so to the PR's author or maintainer.
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/Sources/SwiftDashSDK/PlatformWallet/ManagedPlatformWallet.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/ManagedPlatformWallet.swift:4147-4154: Drain key-limit writes before restoring a replacement manager
The new refresh and reviewed update retain the wallet through their native calls, but neither participates in the owning manager’s shutdown drain. `WalletManagerStore.activate` awaits the old manager’s shutdown before restoring the replacement from the same SwiftData container. Native shutdown stops the managed workers; it does not revoke the old wallet entry in the registry retained by an in-flight call. An old refresh that proved a 1,500 cap can therefore pass its own generation check and commit after the replacement has persisted 2,000. `persistIdentityKeys` assigns the incoming cap directly, so both the displayed and cold-restored cap can go backward. Admit the store-writing calls through their owning manager, reject new calls once shutdown starts, and hold admission through persistence.
_Raised on code unchanged since the last review, and confirmed by an independent pass: Start an Update Limits refresh with a locally cached 1,000-credit cap, dismiss the sheet while the refresh is pending, and rebuild the SDK for the same network. If the replacement manager refreshes and saves the 2,000-credit cap before the old refresh applies its valid 1,500-credit proof, the old refresh overwrites the shared SwiftData row and the next cold restore loads 1,500._
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:389-396: Prevent an in-flight form preview from replacing the reviewed retry
Restoring `reviewed` at line 468 fixes the recovery handler’s own re-preview, but the form remains editable during submission and recovery. After submitting +500 at a total of 1,000, the user can edit the amount and return to +500, starting a separate debounced task. The recovery probe can still see 1,000 and restore the reviewed 1,500 offer. If the wallet folds a raise to 1,500 before the debounced task takes its snapshot, that task publishes a 2,000 offer: it is not cancelled and its inputs still match. Rust will reject the old preview against the new snapshot, but it can accept the replacement preview. Freeze edits through submission and recovery and invalidate pending preview tasks when restoring the offer. The five retry-gate tests only exercise the Boolean decision; add a test that releases a pending preview after recovery and checks that the offered cap and signer are still the reviewed ones.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:442-457: Carry the wallet’s submission disposition through FFI
If the cached total or signer changes after review, `preview_to_submit` returns `InvalidIdentityData` before requesting a nonce. The FFI maps that error and a post-proof `Persistence` error to `ErrorUnknown`; neither has a consensus code. The sheet therefore appends “could not confirm that this update did not land” even to Rust’s explicit “nothing was signed” refusal and locks out a fresh review. Have the Rust wallet classify the result by what happened in this call, including pre-send refusal requiring a new review, a reported refusal eligible to re-offer the same preview, an uncertain send, and proved limits that were not applied locally. Marshal that distinction and let Swift render it. This does not require keeping submission state across sheet reopenings.
In `packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:145-159: Reject proposed expiries already past at a proved block
The opening refresh folds verified block metadata, but `held_identity` clones only the identity and discards the managed identity’s available block-time watermark. With a proved time of 5,000 and a held expiry of 3,000, extending to 4,000 passes both preview and submit preflight. This is not a key expiring between preview and inclusion: the requested expiry is already past at a proved block. Drive-ABCI returns 40219 for a resulting key that is still expired; its block-execution test confirms the refusal is paid if included. Pass the available proved lower bound into the shared Rust preview and submit check and apply DPP’s `is_expired_at` predicate to the resulting key. Leave the no-change eligibility query available so an expired key can still be revived with a sufficiently late extension.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:743-751: Exercise wallet removal through reviewed submission
The test constructs a `GatedSigner` and invokes `sign` directly. It would still pass if `submit_key_limits_update` stopped using the gate or stopped mapping its refusal to `WalletRemovedBeforeSend`. Seed a held identity and mock the nonce fetch, then run the public reviewed submission and remove the wallet while the host signer is paused. After releasing the signer, assert the exact wallet error. This does not need a successful mock broadcast or proof: the behavior under test stops before broadcast.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…expired at a proved block The preview and the submission check the key as the change would leave it against the latest block time the wallet proved for the identity (its balance or keys). A change that leaves the key expired there would be refused by Platform (40219) and charged for, so it is refused before signing. Asked with no change, an expired key is still answered, so it can be revived by a late enough extension. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and its recovery run The change section is disabled while a submission runs and after an unknown outcome, and a form preview started before a submission, or before its reviewed preview is offered again, may no longer publish its answer over the reviewed one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Resolves two conflicts: - `rs-platform-wallet/src/lib.rs`: both sides added re-exports. - `SwiftExampleApp/TEST_PLAN.md`: tier counts, with ID-17 (Thorough) and the base's DOC-17 (Uncommon) both counted, and the Platform total at ~83. Also brings ID-17's expired-key note in line with the preview's new check against the proved block time. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Resolves the TEST_PLAN.md tier counts: the base's VOTE-08 and VOTE-09 with this branch's ID-17 make Thorough 41 and Platform ~85. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head adds the proved-time expiry check and freezes the limits form through submission recovery; the merge carries the target branch’s voting code unchanged. Rust workspace, wasm32, Swift SDK, and Kotlin checks passed, with two test-suite jobs still pending when checked. Dashmate Local Network E2E timed out waiting for Core nodes to reach the same height, before exercising any changed client code.
🔴 2 blocking | 🟡 1 suggestion(s)
Still open from earlier rounds (3)
- 🔴 Blocking: Drain key-limit writes before restoring a replacement manager —
packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/ManagedPlatformWallet.swift:4147-4154(thread) - 🔴 Blocking: Carry the wallet’s submission disposition through FFI —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:452-467(thread) - 🟡 Suggestion: Exercise wallet removal through reviewed submission —
packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:882-893(thread)
Review provenance
Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.2-sol(effort low) — The wallet'supdate_identity_key_limits_as_reviewed_with_external_signerdirectly changes key authorization and signing by binding the reviewed spending limits, expiry, and signer to the signed transition while coordinating wallet removal with broadcast. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (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.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-astra— general (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.2-astra— 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/Sources/SwiftDashSDK/PlatformWallet/ManagedPlatformWallet.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/ManagedPlatformWallet.swift:4147-4154: Drain key-limit writes before restoring a replacement manager
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4659287430)
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/UpdateKeyLimitsView.swift:452-467: Carry the wallet’s submission disposition through FFI
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4659287441)
In `packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rs:882-893: Exercise wallet removal through reviewed submission
(carried; thread: https://github.com/dashpay/platform/pull/6054#discussion_r4659287447)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
Keep #6054's wallet-held refresh through the wallet; the plain-fetch path now uses the shared merge. The fetched-key parser stores the protocol UInt32 key id as its bit pattern, as #6054 made PersistentPublicKey do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Basic explanation
What this does: Since protocol version 14 an identity key can carry a spending budget and an expiry date. The iOS example app showed these limits but had no way to change them. This adds an "Update Limits" screen that tops up a key's budget or moves its expiry later. Before anything is signed, the screen asks the Rust wallet whether the key can be raised, which key would sign, and what the new limits would be. The screen then shows that answer, so the rules exist only in Rust.
Value: A wallet user whose app key ran out of budget, or is about to expire, can extend it in place instead of disabling it and registering a new one. Changes that Platform would refuse and still charge a fee for (a disabled key, a zero top-up, an expiry that is not later) are now refused for free before signing. Swift, Kotlin and JS clients get the same answer from one Rust function. The app signs exactly the new limits it showed, never a larger raise computed from a copy that changed in between.
Risks: Low. No consensus code changes: everything is client side (SDK, wallet, FFI, Swift, example app). The SDK helper
raised_key_limitsnow also refuses a disabled key, which can only stop a transition Platform would refuse anyway. Every interface change is additive: shipped C and Rust signatures are unchanged, and the Swift API stays source compatible. The app flow has not been run against testnet yet (see testing).Issue being fixed or feature implemented
SwiftExampleApp displayed key limits and remaining budgets but could not send
IdentityKeyLimitsUpdate(state transition type 23). The Swift wrapperupdateIdentityKeyLimitsexisted but nothing in the app called it, and nothing let a client ask in advance whether an update would be accepted.Searched open PRs and issues for prior work on this (
IdentityKeyLimitsUpdate,updateIdentityKeyLimits,update_identity_key_limits, "key limits update"). None of them adds this; #5265 is about fee estimates for key operations, a different topic.What was done?
Rust SDK (
rs-sdk)raised_key_limitsrefuses a disabled key (consensus would refuse it with 40208, paid). A key cannot be re-enabled, so a held copy showing it disabled is never too old to trust.signing_key_for_key_limits_updateis nowpub, so the wallet can report which key would sign.Wallet (
rs-platform-wallet)IdentityWallet::preview_identity_key_limits_update. It signs and sends nothing. Called with no change, it answers "can this key be raised at all, and by which key". With a change, it returns the absolute limits the update would set. It refuses a missing or disabled key, a key with no limits, a change that is not a raise, a change that would leave the key expired at the latest block time the wallet proved for the identity, and a signer that holds no MASTER key and no CRITICAL authentication key without limits or contract bounds.update_identity_key_limits_with_external_signerruns the same preview and signs with the key it picked, so the preview and the update cannot disagree. It also refuses an update that raises nothing. Newupdate_identity_key_limits_as_reviewed_with_external_signertakes the preview the user reviewed and signs exactly that total, expiry and signing key, or refuses before taking a nonce when the wallet's copy moved in between.WalletRemovedBeforeSend). When the requested limits are proved but the identity was removed from the wallet in the meantime, the update returnsPersistence(nothing applied locally), notOk. After the proof, the proved key is merged into the held one (higher limits and a later disable are kept) rather than laid over it.FFI (
rs-platform-wallet-ffi)platform_wallet_preview_identity_key_limits_update, returning a plainIdentityKeyLimitsUpdatePreviewFFIstruct (no heap memory, nothing to free). Unlike the update, it accepts a call with no change.platform_wallet_update_identity_key_limits_as_reviewed_with_signersigns a reviewed preview. The existing update keeps its shipped signature. All of them run outside the wallet registry guard, because they call back into the host signer.platform_wallet_refresh_identityexposes the wallet's proved identity refresh (IdentityWallet::refresh_identity), so a key added on another client reaches the wallet's copy.Swift SDK
ManagedPlatformWallet.previewIdentityKeyLimitsUpdate(identityId:keyId:addBudget:expiresAt:signer:)returningManagedPlatformWallet.IdentityKeyLimitsUpdatePreview,updateIdentityKeyLimits(asReviewed:signer:)andrefreshIdentity(identityId:). They only pass values through. They check that the id is 32 bytes and keep the wallet and the signer alive through the native call.SwiftExampleApp
UpdateKeyLimitsViewsheet with three entry points: Key detail → Limits → Update Limits, a leading-edge Limits swipe on the keys list (this one reaches keys whose row opens the private-key view), and Settings → Platform State Transitions → Identity → Update Key Limits.Double, plus converting the picked date into milliseconds. It applies no "must be later" or "must be non-zero" rule of its own.IdentityKeyRefresher(the app's Refresh Identity Data, the post-disable refresh and the Bluetooth key share) rebuilt every key row from a plain fetch, withcontractBounds: niland without the wallet id and derivation path the signer needs. For an identity a wallet holds it now calls the wallet's provedrefreshIdentity, so the wallet is the only writer of those rows. It still rebuilds rows only for identities no wallet holds, keeping the bounds of keys it already has.UInt32bit pattern (PersistentPublicKey, the keys list including Reveal and Forget private key, and the key detail screen), as the wallet's persister already wrote them, so a high key id no longer traps.Before / after
A disabled key's budget top-up:
Asking before offering the action (Swift):
App: before, the key detail screen showed "Total budget / Remaining / Expires" with no action. After, it has an Update Limits button (or a disabled one with Rust's reason). A successful update changes the three figures on the same screen.
Public interface changes
dash-sdk(dash_sdk::platform::transition::update_identity_key_limits)raised_key_limits: same signature; it now also returnsErr(Error::Generic)for a disabled key. Callers compile unchanged. The wallet, wasm-sdk and js-evo-sdk paths now refuse a disabled key before signing instead of after broadcast.signing_key_for_key_limits_update:fn→pub fn, signature unchanged:platform-walletplatform_wallet::IdentityKeyLimitsUpdatePreview(also atwallet::identity::network):PlatformWalletError::InvalidIdentityData(reason).InvalidIdentityDatabefore taking a nonce.update_identity_key_limits_with_external_signer: signature unchanged. If the identity is no longer held when the proof returns, it now returnsPlatformWalletError::Persistenceinstead ofOkwith nothing applied. It now also refuses a disabled key, a signer with no allowed key, and an update that raises nothing, all before fetching a nonce. It passes the key it picked assigning_key_to_use; before, the SDK picked it with the same rule. Its local apply merges the proved key into the held one instead of replacing it, and both methods are fenced to the handle's wallet generation.platform-wallet-ffi(C ABI, additive; the shippedplatform_wallet_update_identity_key_limits_with_signersignature is unchanged)platform_wallet_refresh_identityreturns success when the wallet's copy is current. As for every refresh, a failed host store is logged, not returned.Swift SDK (source compatible)
The existing
updateIdentityKeyLimits(identityId:keyId:addBudget:expiresAt:signer:)is unchanged in signature. It and the new methods now throwinvalidParameterfor an id that is not 32 bytes. Before, a wrong-length id trapped.Unchanged: the transition, its validation, fees, stored bytes, proofs and version tables.
How Has This Been Tested?
cargo test -p platform-wallet --lib -- key_limits identity_ops raised_limits lagging: 34 passed, 12 of them key limits tests. New: a change that leaves the key expired at a proved block is refused, while the no-change answer still works; a reviewed update whose host signer returns after the wallet was removed fails withWalletRemovedBeforeSend, so nothing is broadcast; the no-change answer, the absolute limits of a raise, refusals for a missing, disabled or unlimited key, refusals for a change that is not a raise, refusal of a signer that holds only a HIGH key and a limited key, refusal of an update that raises nothing, refusal of a submission whose total or signing key moved since the review, a reviewed preview refused for a twin key with the same limits and signer, the change derived from a reviewed preview, and a delayed proof merged without losing a later raise or disable (including two disable stamps).cargo test -p platform-wallet-ffi --lib identity_key_limits: 5 passed (null pointers on both entry points, a no-change call reaching the wallet lookup, struct conversion both ways).cargo check -p rs-unified-sdk-jni: clean.cargo test -p platform-wallet --lib refresh: 9 passed (the refresh's first lookup is now fenced to the wallet generation).cargo test -p dash-sdk --lib update_identity_key_limits: 5 passed (new: a disabled key is refused).cargo clippy -p platform-wallet -p platform-wallet-ffi -p dash-sdk -p rs-unified-sdk-jni --all-features --all-targets -- -D warnings: clean.cargo fmt --all -- --check: clean.build_ios.shwas run. I copied a prebuiltDashSDKFFI.xcframeworkfrom today, compared its headers with the ones cargo generates on this branch (the only differences are the new struct and function), and swapped the fresh headers in. With those headers the app and its test target compile. Linking failed only on the new symbols the older library lacks. With stubs for those symbols,KeyLimitsFormattingTests(12, including 7 new parser tests),KeyLimitsRetryGateTests(5, new) andKeyDisableGateTests(10) passed on an iPhone 17e simulator, and so did the SDK'sIdentityKeyLimitsPersistenceTestsandIdentityKeyContractBoundsTests(17, including three new ones: a raise updates the attached hex-tagged row, not a Base58 orphan; an unlinked row is attached when its identity has none; a failed key lookup makes the registered C callback return nonzero and rolls back the whole round).ManagedPlatformWalletidentity writes not taking part in the manager's shutdown drain (swift-sdk: ManagedPlatformWallet identity writes run without native-operation admission, so a manager replacement can overlap their store writes #6082, pre-existing).IdentityUpdates.updateKeyLimits, but no app code calls it. Not changed here.docs/sdk/sdk-parity-manifest.jsontracks no key-limits capability, so it is unchanged.Breaking Changes
None. No consensus change. Every C, Rust and Swift interface change is an addition; shipped signatures are unchanged.
raised_key_limitsrefusing a disabled key is client side and only stops a transition Platform would refuse.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
PR Hygiene ·
3ee0530/self-reviewedrs-platform-wallet-ffi(packages/rs-platform-wallet-ffi/src/identity_key_limits.rs,packages/rs-platform-wallet-ffi/src/wallet.rs) — HashEngineering or ZocoLini or llbartekll or romchornyirs-platform-wallet(packages/rs-platform-wallet/src/lib.rs,packages/rs-platform-wallet/src/wallet/identity/network/contact_requests.rs,packages/rs-platform-wallet/src/wallet/identity/network/key_limits.rsand 4 more) — HashEngineering or ZocoLini or llbartekll or romchornyirust-sdk(packages/rs-sdk/src/platform/transition/update_identity_key_limits.rs) — lklimek or shumkovswift-sdk(packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentPublicKey.swift,packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/ManagedPlatformWallet.swift,packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PlatformWalletPersistenceHandler.swiftand 15 more) — llbartekll or romchornyijs-wasm-sdk(packages/wasm-sdk/src/state_transitions/identity.rs) — shumkovWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.