Skip to content

Harden parameter casting and reduce Windows CI warning noise#316

Merged
hoffmang9 merged 6 commits into
mainfrom
various-dangling-fixes
Feb 20, 2026
Merged

Harden parameter casting and reduce Windows CI warning noise#316
hoffmang9 merged 6 commits into
mainfrom
various-dangling-fixes

Conversation

@hoffmang9
Copy link
Copy Markdown
Member

@hoffmang9 hoffmang9 commented Feb 20, 2026

Summary

  • Harden ApproximateParameters conversions by replacing unchecked float/integer casts with checked range validation in src/util.h and src/prover_slow.h.
  • Fix prover_test CI detection to use environment variable presence (CI / GITHUB_ACTIONS) so CI fast-path iteration count is selected consistently.
  • Reduce Windows CI log noise by suppressing clang-cl's deprecated literal-operator warning for compile_asm and correcting the Windows wheel PYTHONWARNINGS filter (with documentation and a future-removal note).

Test plan

  • Build locally with CMake:
    • cmake -S src -B build-local -DBUILD_PYTHON=OFF -DBUILD_CHIAVDFC=OFF -DBUILD_VDF_CLIENT=ON -DBUILD_VDF_BENCH=ON -DBUILD_VDF_TESTS=ON -DBUILD_HW_TOOLS=OFF -DENABLE_GNU_ASM=ON
    • cmake --build build-local --target vdf_client vdf_bench 1weso_test 2weso_test prover_test vdf_client_session_test checked_cast_test
  • Run local regression tests:
    • ctest --test-dir build-local --output-on-failure -R '^regression\.'
  • Run local runtime tests:
    • ./build-local/1weso_test 1000
    • ./build-local/2weso_test 1000
    • CHIAVDF_PROVER_TEST_FAST=1 CI=1 ./build-local/prover_test
  • Validate Windows wheel workflow warning behavior in GitHub Actions (build.yml, cp312 win_amd64 job).

Made with Cursor


Note

Medium Risk
Touches parameter derivation used by proving paths and changes overflow behavior from silent truncation/asserts to exceptions, which could surface new failures on extreme inputs. CI/build changes are low risk but may affect Windows build output and test runtime selection.

Overview
Hardens ApproximateParameters in both src/util.h and src/prover_slow.h by replacing unchecked float-to-integer casts with explicit finite/range validation and checked_cast, throwing on overflow instead of relying on asserts/UB.

Updates prover_test CI detection to treat CI/GITHUB_ACTIONS as present vs. truthy (via new env_exists helper) so the fast-path iteration count is selected consistently. Reduces Windows build noise by narrowing the PYTHONWARNINGS filter for the benign Py_DEBUG warning and suppressing clang-cl’s deprecated literal-operator warning for the compile_asm utility target.

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

hoffmang9 and others added 5 commits February 19, 2026 20:53
Replace assert-only and unchecked casts with runtime bounds checks plus checked_cast in both ApproximateParameters overloads so overflow protection remains active in release builds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use environment-variable presence for CI and GITHUB_ACTIONS checks so empty or 0-valued CI vars still trigger the shorter CI iteration path.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ws clang.

Apply the warning suppression only to the compile_asm utility target so vendored mpir gmpxx headers do not emit noisy deprecated-literal-operator warnings in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use a literal-prefix PYTHONWARNINGS rule that matches setuptools' RuntimeWarning format so the benign Py_DEBUG ABI-tag warning is reliably suppressed on Windows wheel builds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Clarify why the PYTHONWARNINGS filter is needed today and note that it should be revisited for removal once upstream tooling stops emitting the benign warning.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hoffmang9
Copy link
Copy Markdown
Member Author

@cursor review

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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Add a cross-platform env_exists helper that uses _dupenv_s on Windows and switch prover_test CI checks to it, preserving presence-based CI behavior without deprecation warnings.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hoffmang9
Copy link
Copy Markdown
Member Author

@cursor review

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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@hoffmang9 hoffmang9 merged commit a4b88c2 into main Feb 20, 2026
99 of 101 checks passed
@hoffmang9 hoffmang9 deleted the various-dangling-fixes branch February 20, 2026 18:18
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