Skip to content

fix!: remove hash_to_field from stdlib#9098

Merged
TomAFrench merged 3 commits intomasterfrom
tf/remove-hash-to-field
Jul 2, 2025
Merged

fix!: remove hash_to_field from stdlib#9098
TomAFrench merged 3 commits intomasterfrom
tf/remove-hash-to-field

Conversation

@TomAFrench
Copy link
Member

Description

Problem*

Resolves

Summary*

This PR removes the insecure function hash_to_field from the stdlib. It looks like this came while trying to avoid a breaking change in #4675 as it's no longer possible to pass a slice to blake2s.

Any fix for this is going to be a breaking to the point of being a completely different function (at the minimum it can't take a slice as input, it also doesn't really make sense for it to accept Fields as I would just use a poseidon hash in that case). I think it's then worth just removing the function entirely and we can re-add a fixed implementation in future if necessary

Additional Context

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@TomAFrench TomAFrench requested a review from jfecher July 2, 2025 18:09
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jul 2, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 0709521 Previous: 0098c45 Ratio
test_report_zkpassport_noir_rsa_ 2 s 1 s 2

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

Copy link
Contributor

@jfecher jfecher left a comment

Choose a reason for hiding this comment

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

Need to update all .snap files now that the stdlib changed

@TomAFrench
Copy link
Member Author

🫠

@jfecher
Copy link
Contributor

jfecher commented Jul 2, 2025

I'm running the tests locally now, I'll push a commit when they finish

@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Jul 2, 2025

FYI @noir-lang/developerrelations on Noir doc changes.

@TomAFrench TomAFrench added this pull request to the merge queue Jul 2, 2025
Merged via the queue into master with commit 441f39a Jul 2, 2025
152 of 153 checks passed
@TomAFrench TomAFrench deleted the tf/remove-hash-to-field branch July 2, 2025 21:25
github-merge-queue bot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Jul 4, 2025
Automated pull of nightly from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: remove redundant associated constant lookup
(noir-lang/noir#9114)
chore: test that associated function and constant with the same name
collide (noir-lang/noir#9112)
feat: Allow TraitAsType syntax to refer to associated constants in
expressions (noir-lang/noir#9041)
chore: clippy (noir-lang/noir#9101)
chore(fuzz): Recursively generate lvalue for multi dimensional arrays
and nested tuples (noir-lang/noir#9086)
fix!: remove `hash_to_field` from stdlib
(noir-lang/noir#9098)
chore(docs): Brillig gen (noir-lang/noir#9085)
chore(fuzz): Test AST print-and-parse roundtrip
(noir-lang/noir#9083)
fix(ssa): Do not fail for static assertions in a map over empty dynamic
slices (noir-lang/noir#9060)
chore: merge `RangeCheckFailed` and `RangeCheckFailedWithMessage`
(noir-lang/noir#9093)
chore(fuzz): Capture printed output in `comptime_vs_brillig_direct`
(noir-lang/noir#9090)
chore(debug): Add trait constraint to string helper
(noir-lang/noir#9082)
chore: bump some deps (noir-lang/noir#9076)
END_COMMIT_OVERRIDE

---------

Co-authored-by: AztecBot <tech@aztecprotocol.com>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
@Savio-Sou
Copy link
Collaborator

Projects hosted on GitHub that relies on the library: https://github.com/search?q=path%3A*.nr+AND+%22hash_to_field%22&type=code

For similar removal of features in the future, we should at the minimum add an error that i) recommends an alternative (e.g. alternative hashing scheme in this case) for our users, and ii) prompts them to create an Issue if the alternative is not helpful.

danielntmd pushed a commit to danielntmd/aztec-packages that referenced this pull request Jul 16, 2025
Automated pull of nightly from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: remove redundant associated constant lookup
(noir-lang/noir#9114)
chore: test that associated function and constant with the same name
collide (noir-lang/noir#9112)
feat: Allow TraitAsType syntax to refer to associated constants in
expressions (noir-lang/noir#9041)
chore: clippy (noir-lang/noir#9101)
chore(fuzz): Recursively generate lvalue for multi dimensional arrays
and nested tuples (noir-lang/noir#9086)
fix!: remove `hash_to_field` from stdlib
(noir-lang/noir#9098)
chore(docs): Brillig gen (noir-lang/noir#9085)
chore(fuzz): Test AST print-and-parse roundtrip
(noir-lang/noir#9083)
fix(ssa): Do not fail for static assertions in a map over empty dynamic
slices (noir-lang/noir#9060)
chore: merge `RangeCheckFailed` and `RangeCheckFailedWithMessage`
(noir-lang/noir#9093)
chore(fuzz): Capture printed output in `comptime_vs_brillig_direct`
(noir-lang/noir#9090)
chore(debug): Add trait constraint to string helper
(noir-lang/noir#9082)
chore: bump some deps (noir-lang/noir#9076)
END_COMMIT_OVERRIDE

---------

Co-authored-by: AztecBot <tech@aztecprotocol.com>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants