Repository navigation
Case study: Verity end-to-end on Denaria #1736
denaria-team
started this conversation in
Show and tell
Replies: 2 comments 1 reply
|
Hey ! Thanks for your message, @Th0rgal isn't very active here, sorry about the late response. We just created a Telegram chat for Verity devs and we'll be much more active there. For a precise Denaria Finance question we could even create a group between our two teams if needed. See you in the telegram group ! |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi team — we're sharing the results of our first R&D cycle with Verity, and we're writing primarily to open a line of dialogue ahead of the next phase.
Who we are and why we're here
[Denaria](https://docs.denaria.finance/) is a fully-onchain perpetual DEX on Linea, built around a dynamic virtual AMM whose core is pure math — pricing, funding, liquidation. As a foundation we opened an exploratory R&D track to evaluate formal verification as a complement to our audit pipeline, and Verity was the tool that most convinced us on paper. This post is about what happened when we actually put our hands on it.
Two things worth stating upfront, because they frame everything below:
What we did
We ran a full tracer bullet through Verity on
MatrixMath, the signed 2×2 arithmetic library that underpins our dynAMM. Deliverables:MatrixMath(identity, left/right inverse, revert-on-singular, spec conformance, dot-product commutativity) + 17 supporting theorems on a customSignedIntmodel as a(Uint256, Bool)pairsorry, zero custom axiomsOne result we didn't expect: the compiled Yul came out 22–50% cheaper than our hand-written Solidity on 5 of 6 operations, on a per-external-call basis (this is from a preliminary analysis, without concrete production testing yet). We think we understand why — the flat-
int256calling convention skips the ABI encode/decode cost on nested static arrays — but a gut-check from you would be useful.Where we stand and why we're writing
Overall we're satisfied with the Phase 1 output — the pipeline works, the proofs close, the gas numbers are better than expected. What we need now is not public validation but a sanity check from the people who built Verity, to make sure we're using the tool the way it's meant to be used before we invest in the next phase.
The code (specs, proofs, EDSL implementation, compiled Yul, tests) lives in a private repo of ours. If someone on the team would be willing to take a look, we're happy to share it privately — read-only access to the repo, a walk-through call, or whatever format works for you.
Why timing matters — Phase 2 is CurveMath
The reason we're opening this dialogue now, rather than later, is that the next phase is where verification actually pays off:
CurveMath, the library that prices trades on our dynAMM. It's the library called byPerpPair([verified contract on Lineascan](https://lineascan.build/address/0xb68396dd4230253d27589e2004ac37389836ae17#code)) in thecomputeShortReturn,computeLongReturnandcomputeExactAmountInLongfunctions.From a formal-verification standpoint it's a substantially harder problem than MatrixMath: the logic solves cubic polynomial equations via Newton's method, with iteration to convergence and all the attendant concerns (bounding the iteration count, guaranteed convergence on the domain of interest, bounds on integer-truncation error, behavior at the edges of the curve parameters). A mistake here isn't academic — it translates directly into a mispriced trade and a loss for LPs or traders.
We already have a fallback plan in mind ("bounded iteration + error bound" if a full-fledged convergence proof turns out to be intractable), but we'd like to understand whether in your experience with Verity there are known patterns, recommended proof techniques, or similar cases you've already tackled. This is exactly the kind of problem where the experience of the people who built the tool is worth far more than any amount of documentation reading.
What we're hoping for from here
An ongoing line of contact as we move into Phase 2. A Discussion thread like this is ideal for async technical exchange; if at some point a call makes sense, we're happy to set one up.
cc @Th0rgal — thank you for building Verity in the open. This post exists because you made that possible.
All reactions