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

Fix minor issues in generator #32

Merged
merged 6 commits into from
Mar 27, 2024
Merged

Conversation

glarregay-tob
Copy link
Contributor

I tried to use fuzz-utils and there were some issues that this PR aims to fix:

  • Misaligned vm.warp() in the generated contract in a call template
  • Dynamic array variables were redefined each time they were used. If the same tests had many calls to functions that required arrays as parameters, they were redefined each time, generating compilation errors. Now it is only defined once in each test, and only the value is set in each subsequent call.
  • bool success was redefined for each single low level call, so tests could only have at most one low level call, before the compiler complained.

Copy link
Collaborator

@tuturu-tech tuturu-tech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed some changes:

  • Added the declared_variables set to Medusa as well since I think it had the same issue.
  • Updated the set and comparison to be a tuple[type, name] so that we don't mistakenly match a variable name that has a different type
  • Added a sequence to each fuzzer dyn-arr corpus to reproduce the issue and test the changes

LGTM now, great work on noticing and fixing the issues!

@tuturu-tech tuturu-tech merged commit e0f98c3 into main Mar 27, 2024
11 checks passed
@glarregay-tob
Copy link
Contributor Author

Ah, yes, sorry for the lack of Medusa support, I was only using Echidna for the tests.

Regarding the variables, I assume it's not possible, but if we have two variables with the same name and different type, we will still have compilation issues when reassigning. I haven't considered this case, because variable names should be unique in the current scope, but I'll keep using the tool and report if something comes up.

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

Successfully merging this pull request may close these issues.

2 participants