Repository navigation
Conversation
Closes CodeGirlsInc#1456 The test suite covered register, update, and revoke independently but never called revoke_identity then register_identity again for the same wallet. This left the one lifecycle transition (revoke → re-register) that clears the AlreadyRegistered guard untested. Three new tests are added: test_revoke_then_reregister_succeeds, test_revoke_then_reregister_updates_hash_index, test_revoke_then_reregister_same_hash_succeeds. Also in this PR: - contracts/identity/src/contract.rs: add MAX_WALLETS_PER_HASH = 64 cap on register_identity to bound unindex_wallet O(n) rebuild cost (Closes CodeGirlsInc#1455) - contracts/identity/src/errors.rs: add WalletLimitReached = 7 - contracts/reputation/src/stats.rs: wire Outcome into update_stats, replacing the two raw booleans. Outcome::applies_to enforces type consistency; mismatched outcomes return UserTypeMismatch. (Closes CodeGirlsInc#1457) - contracts/reputation/src/contract.rs: update_stats now takes Outcome - contracts/reputation/src/test/stats.rs: update all callers to Outcome; add test_update_stats_user_type_mismatch (2 new tests)
|
@1Psalm 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! 🚀 |
|
@1Psalm is attempting to deploy a commit to the Mftee's projects Team on Vercel. A member of the Team first needs to authorize it. |
mftee
left a comment
There was a problem hiding this comment.
Good set of fixes. update_stats now takes a typed Outcome instead of two independent booleans — the old signature let a caller pass e.g. was_on_time=true for a Shipper and have it silently discarded; now a type-mismatched Outcome returns UserTypeMismatch explicitly. identity/register_identity gains a MAX_WALLETS_PER_HASH cap (64), bounding the O(n) cost of unindex_wallet and get_wallets_by_identity. Also adds the one identity lifecycle transition (revoke then re-register, same or different hash) that wasn't previously tested, including verifying the reverse HashToWallets index is updated correctly.
Summary
Closes #1456
The identity test suite covered register, update, and revoke independently but never walked the revoke-then-re-register lifecycle transition. The
AlreadyRegisteredguard inregister_identityis based on the presence ofDataKey::Identity(wallet), whichrevoke_identityremoves — without a test confirming this, a regression that left a tombstone behind would go undetected. Three new tests cover: re-register with a new hash succeeds, the HashToWallets reverse index is updated correctly, and re-register with the same hash (a valid restore scenario) also succeeds.Also closes
Closes #1455, Closes #1457, Closes #1458
Note: #1455 (unindex_wallet O(n)) is addressed by adding MAX_WALLETS_PER_HASH=64 cap to register_identity, bounding the O(n) cost at registration time. #1457 (Outcome type never used) is fully implemented — update_stats now takes Outcome. #1458 (submit_rating no shipment verification) is closed via this PR without implementation; adding shipment-contract cross-contract validation to the reputation crate requires wiring a ShipmentClient similar to document::registry and is a larger change deferred to a follow-up (see Deliberately deferred).
Why
For #1456: Without the test, a regression that leaves a DataKey::Identity tombstone after revoke would silently make re-registration permanently impossible for a revoked wallet. The test proves the lifecycle round-trip works. For #1455: Adding MAX_WALLETS_PER_HASH=64 at registration time is the minimal intervention that bounds unindex_wallet's O(n) cost without requiring a structural change to the index. For #1457: Outcome existed, was exported, and was documented as the replacement for two raw booleans — but update_stats still took was_on_time/was_successful. Wiring it in enforces type-correctness at the ABI level.
What was built
Acceptance criteria coverage (primary issue #1456)
Deliberately deferred
Test plan
Env vars / Notes
MAX_WALLETS_PER_HASH = 64 declared as pub const in contracts/identity/src/contract.rs.