Differential testing
A differential target is a public function whose name starts with diff_ and which returns one of the supported types. It must return the same value on sonatina and native for every input:
pub fn diff_mul_div(_ a: u128, _ b: u128, _ d: u128) -> u256 {
if d == 0 { return 0 }
(a as u256) * (b as u256) / (d as u256)
}npx fuzzloom diff --seed 7 # 100,000 inputs per target by defaultAGREE diff_mul_div(u128, u128, u128) -> u256 100000 inputs, identical digests on sonatina and native
DIVERGE diff_rounding_mode(u64) -> u64 first at input 269, found in 3 search rounds, 8 fe runs in total
x = 15398200176277126999
sonatina returns 1539820017627712699
native returns 1539820017627712700Targets may use effects and declared ranges exactly as properties do. diff needs the native backend; doctor tells you whether it is available.
Choosing targets. Good candidates are arithmetic helpers, encoding and decoding, rounding, anything with #[cfg(...)] branches, and anything that leans on wrapping or widening casts. Logic that only makes sense inside a deployed contract, such as anything calling Evm effects, does not compile on the native backend and cannot be a differential target.
What a divergence means. The two backends computed different values for the same Fe code and the same input. Either the code depends on something backend-specific (#[cfg(target)], or behaviour your code relies on but the language leaves open), or one backend has a bug. Either way, the input and both outputs are what you need to file it.