lfglabs-dev / lfglabs-dev/verity
feat(Codegen,Proofs): automatic checked-arithmetic obligations (solc 0.8 overflow semantics)
Open
Nobody has claimed this yet.
enhancement
P2: important
proof
- Dominant language
- Lean
- Stars
- 148
- Forks
- 20
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 29
Description
Problem
Two related gaps, revealed by the Morpho Blue/Midnight ports (Th0rgal/morpho-verity):
- Yul drift: solc 0.8 generates
checked_add_*/checked_sub_*/checked_mul_*helpers by default. Verity does not emit shape-matched equivalents, so these helpers account for a large share of the 75 solc-only vs 214 verity-only functions accepted by Midnight's Yul identity gate. - Hand-stated overflow axioms: Blue's
Proofs/Disciplines.leancarries 4 manually assertedLocalNoOverflowForaxioms (totalBorrowAssets+1,totalBorrowShares+1e6,collateral*price,collateral*price*lltv). These should be derived side conditions, not assumptions.
Note: #1752 (closed) added explicit safeAdd-style builtins only — it did not address default checked semantics or auto-derived obligations.
Scope sketch
- Emission: an opt-in (later default) mode where source arithmetic lowers to solc-shaped
checked_*Yul helpers with panic(0x11) revert paths, closing that Yul-identity-drift category. - Obligation generation: for each checked operation in a generated body, derive a
NoOverflowside condition as a proof obligation attached to the entrypoint summary, replacing hand-statedLocalNoOverflowForaxioms. - Discharge support: tactic/lemma support to discharge the generated conditions from contract invariants (e.g. supply caps), or leave them as explicit
assumedtrust-report entries when not dischargeable.
Relations
- Pairs with the dynamic ABI codec work (#1982 P0-1) as the other big Yul-drift category.
- Obligation discharge composes with generated-body execution summaries (see companion issue) and #1990.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the checked arithmetic and Yul behavior described in the issue, then inspect Proofs/Disciplines.lean and the related work in #1990 and #1982. Done means checked operations emit solc-shaped helpers, generated NoOverflow obligations replace the listed hand-stated axioms, and discharge or trust-report behavior is covered.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100