https://github.com/Recon-Fuzz/call-test-undo
CallTestAndUndo - a simple abstract contract to help you write invariant tests that do not influence the story
https://github.com/Recon-Fuzz/call-test-undo
Last synced: 4 months ago
JSON representation
CallTestAndUndo - a simple abstract contract to help you write invariant tests that do not influence the story
- Host: GitHub
- URL: https://github.com/Recon-Fuzz/call-test-undo
- Owner: Recon-Fuzz
- License: gpl-2.0
- Created: 2024-05-02T14:42:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-02T14:58:19.000Z (about 1 year ago)
- Last Synced: 2024-05-03T01:39:47.766Z (about 1 year ago)
- Language: Solidity
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
- evm-fuzzing-resources - CallTestAndUndo - Simple abstract contract to help write invariant tests that do not influence the story, by [Recon](https://x.com/getreconxyz) (Tooling / Libraries & Frameworks)
- evm-fuzzing-resources - CallTestAndUndo - Simple abstract contract to help write invariant tests that do not influence the story, by [Recon](https://x.com/getreconxyz) (Tooling / Libraries & Frameworks)
README
# CallTestAndUndo
A simple contract that allows you to perform stateful invariant tests without changing global state
## Use Cases
When you're doing tests and don't want to track their side effects into the global state
You can use this abstract contract to perform the test and then revert all state changes
This way you can keep the "Story" simple while testing complex behavior
## Usage
Make your contract inherit `CallTestAndUndo`
Edit the function you want to test to require it being called by `this`
Use `_doTestAndReturnResult` to call the function (use `encodeCall`)
## Demo
See `testDemoCal` for a quick demo