@aztec/bb.js 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/browser/barretenberg_api/index.d.ts +2 -7
- package/dest/browser/barretenberg_api/index.d.ts.map +1 -1
- package/dest/browser/index.js +1 -1
- package/dest/node/barretenberg_api/index.d.ts +2 -7
- package/dest/node/barretenberg_api/index.d.ts.map +1 -1
- package/dest/node/barretenberg_api/index.js +8 -28
- package/dest/node/barretenberg_api/pedersen.test.js +25 -17
- package/dest/node/barretenberg_wasm/barretenberg-threads.wasm +0 -0
- package/dest/node-cjs/barretenberg_api/index.d.ts +2 -7
- package/dest/node-cjs/barretenberg_api/index.d.ts.map +1 -1
- package/dest/node-cjs/barretenberg_api/index.js +8 -28
- package/dest/node-cjs/barretenberg_api/pedersen.test.js +25 -17
- package/dest/node-cjs/barretenberg_wasm/barretenberg-threads.wasm +0 -0
- package/package.json +1 -1
- package/src/barretenberg_api/index.ts +7 -36
- package/src/barretenberg_api/pedersen.test.ts +27 -21
|
@@ -18,41 +18,47 @@ describe('pedersen', () => {
|
|
|
18
18
|
expect(result).toEqual(new Fr(1521373897829389584529155077412196627698249315427143054350987371861781120260n));
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
it('pedersenPlookupCompressFields', async () => {
|
|
22
|
-
const result = await api.pedersenPlookupCompressFields(new Fr(4n), new Fr(8n));
|
|
23
|
-
expect(result).toEqual(new Fr(1521373897829389584529155077412196627698249315427143054350987371861781120260n));
|
|
24
|
-
});
|
|
25
|
-
|
|
26
21
|
it('pedersenCompress', async () => {
|
|
27
22
|
const result = await api.pedersenCompress([new Fr(4n), new Fr(8n), new Fr(12n)]);
|
|
28
23
|
expect(result).toEqual(new Fr(16354408412011670665169322571938780771784319449166930406648760506154417354381n));
|
|
29
24
|
});
|
|
30
25
|
|
|
31
|
-
it('pedersenPlookupCompress', async () => {
|
|
32
|
-
const result = await api.pedersenPlookupCompress([new Fr(4n), new Fr(8n), new Fr(12n)]);
|
|
33
|
-
expect(result).toEqual(new Fr(16354408412011670665169322571938780771784319449166930406648760506154417354381n));
|
|
34
|
-
});
|
|
35
|
-
|
|
36
26
|
it('pedersenCompressWithHashIndex', async () => {
|
|
37
27
|
const result = await api.pedersenCompressWithHashIndex([new Fr(4n), new Fr(8n)], 7);
|
|
38
28
|
expect(result).toEqual(new Fr(2152386650411553803409271316104075950536496387580531018130718456431861859990n));
|
|
39
29
|
});
|
|
40
30
|
|
|
41
|
-
it('
|
|
42
|
-
const
|
|
43
|
-
|
|
31
|
+
it('pedersenCompressAndHashSame', async () => {
|
|
32
|
+
const resultCompress = await api.pedersenCompressWithHashIndex([new Fr(4n), new Fr(8n)], 7);
|
|
33
|
+
const resultHash = await api.pedersenHashWithHashIndex([new Fr(4n), new Fr(8n)], 7);
|
|
34
|
+
expect(resultCompress).toEqual(resultHash);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('pedersenHashWith0IndexSameAsNoIndex', async () => {
|
|
38
|
+
const resultHashImplicit0 = await api.pedersenHash([new Fr(4n), new Fr(8n)]);
|
|
39
|
+
const resultCompressImplicit0 = await api.pedersenCompress([new Fr(4n), new Fr(8n)]);
|
|
40
|
+
const resultCompressFieldsImplicit0 = await api.pedersenCompressFields(new Fr(4n), new Fr(8n));
|
|
41
|
+
const resultHashExplicit0 = await api.pedersenHashWithHashIndex([new Fr(4n), new Fr(8n)], 0);
|
|
42
|
+
expect(resultHashImplicit0).toEqual(resultCompressImplicit0);
|
|
43
|
+
expect(resultHashImplicit0).toEqual(resultHashExplicit0);
|
|
44
|
+
expect(resultHashImplicit0).toEqual(resultCompressFieldsImplicit0);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('pedersenHashPairSameAsWith0Index', async () => {
|
|
48
|
+
const resultHashPair = await api.pedersenHashPair(new Fr(4n), new Fr(8n));
|
|
49
|
+
const resultHashExplicit0 = await api.pedersenHashWithHashIndex([new Fr(4n), new Fr(8n)], 0);
|
|
50
|
+
expect(resultHashExplicit0).toEqual(resultHashPair);
|
|
44
51
|
});
|
|
45
52
|
|
|
46
|
-
it('
|
|
47
|
-
const
|
|
48
|
-
|
|
53
|
+
it('pedersenHashMultipleSameAsWith0Index', async () => {
|
|
54
|
+
const resultHashPair = await api.pedersenHashMultiple([new Fr(4n), new Fr(8n)]);
|
|
55
|
+
const resultHashExplicit0 = await api.pedersenHashWithHashIndex([new Fr(4n), new Fr(8n)], 0);
|
|
56
|
+
expect(resultHashExplicit0).toEqual(resultHashPair);
|
|
49
57
|
});
|
|
50
58
|
|
|
51
|
-
it('
|
|
52
|
-
const result = await api.
|
|
53
|
-
|
|
54
|
-
);
|
|
55
|
-
expect(result).toEqual(new Fr(5836632387256708040349959803326023895450290698906238002955147410646852307074n));
|
|
59
|
+
it('pedersenCommit', async () => {
|
|
60
|
+
const result = await api.pedersenCommit([new Fr(4n), new Fr(8n), new Fr(12n)]);
|
|
61
|
+
expect(result).toEqual(new Fr(18374309251862457296563484909553154519357910650678202211610516068880120638872n));
|
|
56
62
|
});
|
|
57
63
|
|
|
58
64
|
it('pedersenHashPair', async () => {
|