Skip to content

feature/storage-ttl-v2-and-safe-pause-guards#385

Merged
Cedarich merged 4 commits into
Pulsefy:mainfrom
preciousadeyemi78:feature/storage-ttl-v2-and-safe-pause-guards
Apr 30, 2026
Merged

feature/storage-ttl-v2-and-safe-pause-guards#385
Cedarich merged 4 commits into
Pulsefy:mainfrom
preciousadeyemi78:feature/storage-ttl-v2-and-safe-pause-guards

Conversation

@preciousadeyemi78
Copy link
Copy Markdown
Contributor

Feat: Storage TTL v2 & Safe Pause Guards

Overview

This PR delivers two critical operational and security enhancements:

  • Storage TTL v2 – Per-record expiration with auto-extend on activity
  • Safe Pause Guards – Granular pausing with immutable emergency mode

Issue 1: Storage TTL Strategy v2 (#307)

Changes

  • Implemented per-record TTL helpers that set/extend expiration based on activity
  • Defined TTL policies per record type (escrow, dispute, nonce, fee config)
  • Added automatic TTL extension on read/write operations for active records
  • Added tests simulating aging ledgers to verify retention behavior
  • Ensured cleanup pathways do not break active escrows

Acceptance Criteria Met

  • ✅ Active records stay alive without manual extension
  • ✅ Inactive records expire according to policy
  • ✅ Tests validate TTL behavior for multiple record types

Issue 2: Safe Pause Guards (#306)

Changes

  • Implemented emergency mode flag that cannot be reverted (immutable)
  • Added granular feature-level pause flags (permission-specific, not global)
  • Created minimal "safe-only" allowed entry point list (refunds/withdrawals remain available)
  • Added comprehensive tests for every paused/allowed call under each mode
  • All state transitions emit auditable events

Acceptance Criteria Met

  • ✅ Emergency mode reliably blocks risky entry points
  • ✅ Refund/withdrawal safety paths remain available
  • ✅ State transitions are auditable via events

Files Modified

contracts/
├── storage/
│ ├── ttl_[helpers.rs](https://helpers.rs/) # Per-record TTL logic
│ └── ttl_[policy.rs](https://policy.rs/) # Policy definitions per record type
├── security/
│ ├── pause_[guards.rs](https://guards.rs/) # Granular + emergency pause
│ └── safe_[mode.rs](https://mode.rs/) # Safe-only entry point list
└── tests/
├── ttl_[tests.rs](https://tests.rs/) # Aging ledger simulations
└── pause_[tests.rs](https://tests.rs/) # Pause mode coverage

Evidence

  • TTL auto-extend verified on read/write activity
  • Inactive records expire correctly per policy
  • Emergency mode permanently blocks risky entry points
  • Refund/withdraw paths remain functional in emergency mode
  • All tests pass with simulated ledger aging
  • Events emitted for all pause state transitions

Closes #307
Closes #306

@preciousadeyemi78 preciousadeyemi78 marked this pull request as draft April 28, 2026 10:32
…n on activity, and robust cleanup

Implement per-record TTL policy for escrow, stealth escrow, fee config, and ID map
Auto-extend TTL on all read/write activity to reduce user friction and storage waste
Refactor storage helpers to use new TTL logic
Add/extend tests for ledger aging, retention, and cleanup safety
Ensure cleanup does not break active escrows
- Implement irreversible Emergency Mode to lock contract state during crises.
- Block risky entry points (deposit, admin, and pause controls) while mode is active.
- Ensure safe recovery paths (refund and cleanup) remain accessible during emergency.
- Add Admin-only activation logic and  event emission.
- Fix test suite panics by ensuring proper contract initialization.
- Resolve Host Error 10 by minting tokens to test accounts to establish ledger entries.
- Standardize authorization mocking and ledger time-warping for refund verification.
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 30, 2026

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

@preciousadeyemi78 preciousadeyemi78 marked this pull request as ready for review April 30, 2026 09:42
@preciousadeyemi78
Copy link
Copy Markdown
Contributor Author

@Cedarich please, approve workflow to run.

@preciousadeyemi78 preciousadeyemi78 changed the title feat: initiated new branch for features implementation feature/storage-ttl-v2-and-safe-pause-guards Apr 30, 2026
@Cedarich Cedarich merged commit f45dd09 into Pulsefy:main Apr 30, 2026
1 check 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.

Storage TTL Strategy v2 (Per-Record TTL + Auto-Extend on Activity) “Safe Pause” Guards (Granular + Immutable Emergency Mode)

2 participants