Skip to content

feat(formal): add Lean models of the charge intent and Tempo charge with a shared core - #402

Closed
brendanjryan wants to merge 1 commit into
pyramid/24f7068b-fd05-4641-9bd0-556d7c14885dfrom
pyramid/e668c7e9-5ca4-4d30-94f6-b5d46bb8e99d
Closed

brendanjryan wants to merge 1 commit into
pyramid/24f7068b-fd05-4641-9bd0-556d7c14885dfrom
pyramid/e668c7e9-5ca4-4d30-94f6-b5d46bb8e99d

Conversation

@brendanjryan

Copy link
Copy Markdown
Collaborator

Replaces #401 with one signed commit; content is #401's head plus a tempo-charge fix. Stacked on #400.

  • Lean models of the charge intent and the Tempo charge method, alongside feat(formal): add the Lean model of draft-tempo-session-00 #400's tempo-session model.
  • formal/core (MppCore) holds what the models share: run, Reachable, upd, and the proof gate (check-lib.sh, Audit.lean with kernel replay). Each model is audited with it.
  • tempo-charge: a pull transaction must carry the fee payer placeholder exactly when the Challenge asks for feePayer, so the model no longer records sponsorship the server never paid.
  • The subscription model is dropped.

Checks: bash formal/<model>/check.sh passes for core, intent-charge, tempo-charge and tempo-session.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T00:02:05.783538Z c426121 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

Spec Preview

Spec Changed Artifacts
draft-card-charge-00 Yes HTML · TXT · XML · PDF
draft-evm-charge-00 Yes HTML · TXT · XML · PDF
draft-evm-session-00 Yes HTML · TXT · XML · PDF
draft-hedera-charge-00 Yes HTML · TXT · XML · PDF
draft-hedera-session-00 Yes HTML · TXT · XML · PDF
draft-httpauth-payment-01 Yes HTML · TXT · XML · PDF
draft-lightning-charge-00 Yes HTML · TXT · XML · PDF
draft-lightning-session-00 Yes HTML · TXT · XML · PDF
draft-nearintents-charge-01 Yes HTML · TXT · XML · PDF
draft-payment-discovery-01 Yes HTML · TXT · XML · PDF
draft-payment-intent-charge-00 Yes HTML · TXT · XML · PDF
draft-payment-intent-subscription-00 Yes HTML · TXT · XML · PDF
draft-payment-transport-mcp-00 Yes HTML · TXT · XML · PDF
draft-solana-charge-00 Yes HTML · TXT · XML · PDF
draft-solana-session-00 Yes HTML · TXT · XML · PDF
draft-solana-subscription-00 Yes HTML · TXT · XML · PDF
draft-stellar-charge-00 Yes HTML · TXT · XML · PDF
draft-stripe-charge-00 Yes HTML · TXT · XML · PDF
draft-stripe-subscription-00 Yes HTML · TXT · XML · PDF
draft-tempo-charge-00 Yes HTML · TXT · XML · PDF
draft-tempo-session-00 Yes HTML · TXT · XML · PDF
draft-tempo-subscription-00 Yes HTML · TXT · XML · PDF
draft-usdc-charge-00 Yes HTML · TXT · XML · PDF
draft-xrpl-charge-00 Yes HTML · TXT · XML · PDF
draft-xrpl-session-00 Yes HTML · TXT · XML · PDF

Browse preview release assets

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

- Guards for rules the draft leaves out are `Cfg` flags, default on; each has a counterexample with it off ([GAPS.md](./GAPS.md)).
- `splits = []` means absent; `pull` / `push` stand for `supportedModes` (both true when omitted).
- A pull transaction that reverts stays on chain (nonce used, fee paid by the sponsor); its settlement issues no receipt and the challenge reopens, so a client can retry; §Server-Paid Fees accepts that fee risk.
- The server sponsors any pull transaction for a `feePayer` challenge; one with `sponsor = false` needs no fee payer.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 nit (optional): The README tells readers that a sponsor = false pull transaction for a feePayer challenge is accepted, but the model now rejects it. The submit guard at Model.lean:326 requires t.sponsor = cr.echo.request.feePayer, so a feePayer challenge needs a sponsored transaction. Fix: reword line 65 to match the guard: a pull transaction carries the fee payer placeholder exactly when the Challenge sets feePayer, and the server sponsors only those.

Why this was flagged

formal/tempo-charge/TempoCharge/Model.lean:325-326 accepts a .transaction t credential only when t.sponsor = cr.echo.request.feePayer. That covers both directions: a feePayer challenge with sponsor = false is refused, and so is a non-feePayer challenge with sponsor = true. formal/tempo-charge/README.md:65 still says "The server sponsors any pull transaction for a feePayer challenge; one with sponsor = false needs no fee payer", which describes the behaviour before this PR's tempo-charge fix. Anyone reading the README for the modelling choices gets a rule the checked model does not encode. No code safeguard applies because this is documentation.

Verification: The .submit guard for .transaction t in formal/tempo-charge/TempoCharge/Model.lean:325-326 requires t.sponsor = cr.echo.request.feePayer. So a pull transaction with sponsor = false against a feePayer challenge makes step return none (line 336, else none). formal/tempo-charge/README.md:65 still describes the looser rule. Only the README is affected.

Comment thread formal/core/check-lib.sh
Comment on lines +77 to +78
rm -rf .lake "$core/.lake"
lake build

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (optional) A maintainer who adds an MppCore/ module that the MppCore root does not import will see every model's check.sh fail, while core/check.sh passes. The model's lake build (line 78) builds only the model's default target and the MppCore modules it imports. The audit module list (lines 255-257) still names every file under MppCore/, so importModules hits a missing .olean. Fix: build exactly the set the audit loads by running lake build "${libs[@]}" here, so MppCore's own globs target is built in every model run. A model that imports only MppCore.Machine hits the same failure.

Why this was flagged

For a model, check-lib.sh adds MppCore and every MppCore.<file> under formal/core/MppCore/ to $modules. Line 77 then deletes "$core/.lake", and line 78 runs a bare lake build from the model directory. That builds the root package's defaultTargets plus whatever MppCore modules the model's imports reach, not MppCore's globs = ["MppCore", "MppCore.+"] target (formal/core/lakefile.toml). Suppose a module under MppCore/ is not imported by MppCore.lean. Audit.lean's importModules then throws on the missing .olean, and the script prints "FAIL: axiom audit". core/check.sh passes in this case because there MppCore is the root package and its globs are built. The failure is fail-closed, but it rejects valid changes with a misleading error. The base branch had no dependency library, so this mismatch could not happen there.

Verification: Severity: nit. No such module exists today: MppCore/ holds only Fn.lean and Machine.lean, and MppCore.lean imports both. In formal/core/check-lib.sh, line 77 runs rm -rf .lake "$core/.lake", and line 78 runs a bare lake build from the model directory. The failure is fail-closed: CI fails falsely, and no proof goes unchecked.

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.

1 participant