Protocol security
Smart Contract Audit Scope: What Teams Should Prepare
A clear audit scope tells reviewers which code and behavior matter, which deployment assumptions apply, and which risks sit outside the engagement. It improves coverage without implying that a larger file count automatically means a better audit.
Identify the exact implementation
Provide the repository, commit hash, in-scope files, compiler version, optimizer settings, dependency versions, and relevant deployment scripts. If deployed contracts differ from the latest development branch, both the deployed artifact and its source relationship should be clear.
List generated code, inherited contracts, libraries, proxies, and external integrations. Excluding a dependency from detailed review may be reasonable, but the audit still needs to understand how the in-scope system relies on it.
Describe intended behavior and invariants
Reviewers need more than function names. Explain asset flows, role permissions, lifecycle states, expected failures, accounting rules, and conditions that must always remain true. Include examples for complex pricing, share, liquidation, reward, or vesting calculations.
Known quirks should be disclosed. A deliberately accepted design tradeoff is different from an undocumented assumption, but it still needs analysis because users and attackers experience the deployed behavior rather than the team’s intention.
- List privileged roles and the wallets, contracts, or governance processes controlling them.
- Document minting, pausing, upgrades, emergency recovery, and ownership transfers.
- Specify supported tokens, chains, oracles, bridges, and external protocols.
- State invariants in a form that can become executable tests where practical.
Provide deployment and operational context
The same bytecode can have different risk under different initialization, roles, oracle sources, or governance settings. Share constructor arguments, proxy implementation history, initialization order, timelocks, multisig thresholds, keeper behavior, and monitoring arrangements.
If the audit occurs before deployment, identify which parameters are fixed and which remain decisions. Unresolved deployment choices should appear as residual risk rather than silently assuming the safest configuration.
For the external assumptions that belong in a review scope, see Designing Trust Boundaries for Oracles and Bridges.
Prepare tests and previous findings
A runnable test environment saves review time and makes attack scenarios easier to reproduce. Include unit, integration, fuzz, and invariant tests where available, together with setup instructions and external-network requirements. Previous audits, known issues, and public disclosures help reviewers avoid treating accepted behavior as a new discovery.
Previous findings should not be hidden to make the new report look cleaner. Their status and remediation history are part of the system’s assurance record.
Plan remediation before the audit starts
Agree on severity definitions, communication channels, draft finding review, remediation timing, and how fixes will be verified. A fix can change accounting or trust assumptions elsewhere, so verification should consider neighboring code rather than only the edited line.
The final record should distinguish fixed, partially fixed, mitigated, acknowledged, and unresolved findings. No audit guarantees security; a clear scope makes the assurance provided by the review easier to understand.
Example: scope changes that need an explicit decision
Consider a hypothetical team preparing a token-distribution contract for deployment. The review target is a frozen repository commit, but the team is still deciding which tokens, administrative roles, and deployment configuration to support. The examples below show how apparently small changes can alter what needs review. They describe scoping questions, not findings from a real audit.
| Proposed change | Question to resolve | Evidence to add to the scope |
|---|---|---|
| Support an additional token | Does its transfer behavior fit the implementation’s assumptions? | The supported-token assumptions and tests for relevant transfer behavior. |
| Add an administrative role | What can the new role change, and who controls it? | A permission map, privileged functions, and authorization tests. |
| Change the deployment network | Which configuration or dependency assumptions differ? | Target chain, addresses, deployment parameters, and verification steps. |
| Modify code after review begins | Which reviewed behavior is affected by the change? | A new commit identifier, a readable diff, and agreed follow-up coverage. |
| Accept a remediation patch | Does the patch address the finding and preserve intended behavior? | A fix diff, regression tests, and a documented verification result. |
- Freeze the version used for the initial review and record later changes explicitly.
- Agree who decides whether a change needs additional review.
- Keep excluded components visible in the final scope so readers can interpret the findings.
Primary documentation and further reading
These sources describe the underlying protocols and tools. They are provided for technical verification and further study.