Skip to content

fix(user_registry): guard DID wallet rotation against reverse-index c… - #1076

Merged
ONEONUORA merged 2 commits into
Fracverse:masterfrom
codewithzubair07:fix/privy-did-wallet-rotation-982
Sep 25, 2026
Merged

ONEONUORA merged 2 commits into
Fracverse:masterfrom
codewithzubair07:fix/privy-did-wallet-rotation-982

Conversation

@codewithzubair07

@codewithzubair07 codewithzubair07 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

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.

…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
@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@ONEONUORA ONEONUORA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great job @codewithzubair07

@ONEONUORA
ONEONUORA merged commit 60aae91 into Fracverse:master Sep 25, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

contract: Privy Auth: Implement DID updates and address recovery procedures

2 participants