Skip to content

[Smart Contracts] Add error expiration/TTL with configurable retention and automatic cleanup - #220

Open
Dannyswiss1 wants to merge 1 commit into
Epta-Node:mainfrom
Dannyswiss1:feature/agent-registry-error-ttl
Open

[Smart Contracts] Add error expiration/TTL with configurable retention and automatic cleanup#220
Dannyswiss1 wants to merge 1 commit into
Epta-Node:mainfrom
Dannyswiss1:feature/agent-registry-error-ttl

Conversation

@Dannyswiss1

Copy link
Copy Markdown

Summary

  • Add created_at/expires_at fields to ErrorEntry, stamped in report_error using a configurable per-contract TTL (default ~30 days / 518,400 ledgers)
  • Add admin-gated set_error_ttl(ttl_ledgers) and get_error_ttl() to read/configure retention, following the existing pause/unpause admin-auth pattern
  • Add permissionless cleanup_expired_errors(error_ids) that removes entries past their expires_at from the caller-supplied id list (Soroban has no full-storage iterator, so callers/off-chain indexers supply candidate ids — noted in the issue as the expected approach)
  • Extend get_error to bump the persistent-storage TTL on access, consistent with how agent records are treated
  • Extend GasConfig/estimate_gas with cleanup_error/cleanup_error_marginal so cleanup_expired_errors has a gas budget estimate like the other batch ops
  • Add 8 unit tests: default expiration on report, expiry boundary behavior, cleanup removes expired but not live entries, cleanup ignores unknown ids, non-admin cannot set TTL, TTL getter defaults, and gas estimation scaling

Closes #166

Test plan

  • cargo test -p agent-registry --lib — 44/44 passing (36 pre-existing + 8 new)
  • Verified error_expires_after_configured_ttl, cleanup_expired_errors_removes_expired_entries, and set_error_ttl_requires_admin_auth cover the three acceptance-criteria unit tests explicitly

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@Dannyswiss1 is attempting to deploy a commit to the Jaja's projects Team on Vercel.

A member of the Team first needs to authorize it.

@devJaja
devJaja self-requested a review August 24, 2026 01:02
@devJaja

devJaja commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Nice implementation @Dannyswiss1 , I can see all CI checks passed.

kindly resolve the conflicts

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.

[Smart Contracts] Add Error Expiration/TTL with Configurable Retention and Automatic Cleanup

2 participants