Audited code
Overpaid- Swap sent: 100 units in
- Token fee keeps 10, pool receives 90
- Pool prices the trade from 100
- Transaction
- Went through
- Units the pool received
- 90
- Units paid to the trader
- 90
Sec3Proving Layer
AI models can review a program and suggest many plausible security issues. Each one is a hypothesis. Before your team can act on it, someone has to show it can happen on the real program, measure the damage, and confirm the flaw is really the cause. That work still falls on your senior engineers, and an AI-written exploit that passes its own test may prove nothing.
Sec3 Proving Layer automates that work. AI agents write the proof of concept from a plain-text hypothesis and the program’s source code; the hypothesis doesn’t need to come with an exploit. A sophisticated harness runs it on the real program, checks every step, and confirms the named flaw is the cause before returning a verdict you can act on.
The problem with AI proofs
A test can pass and still prove nothing. Here are four ways that happens:
The starting state was written in by hand and can't happen on the real program
Builds every starting state through the program's own instructions, from a fresh deployment. No hand-written account data stands in for state the program would create.
Dependencies such as the token program were mocked
Runs your compiled program alongside the real programs it calls, in a Solana runtime
The test checked the wrong value, or one that doesn't matter
Reads the impact from the actual post-attack state, and a separate review confirms it measures the impact the hypothesis describes.
The flaw was never shown to be the cause
Runs a cause check: the same PoC, unchanged, with only the named flaw neutralized. The impact must disappear while normal setup still succeeds.
Case study
The hypothesis. An audit of a Solana trading-pool program reported a critical issue: when a token charges a fee on every transfer, a swap could pay the trader as if the pool had received more than it did. The audit described the problem in words and included no exploit code.
Building the starting state. The test needs a token that charges a transfer fee, a second token, and a trading pool holding both. None of it can be written in by hand. The transfer fee is a setting that Solana's Token-2022 program applies itself, so the token has to be created and configured by Token-2022. The pool and its vaults are created by the program's own pool-creation instruction, which ties them together in ways a hand-written copy would not. So the starting state was built with 12 real transactions through Solana's System and Token-2022 programs (create two tokens, open four token accounts, set the 10% transfer fee, initialize the tokens and accounts, and fund them), plus the program's own instruction to create the pool.
The root cause. In this test the trader sends 100 units of a token with a 10% transfer fee, so Token-2022 delivers 90 to the pool. The program calculated that 90 correctly, then priced the trade from the original 100 anyway. The pool paid out 90 units, when the 90 it actually received was worth 81. The fix is one line: price the trade from the amount that arrived. Showing that the flaw is real took everything below.
Setup
12 real transactions through Solana's System and Token-2022 programs · no hand-written data
| Trader sends | 100 |
|---|---|
| Token fee keeps (10%) | 10 |
| Pool receives | 90 |
| Pool prices the trade from | 100 |
| Paid to the trader (should be 81) | 90 |
Root cause, step by step
The swap and the cause check
The swap ran on the audited code. For the cause check, only the pricing input was corrected, for this test only, and the same swap ran again.
Both swaps went through and the pool received the same 90 units both times. The only thing that changed is what the trader was paid, and it landed exactly on the value worked out in advance.
Case studyEvidence review
All 12 setup transactions went through Solana's real System and Token-2022 programs, and the pool was created by the program's own instruction. No account data was written by hand.
The compiled audited program ran alongside the real Token-2022 program. The transfer fee and both token transfers happened as real program calls.
Both values were read from the accounts after the transaction: the pool received 90 units, but paid the trader as if it had received 100. A separate review confirms it measures the impact the hypothesis describes.
The fee rate (10%, capped at 10 units) and the pool size were picked so the difference shows up in small whole numbers. The trader's minimum-payout setting was left at zero so that an unrelated safety check couldn't block the trade. Neither causes the mispricing. Getting the test setup right (account layout, price range and pool size) took 38 attempts, and every attempt is kept in the record.
The cause check used the same unchanged test. The only change to the code was passing the already-calculated post-fee amount into the pricing step, which is how the bug was fixed. The swap still went through and the pool still received 90, but the payout moved from 90 to 81, the value worked out in advance.
Verdict: Validated for the tested swap. The input token has to charge a transfer fee, and the pool has to accept that token. The 9-unit overpayment comes from this test's chosen fee and pool size. It shows the direction of the loss, not its size on a real pool. The full test package can be re-run by your team or your auditor.