Skip to content

Commit

Permalink
chore: bump light-poseidon (#7568)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Mar 5, 2025
1 parent 46e8043 commit 33284ac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deny.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
- uses: EmbarkStudios/cargo-deny-action@8d73959fce1cdc8989f23fdf03bec6ae6a6576ef
with:
command: check all
command: check all
10 changes: 4 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions tooling/nargo_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,7 @@ sha3.workspace = true
iai = "0.1.1"
test-case.workspace = true
lazy_static.workspace = true
light-poseidon = "0.2.0"

ark-bn254-v04 = { package = "ark-bn254", version = "^0.4.0", default-features = false, features = [
"curve",
] }
ark-ff-v04 = { package = "ark-ff", version = "^0.4.0", default-features = false }
light-poseidon = "0.3.0"

[[bench]]
name = "criterion"
Expand Down
16 changes: 6 additions & 10 deletions tooling/nargo_cli/tests/stdlib-props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ fn run_snippet_proptest(
Err(e) => panic!("failed to compile program; brillig = {force_brillig}:\n{source}\n{e:?}"),
};

let pedandic_solving = true;
let blackbox_solver = bn254_blackbox_solver::Bn254BlackBoxSolver(pedandic_solving);
let pedantic_solving = true;
let blackbox_solver = bn254_blackbox_solver::Bn254BlackBoxSolver(pedantic_solving);
let foreign_call_executor = RefCell::new(DefaultForeignCallBuilder::default().build());

// Generate multiple input/output
Expand Down Expand Up @@ -165,17 +165,13 @@ fn fuzz_poseidon2_equivalence() {

#[test]
fn fuzz_poseidon_equivalence() {
use ark_ff_v04::{BigInteger, PrimeField};
use light_poseidon::{Poseidon, PoseidonHasher};

let poseidon_hash = |inputs: &[FieldElement]| {
let mut poseidon = Poseidon::<ark_bn254_v04::Fr>::new_circom(inputs.len()).unwrap();
let frs: Vec<ark_bn254_v04::Fr> = inputs
.iter()
.map(|f| ark_bn254_v04::Fr::from_be_bytes_mod_order(&f.to_be_bytes()))
.collect::<Vec<_>>();
let hash = poseidon.hash(&frs).expect("failed to hash");
FieldElement::from_be_bytes_reduce(&hash.into_bigint().to_bytes_be())
let mut poseidon = Poseidon::<ark_bn254::Fr>::new_circom(inputs.len()).unwrap();
let frs: Vec<ark_bn254::Fr> = inputs.iter().map(|f| f.into_repr()).collect::<Vec<_>>();
let hash: ark_bn254::Fr = poseidon.hash(&frs).expect("failed to hash");
FieldElement::from_repr(hash)
};

// Noir has hashes up to length 16, but the reference library won't work with more than 12.
Expand Down

0 comments on commit 33284ac

Please sign in to comment.