Skip to content

Commit

Permalink
Merge pull request #1260 from o1-labs/fix/ts-build-rot
Browse files Browse the repository at this point in the history
Fix TS build and Mina tests
  • Loading branch information
mitschabaude authored Nov 21, 2023
2 parents 084a1e7 + 2fefe98 commit 3e2103d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 28 deletions.
2 changes: 2 additions & 0 deletions run-minimal-mina-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
set -e

npm run dev

./run src/tests/inductive-proofs-small.ts --bundle
2 changes: 1 addition & 1 deletion src/bindings
2 changes: 1 addition & 1 deletion src/lib/gadgets/bitwise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function rotate(
field.toBigInt() < 2n ** BigInt(MAX_BITS),
`rotation: expected field to be at most 64 bits, got ${field.toBigInt()}`
);
return new Field(Fp.rot(field.toBigInt(), bits, direction));
return new Field(Fp.rot(field.toBigInt(), BigInt(bits), direction));
}
const [rotated] = rot(field, bits, direction);
return rotated;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/gadgets/bitwise.unit-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ await Bitwise.compile();

[2, 4, 8, 16, 32, 64].forEach((length) => {
equivalent({ from: [uint(length)], to: field })(
(x) => Fp.rot(x, 12, 'left'),
(x) => Fp.rot(x, 12n, 'left'),
(x) => Gadgets.rotate(x, 12, 'left')
);
equivalent({ from: [uint(length)], to: field })(
Expand Down Expand Up @@ -164,7 +164,7 @@ await equivalentAsync(
await equivalentAsync({ from: [field], to: field }, { runs: 3 })(
(x) => {
if (x >= 2n ** 64n) throw Error('Does not fit into 64 bits');
return Fp.rot(x, 12, 'left');
return Fp.rot(x, 12n, 'left');
},
async (x) => {
let proof = await Bitwise.rot(x);
Expand Down
13 changes: 1 addition & 12 deletions src/tests/inductive-proofs-small.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import {
SelfProof,
Field,
ZkProgram,
isReady,
shutdown,
Proof,
} from '../index.js';
import { SelfProof, Field, ZkProgram, Proof } from 'o1js';
import { tic, toc } from '../examples/utils/tic-toc.node.js';

await isReady;

let MaxProofsVerifiedOne = ZkProgram({
name: 'recursive-1',
publicInput: Field,
Expand Down Expand Up @@ -85,5 +76,3 @@ function testJsonRoundtrip(ProofClass: any, proof: Proof<Field, void>) {
);
return ProofClass.fromJSON(jsonProof);
}

shutdown();
13 changes: 1 addition & 12 deletions src/tests/inductive-proofs.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import {
SelfProof,
Field,
ZkProgram,
isReady,
shutdown,
Proof,
} from '../index.js';
import { SelfProof, Field, ZkProgram, Proof } from 'o1js';
import { tic, toc } from '../examples/utils/tic-toc.node.js';

await isReady;

let MaxProofsVerifiedZero = ZkProgram({
name: 'no-recursion',
publicInput: Field,
Expand Down Expand Up @@ -155,5 +146,3 @@ function testJsonRoundtrip(ProofClass: any, proof: Proof<Field, void>) {
);
return ProofClass.fromJSON(jsonProof);
}

shutdown();

0 comments on commit 3e2103d

Please sign in to comment.