Blockchain & Smart Contracts

Smart Contract Audit Prep Checklist: What to Do Before You Pay an Auditor

A practical pre-audit checklist: freeze the scope, write the threat model, reach meaningful test coverage, run a static analyzer and fix the noise, document roles and assumptions. With real Slither and coverage output from small example contracts.

By Rajib Roy Published 7 min read

If you are about to hire a smart contract auditor, you want their time spent on the hard problems: subtle logic flaws, economic attacks, design assumptions that don't hold. You don't want it spent on discovering that your tests don't compile, your code changed yesterday and nobody remembers what the upgrade key can do. Preparation is the difference between an audit that finds real issues and one that mostly finds mess.

This checklist is what I'd do before sending a codebase to anyone. I've tried to support it with real output from the example contracts in this series, including a few uncomfortable numbers. I'll also be clear about my own limits: I'm a developer preparing code, not an auditor, and nothing here replaces one.

What an audit is, and isn't

An audit is a time-boxed review of a specific version of your code by people who look for vulnerabilities for a living. It can reduce risk. It cannot prove the absence of bugs, and it covers only the commit and scope you give it. Contracts that were audited have still been exploited, usually after a change that happened later, in code outside the scope, or through an assumption no one questioned. So the right mindset is: an audit is one layer in a stack that begins with your own discipline.

1. Freeze the scope

  • Pick one commit and tag it. Auditors review a snapshot; if you keep merging, their findings may no longer apply.
  • List the in-scope files and say what is out of scope (for example, third-party libraries you import unchanged, the front end, the deployment scripts). Be honest about code you copied from elsewhere and modified.
  • Declare the compiler and dependency versions exactly: Solidity version, OpenZeppelin version, optimizer settings.
  • Stop adding features. The best audit target is code you wouldn't change if the audit found nothing.

2. Write down what the system is supposed to do

Auditors check code against intent. If intent lives only in your head, the audit can only check code against itself. Write a short document covering:

  1. Purpose and flows. What can a user do, step by step? Include diagrams if they help.
  2. Roles and powers. Who is the owner, admin, minter, upgrader? What exactly can each do, and can any of them take user funds or freeze withdrawals? Put it in a table.
  3. Assumptions. Which tokens will it handle? Does it assume 18 decimals, no fees on transfer, a trusted price feed, a particular chain?
  4. Invariants. Statements that must always be true, like "the sum of balances equals the total supply" or "the constant product never decreases". They're the best material for tests.
  5. Known issues and accepted risks. If you already know something is imperfect, say so; it saves time and shows you've thought about it.

3. Tests that mean something

A passing test suite proves less than people think. Two checks make it more honest.

Measure coverage. Hardhat 3 supports it with --coverage. Here is the real output for the example contracts in this series:

contracts/lab/AllowlistMint.sol      100.00 line   100.00 statement
contracts/lab/MintPass.sol           100.00        100.00
contracts/TeamToken.sol              100.00        100.00
contracts/lab/Upgradeable.sol         92.31         88.89
contracts/lab/Reentrancy.sol          92.59         90.48
contracts/lab/CommitRevealRaffle.sol  75.00         82.61
contracts/lab/MiniAMM.sol             78.05         70.91
contracts/lab/AssistantBugs.sol       67.44         48.28
Total                                 83.33         79.35

All the tests passed and the total line coverage was still only 83%. The AMM contract, whose six tests all pass, left its second-deposit logic, zero-amount reverts and one swap direction completely unexercised. That is exactly the kind of gap an auditor will find in minutes, and it is much cheaper for you to find first. Don't chase 100% as a goal, because coverage says a line ran, not that it was checked. Use it as a map of what you haven't tested.

Test the attacks, not just the features. For each risky function, write the exploit as a test: the reentrant caller, the wrong signer, the zero amount, the maximum value, the same proof used twice. The reentrancy post and the allowlist post show the pattern of a test that fails against the bug and passes after the fix.

If you can, add property-based or fuzz tests for your invariants, so thousands of random sequences try to break them. I haven't covered a fuzzing tool in this series, so I'm not recommending a specific one here.

4. Run a static analyzer and clean up the noise

Static analysis tools read your code without running it and flag known bad patterns. Slither, from Trail of Bits, is a widely used open-source option for Solidity. Running it on a Hardhat or Foundry project is a single command; on a single file, you point it at the file and remap imports. Here is what it reported on three of my example contracts:

  • Reentrancy.sol (6 results): it flagged VulnerableVault.withdraw() with a reentrancy-eth finding, noting the state variable written after the external call, which is the exact bug. It did not raise that finding for SafeVault. The remaining results were informational: low-level calls and "should inherit from the interface".
  • AssistantBugs.sol (13 results): among them were a tx-origin finding for the wallet that authorizes with tx.origin, and an unchecked-transfer finding for the deposit function that ignores a return value. Both were deliberate bugs from the AI assistants post. It also printed less useful items, such as a "locked ether" warning on the intentionally minimal attacker contract.
  • MintPass.sol (1 result): only an informational note about the low-level call in withdraw.

That is a small sample with planted bugs, so don't read it as a verdict on the tool. The practical lesson is about triage: go through every finding, fix the real ones, and for the rest write a one-line justification ("low-level call is intentional, result checked"). Hand the auditor a clean report with explained exceptions, so that they see your reasoning instead of 40 unexplained warnings. A static analyzer will also miss things, so treat a quiet report as "no known patterns found", not as "safe".

Also treat compiler warnings as errors. The Solidity documentation explicitly recommends taking warnings seriously.

5. Reduce what there is to audit

  • Use audited libraries (for example OpenZeppelin) for tokens, access control, proxies and math instead of reimplementing them. Don't edit library code in place.
  • Delete dead code and unused features. Every function is attack surface.
  • Keep contracts small and modular, another recommendation from the Solidity documentation.
  • Follow checks-effects-interactions and add reentrancy guards where value moves.
  • Cap the blast radius. The Solidity docs also suggest restricting the amount of Ether at risk and including a fail-safe mode, such as a pause for emergencies. A pause is itself power, so document who holds it.

6. Plan the operational side

  • Key management. Owners and upgraders should be multisigs, not a single hot wallet. Say who the signers are and how keys are stored.
  • Upgrade policy. If the contract is upgradeable, write down who can upgrade, whether there's a timelock and how users are told. See the proxy comparison.
  • Deployment script and parameters. Treat these as code under review. A correct contract deployed with a wrong constructor argument is still broken.
  • Monitoring and response. Who watches the contract after launch, what triggers the pause and who has authority to press it?
  • Dress rehearsal. Deploy to a testnet, run the user flows and verify the source; the deployment checklist covers it.

7. Package it for the auditor

  1. A README with build, test and run instructions that work from a fresh clone. Test them on a clean machine.
  2. The intent document from step 2, the roles table and the list of accepted risks.
  3. The commit hash, scope list and dependency versions.
  4. The coverage report and static analysis output with your triage notes.
  5. A named person who can answer questions quickly during the audit.

8. Afterwards

  • Fix, don't argue. For each finding, either fix it, with a test, or write down why not.
  • Re-review the fixes. A fix can introduce a new bug. Ask whether the auditor will check the fix commit and whether that is included.
  • Don't change code after the audit without telling users it has changed since. Publish the report honestly, including findings you chose not to fix.
  • Consider a bug bounty once live, as another layer.

What I'd say about cost and choosing

I don't quote audit prices because they vary widely with scope, firm and timing, and I haven't verified any. Ask for quotes from several firms, ask to see sample public reports, and ask who exactly will review your code. A cheap audit of messy code is less valuable than a focused one of clean code, which is why the preparation above is worth the effort.

One-page summary

  • One tagged commit, exact versions, a stated scope.
  • Written intent, roles table, assumptions and invariants.
  • Attack tests plus coverage you've read, not just a green tick.
  • Static analysis triaged with explanations.
  • Minimal code, audited libraries, a fail-safe, multisig keys.
  • A rehearsed deployment and a monitoring plan.
Build with me

Getting a contract ready for audit?

I help teams tighten tests, documentation and deployment scripts before they pay for a review. If you'd like a pre-audit pass, get in touch.

See services Get in touch

What I ran this against

  • Hardhat 3.22.0 (Mocha + ethers template), @openzeppelin/contracts 5.6.1, ethers 6.17.0, solc 0.8.34, Node.js 24.22.1, run on 17 November 2026 on Hardhat's in-process simulated network. Coverage figures come from npx hardhat test mocha --coverage over the example contracts used in this series.
  • Static analysis was run with Slither 0.11.6 and solc 0.8.34 on three of the example contracts (Reentrancy.sol, MintPass.sol, AssistantBugs.sol), with OpenZeppelin imports remapped to the local copy. The outputs described below are what that run printed, nothing more.
  • Two of those contracts contain deliberate bugs, so the findings are not a measure of how Slither performs on real projects. I give no claim about its false-positive or miss rates. I have not been through a professional audit as a client or an auditor, so the process advice here is a checklist assembled from public documentation and the tests above, not an insider account.

Sources checked

  • Slither, the Solidity and Vyper static analysis framework (Trail of Bits): github.com/crytic/slither.
  • Solidity documentation, Security Considerations, including the recommendations to take warnings seriously, keep contracts small and modular, use checks-effects-interactions, include a fail-safe mode and ask for peer review: docs.soliditylang.org.
  • Ethereum.org, smart contract security overview (further reading): ethereum.org.