Skip to content

Add GoogleTest regressions for vdf_client session parsing#313

Merged
hoffmang9 merged 2 commits into
mainfrom
fix/vdf-client-read-error-checks-on-consolidate
Feb 18, 2026
Merged

Add GoogleTest regressions for vdf_client session parsing#313
hoffmang9 merged 2 commits into
mainfrom
fix/vdf-client-read-error-checks-on-consolidate

Conversation

@hoffmang9
Copy link
Copy Markdown
Member

@hoffmang9 hoffmang9 commented Feb 18, 2026

Summary

  • move InitSession handshake parsing/validation into src/vdf_client_session.h so it can be reused in production and regression tests
  • add vdf_client_session_test with GoogleTest coverage that now explicitly locks in both previously reported issues:
    • read-error handling is checked immediately after reading disc_size and form_size (so parse/validation does not run on truncated reads)
    • discriminant/form size bounds validation from 03e0b34967833fdb6e94921ad318ab081de2b747 remains covered (disc_int_size <= 0, oversized discriminant, zero form size, wrapped negative form size)
  • integrate GoogleTest/CTest execution into the consolidated CI workflow and update docs (README.md, README_ASIC.md) plus ignore build-* scratch directories

Test plan

  • make -f Makefile.vdf-client vdf_client
  • cmake -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=ON
  • cmake --build build-regression --target vdf_client_session_test
  • ctest --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 InitSession implementation in vdf_client_session.h and updates vdf_client.cpp to 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_test regression suite (run via CTest with regression. prefix), wires GoogleTest/CTest into BUILD_VDF_TESTS CMake 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 .gitignore now ignores build-* scratch directories.

Written by Cursor Bugbot for commit ff92b22. This will update automatically on new commits. Configure here.

Base automatically changed from consolidate-vdf-hw-workflow-main to main February 18, 2026 03:28
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread src/vdf_client_session.h Outdated
@hoffmang9 hoffmang9 force-pushed the fix/vdf-client-read-error-checks-on-consolidate branch from 7e09c32 to b2dc9c2 Compare February 18, 2026 03:57
hoffmang9 and others added 2 commits February 17, 2026 21:15
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>
@hoffmang9 hoffmang9 force-pushed the fix/vdf-client-read-error-checks-on-consolidate branch from ff92b22 to 5cdcb12 Compare February 18, 2026 05:16
Copy link
Copy Markdown
Contributor

@wjblanke wjblanke left a comment

Choose a reason for hiding this comment

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

aok

@hoffmang9 hoffmang9 merged commit 4772283 into main Feb 18, 2026
99 of 101 checks passed
@hoffmang9 hoffmang9 deleted the fix/vdf-client-read-error-checks-on-consolidate branch February 18, 2026 19:06
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>
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