Skip to content

Prove maturity ≤ timestamp + MAX_TTM bound (discharge Certora wish-list TODO)#1078

Draft
claude[bot] wants to merge 6 commits into
mainfrom
claude/prove-maturity-max-ttm-bound
Draft

Prove maturity ≤ timestamp + MAX_TTM bound (discharge Certora wish-list TODO)#1078
claude[bot] wants to merge 6 commits into
mainfrom
claude/prove-maturity-max-ttm-bound

Conversation

@claude

@claude claude Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Requested by Mathis GD · Slack thread

Discharges the // TODO verify this cleanly on the maturity <= block.timestamp + MAX_TTM() bound in the take preserved block of pendingContinuousFeeBoundedByCredit (and the mirror in NetCredit.spec's takeNetCreditChangeForBuyerAndSeller). The bound was a bare require; it's now derived.

Mechanism: a persistent ghost mapping(bytes32 => mathint) maturityOfId recorded via the toId summary (require maturityOfId[id] == market.maturity, the same idiom as Solvency.spec's toId summary), plus a monotonic-block.timestamp ghost lastTimestamp, prove strong invariant maturityBoundedById(id): tickSpacing(id) > 0 => maturityOfId[id] <= lastTimestamp + MAX_TTM(). Because id is in scope at the use sites, requireInvariant maturityBoundedById(toId(offer.market)) binds there and discharges the bound; the bare require is removed. Soundness rests on optimistic_hashing (injective hashMarket), as elsewhere in the specs.

Discharges the corresponding item in the [Certora] verif wish list (#109).


Generated by Claude Code

claude added 4 commits July 24, 2026 10:03
Replace the two bare requires that assumed the maturity bound with a
monotonic-clock ghost and a proven strong invariant
maturityBoundedByLastTimestamp, requireInvariant'd at the take use
sites in Midnight.spec and NetCredit.spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W9Ay4xaNZHg8zN4nXvKfii
Comment thread certora/specs/Midnight.spec Outdated
Comment thread certora/specs/NetCredit.spec Outdated
Record each market's maturity into a per-id ghost inside the toId summary
(consistency-require form, as in Solvency's CVL_toId) and prove an id-keyed
invariant maturityBoundedById. The id is in scope at the take use sites, so
requireInvariant threads correctly, replacing the no-op struct requireInvariant
and the bare uncreated-market maturity require.
Comment thread certora/specs/NetCredit.spec Outdated
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.

2 participants