fuzzland / ityfuzz

Blazing Fast Bytecode-Level Hybrid Fuzzer for Smart Contracts
https://docs.ityfuzz.rs
MIT License
734 stars 116 forks source link

Testing invariants on chain #496

Closed 0xSolProf closed 1 month ago

0xSolProf commented 1 month ago

First of all, cool work!

I was wondering if/how we can use ityfuzz to test invariants on-chain?

In case of Echidna we would create a testing contract that calls the contract, how should we approach that in ityfuzz? (We should be able to prank the senders still such that not all tests come from the sender contract as msg.sender)

Have a good weekend

0xSolProf commented 1 month ago

Got it, for others:

Sometimes we need to fuzz from specific senders instead of random senders (i.e. owners / authorized accounts). Ityfuzz can take over the targetSender from Foundry (example) : https://github.com/fuzzland/ityfuzz/blob/96e251e8b0961245d5386d7b0b1a9ed6338e1d05/src/evm/corpus_initializer.rs#L436-L445

So we can then follow https://github.com/fuzzland/ityfuzz/issues/460 and add targetSender(s):

Thanks for implementing this @shouc ❤️