Repository navigation
Conversation
…ollisions Issue Fracverse#982: secure the wallet-rotation path for Privy DID mappings. update_privy_did (owner-authorized) and recover_privy_did (admin-authorized) already required the correct authority before touching a mapping, but neither checked whether the destination wallet already had a *different* DID linked via the WalletDid reverse index. A call could silently overwrite that other DID's reverse mapping while leaving its forward mapping (PrivyDid(other_did) -> new_wallet) untouched, leaving the two indexes disagreeing about which DID a wallet owns. Both entry points now reject the move with 'new wallet already has a different DID linked' unless the destination wallet is unlinked or already points at the same DID being moved (idempotent no-op case). Both also now publish an event (did_upd / did_rec) on a successful rotation, matching the audit-trail convention every other state-changing entry point in this contract already follows (did_reg, adm_prop, admin_xfr, res_rel, prof_upd, prof_del, tkn_resc). Adds four tests: event emission for both paths, and reverse-index collision rejection for both paths, following the file's existing try_*() + #[ignore] convention for panic-path assertions (Soroban v20 testutils panics are non-unwinding). Note: no Rust toolchain was available in the environment this patch was written in, so this has been reviewed carefully but not run through 'cargo test'. Please run the full suite before merging: cargo test -p zaps-user-registry cargo test -p zaps-user-registry -- --ignored Closes Fracverse#982
|
@codewithzubair07 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
ONEONUORA
approved these changes
Sep 25, 2026
ONEONUORA
left a comment
Contributor
There was a problem hiding this comment.
Great job @codewithzubair07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of ChangesData Integrity Fix: Added checks to update_privy_did and recover_privy_did to ensure the destination wallet is not already linked to a different DID, preventing out-of-sync forward and reverse indexes.Audit Trail: Added event emissions (did_upd and did_rec) on successful updates to match the contract's standard state-changing conventions.Test Coverage: Added 4 new tests covering the successful event emissions and the expected panic rejections (using try_*() and #[ignore] for Soroban v20 compatibility).
Status Closes: #982 Criteria Met: All validation, authorization, and data-integrity requirements are verified and fully tested.