Skip to content

Commit

Permalink
refactor(crypto): export hashLeanIMT from index
Browse files Browse the repository at this point in the history
  • Loading branch information
djanluka committed Aug 15, 2024
1 parent aab71cb commit f61a567
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/ts/Poll.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LeanIMT } from "@zk-kit/lean-imt";
import { LeanIMT, LeanIMTHashFunction } from "@zk-kit/lean-imt";
import {
IncrementalQuinTree,
genRandomSalt,
Expand All @@ -12,8 +12,8 @@ import {
genTreeCommitment,
hash2,
poseidon,
hashLeanIMT,
} from "maci-crypto";
import { hashLeanIMT } from "maci-crypto/build/ts/hashing";
import {
PCommand,
Keypair,
Expand Down Expand Up @@ -223,7 +223,7 @@ export class Poll implements IPoll {
// ensure we have the correct actual state tree depth value
this.actualStateTreeDepth = Math.max(1, Math.ceil(Math.log2(Number(this.numSignups))));

this.stateTree = new LeanIMT(hashLeanIMT);
this.stateTree = new LeanIMT(hashLeanIMT as LeanIMTHashFunction);
// add all leaves
this.stateLeaves.forEach((stateLeaf) => {
this.stateTree?.insert(stateLeaf.hash());
Expand Down
14 changes: 13 additions & 1 deletion crypto/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,19 @@ export {

export { G1Point, G2Point, genRandomBabyJubValue } from "./babyjub";

export { sha256Hash, hashLeftRight, hashN, hash2, hash3, hash4, hash5, hash12, hashOne, poseidon } from "./hashing";
export {
sha256Hash,
hashLeftRight,
hashN,
hash2,
hash3,
hash4,
hash5,
hash12,
hashOne,
poseidon,
hashLeanIMT,
} from "./hashing";

export { inCurve } from "@zk-kit/baby-jubjub";

Expand Down

0 comments on commit f61a567

Please sign in to comment.