o1js-pack 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/.eslintrc.cjs +24 -0
  2. package/.gitattributes +3 -0
  3. package/.github/workflows/ci.yml +26 -0
  4. package/.husky/pre-commit +4 -0
  5. package/.prettierignore +14 -0
  6. package/.prettierrc +6 -0
  7. package/LICENSE +199 -0
  8. package/README.md +59 -0
  9. package/babel.config.cjs +3 -0
  10. package/build/src/index.d.ts +5 -0
  11. package/build/src/index.js +6 -0
  12. package/build/src/index.js.map +1 -0
  13. package/build/src/lib/PackingPlant.d.ts +92 -0
  14. package/build/src/lib/PackingPlant.js +75 -0
  15. package/build/src/lib/PackingPlant.js.map +1 -0
  16. package/build/src/lib/packed-types/PackedBool.d.ts +77 -0
  17. package/build/src/lib/packed-types/PackedBool.js +48 -0
  18. package/build/src/lib/packed-types/PackedBool.js.map +1 -0
  19. package/build/src/lib/packed-types/PackedBool.test.d.ts +1 -0
  20. package/build/src/lib/packed-types/PackedBool.test.js +76 -0
  21. package/build/src/lib/packed-types/PackedBool.test.js.map +1 -0
  22. package/build/src/lib/packed-types/PackedCharacter.d.ts +51 -0
  23. package/build/src/lib/packed-types/PackedCharacter.js +34 -0
  24. package/build/src/lib/packed-types/PackedCharacter.js.map +1 -0
  25. package/build/src/lib/packed-types/PackedCharacter.test.d.ts +1 -0
  26. package/build/src/lib/packed-types/PackedCharacter.test.js +31 -0
  27. package/build/src/lib/packed-types/PackedCharacter.test.js.map +1 -0
  28. package/build/src/lib/packed-types/PackedString.d.ts +78 -0
  29. package/build/src/lib/packed-types/PackedString.js +83 -0
  30. package/build/src/lib/packed-types/PackedString.js.map +1 -0
  31. package/build/src/lib/packed-types/PackedString.test.d.ts +1 -0
  32. package/build/src/lib/packed-types/PackedString.test.js +100 -0
  33. package/build/src/lib/packed-types/PackedString.test.js.map +1 -0
  34. package/build/src/lib/packed-types/PackedUInt32.d.ts +77 -0
  35. package/build/src/lib/packed-types/PackedUInt32.js +48 -0
  36. package/build/src/lib/packed-types/PackedUInt32.js.map +1 -0
  37. package/build/src/lib/packed-types/PackedUInt32.test.d.ts +1 -0
  38. package/build/src/lib/packed-types/PackedUInt32.test.js +84 -0
  39. package/build/src/lib/packed-types/PackedUInt32.test.js.map +1 -0
  40. package/build/src/lib/scratch.d.ts +1 -0
  41. package/build/src/lib/scratch.js +16 -0
  42. package/build/src/lib/scratch.js.map +1 -0
  43. package/build/src/packed-types/PackedBool.d.ts +51 -0
  44. package/build/src/packed-types/PackedBool.js +34 -0
  45. package/build/src/packed-types/PackedBool.js.map +1 -0
  46. package/build/src/packed-types/PackedBool.test.d.ts +1 -0
  47. package/build/src/packed-types/PackedBool.test.js +101 -0
  48. package/build/src/packed-types/PackedBool.test.js.map +1 -0
  49. package/build/src/packed-types/PackedCharacter.d.ts +51 -0
  50. package/build/src/packed-types/PackedCharacter.js +34 -0
  51. package/build/src/packed-types/PackedCharacter.js.map +1 -0
  52. package/build/src/packed-types/PackedCharacter.test.d.ts +1 -0
  53. package/build/src/packed-types/PackedCharacter.test.js +31 -0
  54. package/build/src/packed-types/PackedCharacter.test.js.map +1 -0
  55. package/build/src/packed-types/PackedUInt32.d.ts +51 -0
  56. package/build/src/packed-types/PackedUInt32.js +34 -0
  57. package/build/src/packed-types/PackedUInt32.js.map +1 -0
  58. package/build/src/packed-types/PackedUInt32.test.d.ts +1 -0
  59. package/build/src/packed-types/PackedUInt32.test.js +68 -0
  60. package/build/src/packed-types/PackedUInt32.test.js.map +1 -0
  61. package/build/src/packed-types/PackingPlant.d.ts +54 -0
  62. package/build/src/packed-types/PackingPlant.js +45 -0
  63. package/build/src/packed-types/PackingPlant.js.map +1 -0
  64. package/build/src/packed-types/scratch.d.ts +1 -0
  65. package/build/src/packed-types/scratch.js +5 -0
  66. package/build/src/packed-types/scratch.js.map +1 -0
  67. package/config.json +4 -0
  68. package/coverage/clover.xml +166 -0
  69. package/coverage/coverage-final.json +5 -0
  70. package/coverage/lcov-report/PackedBool.ts.html +268 -0
  71. package/coverage/lcov-report/PackedUInt32.ts.html +313 -0
  72. package/coverage/lcov-report/base.css +224 -0
  73. package/coverage/lcov-report/block-navigation.js +87 -0
  74. package/coverage/lcov-report/favicon.png +0 -0
  75. package/coverage/lcov-report/index.html +131 -0
  76. package/coverage/lcov-report/lib/PackingPlant.ts.html +478 -0
  77. package/coverage/lcov-report/lib/index.html +116 -0
  78. package/coverage/lcov-report/lib/packed-types/PackedBool.ts.html +238 -0
  79. package/coverage/lcov-report/lib/packed-types/PackedString.ts.html +364 -0
  80. package/coverage/lcov-report/lib/packed-types/PackedUInt32.ts.html +238 -0
  81. package/coverage/lcov-report/lib/packed-types/index.html +146 -0
  82. package/coverage/lcov-report/prettify.css +1 -0
  83. package/coverage/lcov-report/prettify.js +2 -0
  84. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  85. package/coverage/lcov-report/sorter.js +196 -0
  86. package/coverage/lcov.info +282 -0
  87. package/jest-resolver.cjs +21 -0
  88. package/jest.config.js +24 -0
  89. package/package.json +50 -0
  90. package/tsconfig.json +23 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackedBool.js","sourceRoot":"","sources":["../../../../src/lib/packed-types/PackedBool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,UAAU,iBAAiB,CAAC,CAAS;IACzC,MAAM,WAAY,SAAQ,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC;QAC3D,MAAM,CAAC,WAAW,CAAC,KAAqC;YACtD,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE;gBAC/D,IAAI,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC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D,OAAO,CAAC,CAAC;QACX,CAAC;QAED,MAAM,CAAC,aAAa,CAAC,GAAgB;YACnC,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACrC,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,CAAC,YAAY,CAAC,OAAuB;YACzC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;QAED,UAAU;YACR,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QACnE,CAAC;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,76 @@
1
+ import { Bool, Provable } from 'o1js';
2
+ import { PackedBoolFactory } from './PackedBool';
3
+ describe('PackedBool', () => {
4
+ class PackedBool extends PackedBoolFactory(254) {
5
+ }
6
+ const booleans = new Array(127).fill([true, false]).flat();
7
+ const bools = booleans.map((x) => Bool(x));
8
+ describe('Outside of the circuit', () => {
9
+ it('#fromBooleans', () => {
10
+ const myPackedBool = PackedBool.fromBooleans(booleans);
11
+ expect(myPackedBool.toBooleans()).toMatchObject(booleans);
12
+ });
13
+ it('#pack and #unPack', () => {
14
+ const packed = PackedBool.pack(bools);
15
+ const unpacked = PackedBool.unpack(packed);
16
+ expect(unpacked.length).toBe(bools.length);
17
+ expect(unpacked).toMatchObject(bools);
18
+ });
19
+ });
20
+ describe('Provable Properties', () => {
21
+ it('#sizeInFields', () => {
22
+ class one extends PackedBoolFactory(1) {
23
+ }
24
+ class two_five_four extends PackedBoolFactory(254) {
25
+ }
26
+ expect(one.sizeInFields()).toBe(1);
27
+ expect(two_five_four.sizeInFields()).toBe(1);
28
+ });
29
+ });
30
+ describe('Defensive Cases', () => {
31
+ it('throws for input >= 255 bools', () => {
32
+ expect(() => PackedBoolFactory(254)).not.toThrow();
33
+ expect(() => PackedBoolFactory(255)).toThrow();
34
+ });
35
+ it('initalizes with more input than allowed', () => {
36
+ const tooMany = [...booleans].concat(false);
37
+ expect(() => {
38
+ PackedBool.fromBooleans(tooMany);
39
+ }).toThrow();
40
+ });
41
+ it('initalizes with less input than specified', () => {
42
+ const booleans = [true, false];
43
+ const pad = new Array(252);
44
+ pad.fill(false);
45
+ const expected = booleans.concat(pad);
46
+ expect(PackedBool.fromBooleans(booleans).toBooleans()).toMatchObject(expected);
47
+ });
48
+ });
49
+ describe('In the circuit', () => {
50
+ const outsidePackedBool = PackedBool.fromBooleans(booleans);
51
+ it('Initializes', () => {
52
+ expect(() => {
53
+ Provable.runAndCheck(() => {
54
+ const packedBool = new PackedBool(outsidePackedBool.packed, outsidePackedBool.aux);
55
+ PackedBool.check({ packed: packedBool.packed });
56
+ });
57
+ }).not.toThrow();
58
+ });
59
+ it('#assertEquals', () => {
60
+ expect(() => {
61
+ Provable.runAndCheck(() => {
62
+ const packedBool = new PackedBool(outsidePackedBool.packed, outsidePackedBool.aux);
63
+ packedBool.assertEquals(outsidePackedBool);
64
+ });
65
+ }).not.toThrow();
66
+ expect(() => {
67
+ Provable.runAndCheck(() => {
68
+ const fakePacked = outsidePackedBool.packed.add(32);
69
+ const packedBool = new PackedBool(fakePacked, outsidePackedBool.aux);
70
+ packedBool.assertEquals(outsidePackedBool);
71
+ });
72
+ }).toThrow();
73
+ });
74
+ });
75
+ });
76
+ //# sourceMappingURL=PackedBool.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackedBool.test.js","sourceRoot":"","sources":["../../../../src/lib/packed-types/PackedBool.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI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iBAAiB,CAAC,CAAC;gBAC7C,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { Field, Character } from 'snarkyjs';
2
+ export declare function PackedCharacterFactory(l: number): {
3
+ new (packed: import("snarkyjs/dist/node/lib/field.js").Field, aux: Character[]): {
4
+ packed: import("snarkyjs/dist/node/lib/field.js").Field;
5
+ aux: Character[];
6
+ bitSize: bigint;
7
+ };
8
+ /**
9
+ * Unpacks a Field into its component Character parts
10
+ * @param value
11
+ * @returns the unpacked auxilliary data used to pack the value
12
+ */
13
+ toAuxiliary(value?: {
14
+ packed: Field;
15
+ } | undefined): Character[];
16
+ pack(aux: Character[]): Field;
17
+ type: import("snarkyjs/dist/node/bindings/lib/provable-snarky.js").ProvableExtended<{
18
+ packed: import("snarkyjs/dist/node/lib/field.js").Field;
19
+ }, {
20
+ packed: string;
21
+ }>;
22
+ l: number;
23
+ unpack(f: import("snarkyjs/dist/node/lib/field.js").Field): Character[];
24
+ check(value: {
25
+ packed: import("snarkyjs/dist/node/lib/field.js").Field;
26
+ }): void;
27
+ _isStruct: true;
28
+ toFields: (value: {
29
+ packed: import("snarkyjs/dist/node/lib/field.js").Field;
30
+ }) => import("snarkyjs/dist/node/lib/field.js").Field[];
31
+ fromFields: (fields: import("snarkyjs/dist/node/lib/field.js").Field[]) => {
32
+ packed: import("snarkyjs/dist/node/lib/field.js").Field;
33
+ };
34
+ sizeInFields(): number;
35
+ toInput: (x: {
36
+ packed: import("snarkyjs/dist/node/lib/field.js").Field;
37
+ }) => {
38
+ fields?: import("snarkyjs/dist/node/lib/field.js").Field[] | undefined;
39
+ packed?: [import("snarkyjs/dist/node/lib/field.js").Field, number][] | undefined;
40
+ };
41
+ toJSON: (x: {
42
+ packed: import("snarkyjs/dist/node/lib/field.js").Field;
43
+ }) => {
44
+ packed: string;
45
+ };
46
+ fromJSON: (x: {
47
+ packed: string;
48
+ }) => {
49
+ packed: import("snarkyjs/dist/node/lib/field.js").Field;
50
+ };
51
+ };
@@ -0,0 +1,34 @@
1
+ import { Field, Provable, Character } from 'snarkyjs';
2
+ import { PackingPlant } from '../PackingPlant.js';
3
+ const SIZE_IN_BITS = 16n;
4
+ export function PackedCharacterFactory(l) {
5
+ class PackedCharacter_ extends PackingPlant(Character, l, SIZE_IN_BITS) {
6
+ /**
7
+ * Unpacks a Field into its component Character parts
8
+ * @param value
9
+ * @returns the unpacked auxilliary data used to pack the value
10
+ */
11
+ static toAuxiliary(value) {
12
+ const auxiliary = Provable.witness(Provable.Array(Character, l), () => {
13
+ let uints_ = [];
14
+ let packedN = value?.packed.toBigInt() || 0n;
15
+ for (let i = 0; i < l; i++) {
16
+ uints_[i] = packedN & ((1n << SIZE_IN_BITS) - 1n);
17
+ packedN >>= SIZE_IN_BITS;
18
+ }
19
+ return uints_.map((x) => Character.fromString(String.fromCharCode(Number(x))));
20
+ });
21
+ return auxiliary;
22
+ }
23
+ static pack(aux) {
24
+ let f = Field(0);
25
+ for (let i = 0; i < l; i++) {
26
+ const c = Field((2n ** SIZE_IN_BITS) ** BigInt(i));
27
+ f = f.add(aux[i].value.mul(c));
28
+ }
29
+ return f;
30
+ }
31
+ }
32
+ return PackedCharacter_;
33
+ }
34
+ //# sourceMappingURL=PackedCharacter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackedCharacter.js","sourceRoot":"","sources":["../../../../src/lib/packed-types/PackedCharacter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,MAAM,UAAU,sBAAsB,CAAC,CAAS;IAC9C,MAAM,gBAAiB,SAAQ,YAAY,CAAC,SAAS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D,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { Character } from 'snarkyjs';
2
+ import { PackedCharacterFactory } from './PackedCharacter';
3
+ describe('PackedCharacter', () => {
4
+ it('packs and unpacks a string of length < 16', async () => {
5
+ const myString = 'This is a test!';
6
+ let myCharacters = [];
7
+ for (let i = 0; i < myString.length; i++) {
8
+ myCharacters.push(Character.fromString(myString[i]));
9
+ }
10
+ const PackedCharacter_15 = PackedCharacterFactory(15);
11
+ const packedCharacter_15 = new PackedCharacter_15(PackedCharacter_15.pack(myCharacters), myCharacters);
12
+ const f = packedCharacter_15.packed;
13
+ const unpacked = PackedCharacter_15.unpack(f);
14
+ const unpackedStr = unpacked.map((x) => x.toString()).join('');
15
+ expect(unpackedStr).toBe(myString);
16
+ });
17
+ it('is one field in size', async () => {
18
+ const myString = 'This is a test!';
19
+ let myCharacters = [];
20
+ for (let i = 0; i < myString.length; i++) {
21
+ myCharacters.push(Character.fromString(myString[i]));
22
+ }
23
+ const PackedCharacter_15 = PackedCharacterFactory(15);
24
+ expect(PackedCharacter_15.sizeInFields()).toBe(1);
25
+ });
26
+ it('throws for input >= 16 chars', () => {
27
+ expect(() => PackedCharacterFactory(15)).not.toThrow();
28
+ expect(() => PackedCharacterFactory(16)).toThrow();
29
+ });
30
+ });
31
+ //# sourceMappingURL=PackedCharacter.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackedCharacter.test.js","sourceRoot":"","sources":["../../../../src/lib/packed-types/PackedCharacter.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,QAAQ,GAAG,iBAAiB,CAAC;QACnC,IAAI,YAAY,GAAG,E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AAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACvD,MAAM,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { Field, Character } from 'o1js';
2
+ export declare function PackedStringFactory(l: number): {
3
+ new (packed: import("o1js/dist/node/lib/field.js").Field[], aux: Character[]): {
4
+ toString(): string;
5
+ packed: import("o1js/dist/node/lib/field.js").Field[];
6
+ aux: Character[];
7
+ bitSize: bigint;
8
+ assertEquals(other: {
9
+ packed: import("o1js/dist/node/lib/field.js").Field[];
10
+ aux: Character[];
11
+ bitSize: bigint;
12
+ assertEquals(other: any): void;
13
+ }): void;
14
+ };
15
+ toAuxiliary(value?: {
16
+ packed: Array<Field>;
17
+ } | undefined): Character[];
18
+ pack(aux: Character[]): Array<Field>;
19
+ fromString(str: string): {
20
+ toString(): string;
21
+ packed: import("o1js/dist/node/lib/field.js").Field[];
22
+ aux: Character[];
23
+ bitSize: bigint;
24
+ assertEquals(other: {
25
+ packed: import("o1js/dist/node/lib/field.js").Field[];
26
+ aux: Character[];
27
+ bitSize: bigint;
28
+ assertEquals(other: any): void;
29
+ }): void;
30
+ };
31
+ fromAuxiliary(aux: Array<Character>): {
32
+ toString(): string;
33
+ packed: import("o1js/dist/node/lib/field.js").Field[];
34
+ aux: Character[];
35
+ bitSize: bigint;
36
+ assertEquals(other: {
37
+ packed: import("o1js/dist/node/lib/field.js").Field[];
38
+ aux: Character[];
39
+ bitSize: bigint;
40
+ assertEquals(other: any): void;
41
+ }): void;
42
+ };
43
+ type: import("o1js/dist/node/bindings/lib/provable-snarky.js").ProvableExtended<{
44
+ packed: import("o1js/dist/node/lib/field.js").Field[];
45
+ }, {
46
+ packed: string[];
47
+ }>;
48
+ l: number;
49
+ n: number;
50
+ unpack(fields: import("o1js/dist/node/lib/field.js").Field[]): Character[];
51
+ _isStruct: true;
52
+ toFields: (value: {
53
+ packed: import("o1js/dist/node/lib/field.js").Field[];
54
+ }) => import("o1js/dist/node/lib/field.js").Field[];
55
+ fromFields: (fields: import("o1js/dist/node/lib/field.js").Field[]) => {
56
+ packed: import("o1js/dist/node/lib/field.js").Field[];
57
+ };
58
+ sizeInFields(): number;
59
+ check: (value: {
60
+ packed: import("o1js/dist/node/lib/field.js").Field[];
61
+ }) => void;
62
+ toInput: (x: {
63
+ packed: import("o1js/dist/node/lib/field.js").Field[];
64
+ }) => {
65
+ fields?: import("o1js/dist/node/lib/field.js").Field[] | undefined;
66
+ packed?: [import("o1js/dist/node/lib/field.js").Field, number][] | undefined;
67
+ };
68
+ toJSON: (x: {
69
+ packed: import("o1js/dist/node/lib/field.js").Field[];
70
+ }) => {
71
+ packed: string[];
72
+ };
73
+ fromJSON: (x: {
74
+ packed: string[];
75
+ }) => {
76
+ packed: import("o1js/dist/node/lib/field.js").Field[];
77
+ };
78
+ };
@@ -0,0 +1,83 @@
1
+ import { Field, Provable, Character } from 'o1js';
2
+ import { MultiPackingPlant } from '../PackingPlant.js';
3
+ const SIZE_IN_BITS = 16n;
4
+ const CHARS_PER_FIELD = 15;
5
+ export function PackedStringFactory(l) {
6
+ class PackedString_ extends MultiPackingPlant(Character, l, SIZE_IN_BITS) {
7
+ static toAuxiliary(value) {
8
+ const auxiliary = Provable.witness(Provable.Array(Character, l), () => {
9
+ let uints_ = new Array(l);
10
+ uints_.fill(0n);
11
+ let packedNs = new Array(this.n);
12
+ packedNs.fill(0n);
13
+ const packedArg = new Array(this.n);
14
+ packedArg.fill(Field(0), 0, this.n);
15
+ for (let i = 0; i < this.n; i++) {
16
+ if (value?.packed[i]) {
17
+ packedArg[i] = value?.packed[i];
18
+ }
19
+ }
20
+ if (packedArg.length !== this.n) {
21
+ throw new Error(`Packed value must be exactly ${this.n} in length`);
22
+ }
23
+ for (let i = 0; i < this.n; i++) {
24
+ packedNs[i] = packedArg[i].toConstant().toBigInt();
25
+ }
26
+ for (let i = 0; i < packedNs.length; i++) {
27
+ let packedN = packedNs[i];
28
+ for (let j = 0; j < CHARS_PER_FIELD; j++) {
29
+ const k = i * CHARS_PER_FIELD + j;
30
+ uints_[k] = packedN & ((1n << SIZE_IN_BITS) - 1n);
31
+ packedN >>= SIZE_IN_BITS;
32
+ }
33
+ }
34
+ return uints_.map((x) => Character.fromString(String.fromCharCode(Number(x))));
35
+ });
36
+ return auxiliary;
37
+ }
38
+ static pack(aux) {
39
+ let fields = [];
40
+ let mutableAux = [...aux];
41
+ while (mutableAux.length > 0) {
42
+ const initialChar = mutableAux.shift();
43
+ if (!initialChar) {
44
+ throw new Error('Unexpected Array Length');
45
+ }
46
+ // f = initialChar.value is the same as f = 0; f += char.value * c^0;
47
+ // If f is initialized as 0, then it is a "constant" field and can't be added to a "variable" field in a proof
48
+ let f = initialChar.value;
49
+ const n = Math.min(mutableAux.length + 1, CHARS_PER_FIELD);
50
+ for (let i = 1; i < n; i++) {
51
+ const char = mutableAux.shift();
52
+ if (!char) {
53
+ throw new Error('Unexpected Array Length');
54
+ }
55
+ const value = char.value || Field(0);
56
+ const c = Field((2n ** SIZE_IN_BITS) ** BigInt(i));
57
+ f = f.add(value.mul(c));
58
+ }
59
+ fields.push(f);
60
+ }
61
+ return fields;
62
+ }
63
+ static fromString(str) {
64
+ let characters = [];
65
+ for (let i = 0; i < str.length; i++) {
66
+ characters.push(Character.fromString(str[i]));
67
+ }
68
+ return this.fromAuxiliary(characters);
69
+ }
70
+ static fromAuxiliary(aux) {
71
+ const packed = this.pack(aux);
72
+ return new PackedString_(packed, aux);
73
+ }
74
+ toString() {
75
+ const nullChar = String.fromCharCode(0);
76
+ return PackedString_.unpack(this.packed)
77
+ .filter((c) => c.toString() !== nullChar)
78
+ .join('');
79
+ }
80
+ }
81
+ return PackedString_;
82
+ }
83
+ //# sourceMappingURL=PackedString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackedString.js","sourceRoot":"","sources":["../../../../src/lib/packed-types/PackedString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,MAAM,UAAU,mBAAmB,CAAC,CAAS;IAC3C,MAAM,aAAc,SAAQ,iBAAiB,CAAC,SAAS,EAAE,CAAC,EAAE,YAAY,CAAC;QACvE,MAAM,CAAC,WAAW,CAChB,KAA4C;YAE5C,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE;gBACpE,IAAI,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC1B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAChB,IAAI,QAAQ,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAClB,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;gBACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;oBAC/B,IAAI,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE;wBACpB,SAAS,CAAC,CAAC,CAAC,GAAG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AAC,CAAC;aAC/C;YAED,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,CAAC,aAAa,CAAC,GAAqB;YACxC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC9B,OAAO,IAAI,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACxC,CAAC;QAED,QAAQ;YACN,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACxC,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;iBACrC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC;iBACxC,IAAI,CAAC,EAAE,CAAC,CAAC;QACd,CAAC;KACF;IACD,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,100 @@
1
+ import { Character, Provable } from 'o1js';
2
+ import { PackedStringFactory } from './PackedString';
3
+ describe('PackedString', () => {
4
+ describe('Outside of the Circuit', () => {
5
+ const vitalik_dot_eth = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045';
6
+ class EthAddressString extends PackedStringFactory(42) {
7
+ }
8
+ let characters = [];
9
+ beforeEach(() => {
10
+ characters = [];
11
+ for (let i = 0; i < vitalik_dot_eth.length; i++) {
12
+ characters.push(Character.fromString(vitalik_dot_eth[i]));
13
+ }
14
+ });
15
+ it('#fromString', () => {
16
+ const myEthAddress = EthAddressString.fromString(vitalik_dot_eth);
17
+ expect(myEthAddress.toString()).toBe(vitalik_dot_eth);
18
+ });
19
+ it('#fromAuxilliary', () => {
20
+ const myEthAddress = EthAddressString.fromAuxiliary(characters);
21
+ expect(myEthAddress.toString()).toBe(vitalik_dot_eth);
22
+ });
23
+ it('#pack and #unPack', () => {
24
+ const packed = EthAddressString.pack(characters);
25
+ const unpacked = EthAddressString.unpack(packed);
26
+ expect(packed.length).toBe(Math.ceil(vitalik_dot_eth.length / 15));
27
+ expect(unpacked.length).toBe(vitalik_dot_eth.length);
28
+ expect(unpacked.toString()).toBe(characters.toString());
29
+ });
30
+ });
31
+ describe('Provable Properties', () => {
32
+ it('#sizeInFields', () => {
33
+ class one extends PackedStringFactory(15) {
34
+ }
35
+ class two extends PackedStringFactory(16) {
36
+ }
37
+ class three extends PackedStringFactory(40) {
38
+ }
39
+ expect(one.sizeInFields()).toBe(1);
40
+ expect(two.sizeInFields()).toBe(2);
41
+ expect(three.sizeInFields()).toBe(3);
42
+ });
43
+ });
44
+ describe('Defensive Cases', () => {
45
+ it('Initializes a class with fewer than allowed characters', () => {
46
+ class String10 extends PackedStringFactory(10) {
47
+ }
48
+ const string0 = String10.fromString('');
49
+ const string2 = String10.fromString('ab');
50
+ expect(string0.toString()).toBe('');
51
+ expect(string2.toString()).toBe('ab');
52
+ });
53
+ it('Initializes a class with more than allowed characters', () => {
54
+ class String10 extends PackedStringFactory(10) {
55
+ }
56
+ expect(() => {
57
+ const string11 = String10.fromString('abcdefghijk');
58
+ }).toThrow();
59
+ });
60
+ it('Exceeds maximum size string', () => {
61
+ const tooLong = 'too long!'.repeat(20);
62
+ class MaxString extends PackedStringFactory(120) {
63
+ }
64
+ expect(() => {
65
+ MaxString.fromString(tooLong);
66
+ }).toThrow();
67
+ });
68
+ });
69
+ describe('In the circuit', () => {
70
+ const vitalik_dot_eth = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045';
71
+ class EthAddressString extends PackedStringFactory(42) {
72
+ }
73
+ const outsideEthAddress = EthAddressString.fromString(vitalik_dot_eth);
74
+ it('Initializes a string', () => {
75
+ expect(() => {
76
+ Provable.runAndCheck(() => {
77
+ const myEthAddress = new EthAddressString(outsideEthAddress.packed, outsideEthAddress.aux);
78
+ EthAddressString.check({ packed: myEthAddress.packed });
79
+ });
80
+ }).not.toThrow();
81
+ });
82
+ it('#assertEquals', () => {
83
+ expect(() => {
84
+ Provable.runAndCheck(() => {
85
+ const myEthAddress = new EthAddressString(outsideEthAddress.packed, outsideEthAddress.aux);
86
+ myEthAddress.assertEquals(outsideEthAddress);
87
+ });
88
+ }).not.toThrow();
89
+ expect(() => {
90
+ Provable.runAndCheck(() => {
91
+ const fakePacked = [...outsideEthAddress.packed];
92
+ fakePacked[0] = fakePacked[0].add(1);
93
+ const myEthAddress = new EthAddressString(fakePacked, outsideEthAddress.aux);
94
+ myEthAddress.assertEquals(outsideEthAddress);
95
+ });
96
+ }).toThrow();
97
+ });
98
+ });
99
+ });
100
+ //# sourceMappingURL=PackedString.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackedString.test.js","sourceRoot":"","sources":["../../../../src/lib/packed-types/PackedString.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,QAAQ,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,MAAM,eAAe,GAAG,4CAA4C,CAAC;QACrE,MAAM,gBAAiB,SAAQ,mBAAmB,CAAC,EAAE,CAAC;SAAG;QACzD,IAAI,UAAU,GAAqB,EAAE,CAAC;QAEtC,UAAU,CAAC,GAAG,EAAE;YACd,UAAU,GAAG,EAAE,CAAC;YAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;YACrB,MAAM,YAAY,GAAG,gBAAgB,CAAC,UAAU,CAAC,eAAe,C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,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBACrC,MAAM,YAAY,GAAG,IAAI,gBAAgB,CACvC,UAAU,EACV,iBAAiB,CAAC,GAAG,CACtB,CAAC;oBAEF,YAAY,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { Field, UInt32 } from 'o1js';
2
+ export declare function PackedUInt32Factory(l: number): {
3
+ new (packed: import("o1js/dist/node/lib/field.js").Field, aux: UInt32[]): {
4
+ toBigInts(): Array<bigint>;
5
+ packed: import("o1js/dist/node/lib/field.js").Field;
6
+ aux: UInt32[];
7
+ bitSize: bigint;
8
+ assertEquals(other: {
9
+ packed: import("o1js/dist/node/lib/field.js").Field;
10
+ aux: UInt32[];
11
+ bitSize: bigint;
12
+ assertEquals(other: any): void;
13
+ }): void;
14
+ };
15
+ toAuxiliary(value?: {
16
+ packed: Field;
17
+ } | undefined): Array<UInt32>;
18
+ pack(aux: Array<UInt32>): Field;
19
+ fromAuxiliary(aux: Array<UInt32>): {
20
+ toBigInts(): Array<bigint>;
21
+ packed: import("o1js/dist/node/lib/field.js").Field;
22
+ aux: UInt32[];
23
+ bitSize: bigint;
24
+ assertEquals(other: {
25
+ packed: import("o1js/dist/node/lib/field.js").Field;
26
+ aux: UInt32[];
27
+ bitSize: bigint;
28
+ assertEquals(other: any): void;
29
+ }): void;
30
+ };
31
+ fromBigInts(bigints: Array<bigint>): {
32
+ toBigInts(): Array<bigint>;
33
+ packed: import("o1js/dist/node/lib/field.js").Field;
34
+ aux: UInt32[];
35
+ bitSize: bigint;
36
+ assertEquals(other: {
37
+ packed: import("o1js/dist/node/lib/field.js").Field;
38
+ aux: UInt32[];
39
+ bitSize: bigint;
40
+ assertEquals(other: any): void;
41
+ }): void;
42
+ };
43
+ type: import("o1js/dist/node/bindings/lib/provable-snarky.js").ProvableExtended<{
44
+ packed: import("o1js/dist/node/lib/field.js").Field;
45
+ }, {
46
+ packed: string;
47
+ }>;
48
+ l: number;
49
+ unpack(f: import("o1js/dist/node/lib/field.js").Field): UInt32[];
50
+ _isStruct: true;
51
+ toFields: (value: {
52
+ packed: import("o1js/dist/node/lib/field.js").Field;
53
+ }) => import("o1js/dist/node/lib/field.js").Field[];
54
+ fromFields: (fields: import("o1js/dist/node/lib/field.js").Field[]) => {
55
+ packed: import("o1js/dist/node/lib/field.js").Field;
56
+ };
57
+ sizeInFields(): number;
58
+ check: (value: {
59
+ packed: import("o1js/dist/node/lib/field.js").Field;
60
+ }) => void;
61
+ toInput: (x: {
62
+ packed: import("o1js/dist/node/lib/field.js").Field;
63
+ }) => {
64
+ fields?: import("o1js/dist/node/lib/field.js").Field[] | undefined;
65
+ packed?: [import("o1js/dist/node/lib/field.js").Field, number][] | undefined;
66
+ };
67
+ toJSON: (x: {
68
+ packed: import("o1js/dist/node/lib/field.js").Field;
69
+ }) => {
70
+ packed: string;
71
+ };
72
+ fromJSON: (x: {
73
+ packed: string;
74
+ }) => {
75
+ packed: import("o1js/dist/node/lib/field.js").Field;
76
+ };
77
+ };
@@ -0,0 +1,48 @@
1
+ import { Field, Provable, UInt32 } from 'o1js';
2
+ import { PackingPlant } from '../PackingPlant.js';
3
+ const SIZE_IN_BITS = 32n;
4
+ export function PackedUInt32Factory(l) {
5
+ class PackedUInt32_ extends PackingPlant(UInt32, l, SIZE_IN_BITS) {
6
+ static toAuxiliary(value) {
7
+ const auxiliary = Provable.witness(Provable.Array(UInt32, l), () => {
8
+ let uints_ = new Array(l);
9
+ uints_.fill(0n);
10
+ let packedN;
11
+ if (value && value.packed) {
12
+ packedN = value.packed.toBigInt();
13
+ }
14
+ else {
15
+ throw new Error('No Packed Value Provided');
16
+ }
17
+ for (let i = 0; i < l; i++) {
18
+ uints_[i] = packedN & ((1n << SIZE_IN_BITS) - 1n);
19
+ packedN >>= SIZE_IN_BITS;
20
+ }
21
+ return uints_.map((x) => UInt32.from(x));
22
+ });
23
+ return auxiliary;
24
+ }
25
+ static pack(aux) {
26
+ let f = aux[0].value;
27
+ const n = Math.min(aux.length, l);
28
+ for (let i = 1; i < n; i++) {
29
+ const c = Field((2n ** SIZE_IN_BITS) ** BigInt(i));
30
+ f = f.add(aux[i].value.mul(c));
31
+ }
32
+ return f;
33
+ }
34
+ static fromAuxiliary(aux) {
35
+ const packed = PackedUInt32_.pack(aux);
36
+ return new PackedUInt32_(packed, aux);
37
+ }
38
+ static fromBigInts(bigints) {
39
+ const uint32s = bigints.map((x) => UInt32.from(x));
40
+ return this.fromAuxiliary(uint32s);
41
+ }
42
+ toBigInts() {
43
+ return PackedUInt32_.unpack(this.packed).map((x) => x.toBigint());
44
+ }
45
+ }
46
+ return PackedUInt32_;
47
+ }
48
+ //# sourceMappingURL=PackedUInt32.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackedUInt32.js","sourceRoot":"","sources":["../../../../src/lib/packed-types/PackedUInt32.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,MAAM,UAAU,mBAAmB,CAAC,CAAS;IAC3C,MAAM,aAAc,SAAQ,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,YAAY,CAAC;QAC/D,MAAM,CAAC,WAAW,CAAC,KAAqC;YACtD,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE;gBACjE,IAAI,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;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