You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Echidna should be able to detect constants in Structs
Hello.
I just noticed that echidna is unable to chose values which are defined as constants inside structs in the solidity code.
Actually I stumbled on this issue while trying to build my own fuzzer, using the same technique to mine constants that echidna is using. I was unsure if I had to post the issue here or in the Slither repo, as in order to solve it we must improve the _extract_constants function from the Slither package to make it able to detect such constants.
Here is a minimal example which current version of echidna fails to solve:
contractTest {
struct Todo {
uint x;
bool completed;
}
bool flag =true;
Todo todo =Todo(129856743768, false);
function set(uinta) public {
if (a == todo.x) flag =false;
}
function echidna_test_balance() publicviewreturns (bool) {
return flag;
}
}
Maybe if I have time I will try to do a pull request on the Slither repo, unless I am missing something and this could work with a better config?
EDIT : sorry I think the issue is not what I thought : indeed , weirdly this version is easily broken by echidna :
contractTest {
struct Todo {
uint x;
bool completed;
}
bool flag =true;
function set(uinta) public {
Todo memory todo =Todo(129856743768, false);
if (a == todo.x) flag =false;
}
function echidna_test_balance() publicviewreturns (bool) {
return flag;
}
}
So the problem does not seem to be related to the constant inside the struct, but to the fact that it is declared as a state variable instead of a local one, this behavior is still a bit weird in my opinion...
The text was updated successfully, but these errors were encountered:
jat9292
changed the title
Echidna unable to detect constants in Structs
Echidna unable to detect constants in Structs + improve bytes constants
Apr 5, 2023
jat9292
changed the title
Echidna unable to detect constants in Structs + improve bytes constants
Echidna unable to detect constants in Structs
Apr 5, 2023
jat9292
changed the title
Echidna unable to detect constants in Structs
Echidna unable to detect constants in storage Structs
Apr 5, 2023
Echidna should be able to detect constants in Structs
Hello.
I just noticed that echidna is unable to chose values which are defined as constants inside structs in the solidity code.
Actually I stumbled on this issue while trying to build my own fuzzer, using the same technique to mine constants that echidna is using. I was unsure if I had to post the issue here or in the Slither repo, as in order to solve it we must improve the
_extract_constants
function from the Slither package to make it able to detect such constants.Here is a minimal example which current version of echidna fails to solve:
Maybe if I have time I will try to do a pull request on the Slither repo, unless I am missing something and this could work with a better config?
EDIT : sorry I think the issue is not what I thought : indeed , weirdly this version is easily broken by echidna :
So the problem does not seem to be related to the constant inside the struct, but to the fact that it is declared as a state variable instead of a local one, this behavior is still a bit weird in my opinion...
The text was updated successfully, but these errors were encountered: