Harden parameter casting and reduce Windows CI warning noise#316
Merged
Conversation
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>
Member
Author
|
@cursor review |
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>
Member
Author
|
@cursor review |
emlowe
approved these changes
Feb 20, 2026
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
ApproximateParametersconversions by replacing unchecked float/integer casts with checked range validation insrc/util.handsrc/prover_slow.h.prover_testCI detection to use environment variable presence (CI/GITHUB_ACTIONS) so CI fast-path iteration count is selected consistently.compile_asmand correcting the Windows wheelPYTHONWARNINGSfilter (with documentation and a future-removal note).Test plan
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=ONcmake --build build-local --target vdf_client vdf_bench 1weso_test 2weso_test prover_test vdf_client_session_test checked_cast_testctest --test-dir build-local --output-on-failure -R '^regression\.'./build-local/1weso_test 1000./build-local/2weso_test 1000CHIAVDF_PROVER_TEST_FAST=1 CI=1 ./build-local/prover_testbuild.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
ApproximateParametersin bothsrc/util.handsrc/prover_slow.hby replacing unchecked float-to-integer casts with explicit finite/range validation andchecked_cast, throwing on overflow instead of relying on asserts/UB.Updates
prover_testCI detection to treatCI/GITHUB_ACTIONSas present vs. truthy (via newenv_existshelper) so the fast-path iteration count is selected consistently. Reduces Windows build noise by narrowing thePYTHONWARNINGSfilter for the benignPy_DEBUGwarning and suppressing clang-cl’s deprecated literal-operator warning for thecompile_asmutility target.Written by Cursor Bugbot for commit 283be88. This will update automatically on new commits. Configure here.