Skip to content

refactor(math): remove dead/self-referential code from polynomial.rs#641

Open
diegokingston wants to merge 2 commits into
mainfrom
review/polynomial-dead-code
Open

refactor(math): remove dead/self-referential code from polynomial.rs#641
diegokingston wants to merge 2 commits into
mainfrom
review/polynomial-dead-code

Conversation

@diegokingston
Copy link
Copy Markdown
Collaborator

Remove functions with no production callers (only exercised by their own tests) from crypto/math/src/polynomial.rs:

  • compose_fft (was #[cfg(test)], tested only by composition_fft_works)
  • pad_with_zero_coefficients + pad_with_zero_coefficients_to_length
  • mul_with_ref (no Polynomial Mul operator exists)
  • new_monomial

Adjust affected tests: drop self-tests, rewrite the evaluate-coverage tests to build polynomials via Polynomial::new, and inline the single production-test call site (X^8) in prover_tests.

Remove functions with no production callers (only exercised by their own
tests) from crypto/math/src/polynomial.rs:

- compose_fft (was #[cfg(test)], tested only by composition_fft_works)
- pad_with_zero_coefficients + pad_with_zero_coefficients_to_length
- mul_with_ref (no Polynomial Mul operator exists)
- new_monomial

Adjust affected tests: drop self-tests, rewrite the evaluate-coverage
tests to build polynomials via Polynomial::new, and inline the single
production-test call site (X^8) in prover_tests.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

Codex Code Review

No security, VM, or performance issues found in the PR diff.

One potential compatibility concern: crypto/math/src/polynomial.rs removes public APIs (new_monomial, mul_with_ref, pad_with_zero_coefficients*). Since crypto/math/Cargo.toml defines a publishable library package and these functions were not test-gated, downstream users compiling against them will break. If this crate is intended to have external consumers, consider keeping deprecated wrappers or documenting this as a breaking API change. If it is strictly internal, this is fine.

Tests not run: cargo test was blocked because rustup tried to write under read-only /home/runner/.rustup/tmp.

@claude
Copy link
Copy Markdown

claude Bot commented Jun 1, 2026

Review: refactor(math): remove dead/self-referential code from polynomial.rs\n\nOverall: Clean removal. No issues found.\n\nRemoves 5 dead functions from polynomial.rs, adjusts downstream tests, and inlines the single non-test use of new_monomial in prover_tests.rs. A grep over the full repo confirms zero remaining callers.\n\nMinor notes:\n\n- X^8 construction verbosity — The 9-element array is correct and the comment helps, but a reader who mis-counts zeros creates a silent bug. Acceptable tradeoff since new_monomial is gone; watch if the pattern proliferates.\n\n- Breaking public API — All removed functions were pub. Semver-breaking for any external consumer. Fine at 0.1.0 with no external callers in this repo — worth a changelog entry if the crate is ever published.\n\n- mul_with_ref algorithm — The removed code contained a valid O(n*m) polynomial multiplication. If a Mul trait impl is added later it will need to be re-derived. Nothing actionable now.\n\nNo security, correctness, or performance concerns.

Copy link
Copy Markdown
Contributor

@MauroToscano MauroToscano left a comment

Choose a reason for hiding this comment

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

Why do we even have the Polynomial at this point ? You cannot do much with them, right ?

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