Prove maturity ≤ timestamp + MAX_TTM bound (discharge Certora wish-list TODO)#1078
Draft
claude[bot] wants to merge 6 commits into
Draft
Prove maturity ≤ timestamp + MAX_TTM bound (discharge Certora wish-list TODO)#1078claude[bot] wants to merge 6 commits into
claude[bot] wants to merge 6 commits into
Conversation
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
MathisGD
reviewed
Jul 24, 2026
MathisGD
reviewed
Jul 24, 2026
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.
MathisGD
reviewed
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Mathis GD · Slack thread
Discharges the
// TODO verify this cleanlyon thematurity <= block.timestamp + MAX_TTM()bound in thetakepreserved block ofpendingContinuousFeeBoundedByCredit(and the mirror inNetCredit.spec'stakeNetCreditChangeForBuyerAndSeller). The bound was a barerequire; it's now derived.Mechanism: a
persistent ghost mapping(bytes32 => mathint) maturityOfIdrecorded via thetoIdsummary (require maturityOfId[id] == market.maturity, the same idiom asSolvency.spec'stoIdsummary), plus a monotonic-block.timestampghostlastTimestamp, provestrong invariant maturityBoundedById(id): tickSpacing(id) > 0 => maturityOfId[id] <= lastTimestamp + MAX_TTM(). Becauseidis in scope at the use sites,requireInvariant maturityBoundedById(toId(offer.market))binds there and discharges the bound; the bare require is removed. Soundness rests onoptimistic_hashing(injectivehashMarket), as elsewhere in the specs.Discharges the corresponding item in the [Certora] verif wish list (#109).
Generated by Claude Code