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 VDF prover failures on Windows #216

Merged
merged 36 commits into from
Oct 15, 2024
Merged

Fix VDF prover failures on Windows #216

merged 36 commits into from
Oct 15, 2024

Conversation

wjblanke
Copy link
Contributor

@wjblanke wjblanke commented Oct 8, 2024

The root issue is that labs() was being used instead of llabs(). labs() is undefined (on windows only apparently) if the value tested is too large. This was causing the Pullmark reducer to misbehave and reduction not to happen correctly in rare cases. That resulted in too large values and sometimes buffer overflows causing heap corruption in some cases. In the process fixed some other things the compiler was not happy about but doesn't really affect the behavior.

@wjblanke wjblanke changed the title test Fix VDF prover failures on Windows Oct 13, 2024
@wjblanke wjblanke requested a review from arvidn October 13, 2024 02:30
arvidn
arvidn previously approved these changes Oct 13, 2024
Copy link
Contributor

@arvidn arvidn left a comment

Choose a reason for hiding this comment

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

the memory leak is in a test, so not a big deal probably.
It might deceive a future reader of the code though

src/Reducer.h Show resolved Hide resolved
src/verifier_test.cpp Show resolved Hide resolved
arvidn
arvidn previously approved these changes Oct 15, 2024
Copy link
Contributor

@arvidn arvidn left a comment

Choose a reason for hiding this comment

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

technically it should be delete[] ba.data;, but I was also under the impression that we had a function to free a ByteArray object. mostly just to ensure we use the correct heap in case this is exported over a DLL boundary.
A minor issue though.

@wjblanke wjblanke merged commit 59f0204 into main Oct 15, 2024
60 checks passed
@wjblanke wjblanke deleted the verifywesowjb branch October 15, 2024 20:16
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