TriageWorkflowCode Review

Reading a 3,000-Line Solidity Contract in an Hour: A Triage Workflow

Most auditors read contracts the wrong way — top to bottom, line by line, like a novel. That's how you spend 8 hours and still miss the bug that drains $197M. Here's the triage workflow that actually works.

Duron Epps

Founder, SmartContractAuditor.ai

10 min read
ShareXLinkedIn
Long scroll of code beside an hourglass, with a scanner beam highlighting three sections

A smart contract triage workflow is a structured method for rapidly identifying the highest-risk code paths in a Solidity codebase before doing a deep line-by-line review. The Euler Finance attacker didn't need to understand all 4,000 lines of that protocol — they needed to find one flawed donation function and one missing health check. That one bug was worth $197M. The lesson isn't "audit more carefully." It's look at the right things first.

Most people reviewing contracts — whether they're a founder pre-deploy, an investor doing due diligence, or a junior auditor — start at line 1 and read down. That's the wrong move. A 3,000-line contract has maybe 200 lines that can actually get you rekt. The rest is boilerplate, events, view functions, and scaffolding. Your job in hour one is to find those 200 lines before anything else.

This is the exact workflow I'd use if someone dropped a contract on my desk and said "we deploy in an hour."

What Is Smart Contract Triage and Why Does Speed Matter?

Triage in this context means prioritizing by risk, not by line number. You're asking: where can money move, who can move it, and what stops them from moving it wrong? Those three questions cut through most contracts in under 20 minutes.

Speed matters because the real world doesn't give you a week. Founders push to mainnet. Investors need a quick read before an IDO. Protocols get forked and deployed before anyone checks whether the fork introduced a bug. Chainalysis counted $3.8B stolen in crypto hacks in 2022, most of it from DeFi protocols. Plenty of those contracts had been reviewed. Just not systematically, and not with the riskiest code first.

Having a system is the difference between a 60-minute review that catches critical bugs and a 60-minute review that gives false confidence.

How Do You Structure a Fast Solidity Code Review?

Here's the actual workflow. No fluff.

Step 1 — Build the money map (10 minutes)

Before reading a single line, run a grep or use your IDE to find every function that moves ETH or tokens. These are your kill zone functions.

# Find all external calls and token transfers fast
grep -n "transfer\|transferFrom\|call{\|send(\|\.call(" contracts/*.sol

List every function that appears. That's your triage list. Everything else is secondary until these are cleared.

Step 2 — Map access control in 10 minutes

Find every onlyOwner, onlyRole, require(msg.sender ==, and modifier. Write them down. Then ask: is there any fund-moving function that doesn't have one of these? That's your first red flag. Everyone talks about reentrancy. Access control exploits have drained 3x more from DeFi and nobody gives them the same attention. The Ronin Bridge hack — $625M — was access control. Not reentrancy. Not flash loans. Someone had too many validator keys and nobody noticed.

Step 3 — Check the state update order (10 minutes)

For every fund-moving function you found in Step 1, ask: does the balance update before or after the external call? If it's after, you have a potential reentrancy. This is fast to check once you're only looking at your kill zone list.

Step 4 — Scan for math and input validation (15 minutes)

Check Solidity version. If it's below 0.8.0, every arithmetic operation is an overflow risk. Post-0.8.0 you're safer but not immune — unchecked blocks, casting between types, and division-before-multiplication are all still live issues. Look for unchecked {} blocks specifically. They bypass overflow protection intentionally, which is sometimes fine for gas and sometimes fatal.

Step 5 — Read the upgrade and admin logic (10 minutes)

If the contract is upgradeable (look for Proxy, UUPS, TransparentUpgradeableProxy, or OpenZeppelin's Initializable), find out who controls the upgrade. A single EOA with upgrade rights is a rug pull vector, full stop. If there's no timelock, that's your second major flag.

Step 6 — Skim the rest for logic inconsistencies (remaining time)

Now read the rest. You're not word-for-word parsing — you're looking for functions that touch your kill zone indirectly, storage variables that look mismatched with what the comments describe, or parameters that could be manipulated by a caller.

What Does a Vulnerable Pattern Actually Look Like in Solidity?

Let's make this concrete. Here's a classic reentrancy pattern that still shows up in real contracts more than it should:

// SPDX-License-Identifier: MIT
// Solidity 0.8.24 — but old patterns survive version upgrades
pragma solidity ^0.8.24;

contract VulnerableVault {
    mapping(address => uint256) public balances;

    function deposit() external payable {
        balances[msg.sender] += msg.value;
    }

    // ❌ VULNERABLE: external call happens BEFORE state update
    function withdraw() external {
        uint256 amount = balances[msg.sender];
        require(amount > 0, "Nothing to withdraw");

        // State hasn't changed yet — attacker's fallback can re-enter here
        (bool success, ) = msg.sender.call{value: amount}("");
        require(success, "Transfer failed");

        // Balance only zeroed AFTER the call — too late
        balances[msg.sender] = 0;
    }
}

An attacker deploys a contract with a receive() or fallback() that calls withdraw() again. Since balances[msg.sender] hasn't been zeroed yet, the check passes every time. The vault drains until it's empty. This is the exact pattern that killed The DAO for $60M in 2016 — and variations of it still appear in freshly deployed contracts today.

Here's the fixed version using checks-effects-interactions, which is the pattern you should be looking for in every fund-moving function:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; // OZ 5.x

contract SafeVault is ReentrancyGuard {
    mapping(address => uint256) public balances;

    function deposit() external payable {
        balances[msg.sender] += msg.value;
    }

    // ✅ SAFE: state zeroed BEFORE external call + reentrancy guard
    function withdraw() external nonReentrant {
        uint256 amount = balances[msg.sender];
        require(amount > 0, "Nothing to withdraw");

        // Effects first — balance is zero before any external call runs
        balances[msg.sender] = 0;

        // Interactions last
        (bool success, ) = msg.sender.call{value: amount}("");
        require(success, "Transfer failed");
    }
}

Two changes: state update moves above the call, and nonReentrant from OpenZeppelin 5.x adds a mutex as a second layer. Belt and suspenders. When I see a fund-moving function during triage and it doesn't follow this pattern, that function goes on a priority list immediately.

How Do I Catch Access Control Bugs Before They Ship?

During your Step 2 access control map, you're looking for mismatches. Here's the shape of a problem that gets missed constantly:

// ❌ This looks fine until you notice emergencyWithdraw has no access modifier
contract StakingPool {
    address public owner;
    mapping(address => uint256) public stakes;

    modifier onlyOwner() {
        require(msg.sender == owner, "Not owner");
        _;
    }

    function setRewardRate(uint256 rate) external onlyOwner { ... }
    function pauseDeposits() external onlyOwner { ... }

    // 🚨 Anyone can call this — no modifier, no check
    function emergencyWithdraw(address token, uint256 amount) external {
        IERC20(token).transfer(msg.sender, amount);
    }
}

In a 3,000-line contract with 40 protected functions, one unprotected function is easy to miss if you're reading linearly. The triage workflow catches it because you're building the full access control map first, then checking every fund-moving function against it. The gap is obvious when you're looking for gaps rather than reading prose.

What Static Analysis Tools Should I Use for Fast Contract Review?

Static tools accelerate triage — they don't replace it. Slither from Trail of Bits is the best free option and it'll flag a lot of what's in Step 3 and Step 4 above. Run it first, before you read anything:

slither . --print human-summary
slither . --detect reentrancy-eth,reentrancy-no-eth,unprotected-upgrade

Mythril is heavier but good for symbolic execution on specific functions you've already flagged. The honest truth about static tools: they're excellent at pattern matching and terrible at economic logic. Slither would not have caught the Euler Finance bug because the vulnerability wasn't a code pattern — it was a missing business logic check that only made sense if you understood how the protocol's health factor was supposed to work. That's the gap where human review and AI-assisted analysis earn their keep.

According to Trail of Bits' internal research, Slither catches roughly 70% of common vulnerability classes — but the 30% it misses includes most of the economically complex exploits that cause nine-figure losses.

How Do I Know When to Stop Triaging and Go Deep?

When your kill zone list from Step 1 is fully cleared — either confirmed safe or flagged for deeper review — you've done your hour of triage. At that point you have two outputs: a list of functions that need deeper analysis, and a rough confidence level on the rest of the contract.

If your kill zone list came back clean and the access control map is tight, you're in decent shape. If you found 3+ issues in the first pass, don't ship. Full stop. A contract that fails triage on multiple counts doesn't get better on deeper review — it gets worse.

One counterintuitive thing I'd push back on: a lot of founders think length equals safety. "It's 5,000 lines, it must be complex and therefore well thought out." No. Length increases attack surface. A 500-line contract with clean separation of concerns is safer than 5,000 lines of tangled logic. If you can't follow the money through a function in under 2 minutes of reading, that's a code smell on its own.

How Does AI-Assisted Analysis Fit Into This Workflow?

Static tools catch known patterns. Manual triage catches structural issues. AI analysis catches the in-between — the business logic that looks valid syntactically but doesn't make sense given what the protocol is supposed to do. That's where SmartContractAuditor.ai fits into this workflow. Paste your contract and it flags the exact patterns from Steps 1 through 5 above, explains why each one is dangerous in plain English, and surfaces issues that pure static analysis misses because it understands context, not just syntax.

Run your contract through SmartContractAuditor.ai before you deploy — not after. It takes under a minute and it checks for reentrancy, access control gaps, upgrade risks, and logic issues with the same triage priority order described here. Run a free scan at SmartContractAuditor.ai — paste your contract address or source code and get results before you're the next post-mortem someone writes about.

Your Triage Checklist Before Any Deploy

  • Run grep or Slither to build your kill zone function list — every function that moves ETH or tokens
  • Map all access control modifiers and cross-reference against your kill zone list — any fund-moving function without protection is an immediate flag
  • Check state update order in every kill zone function — effects before interactions, every time
  • Search for unchecked {} blocks and audit each one manually — gas optimization can hide overflow bugs
  • Identify upgrade proxy pattern and admin keys — single EOA with upgrade rights and no timelock is a risk you should name explicitly before shipping
  • Run Slither with --detect reentrancy-eth,unprotected-upgrade and clear every high-severity finding or document why it's a false positive

Frequently Asked Questions

What is a smart contract triage workflow?

A smart contract triage workflow is a structured method for reviewing Solidity code by risk priority rather than line order. Instead of reading top to bottom, you first identify every function that moves funds, map access controls, and check state update ordering — then read the rest. This approach lets you find critical vulnerabilities in large contracts within an hour instead of spending days on low-risk code.

How do I do a fast Solidity code review without missing critical bugs?

Build a "kill zone" list first — every function that transfers ETH or ERC-20 tokens. Use grep or Slither to find them in under 10 minutes. Then check access control on each one and verify state updates happen before external calls. This prioritized approach means you're spending review time where the actual risk is concentrated, not on events and view functions that can't drain funds.

Has access control been exploited in real DeFi protocols? Give an example.

Yes — the Ronin Bridge hack in 2022 lost $625M due to access control failure, not reentrancy or flash loans. Attackers compromised five out of nine validator private keys, giving them enough signing authority to approve fraudulent withdrawals. The fix wasn't a code vulnerability per se — it was insufficient key distribution and monitoring. Access control misconfigurations are responsible for more total DeFi losses than reentrancy, despite reentrancy getting most of the press coverage.

What is the checks-effects-interactions pattern in Solidity?

Checks-effects-interactions (CEI) is an ordering rule for Solidity functions that move funds. First, run all your require/revert checks. Second, update all state variables (effects). Third, make external calls or token transfers (interactions). Following this order prevents reentrancy attacks because by the time an external call executes, your contract's state already reflects the completed transaction — so a re-entrant call finds no funds to drain.

Is smart contract triage covered by a formal audit?

Triage is typically the first phase of a formal audit, but it's not the whole thing. A full audit includes deeper analysis of business logic, economic attack vectors, gas optimization, and test coverage review. Triage in an hour gives you high-confidence coverage of the most critical vulnerability classes — reentrancy, access control, integer issues, and upgrade risks — but shouldn't replace a full audit before deploying a protocol handling significant funds.

What static analysis tools work best for Solidity code review?

Slither from Trail of Bits is the most practical free tool — run it with --detect reentrancy-eth,unprotected-upgrade for a fast first pass. Mythril handles symbolic execution for deeper analysis on specific functions. Neither tool catches business logic vulnerabilities or economic exploits, which is where AI-assisted analysis and human review add the most value. Use static tools to accelerate triage, not replace it.

Further Reading

Written by

Duron Epps

Founder of SmartContractAuditor.ai. Writes about smart contract exploits, audits and the tools that catch them.

About SmartContractAuditor.ai

Check your own contract

Paste Solidity, Vyper or Rust and see what the scanner flags. Three free scans, no sign-up.

Scan a contract free

Keep reading

All articles

Written by Duron Epps, Founder · Published December 3, 2026