Skip to content

feat(contract): ledger TTL expiration strategy & archival state recovery - #7

Merged
amankoli09 merged 2 commits into
LynxXProtocol:mainfrom
Babigdk:feat/ttl-expiration-archival-recovery
Aug 9, 2026
Merged

feat(contract): ledger TTL expiration strategy & archival state recovery#7
amankoli09 merged 2 commits into
LynxXProtocol:mainfrom
Babigdk:feat/ttl-expiration-archival-recovery

Conversation

@Babigdk

@Babigdk Babigdk commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Implement automated rent-bumping and on-chain state restoration across all LynxX Soroban contracts (badge, fund, escrow, factory):

  • Add shared ttl helper crate exposing extend_storage_ttl(), bump(), and bump_instance() with a 30-day extension window (172,800 ledgers) and a 14-day bump threshold (80,640 ledgers). Host only bumps when remaining TTL is below threshold, keeping routine access a free no-op.
  • badge: bump tier entry + instance/code on every award/query; add public restore_badge(user_id, expected_tier) that recovers an archived badge from verifiable archival proof data, emitting BadgeRestored and rejecting forged proof (ProofMismatch) or unknown donors (NotInitialized).
  • fund: bump donor contribution entries and contract instance/code on donate/set_badge/withdraw/refund and contribution reads.
  • escrow: persist lifecycle Status in storage and rent-bump on every transition and read, recovering archived state on access.
  • factory: keep campaign registry instance/code alive on deploy/read.
  • Tests: TTL-bump-on-award/query, simulated archival eviction followed by restore_badge recovery without data loss, forged-proof rejection, and escrow/fund TTL assertions.

Closes #4

Babigdk added 2 commits August 5, 2026 12:19
Implement automated rent-bumping and on-chain state restoration across all
LynxX Soroban contracts (badge, fund, escrow, factory):

- Add shared ttl helper crate exposing extend_storage_ttl(), bump(), and
  bump_instance() with a 30-day extension window (172,800 ledgers) and a
  14-day bump threshold (80,640 ledgers). Host only bumps when remaining
  TTL is below threshold, keeping routine access a free no-op.
- badge: bump tier entry + instance/code on every award/query; add public
  restore_badge(user_id, expected_tier) that recovers an archived badge
  from verifiable archival proof data, emitting BadgeRestored and
  rejecting forged proof (ProofMismatch) or unknown donors
  (NotInitialized).
- fund: bump donor contribution entries and contract instance/code on
  donate/set_badge/withdraw/refund and contribution reads.
- escrow: persist lifecycle Status in storage and rent-bump on every
  transition and read, recovering archived state on access.
- factory: keep campaign registry instance/code alive on deploy/read.
- Tests: TTL-bump-on-award/query, simulated archival eviction followed by
  restore_badge recovery without data loss, forged-proof rejection, and
  escrow/fund TTL assertions.

Closes LynxXProtocol#4
@amankoli09

amankoli09 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@Babigdk , Good Work Please resolve conflict in the Contract ci is failing

@Babigdk

Babigdk commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

@amankoli09 ci fixed

@amankoli09
amankoli09 merged commit adcf23c into LynxXProtocol:main Aug 9, 2026
1 of 2 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.

ISSUE #4: Ledger TTL Expiration Strategy & Automated Archival State Recovery for NFT Badges

2 participants