Differential Testing
with Foundry
@annascarroll
What is differential testing?
Differential testing is utilized to ensure identical behavior between two or more implementations of equivalent code.
�Note: it’s loosely assumed that inputs are generated (e.g. fuzzed), but not required
Differential testing smart contracts
Candidate implementations do not need to be written in the same language, nor even compile to the same VM
with Foundry…
EVM-Specific Use Cases
Gas Optimization
Gas Optimization - Benefits
Validating Upgrades
Coding Patterns
Naive pattern
Naive pattern
Seaport pattern
Seaport pattern: Benefits
Proposed pattern
Proposed pattern
Proposed pattern: Input Equality
Foundry Fuzzer
Proposed pattern: Input Equality
[fuzz]
seed = "1337"
include_push_bytes = false
Proposed pattern: Drawbacks
Proposed pattern: Benefits
Acknowledgements
Kudos to emo.eth, 0age, et al. for work on Differential testing in Seaport
Thank u evalir for answering Qs about Foundry fuzzer :)
Thank u Prestwich, Jenny Pollack, aleph_v for being awesome sounding boards <3
References
Questions?
Twitter: @annascarroll