Skip to content

Commit

Permalink
Merge branch 'brian/nixify' into brian/permisions-precondition
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometer1729 committed Sep 17, 2024
2 parents 09590d3 + 9317da6 commit ce56eb2
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 18 deletions.
4 changes: 2 additions & 2 deletions flake.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" ];
Expand Down
7 changes: 7 additions & 0 deletions run-jest-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/lib/provable/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions src/lib/provable/test/string.unit-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/mina
Submodule mina updated 218 files
2 changes: 1 addition & 1 deletion src/mina-signer/tests/client.test.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/mina-signer/tests/keypair.test.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/mina-signer/tests/message.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/mina-signer/tests/payment.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/mina-signer/tests/rosetta.test.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/mina-signer/tests/stake-delegation.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down

0 comments on commit ce56eb2

Please sign in to comment.