Skip to content

Commit

Permalink
Merge pull request #723 from ImmanuelSegol/feat/avoid-wasm-error
Browse files Browse the repository at this point in the history
bug fix - wasm pack compile error
  • Loading branch information
str4d authored Jan 20, 2023
2 parents 9eb8ead + aae4dce commit 94b454c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion halo2_gadgets/src/poseidon/primitives/mds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ pub(super) fn generate_mds<F: FromUniformBytes<64> + Ord, const T: usize>(
if m == j {
acc
} else {
// We hard-code the type, to avoid spurious "cannot infer type" rustc errors.
let denominator: F = x_j - x_m;

// We can invert freely; by construction, the elements of xs are distinct.
acc * (x - x_m) * (x_j - x_m).invert().unwrap()
let denominator_inverted: F = denominator.invert().unwrap();

acc * (x - x_m) * denominator_inverted
}
})
};
Expand Down

0 comments on commit 94b454c

Please sign in to comment.