fix(contracts): implement admin rotation, emergency pause, TTL extensions and clean dead errors - #1440
Conversation
…ions, and clean dead errors
|
@AbdulSnk is attempting to deploy a commit to the Mftee's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@AbdulSnk 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! 🚀 |
# Conflicts: # contracts/document/src/lib.rs # contracts/escrow/src/lib.rs # contracts/identity/src/lib.rs # contracts/reputation/src/lib.rs # contracts/shipment/src/lib.rs
mftee
left a comment
There was a problem hiding this comment.
Resolved a large merge conflict with main across all 5 contract crates: this PR predates #1438/#1439 (already merged), which split document/escrow/identity/reputation/shipment into contract.rs/errors.rs/types.rs/storage.rs/etc. modules. Reapplied this PR intent into the correct split files for each crate rather than resolving the textual diff in the now-slim lib.rs roots:
- Added a Paused error variant + DataKey, rotate_admin/pause/unpause admin entrypoints, and a require_not_paused() guard called from every state-mutating entrypoint, across all 5 crates (placed in storage.rs as a shared accessor where that pattern already existed, contract.rs otherwise).
- Applied the missing extend_ttl fixes on list-backed storage keys (ShipmentRaters, ShipmentDocs, shipment/{shipper,carrier}List) now that DataKey derives Clone.
- Ported each crate's admin-rotation/pause test into a new test/admin.rs, plus an extra "rotate_admin requires current admin" test per crate.
- Double-checked error-variant numbering against each crate's current main state, since document had grown two new variants (ShipmentNotFound, NotShipmentParty) since this PR was branched - Paused there is 9, not 7.
- Dropped ~29,000 lines of contracts//test_snapshots/.json that this PR had accidentally committed - contracts/.gitignore already excludes test_snapshots/ (Soroban's own per-run ledger snapshot dumps), so these were never meant to be tracked.
Verified no other callers of any function I touched exist elsewhere in the repo. Good security hardening (admin rotation + emergency pause) and TTL cleanup - approving.
📌 Description
This PR addresses smart contract maintenance, state longevity, administrative flexibility, and emergency safety mechanisms tracked under issues #1386, #1387, #1388, and #1389.
🚀 Changes Included
1. Storage Key TTL Maintenance (#1386)
Vec-typed storage keys executeextend_ttlalongside sibling single-record keys, preventing premature ledger state expiration.2. Dead Code Cleanup (#1387)
Errorenum variants across affected contracts to optimize binary size and simplify error handling contracts.3. Admin Key Management (#1388)
4. Emergency Pause System (#1389)
Closes: #1386
Closes: #1387
Closes: #1388
Closes: #1389