Certora: verify ERC4626 round-trip properties - #465
Open
claude[bot] wants to merge 10 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CfzVWCYX7Nrnu4P6h4EuP9
MathisGD
reviewed
Jul 24, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CfzVWCYX7Nrnu4P6h4EuP9
MathisGD
approved these changes
Jul 24, 2026
MathisGD
reviewed
Jul 24, 2026
MathisGD
marked this pull request as ready for review
July 24, 2026 17:59
MathisGD
approved these changes
Jul 24, 2026
MathisGD
reviewed
Jul 31, 2026
MathisGD
reviewed
Jul 31, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CfzVWCYX7Nrnu4P6h4EuP9
MathisGD
reviewed
Jul 31, 2026
Signed-off-by: MathisGD <74971347+MathisGD@users.noreply.github.com>
MathisGD
approved these changes
Jul 31, 2026
MathisGD
reviewed
Jul 31, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CfzVWCYX7Nrnu4P6h4EuP9
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CfzVWCYX7Nrnu4P6h4EuP9
The intermediate lemma proving OZ's real Math.mulDiv matches the basic floor/ceil cvlMulDiv summary does not discharge. The prover returns fast counterexamples (not timeouts) for every rounding mode, in both an exact mathint-division form and a tight two-sided multiplicative-bounds form. Witness (floor, assert (res+1)*d > x*y): x=0xb6db..6dc (~8.27e76), y=7, d=6, returned res=0 on a non-reverting path -- true floor is ~9.65e76. Witness (ceil, assert res*d >= x*y): x=2^255+2, y=4, d=3, returned res=1 -- true ceil is ~7.7e76. The returned values are unrelated to floor/ceil(x*y/d): the prover over-approximates Math.mulDiv's 512-bit mulmod + Newton-Raphson modular-inverse bytecode and admits arbitrary small results. With mulDiv un-summarized there is no ghost to constrain, so no lemma fixes this. Reverting to keep PR green; the Math.mulDiv => cvlMulDiv summary in ERC4626.spec remains an assumption. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CfzVWCYX7Nrnu4P6h4EuP9
MathisGD
reviewed
Aug 1, 2026
Signed-off-by: MathisGD <74971347+MathisGD@users.noreply.github.com>
MathisGD
approved these changes
Aug 1, 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
Adds a Certora spec covering the last unchecked item in the formal verification wish list: the ERC4626 round-trip properties (the a16z
erc4626-testsERC4626.prop.solL244-318) hold — no deposit→redeem, mint→withdraw, or reverse round trip lets a user extract more than they put in.certora/specs/ERC4626.specproves the eight a16z round-trip inequalities (each rule named for its counterpart) plus two conversion lemmas. It proves them at fixed vault totals via thepreview/convertpath: the Morpho-Blue-dependenttotalAssetsfee accrual is summarized to arbitrary-but-fixed totals (a sound over-approximation) so the proof isolates exactly the rounding-direction correctness these properties test, without the supply-accounting cost that timed out #419.Math.mulDivis summarized to exact mathint floor/ceil semantics for SMT tractability. A matchingcertora/confs/ERC4626.confand the CI matrix entry are included.Generated by Claude Code