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

fixed maxBufSize breaking bug #687

Merged
merged 1 commit into from
Mar 19, 2025
Merged

fixed maxBufSize breaking bug #687

merged 1 commit into from
Mar 19, 2025

Conversation

scottbuckley
Copy link
Contributor

Description

Recent changes that introduced the maxBufSize flag broke the version and exec modes, due to a naive bounds check on the input, where that input (nor a default value) does not exist for the above modes. maxBufSize is a partial selector being used on a sum type, and it's being evaluated on non-matching types during CLI argument parsing.

The way this bug presented was the error hevm: No match in record selector maxBufSize, when running hevm version or hevm exec ..., using the hevm binary I installed on my OSX machine (under Rosetta) via Nix pointing at this repo.

I fixed this bug by adding a total function getMaxBufSize which returns the default value 64 for version and exec modes. This is now used instead of .maxBufSize in three places. There will certainly be other ways to fix the same problem; I just did it this way to get it to work for me, so I'm sharing the result.

I was a bit surprised to see that your tests didn't catch this error, but I didn't want to dive into this to figure it out. I'd recommend adding tests that would have caught this kind of bug.

Checklist

  • tested locally
  • added automated tests
  • updated the docs
  • updated the changelog

@msooseth msooseth merged commit 64aa30c into ethereum:main Mar 19, 2025
9 checks passed
@msooseth
Copy link
Collaborator

Wow, that was a bad. Thank you so much. The fact that there are no tests for the executable (at all 😢) is something that has been bugging me for a while. I wanted to add them before. I will now prioritize trying to figure out how to do it well. I wanted to use python lit, which is what llvm is using (and I have been using in many of my projects). I'll create a PR with it and see if it's acceptable.

Thank you again!

@msooseth
Copy link
Collaborator

@scottbuckley BTW, hevm has improved its symbolic execution part significantly over the past months. You may wanna give it a go :) It really is a different beast!

@scottbuckley
Copy link
Contributor Author

scottbuckley commented Mar 19, 2025

@scottbuckley BTW, hevm has improved its symbolic execution part significantly over the past months. You may wanna give it a go :) It really is a different beast!

I will give it a try for sure! I'm trying to move from PL / formal methods research into blockchain verification so I'm just familiarising myself with the existing tools lately. Actually this is a little off-topic, but while I have you - can you point me to documentation on how to run the interactive debugger? I was following the documentation from the dapptools repo on how to interactively debug a live transaction, with hevm exec ... --debug (with other args pulled in via seth), but on this repo's hevm this doesn't seem to trigger interactive debugging. Is there documentation somewhere about this change and about how I could access such a feature on the current version? Sorry, I know this isn't the venue for such a question, but it was the reason I wanted to get hevm running in the first place :)

@msooseth
Copy link
Collaborator

Sorry, the debugger has been removed. We may add it back... one day? The changelog says: - The visual debugger has been removed. It was actually very cool. But no longer. It was a bit hard to maintain but I actually kinda loved it.

@msooseth
Copy link
Collaborator

When you give hevm a go, please let us know of your thoughts. Would be nice to hear some interesting feeback!

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