Skip to content

Deprecated / Unsafe Language Constructs

SAFE-0139 Best Practice Checked automatically by the scanner
1

What goes wrong

The code uses deprecated constructs (suicide, sha3, throw, callcode, block.blockhash, the var keyword, or now). These are removed or discouraged in modern Solidity and often signal an old, unmaintained codebase with other latent issues.

2

The vulnerable pattern

proof of concept — how it is exploited
// throw;            // consumes all gas, no revert reason
// sha3(x);          // removed alias of keccak256
// these compile only on ancient toolchains -> upgrade required.
3

How to fix it

the pattern that is safe
// selfdestruct instead of suicide, keccak256 instead of sha3,
// revert()/require() instead of throw, block.timestamp instead of now.
Replace deprecated constructs with current equivalents.
4

Where this has happened

Largest recorded losses in the same failure class — related, not the same bug:

Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0139 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs