Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing invariants on chain #496

Closed
0xSolProf opened this issue Jun 1, 2024 · 1 comment
Closed

Testing invariants on chain #496

0xSolProf opened this issue Jun 1, 2024 · 1 comment

Comments

@0xSolProf
Copy link

0xSolProf commented Jun 1, 2024

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
Copy link
Author

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) :

// We override default callers when target senders are specified
if let Some(setup_data) = &loader.setup_data {
if !setup_data.target_senders.is_empty() {
for caller in setup_data.target_senders.iter() {
self.state.add_caller(caller);
self.executor
.host
.evmstate
.set_balance(*caller, EVMU256::from(INITIAL_BALANCE));
}

So we can then follow #460 and add targetSender(s):

Thanks for implementing this @shouc ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant