diff --git a/flake.lock b/flake.lock index 6ca03a4162..0e015ce801 100644 --- a/flake.lock +++ b/flake.lock @@ -265,8 +265,8 @@ "utils": "utils" }, "locked": { - "lastModified": 1725991175, - "narHash": "sha256-R+hDedYgV+SR0nz/zJaDjprTEr+g0lS4q532JS06MBY=", + "lastModified": 1726583205, + "narHash": "sha256-mmCw1+MidLxOlKPFNOojn2UfmFXYhNhtzwrwQilXKFA=", "path": "src/mina", "type": "path" }, diff --git a/flake.nix b/flake.nix index 91c3fc8f8c..126cc8b021 100644 --- a/flake.nix +++ b/flake.nix @@ -31,7 +31,7 @@ ./src/bindings/ocaml/dune ./src/bindings/ocaml/lib/dune ./src/bindings/ocaml/dune-project - ./src/bindings/ocaml/js/dune + ./src/bindings/ocaml/jsoo_exports/dune ]; }); phases = [ "unpackPhase" "buildPhase" ]; diff --git a/run-jest-tests.sh b/run-jest-tests.sh index 54b84b73c5..545ffa1c9a 100755 --- a/run-jest-tests.sh +++ b/run-jest-tests.sh @@ -2,6 +2,13 @@ set -e shopt -s globstar # to expand '**' into nested directories +if ! [ -f ./mina-signer/dist ] +then + pushd src/mina-signer + npm run build + popd +fi + for f in ./src/**/*.test.ts; do NODE_OPTIONS=--experimental-vm-modules npx jest $f; done diff --git a/src/bindings b/src/bindings index e0103fc6ad..492c76a3f1 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit e0103fc6ad15462ca937e4d23b9b6aa0ae63da0b +Subproject commit 492c76a3f132f0f53ac864c0381a8411c0d5f3d1 diff --git a/src/lib/provable/string.ts b/src/lib/provable/string.ts index 2a52e33cdf..1a4bd4d451 100644 --- a/src/lib/provable/string.ts +++ b/src/lib/provable/string.ts @@ -88,7 +88,7 @@ class CircuitString extends Struct(RawCircuitString) { let isNull = this.values[i].isNull(); mask[i] = isNull.and(wasntNullAlready); wasntNullAlready = isNull.not().and(wasntNullAlready); - length.add(wasntNullAlready.toField()); + length = length.add(wasntNullAlready.toField()); } // mask has length n+1, the last element is true when `this` has no null char mask[n] = wasntNullAlready; diff --git a/src/lib/provable/test/string.unit-test.ts b/src/lib/provable/test/string.unit-test.ts index 8eccb4bee8..4360baddce 100644 --- a/src/lib/provable/test/string.unit-test.ts +++ b/src/lib/provable/test/string.unit-test.ts @@ -150,6 +150,18 @@ describe('Circuit String', () => { }); }); + describe('#length', () => { + test('length', async () => { + const str1 = CircuitString.fromString('abcd'); + expect(str1.length()).toEqual(Field(4)); + + await Provable.runAndCheck(() => { + const str1 = CircuitString.fromString('abcd'); + expect(str1.length()).toEqual(Field(4)); + }); + }); + }); + /* describe('CircuitString8', async () => { test('cannot create more than 8 chars', () => { expect(() => { diff --git a/src/mina b/src/mina index 5db492d063..cf3719623d 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit 5db492d0634a6ecd4016040fc13cae7629f225cc +Subproject commit cf3719623dbaddec319aa88dfac64679d937674a diff --git a/src/mina-signer/tests/client.test.ts b/src/mina-signer/tests/client.test.ts index 00a63282c3..4ca384a2d2 100644 --- a/src/mina-signer/tests/client.test.ts +++ b/src/mina-signer/tests/client.test.ts @@ -1,4 +1,4 @@ -import Client from '../../../dist/node/mina-signer/mina-signer.js'; +import Client from '../dist/node/mina-signer/mina-signer.js'; describe('Client Class Initialization', () => { let client; diff --git a/src/mina-signer/tests/keypair.test.ts b/src/mina-signer/tests/keypair.test.ts index ae2deb3b5e..2c19c95caa 100644 --- a/src/mina-signer/tests/keypair.test.ts +++ b/src/mina-signer/tests/keypair.test.ts @@ -1,4 +1,4 @@ -import Client from '../../../dist/node/mina-signer/mina-signer.js'; +import Client from '../dist/node/mina-signer/mina-signer.js'; describe('Keypair', () => { let client: Client; diff --git a/src/mina-signer/tests/message.test.ts b/src/mina-signer/tests/message.test.ts index 90f718d450..bd9586fb19 100644 --- a/src/mina-signer/tests/message.test.ts +++ b/src/mina-signer/tests/message.test.ts @@ -1,5 +1,5 @@ -import Client from '../../../dist/node/mina-signer/mina-signer.js'; -import type { PrivateKey } from '.../.././dist/node/mina-signer/src/types.js'; +import Client from '../dist/node/mina-signer/mina-signer.js'; +import type { PrivateKey } from '../dist/node/mina-signer/src/types.js'; describe('Message', () => { describe('Mainnet network', () => { diff --git a/src/mina-signer/tests/payment.test.ts b/src/mina-signer/tests/payment.test.ts index 9c434e3721..de84939d67 100644 --- a/src/mina-signer/tests/payment.test.ts +++ b/src/mina-signer/tests/payment.test.ts @@ -1,5 +1,5 @@ -import Client from '../../../dist/node/mina-signer/mina-signer.js'; -import type { Keypair } from '../../../dist/node/mina-signer/src/types.js'; +import Client from '../dist/node/mina-signer/mina-signer.js'; +import type { Keypair } from '../dist/node/mina-signer/src/types.js'; describe('Payment', () => { describe('Mainnet network', () => { diff --git a/src/mina-signer/tests/rosetta.test.ts b/src/mina-signer/tests/rosetta.test.ts index 67efdc6671..8b8d691822 100644 --- a/src/mina-signer/tests/rosetta.test.ts +++ b/src/mina-signer/tests/rosetta.test.ts @@ -1,7 +1,7 @@ -import Client from '../../../dist/node/mina-signer/mina-signer.js'; -import { fieldFromHex, fieldToHex, signatureJsonToHex, signatureJsonFromHex, UnsignedTransaction, publicKeyToHex, signTransaction } from '../../../dist/node/mina-signer/src/rosetta.js'; -import { PublicKey } from '../../../dist/node/mina-signer/src/curve-bigint.js'; -import { Field } from '../../../dist/node/mina-signer/src/field-bigint.js'; +import Client from '../dist/node/mina-signer/mina-signer.js'; +import { fieldFromHex, fieldToHex, signatureJsonToHex, signatureJsonFromHex, UnsignedTransaction, publicKeyToHex, signTransaction } from '../dist/node/mina-signer/src/rosetta.js'; +import { PublicKey } from '../dist/node/mina-signer/src/curve-bigint.js'; +import { Field } from '../dist/node/mina-signer/src/field-bigint.js'; describe('Rosetta', () => { let client: Client; diff --git a/src/mina-signer/tests/stake-delegation.test.ts b/src/mina-signer/tests/stake-delegation.test.ts index a298157734..16cdf0d8f6 100644 --- a/src/mina-signer/tests/stake-delegation.test.ts +++ b/src/mina-signer/tests/stake-delegation.test.ts @@ -1,5 +1,5 @@ -import Client from '../../../dist/node/mina-signer/mina-signer.js'; -import type { Keypair } from '../../../dist/node/mina-signer/src/types.js'; +import Client from '../dist/node/mina-signer/mina-signer.js'; +import type { Keypair } from '../dist/node/mina-signer/src/types.js'; describe('Stake Delegation', () => { describe('Mainnet network', () => {