o1js-pack 0.4.0 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/README.md +14 -29
  2. package/build/src/index.d.ts +2 -2
  3. package/build/src/index.js +2 -2
  4. package/build/src/index.js.map +1 -1
  5. package/build/src/lib/PackingPlant.d.ts +4 -12
  6. package/build/src/lib/PackingPlant.js +11 -12
  7. package/build/src/lib/PackingPlant.js.map +1 -1
  8. package/build/src/lib/packed-types/PackedBool.d.ts +1 -6
  9. package/build/src/lib/packed-types/PackedBool.js +1 -0
  10. package/build/src/lib/packed-types/PackedBool.js.map +1 -1
  11. package/build/src/lib/packed-types/PackedString.d.ts +96 -7
  12. package/build/src/lib/packed-types/PackedString.js +78 -10
  13. package/build/src/lib/packed-types/PackedString.js.map +1 -1
  14. package/build/src/lib/packed-types/PackedString.test.js +11 -10
  15. package/build/src/lib/packed-types/PackedString.test.js.map +1 -1
  16. package/build/src/lib/packed-types/PackedUInt32.d.ts +1 -6
  17. package/build/src/lib/packed-types/PackedUInt32.js +1 -0
  18. package/build/src/lib/packed-types/PackedUInt32.js.map +1 -1
  19. package/examples/smart_contract/election/README.md +3 -0
  20. package/examples/smart_contract/election/contract.ts +79 -0
  21. package/examples/smart_contract/election/run.ts +98 -0
  22. package/examples/zk_program/age_gate/README.md +7 -0
  23. package/examples/zk_program/age_gate/circuit.ts +75 -0
  24. package/examples/zk_program/age_gate/non-packed-circuit.ts +68 -0
  25. package/examples/zk_program/age_gate/non-packed-run.ts +36 -0
  26. package/examples/zk_program/age_gate/run.ts +35 -0
  27. package/package.json +1 -1
  28. package/tests/provable/end_to_end.test.ts +2 -4
  29. package/tests/provable/example_packed_string_circuit.ts +3 -8
  30. package/tests/provable/example_packed_uint_circuit.ts +6 -12
  31. package/build/src/lib/packed-types/PackedCharacter.d.ts +0 -51
  32. package/build/src/lib/packed-types/PackedCharacter.js +0 -34
  33. package/build/src/lib/packed-types/PackedCharacter.js.map +0 -1
  34. package/build/src/lib/packed-types/PackedCharacter.test.d.ts +0 -1
  35. package/build/src/lib/packed-types/PackedCharacter.test.js +0 -31
  36. package/build/src/lib/packed-types/PackedCharacter.test.js.map +0 -1
  37. package/build/src/lib/scratch.d.ts +0 -1
  38. package/build/src/lib/scratch.js +0 -16
  39. package/build/src/lib/scratch.js.map +0 -1
  40. package/build/src/packed-types/PackedBool.d.ts +0 -51
  41. package/build/src/packed-types/PackedBool.js +0 -34
  42. package/build/src/packed-types/PackedBool.js.map +0 -1
  43. package/build/src/packed-types/PackedBool.test.d.ts +0 -1
  44. package/build/src/packed-types/PackedBool.test.js +0 -101
  45. package/build/src/packed-types/PackedBool.test.js.map +0 -1
  46. package/build/src/packed-types/PackedCharacter.d.ts +0 -51
  47. package/build/src/packed-types/PackedCharacter.js +0 -34
  48. package/build/src/packed-types/PackedCharacter.js.map +0 -1
  49. package/build/src/packed-types/PackedCharacter.test.d.ts +0 -1
  50. package/build/src/packed-types/PackedCharacter.test.js +0 -31
  51. package/build/src/packed-types/PackedCharacter.test.js.map +0 -1
  52. package/build/src/packed-types/PackedUInt32.d.ts +0 -51
  53. package/build/src/packed-types/PackedUInt32.js +0 -34
  54. package/build/src/packed-types/PackedUInt32.js.map +0 -1
  55. package/build/src/packed-types/PackedUInt32.test.d.ts +0 -1
  56. package/build/src/packed-types/PackedUInt32.test.js +0 -68
  57. package/build/src/packed-types/PackedUInt32.test.js.map +0 -1
  58. package/build/src/packed-types/PackingPlant.d.ts +0 -54
  59. package/build/src/packed-types/PackingPlant.js +0 -45
  60. package/build/src/packed-types/PackingPlant.js.map +0 -1
  61. package/build/src/packed-types/scratch.d.ts +0 -1
  62. package/build/src/packed-types/scratch.js +0 -5
  63. package/build/src/packed-types/scratch.js.map +0 -1
  64. package/coverage/clover.xml +0 -166
  65. package/coverage/coverage-final.json +0 -5
  66. package/coverage/lcov-report/PackedBool.ts.html +0 -268
  67. package/coverage/lcov-report/PackedUInt32.ts.html +0 -313
  68. package/coverage/lcov-report/base.css +0 -224
  69. package/coverage/lcov-report/block-navigation.js +0 -87
  70. package/coverage/lcov-report/favicon.png +0 -0
  71. package/coverage/lcov-report/index.html +0 -131
  72. package/coverage/lcov-report/lib/PackingPlant.ts.html +0 -478
  73. package/coverage/lcov-report/lib/index.html +0 -116
  74. package/coverage/lcov-report/lib/packed-types/PackedBool.ts.html +0 -238
  75. package/coverage/lcov-report/lib/packed-types/PackedString.ts.html +0 -364
  76. package/coverage/lcov-report/lib/packed-types/PackedUInt32.ts.html +0 -238
  77. package/coverage/lcov-report/lib/packed-types/index.html +0 -146
  78. package/coverage/lcov-report/prettify.css +0 -1
  79. package/coverage/lcov-report/prettify.js +0 -2
  80. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  81. package/coverage/lcov-report/sorter.js +0 -196
  82. package/coverage/lcov.info +0 -282
package/README.md CHANGED
@@ -1,33 +1,24 @@
1
- # O1JS Pack
1
+ # o1js Pack
2
2
 
3
- Make the most of your ZKApp state!
3
+ Make the most of your zkApp state!
4
4
 
5
5
  ## What is it
6
6
 
7
- O1JS Pack is a library for [O1JS](https://github.com/o1-labs/o1js/) that allows a zkapp developer to pack extra data into a single Field.
7
+ o1js Pack is a library for [o1js](https://github.com/o1-labs/o1js/) that allows a zkApp developer to pack extra data into a single Field.
8
8
 
9
- ### Usage in a ZKApp
9
+ ### Usage in a zkApp
10
10
 
11
- ```
12
- import {
13
- PackedBoolFactory,
14
- PackedStringFactory,
15
- PackedUInt32Factory,
16
- } from 'o1js-pack';
17
-
18
- const MyPackedBools = PackedBoolFactory(); // Max of 254 Bools
19
- const MyPackedString = PackedStringFactory(); // Max of 120 Characters
20
- const MyPackedUInts = PackedUInt32Factory(); // Max of 7 UInt32s
21
-
22
- const sevenUints = [1, 2, 3, 4, 5, 6, 7].map(x => UInt32.from(x));
23
- const myPackedUInts = new MyPackedUInts(MyPackedUInts.pack(sevenUints), sevenUints);
24
- ```
11
+ ### Smart Contract
12
+
13
+ The primary benefit of using this library in a smart contract is that it allows you to use more of your allotted 8 Fields of storage.
14
+
15
+ Check out example usage in a smart contract in [Smart Contract Examples](/examples/smart_contract/).
25
16
 
26
- ## What's the catch?
17
+ ### ZK Program
27
18
 
28
- If a zkapp has two or more independent Fields of state, then preconditions can be set on just one, or on any combination of the Fields. With SnarkyPack, one precondition will be set on the packed Field, which means that independent updates cannot happen asynchronously.
19
+ The benefit to using this library in a zk program is less obvious. In some cases, the number of gates required in a circuit is less using this library than with provable arrays. Especially in applications where the array is hashed many times, packing and unpacking ends up being more effecient than doing a lot of Poseidon hashes. In other cases, you may just prefer the API of o1js Pack compared to using provable arrays.
29
20
 
30
- For example, let's say there is a voting app with two independent Fields of state: `yesCount` and `noCount`. If one user issues an update to `yesCount` and another user issues an update to `noCount` at the same time, both proofs may be valid at the same time. Both transactions may succeed during the same block, since they don't interfere with each others' preconditions. With SnarkyPack, a devolper can save state by putting both `yesCount` and `noCount` into the same Field of state, making room for other state to exist on chain. The tradeoff is that two votes will no longer be able to be cast independently. `yesCount` and `noCount` depend on the same precontition, meaning that to update one or the other, you must lock both.
21
+ Check out example usage in a zk program in [Zk Program Examples](/examples/zk_program/).
31
22
 
32
23
  ## How to build
33
24
 
@@ -39,18 +30,12 @@ npm run build
39
30
 
40
31
  ```sh
41
32
  npm run test src # non-proof tests
42
- npm run testw # watch mode
43
- ```
44
-
45
- ## How to run coverage
46
-
47
- ```sh
48
- npm run coverage
33
+ npm run test tests/provable # provable tests
49
34
  ```
50
35
 
51
36
  ## Credits
52
37
 
53
- Thanks to @mario_zito for seeding the idea for this library on discord ([Thread 1](https://discord.com/channels/484437221055922177/1128509274465779822), [Thread 2](https://discord.com/channels/484437221055922177/1128501705173106698)), and to @gregor for sounding out the early implementation.
38
+ Thanks to @mario_zito for seeding the idea for this library on Discord ([Thread 1](https://discord.com/channels/484437221055922177/1128509274465779822), [Thread 2](https://discord.com/channels/484437221055922177/1128501705173106698)), and to @gregor for sounding out the early implementation.
54
39
 
55
40
  Thanks to @iam-dev for early adoption!
56
41
 
@@ -1,5 +1,5 @@
1
1
  import { PackedBoolFactory } from './lib/packed-types/PackedBool.js';
2
2
  import { PackedUInt32Factory } from './lib/packed-types/PackedUInt32.js';
3
3
  import { PackingPlant, MultiPackingPlant } from './lib/PackingPlant.js';
4
- import { PackedStringFactory } from './lib/packed-types/PackedString.js';
5
- export { PackedBoolFactory, PackedStringFactory, PackedUInt32Factory, PackingPlant, MultiPackingPlant, };
4
+ import { PackedStringFactory, MultiPackedStringFactory } from './lib/packed-types/PackedString.js';
5
+ export { PackedBoolFactory, PackedStringFactory, MultiPackedStringFactory, PackedUInt32Factory, PackingPlant, MultiPackingPlant, };
@@ -1,6 +1,6 @@
1
1
  import { PackedBoolFactory } from './lib/packed-types/PackedBool.js';
2
2
  import { PackedUInt32Factory } from './lib/packed-types/PackedUInt32.js';
3
3
  import { PackingPlant, MultiPackingPlant } from './lib/PackingPlant.js';
4
- import { PackedStringFactory } from './lib/packed-types/PackedString.js';
5
- export { PackedBoolFactory, PackedStringFactory, PackedUInt32Factory, PackingPlant, MultiPackingPlant, };
4
+ import { PackedStringFactory, MultiPackedStringFactory, } from './lib/packed-types/PackedString.js';
5
+ export { PackedBoolFactory, PackedStringFactory, MultiPackedStringFactory, PackedUInt32Factory, PackingPlant, MultiPackingPlant, };
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,GAClB,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { Field, InferProvable } from 'o1js';
2
2
  export declare function PackingPlant<A, T extends InferProvable<A> = InferProvable<A>>(elementType: A, l: number, bitSize: bigint): (abstract new (packed: Field) => {
3
- bitSize: bigint;
4
3
  assertEquals(other: any): void;
5
4
  packed: import("o1js/dist/node/lib/field").Field;
6
5
  }) & {
@@ -10,6 +9,7 @@ export declare function PackingPlant<A, T extends InferProvable<A> = InferProvab
10
9
  packed: string;
11
10
  }>;
12
11
  l: number;
12
+ bitSize: bigint;
13
13
  extractField(input: T): Field;
14
14
  sizeInBits(): bigint;
15
15
  unpack(f: Field): Array<T>;
@@ -31,11 +31,7 @@ export declare function PackingPlant<A, T extends InferProvable<A> = InferProvab
31
31
  * @returns Array of bigints, which can be decoded by the implementing class into the final type
32
32
  */
33
33
  unpackToBigints(f: Field): Array<bigint>;
34
- _isStruct: true; /**
35
- *
36
- * @param fields Array of Fields, packed such that each Field has as much information as possible, as returned in #pack
37
- * @returns Array of bigints, which can be decoded by the implementing class into the final type
38
- */
34
+ _isStruct: true;
39
35
  toFields: (value: {
40
36
  packed: import("o1js/dist/node/lib/field").Field;
41
37
  }) => import("o1js/dist/node/lib/field").Field[];
@@ -67,7 +63,6 @@ export declare function PackingPlant<A, T extends InferProvable<A> = InferProvab
67
63
  };
68
64
  };
69
65
  export declare function MultiPackingPlant<A, T extends InferProvable<A> = InferProvable<A>>(elementType: A, l: number, bitSize: bigint): (abstract new (packed: Array<Field>) => {
70
- bitSize: bigint;
71
66
  assertEquals(other: any): void;
72
67
  packed: import("o1js/dist/node/lib/field").Field[];
73
68
  }) & {
@@ -78,6 +73,7 @@ export declare function MultiPackingPlant<A, T extends InferProvable<A> = InferP
78
73
  }>;
79
74
  l: number;
80
75
  n: number;
76
+ bitSize: bigint;
81
77
  extractField(input: T | undefined): Field;
82
78
  sizeInBits(): bigint;
83
79
  elementsPerField(): number;
@@ -103,11 +99,7 @@ export declare function MultiPackingPlant<A, T extends InferProvable<A> = InferP
103
99
  * @returns Array of bigints, which can be decoded by the implementing class into the final type
104
100
  */
105
101
  unpackToBigints(fields: Array<Field>): Array<bigint>;
106
- _isStruct: true; /**
107
- *
108
- * @param fields Array of Fields, packed such that each Field has as much information as possible, as returned in #pack
109
- * @returns Array of bigints, which can be decoded by the implementing class into the final type
110
- */
102
+ _isStruct: true;
111
103
  toFields: (value: {
112
104
  packed: import("o1js/dist/node/lib/field").Field[];
113
105
  }) => import("o1js/dist/node/lib/field").Field[];
@@ -9,7 +9,6 @@ export function PackingPlant(elementType, l, bitSize) {
9
9
  }) {
10
10
  constructor(packed) {
11
11
  super({ packed });
12
- this.bitSize = bitSize;
13
12
  }
14
13
  // Must implement these in type-specific implementation
15
14
  static extractField(input) {
@@ -74,6 +73,7 @@ export function PackingPlant(elementType, l, bitSize) {
74
73
  }
75
74
  Packed_.type = provable({ packed: Field }, {});
76
75
  Packed_.l = l;
76
+ Packed_.bitSize = bitSize;
77
77
  return Packed_;
78
78
  }
79
79
  export function MultiPackingPlant(elementType, l, bitSize) {
@@ -86,7 +86,6 @@ export function MultiPackingPlant(elementType, l, bitSize) {
86
86
  }) {
87
87
  constructor(packed) {
88
88
  super({ packed });
89
- this.bitSize = bitSize;
90
89
  }
91
90
  // Must implement these in type-specific implementation
92
91
  static extractField(input) {
@@ -108,7 +107,7 @@ export function MultiPackingPlant(elementType, l, bitSize) {
108
107
  * @throws if the length of the array is longer than the length of the implementing factory config
109
108
  */
110
109
  static checkPack(unpacked) {
111
- if (unpacked.length > l) {
110
+ if (unpacked.length > this.l) {
112
111
  throw new Error(`Input of size ${unpacked.length} is larger than expected size of ${l}`);
113
112
  }
114
113
  }
@@ -122,23 +121,22 @@ export function MultiPackingPlant(elementType, l, bitSize) {
122
121
  */
123
122
  static pack(unpacked) {
124
123
  this.checkPack(unpacked);
124
+ const q = this.elementsPerField();
125
125
  let fields = [];
126
126
  let mutableUnpacked = [...unpacked];
127
- while (mutableUnpacked.length > 0) {
128
- let f = this.extractField(mutableUnpacked.shift());
127
+ for (let i = 0; i < this.n; i++) {
128
+ let f = this.extractField(mutableUnpacked[i * q]);
129
129
  if (!f) {
130
130
  throw new Error('Unexpected Array Length');
131
131
  }
132
- // f = f.value is the same as f = 0; f += char.value * c^0;
133
- // If f is initialized as 0, then it is a "constant" field and can't be added to a "variable" field in a proof
134
- const n = Math.min(mutableUnpacked.length + 1, this.elementsPerField());
135
- for (let i = 1; i < n; i++) {
136
- let value = this.extractField(mutableUnpacked.shift());
132
+ for (let j = 1; j < q; j++) {
133
+ const idx = i * q + j;
134
+ let value = this.extractField(mutableUnpacked[idx]);
137
135
  if (!value) {
138
136
  throw new Error('Unexpected Array Length');
139
137
  }
140
138
  value = value || Field(0);
141
- const c = Field((2n ** this.sizeInBits()) ** BigInt(i));
139
+ const c = Field((2n ** this.sizeInBits()) ** BigInt(j));
142
140
  f = f.add(value.mul(c));
143
141
  }
144
142
  fields.push(f);
@@ -151,7 +149,7 @@ export function MultiPackingPlant(elementType, l, bitSize) {
151
149
  * @returns Array of bigints, which can be decoded by the implementing class into the final type
152
150
  */
153
151
  static unpackToBigints(fields) {
154
- let uints_ = new Array(l);
152
+ let uints_ = new Array(this.l); // array length is number of elements per field * number of fields
155
153
  uints_.fill(0n);
156
154
  let packedNs = new Array(this.n);
157
155
  packedNs.fill(0n);
@@ -187,6 +185,7 @@ export function MultiPackingPlant(elementType, l, bitSize) {
187
185
  Packed_.type = provable({ packed: Provable.Array(Field, n) }, {});
188
186
  Packed_.l = l;
189
187
  Packed_.n = n;
188
+ Packed_.bitSize = bitSize;
190
189
  return Packed_;
191
190
  }
192
191
  //# sourceMappingURL=PackingPlant.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PackingPlant.js","sourceRoot":"","sources":["../../../src/lib/PackingPlant.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,EAEN,QAAQ,EAER,QAAQ,GACT,MAAM,MAAM,CAAC;AAEd,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,MAAM,UAAU,YAAY,CAC1B,WAAc,EACd,CAAS,EACT,OAAe;IAEf,IAAI,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,kBAAkB,EAAE;QAC5C,MAAM,IAAI,KAAK,CACb,qGAAqG,CACtG,CAAC;KACH;IACD,MAAe,OAAQ,SAAQ,MAAM,CAAC;QACpC,MAAM,EAAE,KAAK;KACd,CAAC;QAKA,YAAY,MAAa;YACvB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;YAHpB,YAAO,GAAW,OAAO,CAAC;QAI1B,CAAC;QAED,uDAAuD;QACvD,MAAM,CAAC,YAAY,CAAC,KAAQ;YAC1B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,MAAM,CAAC,UAAU;YACf,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,CAAQ;YACpB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM;QAEN;;;;WAIG;QACH,MAAM,CAAC,SAAS,CAAC,QAAkB;YACjC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvB,MAAM,IAAI,KAAK,CACb,iBAAiB,QAAQ,CAAC,MAAM,oCAAoC,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C;gBAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE;oBAChD,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;oBAC1C,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;oBACvD,OAAO,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;iBAC/B;aACF;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,YAAY,CAAC,KAAc;YACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC1B,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9C;QACH,CAAC;;IA5GM,YAAI,GAAG,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1D,SAAC,GAAW,CAAC,CAAC;IACd,SAAC,GAAW,CAAC,CAAC;IACd,eAAO,GAAW,OAAO,CAAC;IA2GnC,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -2,9 +2,7 @@ import { Field, Bool } from 'o1js';
2
2
  export declare function PackedBoolFactory(l?: number): {
3
3
  new (packed: import("o1js/dist/node/lib/field.js").Field): {
4
4
  toBooleans(): Array<boolean>;
5
- bitSize: bigint;
6
5
  assertEquals(other: {
7
- bitSize: bigint;
8
6
  assertEquals(other: any): void;
9
7
  packed: import("o1js/dist/node/lib/field.js").Field;
10
8
  }): void;
@@ -25,9 +23,7 @@ export declare function PackedBoolFactory(l?: number): {
25
23
  */
26
24
  fromBools(bools: Array<Bool>): {
27
25
  toBooleans(): Array<boolean>;
28
- bitSize: bigint;
29
26
  assertEquals(other: {
30
- bitSize: bigint;
31
27
  assertEquals(other: any): void;
32
28
  packed: import("o1js/dist/node/lib/field.js").Field;
33
29
  }): void;
@@ -40,9 +36,7 @@ export declare function PackedBoolFactory(l?: number): {
40
36
  */
41
37
  fromBooleans(booleans: Array<boolean>): {
42
38
  toBooleans(): Array<boolean>;
43
- bitSize: bigint;
44
39
  assertEquals(other: {
45
- bitSize: bigint;
46
40
  assertEquals(other: any): void;
47
41
  packed: import("o1js/dist/node/lib/field.js").Field;
48
42
  }): void;
@@ -54,6 +48,7 @@ export declare function PackedBoolFactory(l?: number): {
54
48
  packed: string;
55
49
  }>;
56
50
  l: number;
51
+ bitSize: bigint;
57
52
  checkPack(unpacked: import("o1js/dist/node/lib/bool.js").Bool[]): void;
58
53
  pack(unpacked: import("o1js/dist/node/lib/bool.js").Bool[]): import("o1js/dist/node/lib/field.js").Field;
59
54
  unpackToBigints(f: import("o1js/dist/node/lib/field.js").Field): bigint[];
@@ -20,6 +20,7 @@ export function PackedBoolFactory(l = L) {
20
20
  const unpacked = this.unpackToBigints(f);
21
21
  return unpacked.map((x) => Bool.fromJSON(Boolean(x)));
22
22
  });
23
+ f.assertEquals(PackedBool_.pack(unpacked));
23
24
  return unpacked;
24
25
  }
25
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PackedBool.js","sourceRoot":"","sources":["../../../../src/lib/packed-types/PackedBool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,sCAAsC;AACrD,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,MAAM,UAAU,iBAAiB,CAAC,IAAY,CAAC;IAC7C,MAAM,WAAY,SAAQ,YAAY,CAAC,IA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,CAAC;QACjC,CAAC;QAED;;;;WAIG;QACH,MAAM,CAAC,YAAY,CAAC,QAAwB;YAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,OAAO,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACtC,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"}
@@ -1,10 +1,102 @@
1
1
  import { Field, Character } from 'o1js';
2
2
  export declare function PackedStringFactory(l?: number): {
3
+ new (packed: import("o1js/dist/node/lib/field.js").Field): {
4
+ toString(): string;
5
+ assertEquals(other: {
6
+ assertEquals(other: any): void;
7
+ packed: import("o1js/dist/node/lib/field.js").Field;
8
+ }): void;
9
+ packed: import("o1js/dist/node/lib/field.js").Field;
10
+ };
11
+ extractField(input: Character): Field;
12
+ sizeInBits(): bigint;
13
+ /**
14
+ *
15
+ * @param f Field, packed with the information, as returned by #pack
16
+ * @returns Array of Character
17
+ */
18
+ unpack(f: Field): Character[];
19
+ /**
20
+ *
21
+ * @param characters Array of Character to be packed
22
+ * @returns Instance of the implementing class
23
+ */
24
+ fromCharacters(input: Array<Character>): {
25
+ toString(): string;
26
+ assertEquals(other: {
27
+ assertEquals(other: any): void;
28
+ packed: import("o1js/dist/node/lib/field.js").Field;
29
+ }): void;
30
+ packed: import("o1js/dist/node/lib/field.js").Field;
31
+ };
32
+ /**
33
+ *
34
+ * @param str string to be packed
35
+ * @returns Instance of the implementing class
36
+ */
37
+ fromString(str: string): {
38
+ toString(): string;
39
+ assertEquals(other: {
40
+ assertEquals(other: any): void;
41
+ packed: import("o1js/dist/node/lib/field.js").Field;
42
+ }): void;
43
+ packed: import("o1js/dist/node/lib/field.js").Field;
44
+ };
45
+ /**
46
+ *
47
+ * @param f Field, packed with the information, as returned by #pack
48
+ * @returns Array of Character
49
+ */
50
+ type: import("o1js/dist/node/bindings/lib/provable-snarky.js").ProvableExtended<{
51
+ packed: import("o1js/dist/node/lib/field.js").Field;
52
+ }, {
53
+ packed: string;
54
+ }>;
55
+ l: number;
56
+ bitSize: bigint;
57
+ checkPack(unpacked: Character[]): void;
58
+ pack(unpacked: Character[]): import("o1js/dist/node/lib/field.js").Field;
59
+ unpackToBigints(f: import("o1js/dist/node/lib/field.js").Field): bigint[];
60
+ _isStruct: true;
61
+ toFields: (value: {
62
+ packed: import("o1js/dist/node/lib/field.js").Field;
63
+ }) => import("o1js/dist/node/lib/field.js").Field[];
64
+ toAuxiliary: (value?: {
65
+ packed: import("o1js/dist/node/lib/field.js").Field;
66
+ } | undefined) => any[];
67
+ fromFields: (fields: import("o1js/dist/node/lib/field.js").Field[]) => {
68
+ packed: import("o1js/dist/node/lib/field.js").Field;
69
+ };
70
+ sizeInFields(): number;
71
+ check: (value: {
72
+ packed: import("o1js/dist/node/lib/field.js").Field;
73
+ }) => void;
74
+ toInput: (x: {
75
+ packed: import("o1js/dist/node/lib/field.js").Field;
76
+ }) => {
77
+ fields?: import("o1js/dist/node/lib/field.js").Field[] | undefined;
78
+ packed?: [import("o1js/dist/node/lib/field.js").Field, number][] | undefined;
79
+ };
80
+ toJSON: (x: {
81
+ packed: import("o1js/dist/node/lib/field.js").Field;
82
+ }) => {
83
+ packed: string;
84
+ };
85
+ fromJSON: (x: {
86
+ packed: string;
87
+ }) => {
88
+ packed: import("o1js/dist/node/lib/field.js").Field;
89
+ };
90
+ };
91
+ /**
92
+ *
93
+ * @param n number of fields to employ to store the string
94
+ * @returns MultiPackedString_ class with length of n * CHARS_PER_FIELD
95
+ */
96
+ export declare function MultiPackedStringFactory(n?: number): {
3
97
  new (packed: import("o1js/dist/node/lib/field.js").Field[]): {
4
98
  toString(): string;
5
- bitSize: bigint;
6
99
  assertEquals(other: {
7
- bitSize: bigint;
8
100
  assertEquals(other: any): void;
9
101
  packed: import("o1js/dist/node/lib/field.js").Field[];
10
102
  }): void;
@@ -24,11 +116,9 @@ export declare function PackedStringFactory(l?: number): {
24
116
  * @param characters Array of Character to be packed
25
117
  * @returns Instance of the implementing class
26
118
  */
27
- fromCharacters(characters: Array<Character>): {
119
+ fromCharacters(input: Array<Character>): {
28
120
  toString(): string;
29
- bitSize: bigint;
30
121
  assertEquals(other: {
31
- bitSize: bigint;
32
122
  assertEquals(other: any): void;
33
123
  packed: import("o1js/dist/node/lib/field.js").Field[];
34
124
  }): void;
@@ -41,9 +131,7 @@ export declare function PackedStringFactory(l?: number): {
41
131
  */
42
132
  fromString(str: string): {
43
133
  toString(): string;
44
- bitSize: bigint;
45
134
  assertEquals(other: {
46
- bitSize: bigint;
47
135
  assertEquals(other: any): void;
48
136
  packed: import("o1js/dist/node/lib/field.js").Field[];
49
137
  }): void;
@@ -56,6 +144,7 @@ export declare function PackedStringFactory(l?: number): {
56
144
  }>;
57
145
  l: number;
58
146
  n: number;
147
+ bitSize: bigint;
59
148
  checkPack(unpacked: Character[]): void;
60
149
  pack(unpacked: Character[]): import("o1js/dist/node/lib/field.js").Field[];
61
150
  unpackToBigints(fields: import("o1js/dist/node/lib/field.js").Field[]): bigint[];
@@ -1,10 +1,72 @@
1
- import { Field, Provable, Character } from 'o1js';
2
- import { MultiPackingPlant } from '../PackingPlant.js';
1
+ import { Field, Provable, Character, Poseidon } from 'o1js';
2
+ import { PackingPlant, MultiPackingPlant } from '../PackingPlant.js';
3
3
  const SIZE_IN_BITS = 16n;
4
4
  const L = 15; // Default to one-field worth of characters
5
5
  const CHARS_PER_FIELD = 15;
6
6
  export function PackedStringFactory(l = L) {
7
- class PackedString_ extends MultiPackingPlant(Character, l, SIZE_IN_BITS) {
7
+ class PackedString_ extends PackingPlant(Character, l, SIZE_IN_BITS) {
8
+ static extractField(input) {
9
+ return input.value;
10
+ }
11
+ static sizeInBits() {
12
+ return SIZE_IN_BITS;
13
+ }
14
+ /**
15
+ *
16
+ * @param f Field, packed with the information, as returned by #pack
17
+ * @returns Array of Character
18
+ */
19
+ static unpack(f) {
20
+ const unpacked = Provable.witness(Provable.Array(Character, l), () => {
21
+ const unpacked = this.unpackToBigints(f);
22
+ return unpacked.map((x) => Character.fromString(String.fromCharCode(Number(x))));
23
+ });
24
+ f.assertEquals(PackedString_.pack(unpacked));
25
+ return unpacked;
26
+ }
27
+ /**
28
+ *
29
+ * @param characters Array of Character to be packed
30
+ * @returns Instance of the implementing class
31
+ */
32
+ static fromCharacters(input) {
33
+ let characters = new Array(this.l);
34
+ characters.fill(new Character(Field(0)), 0, this.l);
35
+ for (let i = 0; i < input.length; i++) {
36
+ characters[i] = input[i];
37
+ }
38
+ const packed = this.pack(characters);
39
+ return new PackedString_(packed);
40
+ }
41
+ /**
42
+ *
43
+ * @param str string to be packed
44
+ * @returns Instance of the implementing class
45
+ */
46
+ static fromString(str) {
47
+ let characters = new Array(this.l);
48
+ characters.fill(new Character(Field(0)), 0, this.l);
49
+ for (let i = 0; i < str.length; i++) {
50
+ characters[i] = Character.fromString(str[i]);
51
+ }
52
+ return this.fromCharacters(characters);
53
+ }
54
+ toString() {
55
+ const nullChar = String.fromCharCode(0);
56
+ return PackedString_.unpack(this.packed)
57
+ .filter((c) => c.toString() !== nullChar)
58
+ .join('');
59
+ }
60
+ }
61
+ return PackedString_;
62
+ }
63
+ /**
64
+ *
65
+ * @param n number of fields to employ to store the string
66
+ * @returns MultiPackedString_ class with length of n * CHARS_PER_FIELD
67
+ */
68
+ export function MultiPackedStringFactory(n = 8) {
69
+ class MultiPackedString_ extends MultiPackingPlant(Character, n * CHARS_PER_FIELD, SIZE_IN_BITS) {
8
70
  static extractField(input) {
9
71
  return input.value;
10
72
  }
@@ -20,10 +82,11 @@ export function PackedStringFactory(l = L) {
20
82
  * @returns Array of Character
21
83
  */
22
84
  static unpack(fields) {
23
- const unpacked = Provable.witness(Provable.Array(Character, l), () => {
85
+ const unpacked = Provable.witness(Provable.Array(Character, this.l), () => {
24
86
  let unpacked = this.unpackToBigints(fields);
25
87
  return unpacked.map((x) => Character.fromString(String.fromCharCode(Number(x))));
26
88
  });
89
+ Poseidon.hash(fields).assertEquals(Poseidon.hash(MultiPackedString_.pack(unpacked)));
27
90
  return unpacked;
28
91
  }
29
92
  /**
@@ -31,9 +94,14 @@ export function PackedStringFactory(l = L) {
31
94
  * @param characters Array of Character to be packed
32
95
  * @returns Instance of the implementing class
33
96
  */
34
- static fromCharacters(characters) {
97
+ static fromCharacters(input) {
98
+ let characters = new Array(this.l);
99
+ characters.fill(new Character(Field(0)), 0, this.l);
100
+ for (let i = 0; i < input.length; i++) {
101
+ characters[i] = input[i];
102
+ }
35
103
  const packed = this.pack(characters);
36
- return new PackedString_(packed);
104
+ return new MultiPackedString_(packed);
37
105
  }
38
106
  /**
39
107
  *
@@ -41,8 +109,8 @@ export function PackedStringFactory(l = L) {
41
109
  * @returns Instance of the implementing class
42
110
  */
43
111
  static fromString(str) {
44
- let characters = new Array(l);
45
- characters.fill(new Character(Field(0)), 0, l);
112
+ let characters = new Array(this.l);
113
+ characters.fill(new Character(Field(0)), 0, this.l);
46
114
  for (let i = 0; i < str.length; i++) {
47
115
  characters[i] = Character.fromString(str[i]);
48
116
  }
@@ -50,11 +118,11 @@ export function PackedStringFactory(l = L) {
50
118
  }
51
119
  toString() {
52
120
  const nullChar = String.fromCharCode(0);
53
- return PackedString_.unpack(this.packed)
121
+ return MultiPackedString_.unpack(this.packed)
54
122
  .filter((c) => c.toString() !== nullChar)
55
123
  .join('');
56
124
  }
57
125
  }
58
- return PackedString_;
126
+ return MultiPackedString_;
59
127
  }
60
128
  //# sourceMappingURL=PackedString.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PackedString.js","sourceRoot":"","sources":["../../../../src/lib/packed-types/PackedString.ts"],"names":[],"mappings":"AAAA,O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