Skip to content

feat: implement per-market cumulative extension cap (#672) - #692

Merged
greatest0fallt1me merged 1 commit into
Predictify-org:masterfrom
Awointa:feature/extensions-cumulative-cap
Jun 27, 2026
Merged

feat: implement per-market cumulative extension cap (#672)#692
greatest0fallt1me merged 1 commit into
Predictify-org:masterfrom
Awointa:feature/extensions-cumulative-cap

Conversation

@Awointa

@Awointa Awointa commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

closes #672
Adds a configurable cumulative extension cap per market, preventing a single
market from being extended beyond an admin-set total day limit across all extension calls.

Changes

storage.rs

  • Added DataKey::MarketExtensionTotal(Symbol) — persistent counter tracking total days
    extended per market.

extensions.rs

  • Added ExtensionValidator::check_cumulative_cap — reads the admin-configured cap
    (cum_ext_cap) from persistent storage; a value of 0 disables the cap. Emits an audit event
    before rejecting a cap-exceeding request.
  • Added ExtensionUtils::increment_extension_total — increments the per-market counter after
    each successful extension.
  • Wired both into ExtensionManager::extend_market_deadline, after the existing per-call
    limit check.

err.rs

  • Added CumulativeExtensionCapHit = 506 with message and code string.

extensions_cumulative_cap_tests.rs

  • Full test coverage: no cap set (unrestricted), cap enforced on overflow, running total
    correctness, audit event emitted on rejection.

Testing

cargo test -p predictify-hybrid

All existing and new tests pass.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

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

@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Merged via direct push to master (admin)

@greatest0fallt1me
greatest0fallt1me merged commit 591e9d8 into Predictify-org:master Jun 27, 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

Development

Successfully merging this pull request may close these issues.

Add per-extension cumulative cap to Extensions with audit-event on cap hit

2 participants