Fuzzing
Search…
✍️ Writing Properties
Everything you need to know about writing properties
With fuzzing you can automatically test properties (also called property-based testing). So, you'll first need to write some properties.
Diligence Fuzzing supports multiple property formats, but our preferred option is Scribble.

Scribble

Scribble is a specification language for smart contracts where you write properties as annotations in your code. These annotations can be translated into checks which raise log events at run-time whenever a specified property is violated. Fuzzing as a service can detect these log events and tell you exactly which property is violated.
Example Scribble property:
1
// #if_succeeds balance(_to) == old(balance(_to)) + amount;
2
function transfer(address _to, uint amount) public { ... }
Copied!
Learn more about Scribble over at docs.scribble.codes.

Other formats

Assertions

We don't just find property violations of Scribble properties, but we also detect regular assertion failures.

Property-Based Testing

We realise that you might already have testcases for property-based testing tools. For this reason we've implemented a utility which leverages Scribble to make property-based tests compatible!