Get the Monday email →
Loading player…

Bug-Free Solidity Coding Agents

DevconSat, Nov 7, 2026, 12:00 AM

Transcript

[music] [music]

Uh I'm here to disturb disturb you and entertain you before lunch. So I'm sure I'm been in this space for a long time and many of you are probably security researcher. I just want to spend some few words that I am actually representing and this is very different than the talk I gave for the Ethereum Foundation. Here I'm representing Certora and Certora is a service company. We are actually providing a lot of services in this space and working with many of the client in this space.

We're providing audit, formal verification, opsec, design review. We are providing many many things. Uh I'm sorry doing a little advertisement. It's the last one, but the idea in this product that we are launching now is that it will actually be something that way more affordable and it doesn't cover all our services, but it's something that it's beginning. And this is the product that we want to release and actually we'll release this week and it's open source and it's actually will include a lot of things.

It doesn't replace audit or formal verification or something, but it's the beginning of it. So please listen. I will encourage question either before after the talk. Everything that we produce here is open source. We have been producing the Certora Prover, which I think George mentioned.

Certora Prover people use it for Solidity, which is amazing, but I want to point out that Certora Prover handles many things beyond Solidity. It handles particularly different virtual machine, the Ethereum virtual machine, which is the first, Solana bytecode is the second one, WebAssembly, which is the third one. It handle many programming language including Viper, Rust, and we want to actually build more. We are building more. And we have we are extending this the Certora Prover.

Okay. So actually is probably something interesting that we need to think of and I'm not sure what is the solution. We are seeing everybody that the LLM, the agent are getting better in writing code and definitely faster. They can produce I don't know if you've seen the Ben example the people talk a code a huge code in a in a variant of C and they rewrite it in a into rust in few days. It's amazing.

I work in industry and we ended up writing like 1 million lines of code. It took us 1 year and we got many award of it. So people are really really writing code very fast with agent. But now the bottleneck and I think we saw it in George question but the bottleneck is code review is testing. What do we do about it?

How do we review that and maybe what do we do about it? And what how do we how do we get into this domain that code are being changed all the time and new code is generated and new code from old code or new code from scratch. So the solution that I'm proposing and in fact it's not any new. It's when I started computer science which is long time ago this solution was proposed. Okay, so it's called spec based development.

It's one of the oldest idea in computer science. You start with the prompts or something. You ask the agent not just to write code, to write spec and to write spec and code and the idea is now we have the agent is non-deterministic. The agent is doing all this smart thing but we have a mechanism we can share that the code and the spec adhere so basically we say we check that the code adheres to the requirement which are defined by the spec. Okay?

And and the spec the question is it written by human? Is it written by agent? How is it reviewed? But this is this idea of spec driven development has been around for a while. It's been around for a while.

But there's a huge challenge on it, and I actually love it when I give talks about formal verification. you ask people to write specs, initial specs are terrible that writing by human. And they ended up writing spec which is exactly simulating the code. Okay? So you do an assignment, say X gets five, and you ask the the the human what the spec, they say X is equal five.

Okay? And you see now when people tweet that they formally verify, you look what they formally verify, they formally verify exactly what the code is doing. This does not increase the security by any means, but it's good for marketing. I agree. So this is what we want to avoid.

We want them to write something which doesn't mirror the the spec. And the challenge is also that the good spec, informal or formal, it need to capture some interactions between different part of the system. This is what's sort of art, and it's hard for human, and at the moment it's also very very hard for agent. Okay? And the the challenge is that LLM, and we have seen it in the last few weeks, and I'm sure we'll see more, LLM generate code and generate spec, and it will generate basically code which meets the spec.

But this code is not good at all because the spec is not good at all. In some sense, it's just making sure that the code and the spec have the same bugs. Okay. So what are we doing? We are doing baby step here, and I'm sure many can do more.

But we are doing different fix. We are using off-the-shelf coding agent like CodeX and others, but we add these skills. We call them FV plugin. They're based on our experience in the last eight years proving smart contact, but we are going to more fix. And they are trying to the things that we learn when we are doing formal verification.

So what are we doing? The first thing that we do is property property inference in English. We at the moment use the agent, but as a human we review that and we hope in the future they'll get better. We are using different agent. This is definitely the weakest part, but we are trying to help and I give you a simple example later, but this is the weakest part.

It's sort of getting to the good informal spec. The other thing we are doing and actually this is actually where is getting better and we are getting better and it's surprisingly. We have a tool that we build and we invested a lot of time and a lot of engineering to get it working, but it it seems like and we are really surprised the agent is sometimes better than us. The agent like we have a a solution of the formal verification, the formal verification fail, the agent can help us and it's amazing the ideas and I'll show you some, but you can see more. This is the FB troubleshooter.

So it's something that help you to diagnose failure of the formal verification. The other thing that we are doing which I think very important from security is to understand the quality of the spec because that is our biggest scary thing. When with client and we miss bugs in client we miss it only because of one reason. It has nothing to do. It's not a technological failure.

It's has to do with our human or or the developer themselves did not write the right spec. So this is where we are trying to help. We are doing some string. We are also doing academic work. I think this is interesting.

The last thing that we do which we haven't done enough, but we do more, we are not actually betting only on formal verification. We are also betting on testing. We think that getting good test is as hard as getting good spec. If you ask to LLM to give you a test, it give you immediately many many test. They are useless.

It's basically they are simulating behavior of the code which is which is essentially very very simple and very very connected to the code. So it's unlikely to find the tricky part where many many things go together. So we are trying to generate test and we are actually pretty positive. What we did is that we took repository for our client and we took the test that the human wrote. We throw them away and we are now generating automatically and since we have good spec, we can actually generate test which are as good as the test that produced by human.

We believe this is a good saving for protocol now and will be huge for protocol saving for protocol in the future because testing is expensive and getting good test is very expensive, especially if this code is generated by LLM. Well, have to be speed up. Okay. So how does it go? There's this property there's there's the the the agent it it infers the property.

It gets the code and the spec. Then it use the prover. It uses our prover, but in fact we can plug in other prover or father. We are actually integrating in Lean and others. And then you see either it finds a bug.

It's basically the like we seen in George talk, it finds a bug in the in the code which the agent generated or it says a proof or there's a timeout. There's a failure of the solver and then we use the the the the every troubleshoot. The last part is a spec evaluator. It checks the spec. If the spec is not good enough or if there is a bug, we ask the agent to generate more code.

So you may have to spend more tokens. The agent generate code and then you you recheck if it's correct and then we call the agent again and so on. So this is a loop around the agent that you keep improving the code depending on your budget and you keep improving the security of the code. Okay, so I wanted to give you an example. I have nine minutes.

I'll make it. I want to give you an example. I use the simplest code and we have actually been using it with real code. For example, we took the Aave V4. We give it uh I think something like uh very expensive, I should say.

We give it like 48 hours. I think it simulate about half half of the properties that we wrote manually. Okay, we have to see. So it's interesting. We are actually investing in trying to understand in retro perspective on project that we did things.

How can the LLM do it? Okay. So this is a a very very simple uh vault. You see the ERC. Here you see the the informal spec.

You see there is a vault. You see the property. This is what is given to the agent and you see as the result you see these are the properties that the agent get informally. You see there is a property of the vault. No one can withdraw.

When you when you have add 10% you see it gives you a property for each of the API calls. It give you an informal property and you get all these informal property. You see for an owner vault you get these all informal properties. From there you generate the code. Essentially like a coding agent that you are using now you generate the code.

You see it it it generate the code. It's the Solidity code. It's it's standard. There's nothing any news here. You take the prompt and you get your favorite coding agent to generate the code.

Here it's interesting. You see we take the informal properties and we generate CVR. I think this what George did in his talk. It's easy actually. It's very interesting.

The the the agent is pretty good in understanding CV. At the beginning it does badly, but you tell him about the the manual and it's getting better and better all the time. It's amazing. It's something which for us was hard to teach our team, but LLM is getting better and also understanding diagnostic everything. So you see the agent is generating a rule.

Don't don't worry about it. It's look like solidity, but it's different than solidity. You see there is this assertion. It's essentially checking a property that you have. Here you are checking that no one can resolve more than the the legitimate value.

This is interesting. You ask the agent to to generate correct code. The agent asks you what's correct. You mean correct is winning by the Sator approver. So the agent you see it does it.

It tells you it's very interesting. It even explains very nice. It basically generates a code, then it called the Sator approver. It finds a bug. It explains the bug actually.

Of course the Sator approver give you a counter example, but it's technical, but it's explained it informally. It's explained it informally. You see there's this bug with higher motor mark and it's also give you the fix all the LLM. It's give you the fix. It give you the fix and and it give you actually it's telling you that there is you see there is and it's and it's and it's it's it's gives you everything.

It's nice. Okay? And you see here the I I I'm unable to do it. My co-founder did it yesterday. You see the commit.

It uses the opposite. It's it's it's actually does everything for you. Okay? And and and you see the it fix the account share and I I should show you the code, but you see here that what happened after every operation it's there is this raise of high watermark watermark. It's the solidity code is updated correctly.

So you see the agent using the Sator approver is able to generate this correct code. This is great, but here is what we need to help you. And this is what we help you with a sort of prover. The first thing we do this FB troubleshooter. Once you fix the code, the the prover is unable to get it because there are some limits.

So the prover is unable to get it uh and and you see that the rule timeout. So what happened is the agent is calling another prover which is called lean and proving a very interesting theorem about code. Actually, it's very interesting. So it's proving something informally about the code and then using it to solve the timeout. So in fact, it's helping you in the formal verification process.

Okay? And the last this is probably the most important part of the thing. We need to understand how good the verification is because our theory is that people will do formal verification and after that they will have they will they will have bugs. The purpose of formal verification as far as we see is to prevent bugs. Okay?

So here is what we do. We have three ways that we measure the quality of formal verification. I'll elaborate on on on all of them. One is called property property coverage. The other one is the spec themselves and the last is understanding how good the agent himself itself is doing.

I think all of them are interesting. We evaluate all of them and we show you the result and you of course as a developer, you need to decide what you do about it because you're owning the security. Okay. So what's the first one? The first one is probably I think the most important and most interesting one.

To understand what I told you before, how good is your specification? In particular, maybe you can think about it in terms of coverage. How many behaviors are you covering with your specification? So one way to use is mutation testing. we have other ways to do.

These are methods that you can use with or without LLM and understand how many of the situation you are covered. So, you see in this case, are covering 75% of of the situation. You can argue if it's good or bad. I argue it's bad. I argue and actually statistics shows that when you are not covering something close to 100% the value of formal verification is not high.

So, you need as a human when you see this, you need to do more. And it this is also experience with project that we work with. That project that use formal verification and proved and only one rule didn't do anything interesting. So, this is the first thing. It's basically showing how good your your your specification.

And one way to do it is for example change the code, insert an interesting bug and see if it's this is what I tell people when they do audit with us. Try to insert bug, see if it's correct or not. So, you see here it's we are covering some bugs but not all of them and we have to invest in more informal properties in order to cover more. The other thing which is also interesting is understand and here again the LLM is useful. We can also use formal verification.

Understand for each rule how accurate how does it capture the correctness of the code. We call it here CVL faithfulness. Here you see it's also this spec that we generate for this talk is not great. It's not as good as the spec that we wrote for our. It's clear but we spend nine months on our.

I want to be clear here. Okay? So, and you ask the agent. Actually the agent is coming up with pretty interesting explanation why this spec is not good. I I I leave it to you but the idea is that because I'm running out of time but the idea is that you are actually not capturing the right properties of this code because the way it's doing one thing and other things.

And it's interesting. The agent is actually helping you here in writing a better spec. And of course, you as a human need to decide if this is if this is this is a a good or bad. But I still think it's good for you because in this process you get better spec and hopefully you get better code. The last part, it's obvious but still you have to do it.

It's you have to check how well the agent is doing and of course this is issue of budget. In this case for this talk I didn't want to burn a lot of tokens so I didn't run it a lot. So you see the agent is cheating. The agent is cheating all the way if it can so you see the agent actually it's a one one property is violated and in fact it's okay because it didn't want to run it again. And also you see that uh it didn't verify there are time two timeouts.

And of course if you are not happy you can run it again. You can run it again but it's requires more token and you'll get better you will get a better code. Okay. So I think I'm almost at the end. I have time.

So uh I want to actually explain to you what you want to take from this code from this lecture. We have I've been of course working on formalization long time but I think this is very very exciting time for formalization. I'm sure you have heard from Adam. So I think the the the most interesting thing from that and this is what we learned from people also in manual audit that the more complete spec you have you have a better code. And the more understanding of this code the better.

And if you have a complete spec actually you can change the code as long as you maintain the spec. And reviewing the spec is in many ways more important than reviewing the code. It can also allow you to generate test and many other things. So that's the first thing. And because of this as a human as AI we want to spend a lot of time in generating the right spec because once we have the right informal spec, we can generate code.

So in fact, we used to say that code is low, maybe we should change the spec is low because once you have the good spec, we can generate the code. So we we you as humans will the only way to review is code is by reading it and AI generate code which is correct by construction using our prover or other prover. Also AI generate test cases. Once you have good specification, AI can do many things for you. That's the idea.

We are releasing this auto prover skill. It has other SAS interface that you can do or it has a skill as an open source and you can use it. In fact, it can give you even audit report. It has integration with bug finding and AI audit and others. But the interesting thing here, it gets this formal spec, also it gets fast tests.

So it's get the ability that you can actually use and and ideally you can use it when you develop the code, but you can also use it before audit, but you can use it when you develop your code. Okay, I'm running out of time. So I want to say we have this auto prover. If you want, you can just scan this QR code. This is a tool which will be we are releasing now.

We will support it. We we will actually it's it's for solidity, but it will be available also for Solana, for Stellar, for other domain. It will also be available outside smart contract. This is a tool that you can use to secure your code and also it help you in the formal verification process. So this is the idea.

It's called auto prover. I'm ready to take questions either here or later, of course.

Thank you very much. So it seems the programmer's job is now writing and reviewing the specification, right?

Say it one more time.

That that now the programmer's job is writing and reviewing specification.

Exactly. Exactly. Reading and writing informal specification. And later, of course, sometimes reviewing formal specification because we cannot trust the LLM to to to to really to even though in general it does a good job, but we don't know. And I I I must say sometimes also of course reading the code.

Yeah.

So let's take some questions from the audience. Thanks for submitting. I'll read the first question. And it's here. It's Are you saying that generating specs from an implementation is not ideal?

Rather, you should generate specs from product requirements and then check the implementation against it.

Definitely. Definitely. And what we have seen actually when we work with LLM, they they they actually cheat. Sometimes when we when we show them both, they cheat. So you definitely I think the the looking into the the data, I think I remember once that there was auditor.

I think it's now I I'm I'm I'm I'm bulking in his name, but he's from Consensus that saying that when he gets an audit, he doesn't want to look into the code. He first wants to look into the spec. Yeah.

Nice. Okay. So the next question will be this one. How do we ensure that the LLM infer and test edge cases that may not be too obvious from a single requirement? EG some box arise from changing multiple operations together.

So that's the beauty of formal verification. Formal verification rely on modularity. So ideally you have a spec of the procedure boundaries. And then what we want, we want the formal verification to check the interaction between the different functions. And so so we want to actually to to come up with specification for each module.

That's by the way an advantage of formal verification or in fact formal specification as opposed to agent. We think on a module base.

Okay. Now we have here a question from students. Can you give me a short advice to all students out here who are here to learn something and build future in cyber security web three. So question.

Yeah, so I think a lot of things about web three. I think web three is the most open domain. A lot of excellent material rare skill a lot of most of the project is open. Everything is open. I think if you look into recent formal verification project there are some are good or some are bad, but they're all open.

It's great. You can you can look at it. I think this domain is excellent for student. It's moving fast, but I would advise you to pick one topic and follow it. Yeah.

Very nice. So let's Mark answered and the next question is about hallucinations. So what about hallucinations and novel approaches if any updates from like new compiles version ATC memory and orchestrations of agents. I guess we a little bit answer that, but you can.

So so so hallucination from what I understand, these are the cases that the LLM itself because it's actually produced some errors. Formal verification of course, if you have the right path can can check it. I think there's a we have a interesting competitor logical intelligence. They're actually trying to combine intelligence with formal with formal verification. I think it's a big issue hallucination definitely, but for from our perspective working with LLM, especially working in formal verification, which is a very deterministic procedure.

The fact that the LLM is non-deterministic is sometimes also an advantage. So I would but at the end when you're working with such a tool, you have to have some kind of level of paranoia. When it finds a bug and you understand the bug, it's great. When it prove the property, you as a human still need to understand what's going on.

Okay, now we have a question about models because we didn't discuss which models we should use. So there's a question. Do you think that decision models like Jeff can change the workflow?

Yes, yes, yes. We have not invest enough about in this, but it's definitely Jeff. Of course, things like thinking we are at the moment in Cetora because we are very, very small and don't understand we are essentially integrating all model. In fact, you can plug in your own models, but definitely it's very interesting what people do in models for and for application or other models is very interesting, very useful also in terms of reducing the cost. Our our tool at the moment I didn't tell you as you're using a very expensive model, it will be expensive.

Okay, thank you very much. We are out of time, so please huge applause for Molly.

Thank you very much. Thank you very much. I'm here around and also our team around. Please send us message. Try this tool.

We are interested We are eager to learn how good it does. We want to see actually and take a code that you are familiar with and try to run this tool and give us feedback. Thanks a lot.

We are also out of time for this morning security block. So thanks you. Thank you for being here. It was a very pleasant experience and we both look forward seeing you on the next event.

[music]

Automatic transcript — names and jargon may be misspelled.