Differential Testing with Foundry
Thu, Nov 16, 2023, 11:40 AM · 25:59
Differential testing using the Foundry fuzzer can be utilized to ensure identical behavior between two implementations of the same contract. Developers can leverage differential fuzzing in their development workflow to transpile idiomatic Solidity into highly gas optimized contracts. We will outline the steps to replicate this development workflow, discuss common “gotchas” and workarounds, and circulate a template repo with example tests in order to empower devs to leverage this process. [detail] During the design process, developers can begin by writing their contract implementation in idiomatic Solidity, enabling quicker development and more intuitive understanding of contract functionality. Next, developers can transpile the reference implementation into a highly optimized version utilizing Yul / Assembly by leveraging `forge inspect ir` and other tools. Finally, developers can use differential fuzzing with Foundry to ensure the equality of the two implementations. The most notable example of this development process is OpenSea’s Seaport contracts.
Anna Carroll is a protocol engineer with years of experience architecting smart contracts for the EVM. Her areas of expertise include Solidity, cross-chain protocols, DAOs and governance. Throughout her time in the crypto space, Anna has worked on a range of projects including PartyBid, Nomad, Celo and Dharma. Anna graduated from Stanford with a degree in Computer Science and is now based in Berlin where she enjoys a vibrant crypto community.
More from Solidity Summit
Experimental Solidity
Devconnect
Solidity Summit · Nov 16, 2023
Daniel Kirchner
How we built MUD: An On-chain Kernel for Complex Applications on Ethereum
Devconnect
Solidity Summit · Nov 16, 2023
Alvarius
Slang: Building Solidity Compiler APIs from a Declarative Language Specification
Devconnect
Solidity Summit · Nov 16, 2023
Omar Tawfik
The State of EVM Languages
Devconnect
Solidity Summit · Nov 16, 2023
Grant Wuerker, Harikrishnan Mulackal, Maddiaa
Branching Tree Technique: Writing structured Solidity tests
Devconnect
Solidity Summit · Nov 16, 2023
Paul Razvan Berg
Beyond Fuzzing: Symbolic Testing in Practice
Devconnect
Solidity Summit · Nov 16, 2023
Daniel "karmacoma" Reynaud
Namespace storage (for now and for a verkle EVM)
Devconnect
Solidity Summit · Nov 16, 2023
Hadrien Croubois
Documenting Solidity with diagrams
Devconnect
Solidity Summit · Nov 16, 2023
Nick Addison
Deep dive into L2 deployed contracts
Devconnect
Solidity Summit · Nov 16, 2023
Ren Crypto Fish
Solidity's most common security pitfalls (and its best safeguards)
Devconnect
Solidity Summit · Nov 16, 2023
gmhacker
The Art of Huff
Devconnect
Solidity Summit · Nov 16, 2023
jtriley
Test your tests: The dos and don'ts of testing
Devconnect
Solidity Summit · Nov 16, 2023
Kurt Willis