Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Poseidon-BN254 hash functions #1176

Merged
merged 4 commits into from
Apr 19, 2023
Merged

Conversation

ax0
Copy link
Contributor

@ax0 ax0 commented Apr 19, 2023

Related issue(s)

Resolves #1162

Description

Following up on the discussion in #1162, this PR adds the more conventional fixed-length Poseidon hash functions in the case of the BN254 field (i.e. using the permutation instances under std::hash::poseidon::bn254::perm). These hash functions agree with those used by Circom. These are exposed as std::hash::poseidon::bn254::hash_1, std::hash::poseidon::hash_2, ..., std::hash::poseidon::bn254::hash_16.

Summary of changes

  • Addition of fixed-length Poseidon hash function instances
  • Modification of permutation test

Dependency additions / changes

Test additions / changes

The poseidonperm_x5_254 test was modified to make use of the appropriate hash functions directly and thus renamed. Both Poseidon tests are still in the wrong place due to the linear_eval is not 0. bug (see #1124).

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.
  • Poseidon hash function syntax

Additional context

@kevaundray kevaundray changed the title Add Poseidon-BN254 hash functions feat: Add Poseidon-BN254 hash functions Apr 19, 2023
@joss-aztec
Copy link
Contributor

I can attest that the values used in the poseidon_bn254_hash test are consistent with the equivalent circom.

@kevaundray kevaundray added this pull request to the merge queue Apr 19, 2023
Merged via the queue into noir-lang:master with commit 33feb2b Apr 19, 2023
TomAFrench added a commit that referenced this pull request Apr 24, 2023
* master:
  chore: update flake version to match current release (#1204)
  feat!: Switch to aztec_backend that uses upstream BB & UltraPlonk (#1114)
  chore(ssa refactor): Add Context structs and start ssa gen pass (#1196)
  chore(ssa): Replace JmpIf with BrIf (#1193)
  chore(noir): Release 0.4.1 (#1164)
  chore(ssa refactor): Add DenseMap and SparseMap types (#1184)
  feat: bump noir-source-resolver version (#1182)
  chore(deps): bump h2 from 0.3.16 to 0.3.18 (#1186)
  fix(nargo): restore `nargo codegen-verifier` functionality (#1185)
  chore: simplify setup code in `noir_integration` test (#1180)
  feat: Add Poseidon-BN254 hash functions (#1176)
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.

stdlib poseidon inconsistent with circom's
3 participants