Skip to content

feat(auction): bump TTL on hot storage reads - #1243

Open
Kingvic300 wants to merge 1 commit into
Predictify-org:masterfrom
Kingvic300:feat/auction-ttl-bump-1115
Open

feat(auction): bump TTL on hot storage reads#1243
Kingvic300 wants to merge 1 commit into
Predictify-org:masterfrom
Kingvic300:feat/auction-ttl-bump-1115

Conversation

@Kingvic300

Copy link
Copy Markdown

Summary

  • Adds a minimal persistent-storage layer to the auction contract: create_auction (state-changing, requires seller.require_auth()) and get_auction (read-only).
  • get_auction is the contract's hot read path. Every call extends the auction record's persistent TTL back to a full lifetime (AUCTION_TTL_EXTEND_TO) once it has dropped below the refresh threshold (AUCTION_TTL_THRESHOLD), using extend_ttl() semantics (extend-only, idempotent). This keeps frequently-read, rarely-written auctions from falling to archival eviction / rent pressure.
  • create_auction writes the record with a full TTL up front and validates reserve_price > 0; the auction id counter uses checked_add (overflow-safe, no unwrap()).

Why

The auction contract previously only exposed a capabilities() stub with no storage at all, so there was no read path to bump. This change adds the smallest real storage layer needed to give "bump TTL on hot reads" concrete meaning, following the same threshold/bump-amount pattern already used in predictify-hybrid (e.g. MARKETS_LIFETIME_THRESHOLD / MARKETS_BUMP_AMOUNT) and in the allowlist contract.

Test plan

  • cargo test -p auction — 10/10 passing, covering: capabilities (existing), auction creation + auth requirement, reserve-price validation (zero/negative), id increment across creations, id-counter overflow, not-found on missing auction, and TTL-bump behavior both below and above the refresh threshold.
  • cargo clippy -p auction --all-targets — clean, no warnings.
  • cargo fmt -p auction -- --check — clean.

Closes #1115

Add persistent-storage-backed auctions with create_auction/get_auction
entrypoints. get_auction is the contract's hot read path, so every call
extends the auction record's TTL back to a full lifetime once it drops
below the refresh threshold, keeping frequently-read, rarely-written
auctions clear of archival eviction.

Closes Predictify-org#1115
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

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

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.

Add TTL bump on auction storage reads [b#025]

1 participant