Hacken’s Q3 2026 security report counts $1.18 billion stolen across 107 incidents, with smart contract exploits at 48% of losses, up from 12% in Q2. A smart contract audit in CI puts three checks on every pull request: Slither scans the source, while Echidna and Foundry run randomized call sequences against invariants the team writes, and a failing check blocks the merge.
Sherlock’s January to October 2026 tally attributes 46.6% of 234 incidents to accounting, oracle and protocol-logic faults but only 22.3% of recorded losses, while access control, bridge and cross-chain failures account for 57.8% of losses.
Slither Clears Known Bug Patterns in Seconds
Slither suits a pull-request gate on speed: in the MSR 2026 benchmark of 653 real contracts, Abdelaziz, Alsaghir and Ali of NYU Abu Dhabi measured 1.33 seconds per contract on reentrancy, with an F1 score of 90.7% and a 17.8% false-positive rate.
Their survey of 150 developers ranked Slither the most used analyzer at 77%, and excess false positives, cited by 33%, led the reasons for ignoring warnings. Triage settings decide whether the job stays enforced: the Slither Action fails a run only at a chosen severity, so low-severity findings stay visible without blocking merges.
Feist, Grieco and Groce reported a 10.9% false-positive rate for the reentrancy detector in 2019, the lowest among four static tools tested on the 1,000 most-used contracts. Teams extend Slither through its Python API, described in the same paper as a way to assert, for example, a variable is never tainted by a given function parameter.
A pattern detector still cannot know a pool’s invariant must not fall after a swap; the rule exists in the protocol design, not in the syntax.
Invariants Encode Rules a Detector Cannot Infer
An invariant is a property the protocol must keep after any sequence of calls: assets cover liabilities, share price does not fall, a swap round trip returns no profit. Fuzzers generate the sequences; the team supplies the property and, in Foundry, a handler contract bounding inputs to valid ranges and tracking ghost totals the chain does not store.

In the ICSE 2024 study by Chaliasos and colleagues at Imperial College London, five automated tools including Slither could have prevented 8% of 127 documented DeFi attacks worth $2.3 billion, and every preventable case involved reentrancy. The same study found tools accepting user-written input could address 47 attacks tied to missing sanity checks and logic errors.

Echidna targets user-written rules directly: it set the goal of revealing issues in under five minutes and reported use in more than 10 paid security audits. Its configuration reference lists property mode, with echidna_-prefixed functions as properties, as the default.
Foundry runs the same idea inside forge test: invariant_ functions execute after every call in a randomized sequence, and since v1.7.0 campaigns fuzz the time and block gaps between calls, a fit for vesting, auction and TWAP logic. Setting fail_on_revert to false stops handler reverts from failing the run, so campaigns report broken invariants instead of rejected inputs.
Worked example: share price must not fall
Scenario. A vault without yield, fees or donations, where deposits and redemptions are the only state changes.
Handler. Wraps deposit and redeem, picks one of several actors and bounds amounts from 1 wei upward, since small balances expose rounding faults.
Check. Before each call the handler reads totalAssets() and totalSupply(), and reads both again after it. Cross-multiplying, assetsAfter * supplyBefore >= assetsBefore * supplyAfter, avoids division rounding inside the check, and a failed comparison sets ghost_priceFell. The check skips calls that leave the supply at zero.
Invariant. The test contract asserts the flag stays false after every call.
function invariant_sharePriceNeverFalls() public view {
assertFalse(handler.ghost_priceFell());
}
Failure signal. A rounding direction favoring the depositor lowers share price on a 1 wei call, and Foundry prints the shrunken call sequence that triggered it.
Balancer v2 shows how a rounding fault outlives its first report: attackers drained more than $100 million across nine networks on November 3, 2025, and the Trail of Bits retrospective traces the flaw to an October 2021 Linear Pools finding rated undetermined severity, with fuzzing of every rounding direction recommended at the time.
The Stable Math library sat outside the scope of the firm’s 2022 Composable Stable Pools review.
Wiring a Smart Contract Audit in CI Without Slowing Merges
In the MSR 2026 survey, 68% of developers expect analyzer results within 10 minutes and none accept waits longer than 30, so Slither and short Foundry campaigns suit each pull request, while long Echidna campaigns suit a nightly job. Echidna has no default campaign timeout and stops only at its transaction limit, so a CI job sets timeout explicitly and treats the run as bounded effort rather than proof.
50,000
Transactions Echidna generates per campaign by default (testLimit).
100
Transactions in each sequence before Echidna resets the EVM to its post-deployment state (seqLen).
5,000
Attempts to shrink a failing sequence before Echidna reports it (shrinkLimit).
Foundry and Echidna both print a shrunken call sequence for each broken invariant, and committing it as a regression test keeps the fix in place. Exploit classes recur: Trail of Bits documented a 2023 rounding exploit at Hundred Finance repeated against Sonne Finance in 2024, and Hacken’s Q3 report notes the same exploit classes across different codebases and languages.
Suites decay as code changes: a function once rounding up may later round down, and only a maintained suite flags the flip, so the pipeline reruns invariants on every pull request touching arithmetic. Trail of Bits recommends mutation testing with slither-mutate to expose blind spots in unit and integration tests, a job suited to the nightly run.

Invariants Carry the Protocol-Specific Risk
Slither handles known patterns at low cost, and invariants handle rules only the protocol team can state. The 8% figure measures detectors, not invariants, so it says little about what a well-written suite catches, and Certora’s account of Balancer shows the reverse limit: formally verified solvency properties were too weak to catch the rounding error.
Hacken’s Q2 2026 report traced 88.3% of losses to compromised keys and signer infrastructure, a surface mostly outside invariant suites, and adoption splits by effort: 31% of surveyed developers use Echidna, a tool requiring user-written properties, against 77% for Slither.
A team writing invariants for its own math, running them on every change and adding one regression case per public exploit gives the pipeline a check no detector provides.

Isai Alexei is a journalist and financial analyst covering cryptocurrency markets and traditional securities for Blockchaindose. He has spent ten years analyzing digital assets, trading activity, and market structure.








