Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Recent changes that introduced the maxBufSize flag broke the
version
andexec
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 runninghevm version
orhevm exec ...
, using thehevm
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 forversion
andexec
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