Repository navigation
Conversation
…contract in from_u64 ## Description Corrects a documentation and behavior mismatch on `Goldilocks::from_u64` in `qp-poseidon`. ## Key Changes * Updated the doc comment on `Goldilocks::from_u64` to explicitly state that no field reduction modulo P is performed at construction time. * Documented the caller requirement to invoke `as_canonical_u64()` before serialization or use fallible deserializers (`bytes_to_digest` / `bytes_to_felts_compact`) to prevent non-injective limb aliasing (`P` aliasing with `0`). ## Verification - Verified no code or logic changes were introduced. - Verified doc comments render accurately with Rust documentation tooling.
n13
left a comment
There was a problem hiding this comment.
Reviewer model: GPT-6.1 Sol
REQUEST_CHANGES — the required formatting check fails at reviewed head 3eab3c5e534a13093ddfbcc7ebd0f4e2236af7f7.
- [P2] Restore Unix line endings in
src/goldilocks.rs(example location). The patch converts the entire file from LF to CRLF, while.rustfmt.tomlexplicitly requiresnewline_style = "Unix". Runningcargo +nightly fmt --all -- --checkexits 1 withIncorrect newline style in .../src/goldilocks.rs. This is thefast-checksgate in.github/workflows/ci.yml:43-46, on which the build/test and analysis jobs depend. The base file passes a standalone rustfmt check; the PR file fails; an otherwise identical temporary copy with LF restored passes. Restore LF so the required CI gate can pass.
Non-blocking documentation follow-up: at src/goldilocks.rs:82-85, replace the retained opening sentence “Create a field element from a u64, reducing if necessary.” It contradicts the new paragraph and still appears in Rustdoc method summaries. A direct statement that construction stores the input without reduction would resolve the original mismatch.
Validation:
- Inspected the complete diff and confirmed that, apart from line endings, only nine documentation lines were added; executable code is unchanged.
- Checked canonicalization and rejection behavior against the serializers and existing non-canonical-limb regression tests.
cargo test --locked: passed (62 unit tests, 11 integration tests, 2 doctests; the release-only stack-zeroization tests are disabled in this debug run).cargo doc --workspace --locked --no-deps --all-features --release: passed. A stricterRUSTDOCFLAGS='-D warnings'run failed on a pre-existing bare URL in unchangedsrc/poseidon2.rs:4.cargo +nightly fmt --all -- --check: failed as described above.- GitHub reported no CI check results at review time.
|
Thanks for the thorough review and catch @n13! I've pushed a new commit addressing both items:
|
n13
left a comment
There was a problem hiding this comment.
Verdict: Request changes
Reviewer: GPT-6.1 Sol
Reviewed head 850cdcc00372bdcba33ae069cafe40541802d2eb against base 0117e2ca7f46a07d86a43385b5079ac6aaadaadc.
- [P2] Wrap the new opening doc sentence to pass the required formatting gate —
src/goldilocks.rs:82.cargo +nightly fmt --all -- --checkexits 1 because rustfmt splits this sentence after “at”, moving “construction time.” onto a second doc-comment line. The same failure reproduces withnightly-2026-08-31; the base version of this file passes. This command is required by.github/workflows/ci.yml:46, and the build/test and analysis jobs depend on that formatting gate. Apply the formatter's suggested line wrap before merging.
The previous LF-line-ending issue and misleading “reducing if necessary” wording are fixed. The complete diff changes only documentation, and the canonicalization/rejection guidance agrees with the constructor, serializers, and existing regression tests. No additional blocking findings.
Validation:
timeout 60 cargo test --locked --release: passed — 62 unit tests, 13 integration tests (including stack-zeroization checks), and 2 doctests.CARGO_TARGET_DIR=target-doc timeout 60 cargo doc --workspace --locked --no-deps --all-features --release: passed; one pre-existing bare-URL warning in unchangedsrc/poseidon2.rs:4.- Nightly formatting checks: failed as described above.
git diff --check: passed.- GitHub reported no CI check results at review time.
Description
Corrects a documentation and behavior mismatch on
Goldilocks::from_u64inqp-poseidon.Key Changes
Goldilocks::from_u64to explicitly state that no field reduction modulo P is performed at construction time.as_canonical_u64()before serialization or use fallible deserializers (bytes_to_digest/bytes_to_felts_compact) to prevent non-injective limb aliasing (Paliasing with0).Verification