Skip to content

fix(contracts): implement admin rotation, emergency pause, TTL extensions and clean dead errors - #1440

Merged
mftee merged 2 commits into
CodeGirlsInc:mainfrom
AbdulSnk:fix/contracts-admin-pause-ttl-and-error-cleanup
Aug 29, 2026
Merged

fix(contracts): implement admin rotation, emergency pause, TTL extensions and clean dead errors#1440
mftee merged 2 commits into
CodeGirlsInc:mainfrom
AbdulSnk:fix/contracts-admin-pause-ttl-and-error-cleanup

Conversation

@AbdulSnk

Copy link
Copy Markdown
Contributor

📌 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)

  • Updated contract storage routines so Vec-typed storage keys execute extend_ttl alongside sibling single-record keys, preventing premature ledger state expiration.

2. Dead Code Cleanup (#1387)

  • Removed unreturned contract Error enum variants across affected contracts to optimize binary size and simplify error handling contracts.

3. Admin Key Management (#1388)

  • Added administrative functions to support two-step or direct admin key rotation/transfer, removing hardcoded single-admin operational constraints.

4. Emergency Pause System (#1389)

  • Introduced state-level emergency pause controls and modifier checks across state-changing functions to halt sensitive contract execution in the event of an exploit or emergency.

Closes: #1386
Closes: #1387
Closes: #1388
Closes: #1389

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@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.

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

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

Learn more about application limits

# 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 mftee 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.

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.

@mftee
mftee merged commit ca7bbaa into CodeGirlsInc:main Aug 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants