Skip to content

Fix compilation warnings#587

Merged
mratsim merged 7 commits intomasterfrom
fix-compilation-warnings
Mar 15, 2026
Merged

Fix compilation warnings#587
mratsim merged 7 commits intomasterfrom
fix-compilation-warnings

Conversation

@mratsim
Copy link
Owner

@mratsim mratsim commented Mar 15, 2026

This fixes most compilation warnings and hints.

Tested on:

  • EIP 4844 KZG (tests KZG, serialization, hashes, pairings, ...)
    • Parallel KZG
  • BLS Signatures
  • lib_constantine (tests everything exported to C/Rust/Go and all curves and field primitives)
  • EVM precompiles
  • Verkle
  • Poly1305, HMAC, HKDF, Chacha20
  • R1CS
  • Polynomials
  • Multilinear extensions

Has leftover:

  • LLVM IR + Nvidia PTX codegen
  • NVRTC compiler (unexpected Ast node to fix)

I've also removed SHA3 tests against OpenSSL as EVP_Q_digest support is very spotty: not on Windows, MacOS (libressl) or my dev machine (Archlinux).

Summary by CodeRabbit

  • Refactoring

    • Renamed internal cryptographic constants for clearer, more consistent naming.
  • Code Cleanup

    • Removed unused imports and local variables across modules to simplify builds.
  • Chores

    • Added compiler pragmas and tightened type-size assertions to reduce warnings and improve build reliability.
  • Tests

    • Disabled or silenced select platform-specific tests to avoid flaky or unsupported executions.

@coderabbitai
Copy link

coderabbitai bot commented Mar 15, 2026

Warning

Rate limit exceeded

@mratsim has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dd28bd9a-e74a-4a29-b111-73a822fe5859

📥 Commits

Reviewing files that changed from the base of the PR and between 3baec0a and e0de081.

📒 Files selected for processing (51)
  • bindings/lib_hashes.nim
  • constantine/ethereum_bls_signatures.nim
  • constantine/ethereum_evm_precompiles.nim
  • constantine/ethereum_verkle_ipa.nim
  • constantine/hash_to_curve/h2c_hash_to_field.nim
  • constantine/hashes/h_ripemd160.nim
  • constantine/hashes/h_sha256.nim
  • constantine/hashes/ripemd160/ripemd160_generic.nim
  • constantine/hashes/sha256/sha256_arm64_sha2.nim
  • constantine/hashes/sha256/sha256_generic.nim
  • constantine/hashes/sha256/sha256_x86_sha.nim
  • constantine/hashes/sha256/sha256_x86_ssse3.nim
  • constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86.nim
  • constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86_adx_bmi2.nim
  • constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86_adx_bmi2.nim
  • constantine/math/arithmetic/limbs_crandall.nim
  • constantine/math/elliptic/ec_multi_scalar_mul_parallel.nim
  • constantine/math/elliptic/ec_scalar_mul.nim
  • constantine/math/elliptic/ec_scalar_mul_vartime.nim
  • constantine/math/polynomials/polynomials.nim
  • constantine/math/polynomials/polynomials_parallel.nim
  • constantine/math_compiler/experimental/backends/cuda.nim
  • constantine/math_compiler/experimental/backends/wgsl.nim
  • constantine/math_compiler/experimental/cuda_execute_dsl.nim
  • constantine/math_compiler/experimental/gpu_compiler.nim
  • constantine/math_compiler/experimental/nim_to_gpu.nim
  • constantine/math_compiler/experimental/runtime_compile.nim
  • constantine/math_compiler/impl_curves_ops_affine.nim
  • constantine/math_compiler/impl_curves_ops_jacobian.nim
  • constantine/math_compiler/impl_fields_ops.nim
  • constantine/math_compiler/impl_msm_nvidia.nim
  • constantine/math_compiler/ir.nim
  • constantine/math_compiler/pub_curves_jacobian.nim
  • constantine/math_compiler/pub_fields.nim
  • constantine/named/constants/bandersnatch_endomorphisms.nim
  • constantine/named/constants/banderwagon_endomorphisms.nim
  • constantine/named/constants/secp256k1_endomorphisms.nim
  • constantine/named/properties_fields.nim
  • constantine/platforms/constant_time/ct_routines.nim
  • constantine/platforms/loadtime_functions.nim
  • constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim
  • constantine/signatures/bls_signatures.nim
  • constantine/signatures/ecc_sig_ops.nim
  • constantine/signatures/ecdsa.nim
  • constantine/threadpool/crossthread/scoped_barriers.nim
  • constantine/threadpool/instrumentation.nim
  • constantine/threadpool/parallel_offloading.nim
  • constantine/threadpool/primitives/topology_linux.nim
  • tests/gpu/t_msm.nim
  • tests/t_ethereum_eip4844_deneb_kzg_parallel.nim
  • tests/t_hash_keccak_sha3_vs_openssl.nim
📝 Walkthrough

Walkthrough

This PR adds many {.used.} pragmas, renames generic hash constants to algorithm-prefixed names (Sha256_, RMD160_), removes unused imports/locals, tightens several static size assertions, and disables or trims multiple tests and experimental backend imports.

Changes

Cohort / File(s) Summary
Hash constants & APIs
constantine/hashes/h_ripemd160.nim, constantine/hashes/h_sha256.nim, constantine/hashes/ripemd160/ripemd160_generic.nim, constantine/hashes/sha256/sha256_generic.nim, constantine/hashes/sha256/sha256_x86_sha.nim, constantine/hashes/sha256/sha256_x86_ssse3.nim, constantine/hashes/sha256/sha256_arm64_sha2.nim
Renamed generic sized constants/types (DigestSize, BlockSize, HashSize, Word) to prefixed variants (Sha256_, RMD160_), updated array/buffer types and related signatures/usages to the new names.
Bindings & small pragma tweaks
bindings/lib_hashes.nim, constantine/ethereum_verkle_ipa.nim, constantine/math/arithmetic/limbs_crandall.nim, constantine/named/constants/*_endomorphisms.nim, constantine/signatures/bls_signatures.nim, constantine/math_compiler/ir.nim, constantine/math_compiler/impl_curves_ops_affine.nim, constantine/math_compiler/impl_curves_ops_jacobian.nim, constantine/math_compiler/impl_fields_ops.nim, constantine/math_compiler/impl_msm_nvidia.nim, constantine/math_compiler/pub_curves_jacobian.nim, constantine/math_compiler/pub_fields.nim, constantine/math_compiler/impl_fields_ops.nim, constantine/threadpool/instrumentation.nim, constantine/platforms/loadtime_functions.nim, constantine/math_compiler/...
Added {.used.} (and occasional {.dirty.}) pragmas to functions, templates, type aliases and generated type declarations; adjusted a few inline/used pragmas.
Import & dependency reductions
constantine/ethereum_bls_signatures.nim, constantine/ethereum_evm_precompiles.nim, constantine/math/polynomials/polynomials.nim, constantine/math/polynomials/polynomials_parallel.nim, constantine/signatures/ecc_sig_ops.nim, constantine/signatures/ecdsa.nim, constantine/math_compiler/experimental/*.nim, tests/gpu/t_msm.nim
Removed unused imports and local bindings across many modules; simplified LLVM/backend import paths (removed asm_nvidia), removed unused variables.
Assembly & static assertions
constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86.nim, constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86_adx_bmi2.nim, constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86_adx_bmi2.nim
Replaced static assertions comparing SecretWord to sizeof(ByteAddress) with comparisons to sizeof(uint) in multiple places.
Elliptic & scalar changes
constantine/math/elliptic/ec_multi_scalar_mul_parallel.nim, constantine/math/elliptic/ec_scalar_mul.nim, constantine/math/elliptic/ec_scalar_mul_vartime.nim
Removed an extra numWindows declaration; changed a call to cneg to pass a plain boolean instead of SecretBool; removed a top-level field-based M selection block.
Polynomials, bindings, CT templates
constantine/named/properties_fields.nim, constantine/platforms/constant_time/ct_routines.nim
Inserted bind directives for BigInt and CTBool inside templates to ensure explicit bindings.
Threadpool & parallel changes
constantine/threadpool/crossthread/scoped_barriers.nim, constantine/threadpool/parallel_offloading.nim, constantine/threadpool/primitives/topology_linux.nim
Renamed copy operator to =copy (error-on-copy), adjusted pointer arithmetic cast for captured env offsets, and removed/converted an inline pragma to a comment.
Tests modified or disabled
tests/t_ethereum_eip4844_deneb_kzg_parallel.nim, tests/t_hash_keccak_sha3_vs_openssl.nim
Disabled/converted test blocks: commented out a verify_kzg_proof test, and replaced platform-gated OpenSSL test blocks with when false to skip them.
Minor cleanups
constantine/math_compiler/impl_msm_nvidia.nim, constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim, tests/gpu/t_msm.nim, package.nimble
Removed small unused locals and imports; minor deletion/addition lines across build/test metadata and helpers.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nibbled pragmas, one by one,
Prefixed hashes in the sun,
Imports trimmed, assertions right,
Tests tucked in for cozy night,
A tidy hop — compile takes flight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Fix compilation warnings' accurately summarizes the main objective of the changeset, which involves fixing compiler warnings and hints across multiple modules in the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-compilation-warnings
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the overall code quality and maintainability by systematically addressing compilation warnings and removing dead code. The changes primarily involve refining imports, updating constant references for clarity, and explicitly marking elements as 'used' to satisfy the compiler. A notable functional change is the removal of problematic SHA3 tests that relied on inconsistent OpenSSL features, which improves the stability of the test environment.

Highlights

  • Compilation Warnings Fixed: Addressed and resolved most compilation warnings and hints across the codebase, improving code cleanliness and reducing potential issues.
  • Unused Code Removal: Eliminated various unused imports, constants, and variables, streamlining the codebase and reducing unnecessary dependencies.
  • SHA3 Test Removal: Removed SHA3 tests against OpenSSL due to inconsistent EVP_Q_digest support across different operating systems and OpenSSL versions, ensuring test suite reliability.
  • Pragma Additions: Introduced .used pragmas to several functions and templates to explicitly mark them as used, preventing compiler warnings about unused entities, particularly in Nim's macro system.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • bindings/lib_hashes.nim
    • Added .used pragma to keccak256_hash and sha256_hash functions.
  • constantine/ethereum_bls_signatures.nim
    • Removed the unused import named/zoo_subgroups.
  • constantine/ethereum_evm_precompiles.nim
    • Removed the unused import serialization/codecs_status_codes.
  • constantine/ethereum_verkle_ipa.nim
    • Added the .used pragma to check templates for CttCodecScalarStatus and CttCodecEccStatus.
  • constantine/hash_to_curve/h2c_hash_to_field.nim
    • Removed the unused BlockSize constant from expandMessageXMD.
  • constantine/hashes/h_ripemd160.nim
    • Removed unused imports related to zoo_exports, platforms, and serialization.
    • Updated digestSize and internalBlockSize templates to use RMD160_DigestSize and RMD160_BlockSize.
    • Modified the finish function signature to use RMD160_DigestSize.
  • constantine/hashes/h_sha256.nim
    • Updated buf field type to use Sha256_BlockSize.
    • Modified dumpHash function signature to use Sha256_DigestSize.
    • Updated digestSize and internalBlockSize templates to use Sha256_DigestSize and Sha256_BlockSize.
    • Updated initZeroPadded to use Sha256_BlockSize.
    • Replaced BlockSize with Sha256_BlockSize in update function logic.
    • Updated bufIdx calculation in finish function to use Sha256_BlockSize.
  • constantine/hashes/ripemd160/ripemd160_generic.nim
    • Renamed Word to uint32 and constants DigestSize, BlockSize, HashSize to RMD160_DigestSize, RMD160_BlockSize, RMD160_HashSize.
    • Updated Ripemd160Context fields s and buf to use new constant names.
    • Removed the initRipemdCtx procedure.
    • Updated initialize and transform procedure signatures to use RMD160_HashSize.
    • Removed ReadLE32 template and updated finalize procedure signature to use RMD160_DigestSize.
  • constantine/hashes/sha256/sha256_generic.nim
    • Renamed Word to Sha256_Word and constants DigestSize, BlockSize, HashSize to Sha256_DigestSize, Sha256_BlockSize, Sha256_HashSize.
    • Updated Sha256_MessageSchedule and Sha256_state types to use new constant names.
    • Updated copy and accumulate templates to use Sha256_HashSize.
    • Added .redefine pragma to sha256_round template variables and updated Word type to Sha256_Word.
    • Updated sha256_rounds_0_15 to use Sha256_Word.
    • Updated hashMessageBlocks_generic to use Sha256_BlockSize.
  • constantine/hashes/sha256/sha256_x86_sha.nim
    • Updated hashMessageBlocks_x86_sha to use Sha256_BlockSize.
  • constantine/hashes/sha256/sha256_x86_ssse3.nim
    • Updated VecNum and VecWords constants to use Sha256_BlockSize and Sha256_Word.
    • Updated hashMessageBlocks_ssse3 to use Sha256_BlockSize.
  • constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86.nim
    • Changed sizeof(ByteAddress) to sizeof(uint) in mulMont_CIOS_sparebit_gen and sumprodMont_CIOS_spare2bits_gen macros.
  • constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86_adx_bmi2.nim
    • Changed sizeof(ByteAddress) to sizeof(uint) in mulMont_CIOS_sparebit_adx_gen and sumprodMont_CIOS_spare2bits_adx_gen macros.
  • constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86_adx_bmi2.nim
    • Changed sizeof(ByteAddress) to sizeof(uint) in redc2xMont_adx_gen macro.
  • constantine/math/arithmetic/limbs_crandall.nim
    • Added the .used pragma to the reduceCrandallFinal function.
  • constantine/math/elliptic/ec_multi_scalar_mul_parallel.nim
    • Removed the unused numWindows constant calculation.
  • constantine/math/elliptic/ec_scalar_mul.nim
    • Removed the SecretBool type cast in the cneg call.
  • constantine/math/elliptic/ec_scalar_mul_vartime.nim
    • Removed the unused M constant calculation block.
  • constantine/math/polynomials/polynomials.nim
    • Removed the unused import constantine/named/algebras.
  • constantine/math/polynomials/polynomials_parallel.nim
    • Removed the unused import constantine/named/algebras.
  • constantine/math_compiler/experimental/backends/cuda.nim
    • Removed the algorithm import.
    • Removed the redundant result = "" assignment in genCuda.
  • constantine/math_compiler/experimental/backends/wgsl.nim
    • Removed the sets import.
    • Removed the redundant result = "" assignment in genWebGpu.
  • constantine/math_compiler/experimental/cuda_execute_dsl.nim
    • Removed the unused rTypes variable.
  • constantine/math_compiler/experimental/gpu_compiler.nim
    • Simplified standard library imports.
  • constantine/math_compiler/experimental/nim_to_gpu.nim
    • Simplified standard library imports.
    • Removed the unused name variable in toGpuAst.
  • constantine/math_compiler/experimental/runtime_compile.nim
    • Simplified standard library imports.
  • constantine/math_compiler/impl_curves_ops_affine.nim
    • Simplified imports by removing asm_nvidia, impl_fields_globals, and impl_fields_dispatch.
    • Added .used pragma to isNeutral, x, and y templates.
    • Removed unused M and aA local variables in isNeutralAff and setNeutral.
  • constantine/math_compiler/impl_curves_ops_jacobian.nim
    • Simplified imports by removing asm_nvidia, impl_fields_globals, and impl_fields_dispatch.
    • Added .used pragma to various templates like setNeutral, isNeutral, sum, +=, mixedSum, double, ccopy, x, y, and z.
  • constantine/math_compiler/impl_fields_ops.nim
    • Simplified imports by removing asm_nvidia.
    • Added .used pragma to various templates like isZero, not, and, setZero, setOne, neg, csetZero, csetOne, sum, add, diff, prod, cadd, csub, ccopy, square, double, div2, *=, +=, -=, and mulCheckSparse.
    • Removed unused M local variables in setZero, setOne, csetOne, csetZero, cadd, csub, isZero, and cneg.
    • Removed unused rA local variable in getWindowAt.
  • constantine/math_compiler/impl_msm_nvidia.nim
    • Simplified imports by removing asm_nvidia, impl_fields_globals, and impl_fields_dispatch.
    • Removed the unused cNonZero variable.
  • constantine/math_compiler/ir.nim
    • Added .used pragma to T, name (various overloads) templates in declNumberOps.
  • constantine/math_compiler/pub_curves_jacobian.nim
    • Simplified imports by removing asm_nvidia, impl_fields_globals, impl_fields_dispatch, impl_fields_ops, and impl_curves_ops_affine.
    • Removed the unused ptrBool variable.
  • constantine/math_compiler/pub_fields.nim
    • Simplified imports by removing asm_nvidia.
    • Removed the unused M local variable in genFpAdd and genFpMul.
  • constantine/named/constants/bandersnatch_endomorphisms.nim
    • Added {.used.} pragma to prevent compiler misreporting.
    • Simplified import statement.
  • constantine/named/constants/banderwagon_endomorphisms.nim
    • Added {.used.} pragma to prevent compiler misreporting.
    • Simplified import statement.
  • constantine/named/constants/secp256k1_endomorphisms.nim
    • Added {.used.} pragma to prevent compiler misreporting.
  • constantine/named/properties_fields.nim
    • Added bind BigInt to matchingBigInt and matchingOrderBigInt templates.
  • constantine/platforms/constant_time/ct_routines.nim
    • Added bind CTBool to isMsbSet, fmap, and not templates.
  • constantine/platforms/loadtime_functions.nim
    • Added {.used.} pragma to prevent compiler misreporting.
  • constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim
    • Removed the unused import ../../serialization/io_limbs.
    • Removed the unused fp variable.
  • constantine/signatures/bls_signatures.nim
    • Added {.used.} pragma to FF1 and FF2 type aliases in finalVerify functions.
  • constantine/signatures/ecc_sig_ops.nim
    • Simplified imports by removing named/zoo_generators and named/algebras.
    • Removed the unused EC constant.
  • constantine/signatures/ecdsa.nim
    • Simplified imports by removing io_ec and serialization/codecs.
    • Changed EC_ShortW_Aff to ECAff in recoverPubkeyImpl_vartime.
  • constantine/threadpool/crossthread/scoped_barriers.nim
    • Changed the = operator to =copy for ScopedBarrier.
    • Commented out a warning about moving shared resources.
  • constantine/threadpool/instrumentation.nim
    • Added {.used.} pragma to the defCountersType macro definition.
  • constantine/threadpool/parallel_offloading.nim
    • Changed ByteAddress to int in the generateClosure procedure.
  • constantine/threadpool/primitives/topology_linux.nim
    • Commented out a warning regarding core handling limits on Linux.
  • tests/gpu/t_msm.nim
    • Simplified imports by removing pub_fields, impl_fields_globals, and helpers/prng_unsafe.
  • tests/t_ethereum_eip4844_deneb_kzg_parallel.nim
    • Commented out the verify_kzg_proof test, noting it is not parallel.
  • tests/t_hash_keccak_sha3_vs_openssl.nim
    • Disabled SHA3 tests against OpenSSL by changing when not defined(windows) and not defined(macosx): to when false:.
Activity
  • The author, mratsim, created this pull request to address compilation warnings and improve code quality.
  • The author provided a detailed description of the changes, including the scope of fixes and remaining known issues.
  • The author listed various test suites that were used to verify the changes, such as EIP 4844 KZG, BLS Signatures, and EVM precompiles.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses a number of compilation warnings and hints across the codebase. The changes primarily involve removing unused imports and variables, adding {.used.} pragmas to prevent incorrect unused symbol warnings, and updating code to align with modern Nim practices (e.g., proc =copy for disabling copies). These modifications improve code hygiene and maintainability without introducing any apparent issues. The approach taken is sound and the changes are well-contained.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
tests/t_hash_keccak_sha3_vs_openssl.nim (1)

206-214: ⚠️ Potential issue | 🟡 Minor

Fix the skip log label mismatch.

Line 213 prints “SHA256” in a SHA3-256 test file, which can mislead CI/debug output.

✏️ Proposed fix
-    echo "SHA256 - Differential testing vs OpenSSL - [SKIPPED]"
+    echo "SHA3-256 - Differential testing vs OpenSSL - [SKIPPED]"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/t_hash_keccak_sha3_vs_openssl.nim` around lines 206 - 214, The else
branch prints the wrong algorithm label—change the echo that currently outputs
"SHA256 - Differential testing vs OpenSSL - [SKIPPED]" to use "SHA3-256" so the
skip message matches the test file; locate the else branch echo in
tests/t_hash_keccak_sha3_vs_openssl.nim (the echo in the when/else block) and
update the string to "SHA3-256 - Differential testing vs OpenSSL - [SKIPPED]".
constantine/math_compiler/impl_fields_ops.nim (1)

105-116: ⚠️ Potential issue | 🟠 Major

Fix wrong identifier in mulCheckSparse fallback branch.

At Line 115, x *= b should use the template parameter y. Current code can bind to an unintended outer b symbol and compute the wrong result.

🔧 Proposed fix
   else:
-      x *= b
+      x *= y
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@constantine/math_compiler/impl_fields_ops.nim` around lines 105 - 116, The
fallback branch in the template mulCheckSparse uses the wrong identifier `b`,
which can bind to an outer symbol and produce incorrect results; change the
multiplication to use the template parameter `y` instead (replace `x *= b` with
`x *= y`) so the method always multiplies by the intended argument; update any
related comments if needed and run tests that exercise mulCheckSparse to confirm
correct behavior.
🧹 Nitpick comments (2)
constantine/math_compiler/pub_fields.nim (1)

9-12: Top-of-file NOTE appears stale after removing asm_nvidia.

The NOTE still describes a direct asm_nvidia dependency, but the import now excludes it. Consider updating/removing the comment to avoid misleading maintenance context.

Suggested comment-only cleanup
-# NOTE: We probably don't want the explicit `asm_nvidia` dependency here, I imagine? Currently it's
-# for direct usage of `slct` in `neg`.
+# NOTE: Explicit `asm_nvidia` dependency was removed from this module as part of warning/import cleanup.
+# Keep backend-specific operations encapsulated in lower-level implementation modules.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@constantine/math_compiler/pub_fields.nim` around lines 9 - 12, The
top-of-file NOTE about an explicit asm_nvidia dependency is stale: update or
remove that comment so it no longer claims a direct asm_nvidia import; either
delete the NOTE or reword it to reflect the current import of
constantine/platforms/llvm/llvm and the fact that usage of slct in neg no longer
requires asm_nvidia. Ensure the comment references the symbols asm_nvidia, slct,
and neg so future readers understand why the NOTE was changed.
tests/t_ethereum_eip4844_deneb_kzg_parallel.nim (1)

176-191: Consider removing the large commented-out test body.

Lines 176-191 keep dead code inline. A short comment pointing to the non-parallel test location is easier to maintain than a fully commented implementation.

🧹 Suggested cleanup
-# testGen(verify_kzg_proof, testVector):
-#   ...
-#   else:
-#     doAssert testVector["output"].content == "null"
+# `verify_kzg_proof` is intentionally omitted in this parallel suite
+# because the implementation under test is non-parallel.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/t_ethereum_eip4844_deneb_kzg_parallel.nim` around lines 176 - 191,
Remove the large commented-out test body that includes the
testGen/verify_kzg_proof scaffold and parseAssign lines (commitment, z, y,
proof) and the ctx.verify_kzg_proof status-checking block; replace it with a
short one-line comment that points to the canonical non-parallel test location
(or references the existing non-parallel test) so the file no longer contains
the dead inline implementation while preserving a pointer for future
maintainers.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@constantine/math_compiler/impl_fields_ops.nim`:
- Around line 105-116: The fallback branch in the template mulCheckSparse uses
the wrong identifier `b`, which can bind to an outer symbol and produce
incorrect results; change the multiplication to use the template parameter `y`
instead (replace `x *= b` with `x *= y`) so the method always multiplies by the
intended argument; update any related comments if needed and run tests that
exercise mulCheckSparse to confirm correct behavior.

In `@tests/t_hash_keccak_sha3_vs_openssl.nim`:
- Around line 206-214: The else branch prints the wrong algorithm label—change
the echo that currently outputs "SHA256 - Differential testing vs OpenSSL -
[SKIPPED]" to use "SHA3-256" so the skip message matches the test file; locate
the else branch echo in tests/t_hash_keccak_sha3_vs_openssl.nim (the echo in the
when/else block) and update the string to "SHA3-256 - Differential testing vs
OpenSSL - [SKIPPED]".

---

Nitpick comments:
In `@constantine/math_compiler/pub_fields.nim`:
- Around line 9-12: The top-of-file NOTE about an explicit asm_nvidia dependency
is stale: update or remove that comment so it no longer claims a direct
asm_nvidia import; either delete the NOTE or reword it to reflect the current
import of constantine/platforms/llvm/llvm and the fact that usage of slct in neg
no longer requires asm_nvidia. Ensure the comment references the symbols
asm_nvidia, slct, and neg so future readers understand why the NOTE was changed.

In `@tests/t_ethereum_eip4844_deneb_kzg_parallel.nim`:
- Around line 176-191: Remove the large commented-out test body that includes
the testGen/verify_kzg_proof scaffold and parseAssign lines (commitment, z, y,
proof) and the ctx.verify_kzg_proof status-checking block; replace it with a
short one-line comment that points to the canonical non-parallel test location
(or references the existing non-parallel test) so the file no longer contains
the dead inline implementation while preserving a pointer for future
maintainers.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c93bd435-d291-41b3-a31d-b98ec0e3b777

📥 Commits

Reviewing files that changed from the base of the PR and between 8e117d7 and 08eadbc.

📒 Files selected for processing (50)
  • bindings/lib_hashes.nim
  • constantine/ethereum_bls_signatures.nim
  • constantine/ethereum_evm_precompiles.nim
  • constantine/ethereum_verkle_ipa.nim
  • constantine/hash_to_curve/h2c_hash_to_field.nim
  • constantine/hashes/h_ripemd160.nim
  • constantine/hashes/h_sha256.nim
  • constantine/hashes/ripemd160/ripemd160_generic.nim
  • constantine/hashes/sha256/sha256_generic.nim
  • constantine/hashes/sha256/sha256_x86_sha.nim
  • constantine/hashes/sha256/sha256_x86_ssse3.nim
  • constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86.nim
  • constantine/math/arithmetic/assembly/limbs_asm_mul_mont_x86_adx_bmi2.nim
  • constantine/math/arithmetic/assembly/limbs_asm_redc_mont_x86_adx_bmi2.nim
  • constantine/math/arithmetic/limbs_crandall.nim
  • constantine/math/elliptic/ec_multi_scalar_mul_parallel.nim
  • constantine/math/elliptic/ec_scalar_mul.nim
  • constantine/math/elliptic/ec_scalar_mul_vartime.nim
  • constantine/math/polynomials/polynomials.nim
  • constantine/math/polynomials/polynomials_parallel.nim
  • constantine/math_compiler/experimental/backends/cuda.nim
  • constantine/math_compiler/experimental/backends/wgsl.nim
  • constantine/math_compiler/experimental/cuda_execute_dsl.nim
  • constantine/math_compiler/experimental/gpu_compiler.nim
  • constantine/math_compiler/experimental/nim_to_gpu.nim
  • constantine/math_compiler/experimental/runtime_compile.nim
  • constantine/math_compiler/impl_curves_ops_affine.nim
  • constantine/math_compiler/impl_curves_ops_jacobian.nim
  • constantine/math_compiler/impl_fields_ops.nim
  • constantine/math_compiler/impl_msm_nvidia.nim
  • constantine/math_compiler/ir.nim
  • constantine/math_compiler/pub_curves_jacobian.nim
  • constantine/math_compiler/pub_fields.nim
  • constantine/named/constants/bandersnatch_endomorphisms.nim
  • constantine/named/constants/banderwagon_endomorphisms.nim
  • constantine/named/constants/secp256k1_endomorphisms.nim
  • constantine/named/properties_fields.nim
  • constantine/platforms/constant_time/ct_routines.nim
  • constantine/platforms/loadtime_functions.nim
  • constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim
  • constantine/signatures/bls_signatures.nim
  • constantine/signatures/ecc_sig_ops.nim
  • constantine/signatures/ecdsa.nim
  • constantine/threadpool/crossthread/scoped_barriers.nim
  • constantine/threadpool/instrumentation.nim
  • constantine/threadpool/parallel_offloading.nim
  • constantine/threadpool/primitives/topology_linux.nim
  • tests/gpu/t_msm.nim
  • tests/t_ethereum_eip4844_deneb_kzg_parallel.nim
  • tests/t_hash_keccak_sha3_vs_openssl.nim
💤 Files with no reviewable changes (7)
  • constantine/ethereum_bls_signatures.nim
  • constantine/ethereum_evm_precompiles.nim
  • constantine/math/polynomials/polynomials_parallel.nim
  • constantine/math/polynomials/polynomials.nim
  • constantine/hash_to_curve/h2c_hash_to_field.nim
  • constantine/math/elliptic/ec_multi_scalar_mul_parallel.nim
  • constantine/math/elliptic/ec_scalar_mul_vartime.nim

@mratsim mratsim force-pushed the fix-compilation-warnings branch from 6fe834b to f4a5271 Compare March 15, 2026 01:04
@mratsim mratsim force-pushed the fix-compilation-warnings branch from f4a5271 to e0de081 Compare March 15, 2026 01:04
@mratsim mratsim merged commit cedcf0d into master Mar 15, 2026
17 checks passed
@mratsim mratsim deleted the fix-compilation-warnings branch March 15, 2026 01:05
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.

1 participant