Add GoogleTest regressions for vdf_client session parsing#313
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
7e09c32 to
b2dc9c2
Compare
Extract session read/validation logic for reuse, add targeted regression coverage for discriminant/form size edge cases, and wire regression execution into the unified CI workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep disc_size and disc_int_size local to reduce exported header globals and make InitSession-owned state explicit. Co-authored-by: Cursor <cursoragent@cursor.com>
ff92b22 to
5cdcb12
Compare
hoffmang9
added a commit
that referenced
this pull request
Feb 18, 2026
Rebase warning-cleanup work onto current main, keep vdf_client session parser refactor from #313, and apply targeted warning/robustness fixes across CI workflows, CMake/build scripts, and core/runtime code paths. Co-authored-by: Cursor <cursoragent@cursor.com>
hoffmang9
added a commit
that referenced
this pull request
Feb 20, 2026
* Reduce CI/build warning noise and harden cross-platform behavior. Rebase warning-cleanup work onto current main, keep vdf_client session parser refactor from #313, and apply targeted warning/robustness fixes across CI workflows, CMake/build scripts, and core/runtime code paths. Co-authored-by: Cursor <cursoragent@cursor.com> * Restore full 2weso CI durations and tighten Python/Cargo target plumbing. Remove temporary shortened 2weso test overrides in vdf-client-hw CI and align build scripts with modern CMake/Cargo target variables to eliminate unused PYTHON_EXECUTABLE warnings and keep MSVC-only CRT overrides scoped correctly. Co-authored-by: Cursor <cursoragent@cursor.com> * Consolidate checked integer casts across C/C++ and Python bindings. Replace ad-hoc narrowing checks and release-elided asserts with a shared checked_cast helper to keep overflow handling consistent across wrapper and test paths. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix unsigned-to-signed checked_cast overflow guard and add regression coverage. The unsigned-to-signed conversion path now checks against the signed destination max, preventing silent wraparound for values above INT32_MAX, and adds a GoogleTest regression to lock this behavior. Co-authored-by: Cursor <cursoragent@cursor.com> * Fix signed-widening behavior in checked_cast and add regression coverage. Avoid truncated bounds checks for same-signed widening casts and add positive/negative int32-to-int64 tests. Co-authored-by: Cursor <cursoragent@cursor.com> * Use checked_cast for primetest and verifier discriminant conversions. Replace manual narrowing checks/casts with checked_cast to keep overflow handling consistent and centralized. Co-authored-by: Cursor <cursoragent@cursor.com> * Use 64-bit recursion and proof lengths in verifier APIs. Align the Python and C bindings with the native verifier interface by accepting full-size proof blob lengths and recursion depth instead of narrowing to int32, removing wrapper-level truncation guards. Co-authored-by: Cursor <cursoragent@cursor.com> * Use logical OR for uint128 comparison operators. Switch boolean composition in <= and >= from bitwise OR to logical OR for clearer intent and short-circuit behavior. Co-authored-by: Cursor <cursoragent@cursor.com> * Update verifier proof-length tests and known-proof fixture. Switch verifier and stress tests to pass proof blob lengths as size_t without narrowing casts, and refresh verifier_test's fixed proof vector to a current-format fixture so the known-proof assertion remains meaningful with the widened verifier API. Co-authored-by: Cursor <cursoragent@cursor.com> * Mirror production verifier path in known-proof test. Update verifier_test to construct and reuse the discriminant before calling CheckProofOfTimeNWesolowski directly, so the test reflects production verifier usage while keeping the current-format known-proof fixture. Co-authored-by: Cursor <cursoragent@cursor.com> * Pass witness_type directly to uint64 depth API. Remove the obsolete int32_t intermediate cast in stress_test so the call matches the updated verifier depth parameter type. Co-authored-by: Cursor <cursoragent@cursor.com> * Inline env_flag use in prover_test fast-mode check. Remove the redundant env_truthy wrapper and call env_flag directly to keep the test setup path simpler without changing behavior. Co-authored-by: Cursor <cursoragent@cursor.com> * Revert "Use logical OR for uint128 comparison operators." This reverts commit 8db997d. --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
InitSessionhandshake parsing/validation intosrc/vdf_client_session.hso it can be reused in production and regression testsvdf_client_session_testwith GoogleTest coverage that now explicitly locks in both previously reported issues:disc_sizeandform_size(so parse/validation does not run on truncated reads)03e0b34967833fdb6e94921ad318ab081de2b747remains covered (disc_int_size <= 0, oversized discriminant, zero form size, wrapped negative form size)README.md,README_ASIC.md) plus ignorebuild-*scratch directoriesTest plan
make -f Makefile.vdf-client vdf_clientcmake -S src -B build-regression -DBUILD_PYTHON=OFF -DBUILD_CHIAVDFC=OFF -DBUILD_VDF_CLIENT=OFF -DBUILD_VDF_BENCH=OFF -DBUILD_VDF_TESTS=ON -DBUILD_HW_TOOLS=OFF -DENABLE_GNU_ASM=ONcmake --build build-regression --target vdf_client_session_testctest --test-dir build-regression --output-on-failure -R '^regression\.'Made with Cursor
Note
Medium Risk
Adds new build/test dependencies and CI execution paths (GoogleTest/CTest), which can introduce cross-platform build/runner issues even though production logic changes are small and localized to session parsing.
Overview
Adds a reusable
InitSessionimplementation invdf_client_session.hand updatesvdf_client.cppto use it, improving handshake parsing error handling (explicit failures on truncated reads) without changing the high-level session flow.Introduces a new GoogleTest-based
vdf_client_session_testregression suite (run via CTest withregression.prefix), wires GoogleTest/CTest intoBUILD_VDF_TESTSCMake builds via FetchContent, and runs these regressions in CI on Unix and Windows. Docs are updated to describe the new test matrix and build targets, and.gitignorenow ignoresbuild-*scratch directories.Written by Cursor Bugbot for commit ff92b22. This will update automatically on new commits. Configure here.