At the forefront of ZK panel with Grigore Rosu (Runtime Verification) and Alp Bassa (Veridise)

Nethermind Summit Istanbul 2023 · 7 Dec 2023 · 28:13

Grigore Rosu of Runtime Verification and Alp Bassa of Veridise, with moderator Julian Sutherland of Nethermind, discuss where formal verification meets zero-knowledge proofs. Rosu explains the Pi Squared idea of a cryptographic proof of a mathematical proof, while Bassa describes using SMT-based tools to check ZK circuits for bugs. They talk about zkVM trust, sparse circuit structure, and the next challenges, including parallelising proof generation.

Speakers

Topics

From Nethermind Summit Istanbul 2023, hosted by Nethermind.

Transcript

I think that um actually Alp and Gard work in I guess very different areas firstly I mean they're mostly working on the application side of of ZK for the moment right um and so it's it's not so much about the cryptographic techniques as the applications and what you can do with these new technologies and but actually they work in very very different areas whereas Alp is focused mostly on the security and proving proving like formally trying to formally verify certain properties of ZK circuits regard regard is working on some applications that he's going to tell you about a little bit about uh in a second but yeah let me start off with some intros so uh G is the CEO of runtime verification a company that has historically worked on the Kover and a lot of other cool pH verification

techniques but also auditing and now they're going into a new foray working on some ZK stuff which is's going to tell you about and uh oh yeah you're also a professor of foral Methods at the University of Illinois at OB champag important uh so an Alp is a form verification engineer at very and also I believe holds a PhD in mathematics uh so and and yeah so any anything else you guys want to add intro wise or is that that does that cover most of the things okay so uh so I'll just hand over the floor to you guys to talk a little bit about the individual projects that you're working on a little bit so would you like to start yeah perfect all right thank you so

traditionally um closer traditionally we um at runtime verification do runtime verification and formal verification and make sure that programs do what they are supposed to do mathematically rigorously but uh recently we became interested in combining that with zero knowledge technology because in the end if you think about formal verification and zero knowledge or verifiable Computing let's say more generally the concept fi Computing they both attack the same problem from different angles they both attempt to prove

correctness of computational claims some of them are very concrete claims like this program evaluates to 42 others are a bit more complex claims like this uh bite code implements an erc20 token but in the end they are both mathematical statements or theorems how we call them and they admit mathematical proofs and now if we can verify those mathematical proofs then in particular we can verify computations so we became very interested recently into combining these two different approaches to correctness that were developed by almost disjoint communities these were done by former

verification former methods people mathematicians and these were done by cryptographers and they follow different paths but now we believe it's time to bring it together and um and have one approach to correctness that goes through mathematical proofs so in both of them Indian you can gener mathematical proofs mathematical proof of correct execution of the program mathematical proof of the requirements that the program satisfies and then generate a verifiable Computing argument ZK proof or certificate ctog graphic evidence cryptographic proof that the mathematical proof exists for the claim so the claim is true and uh that's what

they're doing now um so I'm Al I'm a research scientist at verise uh veridis is a blockchain security uh and auditing company so I myself come from more mathematical background I used to do research in number Theory and algebraic geometry and to cryptography for a long time for uh but now at verise what we do is I mean verise is comes also from kind of academic background the founders are researchers mainly in formal methods and um the a is kind of to use formal methods in auditing so what we do is uh I mean how it evolved basically was um

there were many auditing projects uh and of course I mean we do lots of manual AUD but um there's a big need for tools and we had some in-house tools that we used to use a lot and since many people come from uh formal methods background they were based on various levels of uh uh sophistication coming from formal methods like some basic simple fuzzing methods some static analysis or uh more like smt based methods and so on uh with a a whole hierarchy and then um since we had developed those tools in house and we're using them very nicely we thought let's make them available so now uh verise is also offering these auditing

tools as a service uh that that will be I mean some of them are open already you can use and experiment them and we we do workshops about them and uh from those workshops we get like people can use them directly and we get feedback which we again feed into the tools themselves and it's kind of a um like a loop going back and forth uh yeah but that's basically what we're doing yeah great thank you so much for the the intro guys and by the way G you didn't mention the name of the project is it okay to do so yes yeah so the project is called Pi squ I think it's important to mention so yeah that so thanks thanks for the interest of your project guys um

and yeah I know incidentally for both of you the pain when you're working in formal methods but also uh you know ZK stuff the word proof is highly overloaded so you know so we use the term cryptographic and mathematical proof to try squ comes from proof of proof oh oh I like that I cryptographic proof of mathema you want to say that so it can be heard sorry right so the name of the project yes it's pi squar and Pi squ comes from proof of proof because you have a cryptographic proof of a mathematical proof the ultimate evidence of correctness that that's a great tagline the ultimate evidence of PR I love it great um cool so uh so my next the next question I wanted to ask you guys and I

think it was meant to be more so for G and um and Misha but Misha isn't here so you're really going to have to carry carry this one k because I imagine Al that you heard I was going to ask basically when did you first hear about zkps and did you immediately see the potential of the technology and I imagine Alp you've heard about zkps quite some time ago a given your area of work so uh well okay I mean can feel still feel free feel free to answer the question of course and uh but yeah I'll hand that over to G okay okay help thought why not we can go both directions yeah so I mean for me it was kind of interesting I mean I was doing initially research on uh the arithmetic of Curves and um so at some point ronad

ker from the CWI approached me he says okay I'm working on secret sharing schemes multi party computation and uh which are kind of a basic primitive for most of CK and here some very Hands-On question on algebraic curves and uh and that's kind of the first time I uh I mean I I because I mean basically because of elliptic curve cryptography I was kind of aware of many applications of alic geometry in cryptography but this was a very novel thing and um and that was the first time when I first it was well I was a post still the first time I was kind of uh when I saw the uh concept of a zero knowledge proof and so on and that's kind of uh for me it was kind of quite interesting to see because

like with most cryptographic constructions that you have around there they are based on some contradiction in some sense like there there's something that intuitively you think should not be possible uh but it is possible and that's kind of the surprising side of it I mean it's a like zero knowledge should not be possible if you ask someone on the street and if you look it's used everywhere so it is possible in the end and that that's kind of that contradiction I found very intriguing and I think that's also something that uh shows that it has a lot of um kind of future because kind of if something is not so intuitive you really need some time for people to come up with ideas of using those things after some point

because it's not immediately apparent how you could use something that is not intuitive at all yeah so that was my first encounter with ZK all right right yeah I guess um I Heard lots of people talking about it and I was intrigued what it is zero knowledge in fact there is a lot of knowledge um and um yes it looked impossible once I understood the problem that was solving I said that's impossible and uh I started reading U and I remember I read the Tyler's book and I was so um so fascinated by the whole concept and and U you know how you

can combine different you know Witnesses into one witness and all that became like an obsession it's it's very addictive once you get into it and um I don't know when it happened but at some point I said wait a minute actually we can do exactly the same with mathematical proofs we can um generate so of the mathematical proof of the theorem is the witness why the theorem is correct and now I can um I can um generate a succinct argument that I have uh such such a mathematical proof and and and then then I became obsessed with it I said okay we really have to understand this very well go deep into the rabbit's hole and understand

everything and then we discovered uh the different implementations around particularly of ZK VMS uh like the ZK VM and we try to understand what is the trust base of that because this is such a complicated monster and we doing formal verification we are of course obsessed with correctness yes why should I trust 1 million lines of code basically yeah uh that's so complicated and U I don't know if anybody verified ZK evm but I would not do it no matter how much they would pay us I would not take Project R time verification maybe very nice I don't know but not definitely um dep how the pay

right um and then maybe now I should answer a bit you know on Michelle's behalf I'm very right so so um you know the next thought that comes to mind is why not to generate correct by construction ideally all these uh VMS give me your program in particular an implementation of evm of of a VM be evm or is five or whatever and I'm going to generate for you from the implementation a ZK variant of your VM It's a Wonderful thought but now you have another problem why is the

compiler correct maybe you can do translation validation you can take for each instance you can generate a proof but then you still have to first say what the proof is for which means that you need the semantics of the programming language the semantics of the of the target language it's a very complicated problem even then um and then I put my back my my head mind okay um and then he said wait a minute maybe if we go through mathematics maybe we don't need the VM at all for a programming

language because when we have a formal semantics of a language or of a VM you actually have a mathematical Theory and now whenever I make any Claim about that programming language in particular the program evaluat to 42 or the bite code is rc20 uh compliant uh code that has a mathematical proof so now if I can verify mathematical proofs I get exactly the same guarantee that I would get if I had ZK right and then the next challenge is well how difficult would it be to verify mathematical proofs and it turns out

that it's a much much simpler problem and that's what uh brought us into this so there is a proof checker for example for mathematical proofs that has like 200 lines of code that's it that's the only trust base 200 lines of code and now if we can uh Implement that as a ZK circuit and prove it correct actually I think that is feasible right to take 200 lines of code and have a circuit for them and prove it correct compe I would take that project actually already took it have yes so that's um yeah so I heard of zkps for a long time that's your question now but I became interested in it about one year ago and I became

obsessed with it about six months ago and uh now we want to do this P Square project awesome thanks so much for your answers um just in response to some of the things that you said the first thing is um um Al I really empathize with you saying that hey you were aware of these cryptographic Primitives and that I remember I wanted to do my master thesis on modular forms with a a number theorist at my University when I was studying math and uh I told him you know oh yeah there are I've heard there are some cryptographic applications to this and he said yeah I write those on Grant sometimes so so um yeah anyways um but yeah so so thanks for your answers on this that's been

very interesting and yeah specifically this 200 these 200 lines of code are the verifier for um damn what's a very simple proof um proof assistant called that I called Remember met metth yeah metth yeah so this is a metth proof Checker right yeah so but I think in the end you're going for a slightly different direction right but but still yeah it's quite feasible to do this in a very succinct way and then verify the underlying circuits against the spec of the of the proof language yeah that's quite amazing um okay so I think next for my next question is going to be and once again you're going to have radically different answers I expect uh will be essentially what have been significant technological um what do you call it uh

what's the word that I'm looking for like difficulties that you've had right so I assume you'll say something to do with S&T solvers I might be wrong uh but but I I feel like I'm likely to be right here and regarding your answer will be more to do cryptographic Primitives perhaps or or maybe the compilation process or something like that but you know let me also let me let you answer my question you know so I'll hand it to your first thank you um so our first challenge was to understand ZK um the mathematics and everything and Al we are mathematically trained all of us U mostly phds and former mathematical background um we started questioning everything and that's the problem with people like us

whenever we need something takes us like 10 times longer than we should because we've seen this before somewhere it didn't work and why should it work here and so that was one one step another was to actually decide how to implement this 200 200 L of code is a circuit right so we tried all the existing Solutions right Ciro risk zero ZK lvm and uh and uh now we're also playing with lur and um actually Misha if Mish here he knows we communicate almost every other day where we get stuck with something so it was quite tough to make these systems work right there is a lot of enthusiasm around about the system but when you try

them out they are not that easy right so we had only 200 lines of code to implement and we are all experts in programming languages and software engineering and compilers should easy Julian knows he tried I tried one I tried to write we spend like two you spend two or three days with super super strong formal verification person right they tried to implement and they gave up right well we got we got some nice parts of the core proof Checker working but in the end yeah we completely fell prey to some issues with uh we keep discovering bugs in in these tools the compiler yeah and then they oh yeah we want to fix that then we will fix it we will have it in two days you know then one week later hey what is going on ah two more days and so on I mean it's the way things are

these are very difficult um um well so that was that was a challenge for us and it's still a challenge we are working in par with four different implementations and when they work they are extremely slow um of course everybody has this problem yeah the performance so now we are thinking of implementing a custom circuit going down to the basics specifically for mathematics and U see how it goes and then we have very nice audited for us mind well there you go yeah I mean you mentioned already the keyword or difficulties with smt and we've had some fun with that too getting them to to mod

model finite Fields is not you know super fun no it's okay sorry I mean it's just a very nice promise that smt gives it says okay I'll prove it to you I I'll do this course but then there's the bottleneck because at the end U it BS down to pomal equations solving them and so on so I mean basically like in some of our tools just to give some background what we do is for instance um if you want to look for a particular bug like want to check if your circuits are under constraint or something like that you can express that as a logical formula and then you all you have to see is whether that formula is satisfiable it's not just the usual Boolean satisfiability where you look

some for some interpretation where you just assign fruit values for the variables there's some other Theory involved so that's why it's called smt so satisfy modul theory in this case it will be the theory of finite fields and like polinomial equations over finite fields and so on but then you can ask similar problems given some statement in this Theory can I can I kind of decide whether it is true uh or false if if it's satisfiable can I find the model if it is not satisfiable can I kind of uh convey that in a simple way and uh what happens at the end I mean if you use most of the smt Sol um especially if you do satisfi buil

modular Theory where the theory is finite Fields you boil down everything to solving polinomial equations over finite fields and that is a inherently difficult problem that's something for decades people in computer algebra and commutative algebra have been working on they're very nice algorithms they work very nice theoretically they're extremely powerful uh but then when it comes to practice when you implement it small examples they work so you get the feeling oh it's wonderful if your examples grow a bit I when they have doubly exponential wor Time Performance they get stuck and that was our biggest problem one of our biggest problems at least uh that I have been working on is was how to make those faster and that's

kind of a basically a question in algebraic geometry basically it's h you have these polinomial equations can you solve them or can you show that they have no Solutions and that's kind of what caused us some sleepless nights but uh I think we did quite some improvement there I guess the arithmetization part that should be easier to prove right that a certain arithmetization is correct right because that's this is pure smt in some sense right the polinomial part is difficult but you need to solve the polins or you just need to check that something is a solution for a polinomial uh you need to solve them

yeah I mean if you have a solution that would for instance show you that it's under constraints and then the solution would tell you okay like this input gives two different outputs or for this circuit there are two different proofs or those kind of things or so in particular sorry yeah in particular you want to find two satisfying assignments of a circuit where in particular and you want to assert then that they're not equal essentially right and you want to then show that that's not satisfiable s i uh exactly exactly and in fact it's a very nice trick if you want to show that two things are not equal there's yet another you can express that as yet another equality so you just add that as another equality and then you take two

copies of the same circuit and then you say these two should be different which you then translate into equality which will be yet another equality on them so it's basically solving pomal equations thank you um so yeah so actually so obviously NE mind developed a I'll talk a little bit from my experience if that's okay we developed a tool for reasoning about Cairo right which obviously require well chyo zero specifically which obviously required reasoning about finite fields and our trick was that we uh just restricted the set of theories we use in an SNT solver as heavily as possible so we only use nonlinear integer arithmetic and under very restricted conditions we had higher order on in integer arithmetic but I

believe that you guys have uh actually developed a what do you call it um a new SNT theory in fact specifically for finite Fields right um can you can you tell us a little bit about uh do you actually use this in the tool currently and can you tell us a little bit about I think it uses like Montgomery representations right can you tell us a little bit about how that improve the the solving performance or yeah okay cheers def uh I mean so what we did was um like the first step I mean that was uh uh helpful was to not rely only on on smt I mean there's like the static analysis tools that you can use that kind of just looks at the syntax and looks for particular uh vulnerabilities for instance and

that's very fast but it's uh it's not so reliable because it can give you many false positives for instance and it's just you look for very particular things there and then there's the smt which is kind of much stronger you get guarantees and um you get proofs out of it but it's very slow and uh so we first developed one tool that we call pus it's also available uh open you can download it and experiment with it which kind of combines the two so it's kind of an interactive Loop between the static analysis phase and this smt phase where whenever one of them gets into trouble it passes it on to the other and says oh

can you say something and sometimes they both get into trouble and that's usually the case when the smt phase just is uh kind of confronted with a very difficult polinomial system and then so at the end the bottleneck was how to solve difficult polinomial equations and difficult means like those circuits can be huge they can have many variables and many equations and so on we are talking in the thousands sometimes and that's beyond anything that normal computer algebra systems would really care about because I mean those computer algebra systems that are around they were done mainly by people working on competive algebra and algebraic geometry and they

never write down equations with thousands of equation polinomial equations usually there are of course but that's not their initial goal so then we had to kind of see how to solve those because relying on the tools that were available did not help but then uh what's not interesting is that the circuits that one deals with in ZK applications they have a very particular form they're very sparse right so if you take one equation it will only involve very few of the variables right and they will have for instance if you have R1 CS constraints and so on you will have bounds on the degrees they will be just quadratic equation so it's not just a

random if you take an arbitrary like random uh polinomial equation whatever that means that's not going to be how uh a polinomial equation coming from a circuit will look like so they'll be very sparse they will have a lot of structure and what we wanted to do then is to exploit the structure So to that polinomial equation we attached some graphs that kind of showed us how the polinomial how the variables appearing in those polinomial are related to each other and uh from that uh we could push things way further I mean like just to give a very simple example in many ZK applications you have some range checks which say says for instance that that the variable X is between 0 and 2 the 14

for instance right and if you express this as a polinomial you would have to write down a polinomial whose roots are all the numbers between 0 and 2 to the 14 which would have then degree 2 to the 14 and that's a huge number yeah so range checks appear a lot but they are not uh things that you should Express in polinomial but smt solvers do Express them in pooms that's for instance just one example that uh kind of using just the methods as they are given smt solvers the big promise if you use it without thinking it will be uh uh a big disaster uh thank you so much uh do we have two minutes left we do we do yeah okay two minutes so I wanted to ask one

last question um but but yeah if you could keep it relatively short just given the time constraints which was uh essentially do you see problem upcoming problems that you're going to solve so what are are the next problems you guys are going to face and how do you think you're going to solve it I I know it's one minute teach is is a bit tough for that question but hey let's give it a try I think the problem would be to parallelize um The zkp Generation Um if we don't find embarrassingly parall algorithms to generate zkps at least in our case will never be as efficient is we need to that will be the challenge okay thank you I mean for me I'll just use is the easy way out

I'll say it will depend on which problems we'll see I mean because like our tools we use them on Audits and then we see where the bottlenecks are and that gives us a nice feedback of which parts we have to improve where where we have the problems so depends on which projects want audits at the end and then what what the problem what our tools have uh issues with them that's would be kind of the direction great thank you very much we did keep it to two minutes I believe perfect thank you so much thank you so much to both panelists thank you thank you Al and uh yeah looking forward to hear how both of your projects keep going right thank you so much

Related talks