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
@@ -1,478 +0,0 @@
1
-
2
- <!doctype html>
3
- <html lang="en">
4
-
5
- <head>
6
- <title>Code coverage report for lib/PackingPlant.ts</title>
7
- <meta charset="utf-8" />
8
- <link rel="stylesheet" href="../prettify.css" />
9
- <link rel="stylesheet" href="../base.css" />
10
- <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
11
- <meta name="viewport" content="width=device-width, initial-scale=1" />
12
- <style type='text/css'>
13
- .coverage-summary .sorter {
14
- background-image: url(../sort-arrow-sprite.png);
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div class='wrapper'>
21
- <div class='pad1'>
22
- <h1><a href="../index.html">All files</a> / <a href="index.html">lib</a> PackingPlant.ts</h1>
23
- <div class='clearfix'>
24
-
25
- <div class='fl pad1y space-right2'>
26
- <span class="strong">75.55% </span>
27
- <span class="quiet">Statements</span>
28
- <span class='fraction'>34/45</span>
29
- </div>
30
-
31
-
32
- <div class='fl pad1y space-right2'>
33
- <span class="strong">75% </span>
34
- <span class="quiet">Branches</span>
35
- <span class='fraction'>3/4</span>
36
- </div>
37
-
38
-
39
- <div class='fl pad1y space-right2'>
40
- <span class="strong">71.42% </span>
41
- <span class="quiet">Functions</span>
42
- <span class='fraction'>10/14</span>
43
- </div>
44
-
45
-
46
- <div class='fl pad1y space-right2'>
47
- <span class="strong">75% </span>
48
- <span class="quiet">Lines</span>
49
- <span class='fraction'>33/44</span>
50
- </div>
51
-
52
-
53
- </div>
54
- <p class="quiet">
55
- Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
- </p>
57
- <template id="filterTemplate">
58
- <div class="quiet">
59
- Filter:
60
- <input oninput="onInput()" type="search" id="fileSearch">
61
- </div>
62
- </template>
63
- </div>
64
- <div class='status-line medium'></div>
65
- <pre><table class="coverage">
66
- <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
67
- <a name='L2'></a><a href='#L2'>2</a>
68
- <a name='L3'></a><a href='#L3'>3</a>
69
- <a name='L4'></a><a href='#L4'>4</a>
70
- <a name='L5'></a><a href='#L5'>5</a>
71
- <a name='L6'></a><a href='#L6'>6</a>
72
- <a name='L7'></a><a href='#L7'>7</a>
73
- <a name='L8'></a><a href='#L8'>8</a>
74
- <a name='L9'></a><a href='#L9'>9</a>
75
- <a name='L10'></a><a href='#L10'>10</a>
76
- <a name='L11'></a><a href='#L11'>11</a>
77
- <a name='L12'></a><a href='#L12'>12</a>
78
- <a name='L13'></a><a href='#L13'>13</a>
79
- <a name='L14'></a><a href='#L14'>14</a>
80
- <a name='L15'></a><a href='#L15'>15</a>
81
- <a name='L16'></a><a href='#L16'>16</a>
82
- <a name='L17'></a><a href='#L17'>17</a>
83
- <a name='L18'></a><a href='#L18'>18</a>
84
- <a name='L19'></a><a href='#L19'>19</a>
85
- <a name='L20'></a><a href='#L20'>20</a>
86
- <a name='L21'></a><a href='#L21'>21</a>
87
- <a name='L22'></a><a href='#L22'>22</a>
88
- <a name='L23'></a><a href='#L23'>23</a>
89
- <a name='L24'></a><a href='#L24'>24</a>
90
- <a name='L25'></a><a href='#L25'>25</a>
91
- <a name='L26'></a><a href='#L26'>26</a>
92
- <a name='L27'></a><a href='#L27'>27</a>
93
- <a name='L28'></a><a href='#L28'>28</a>
94
- <a name='L29'></a><a href='#L29'>29</a>
95
- <a name='L30'></a><a href='#L30'>30</a>
96
- <a name='L31'></a><a href='#L31'>31</a>
97
- <a name='L32'></a><a href='#L32'>32</a>
98
- <a name='L33'></a><a href='#L33'>33</a>
99
- <a name='L34'></a><a href='#L34'>34</a>
100
- <a name='L35'></a><a href='#L35'>35</a>
101
- <a name='L36'></a><a href='#L36'>36</a>
102
- <a name='L37'></a><a href='#L37'>37</a>
103
- <a name='L38'></a><a href='#L38'>38</a>
104
- <a name='L39'></a><a href='#L39'>39</a>
105
- <a name='L40'></a><a href='#L40'>40</a>
106
- <a name='L41'></a><a href='#L41'>41</a>
107
- <a name='L42'></a><a href='#L42'>42</a>
108
- <a name='L43'></a><a href='#L43'>43</a>
109
- <a name='L44'></a><a href='#L44'>44</a>
110
- <a name='L45'></a><a href='#L45'>45</a>
111
- <a name='L46'></a><a href='#L46'>46</a>
112
- <a name='L47'></a><a href='#L47'>47</a>
113
- <a name='L48'></a><a href='#L48'>48</a>
114
- <a name='L49'></a><a href='#L49'>49</a>
115
- <a name='L50'></a><a href='#L50'>50</a>
116
- <a name='L51'></a><a href='#L51'>51</a>
117
- <a name='L52'></a><a href='#L52'>52</a>
118
- <a name='L53'></a><a href='#L53'>53</a>
119
- <a name='L54'></a><a href='#L54'>54</a>
120
- <a name='L55'></a><a href='#L55'>55</a>
121
- <a name='L56'></a><a href='#L56'>56</a>
122
- <a name='L57'></a><a href='#L57'>57</a>
123
- <a name='L58'></a><a href='#L58'>58</a>
124
- <a name='L59'></a><a href='#L59'>59</a>
125
- <a name='L60'></a><a href='#L60'>60</a>
126
- <a name='L61'></a><a href='#L61'>61</a>
127
- <a name='L62'></a><a href='#L62'>62</a>
128
- <a name='L63'></a><a href='#L63'>63</a>
129
- <a name='L64'></a><a href='#L64'>64</a>
130
- <a name='L65'></a><a href='#L65'>65</a>
131
- <a name='L66'></a><a href='#L66'>66</a>
132
- <a name='L67'></a><a href='#L67'>67</a>
133
- <a name='L68'></a><a href='#L68'>68</a>
134
- <a name='L69'></a><a href='#L69'>69</a>
135
- <a name='L70'></a><a href='#L70'>70</a>
136
- <a name='L71'></a><a href='#L71'>71</a>
137
- <a name='L72'></a><a href='#L72'>72</a>
138
- <a name='L73'></a><a href='#L73'>73</a>
139
- <a name='L74'></a><a href='#L74'>74</a>
140
- <a name='L75'></a><a href='#L75'>75</a>
141
- <a name='L76'></a><a href='#L76'>76</a>
142
- <a name='L77'></a><a href='#L77'>77</a>
143
- <a name='L78'></a><a href='#L78'>78</a>
144
- <a name='L79'></a><a href='#L79'>79</a>
145
- <a name='L80'></a><a href='#L80'>80</a>
146
- <a name='L81'></a><a href='#L81'>81</a>
147
- <a name='L82'></a><a href='#L82'>82</a>
148
- <a name='L83'></a><a href='#L83'>83</a>
149
- <a name='L84'></a><a href='#L84'>84</a>
150
- <a name='L85'></a><a href='#L85'>85</a>
151
- <a name='L86'></a><a href='#L86'>86</a>
152
- <a name='L87'></a><a href='#L87'>87</a>
153
- <a name='L88'></a><a href='#L88'>88</a>
154
- <a name='L89'></a><a href='#L89'>89</a>
155
- <a name='L90'></a><a href='#L90'>90</a>
156
- <a name='L91'></a><a href='#L91'>91</a>
157
- <a name='L92'></a><a href='#L92'>92</a>
158
- <a name='L93'></a><a href='#L93'>93</a>
159
- <a name='L94'></a><a href='#L94'>94</a>
160
- <a name='L95'></a><a href='#L95'>95</a>
161
- <a name='L96'></a><a href='#L96'>96</a>
162
- <a name='L97'></a><a href='#L97'>97</a>
163
- <a name='L98'></a><a href='#L98'>98</a>
164
- <a name='L99'></a><a href='#L99'>99</a>
165
- <a name='L100'></a><a href='#L100'>100</a>
166
- <a name='L101'></a><a href='#L101'>101</a>
167
- <a name='L102'></a><a href='#L102'>102</a>
168
- <a name='L103'></a><a href='#L103'>103</a>
169
- <a name='L104'></a><a href='#L104'>104</a>
170
- <a name='L105'></a><a href='#L105'>105</a>
171
- <a name='L106'></a><a href='#L106'>106</a>
172
- <a name='L107'></a><a href='#L107'>107</a>
173
- <a name='L108'></a><a href='#L108'>108</a>
174
- <a name='L109'></a><a href='#L109'>109</a>
175
- <a name='L110'></a><a href='#L110'>110</a>
176
- <a name='L111'></a><a href='#L111'>111</a>
177
- <a name='L112'></a><a href='#L112'>112</a>
178
- <a name='L113'></a><a href='#L113'>113</a>
179
- <a name='L114'></a><a href='#L114'>114</a>
180
- <a name='L115'></a><a href='#L115'>115</a>
181
- <a name='L116'></a><a href='#L116'>116</a>
182
- <a name='L117'></a><a href='#L117'>117</a>
183
- <a name='L118'></a><a href='#L118'>118</a>
184
- <a name='L119'></a><a href='#L119'>119</a>
185
- <a name='L120'></a><a href='#L120'>120</a>
186
- <a name='L121'></a><a href='#L121'>121</a>
187
- <a name='L122'></a><a href='#L122'>122</a>
188
- <a name='L123'></a><a href='#L123'>123</a>
189
- <a name='L124'></a><a href='#L124'>124</a>
190
- <a name='L125'></a><a href='#L125'>125</a>
191
- <a name='L126'></a><a href='#L126'>126</a>
192
- <a name='L127'></a><a href='#L127'>127</a>
193
- <a name='L128'></a><a href='#L128'>128</a>
194
- <a name='L129'></a><a href='#L129'>129</a>
195
- <a name='L130'></a><a href='#L130'>130</a>
196
- <a name='L131'></a><a href='#L131'>131</a>
197
- <a name='L132'></a><a href='#L132'>132</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
198
- <span class="cline-any cline-neutral">&nbsp;</span>
199
- <span class="cline-any cline-neutral">&nbsp;</span>
200
- <span class="cline-any cline-neutral">&nbsp;</span>
201
- <span class="cline-any cline-neutral">&nbsp;</span>
202
- <span class="cline-any cline-neutral">&nbsp;</span>
203
- <span class="cline-any cline-neutral">&nbsp;</span>
204
- <span class="cline-any cline-neutral">&nbsp;</span>
205
- <span class="cline-any cline-neutral">&nbsp;</span>
206
- <span class="cline-any cline-yes">3x</span>
207
- <span class="cline-any cline-neutral">&nbsp;</span>
208
- <span class="cline-any cline-neutral">&nbsp;</span>
209
- <span class="cline-any cline-neutral">&nbsp;</span>
210
- <span class="cline-any cline-neutral">&nbsp;</span>
211
- <span class="cline-any cline-neutral">&nbsp;</span>
212
- <span class="cline-any cline-neutral">&nbsp;</span>
213
- <span class="cline-any cline-yes">10x</span>
214
- <span class="cline-any cline-yes">2x</span>
215
- <span class="cline-any cline-neutral">&nbsp;</span>
216
- <span class="cline-any cline-neutral">&nbsp;</span>
217
- <span class="cline-any cline-neutral">&nbsp;</span>
218
- <span class="cline-any cline-neutral">&nbsp;</span>
219
- <span class="cline-any cline-neutral">&nbsp;</span>
220
- <span class="cline-any cline-neutral">&nbsp;</span>
221
- <span class="cline-any cline-yes">8x</span>
222
- <span class="cline-any cline-yes">8x</span>
223
- <span class="cline-any cline-neutral">&nbsp;</span>
224
- <span class="cline-any cline-neutral">&nbsp;</span>
225
- <span class="cline-any cline-yes">10x</span>
226
- <span class="cline-any cline-neutral">&nbsp;</span>
227
- <span class="cline-any cline-neutral">&nbsp;</span>
228
- <span class="cline-any cline-yes">12x</span>
229
- <span class="cline-any cline-yes">2x</span>
230
- <span class="cline-any cline-neutral">&nbsp;</span>
231
- <span class="cline-any cline-neutral">&nbsp;</span>
232
- <span class="cline-any cline-neutral">&nbsp;</span>
233
- <span class="cline-any cline-yes">10x</span>
234
- <span class="cline-any cline-yes">10x</span>
235
- <span class="cline-any cline-neutral">&nbsp;</span>
236
- <span class="cline-any cline-neutral">&nbsp;</span>
237
- <span class="cline-any cline-neutral">&nbsp;</span>
238
- <span class="cline-any cline-no">&nbsp;</span>
239
- <span class="cline-any cline-no">&nbsp;</span>
240
- <span class="cline-any cline-neutral">&nbsp;</span>
241
- <span class="cline-any cline-neutral">&nbsp;</span>
242
- <span class="cline-any cline-neutral">&nbsp;</span>
243
- <span class="cline-any cline-no">&nbsp;</span>
244
- <span class="cline-any cline-no">&nbsp;</span>
245
- <span class="cline-any cline-no">&nbsp;</span>
246
- <span class="cline-any cline-neutral">&nbsp;</span>
247
- <span class="cline-any cline-neutral">&nbsp;</span>
248
- <span class="cline-any cline-neutral">&nbsp;</span>
249
- <span class="cline-any cline-yes">4x</span>
250
- <span class="cline-any cline-neutral">&nbsp;</span>
251
- <span class="cline-any cline-neutral">&nbsp;</span>
252
- <span class="cline-any cline-neutral">&nbsp;</span>
253
- <span class="cline-any cline-yes">4x</span>
254
- <span class="cline-any cline-neutral">&nbsp;</span>
255
- <span class="cline-any cline-neutral">&nbsp;</span>
256
- <span class="cline-any cline-neutral">&nbsp;</span>
257
- <span class="cline-any cline-neutral">&nbsp;</span>
258
- <span class="cline-any cline-neutral">&nbsp;</span>
259
- <span class="cline-any cline-neutral">&nbsp;</span>
260
- <span class="cline-any cline-yes">2x</span>
261
- <span class="cline-any cline-yes">2x</span>
262
- <span class="cline-any cline-yes">2x</span>
263
- <span class="cline-any cline-neutral">&nbsp;</span>
264
- <span class="cline-any cline-neutral">&nbsp;</span>
265
- <span class="cline-any cline-yes">8x</span>
266
- <span class="cline-any cline-neutral">&nbsp;</span>
267
- <span class="cline-any cline-neutral">&nbsp;</span>
268
- <span class="cline-any cline-neutral">&nbsp;</span>
269
- <span class="cline-any cline-neutral">&nbsp;</span>
270
- <span class="cline-any cline-neutral">&nbsp;</span>
271
- <span class="cline-any cline-neutral">&nbsp;</span>
272
- <span class="cline-any cline-yes">8x</span>
273
- <span class="cline-any cline-no">&nbsp;</span>
274
- <span class="cline-any cline-neutral">&nbsp;</span>
275
- <span class="cline-any cline-neutral">&nbsp;</span>
276
- <span class="cline-any cline-neutral">&nbsp;</span>
277
- <span class="cline-any cline-yes">8x</span>
278
- <span class="cline-any cline-neutral">&nbsp;</span>
279
- <span class="cline-any cline-neutral">&nbsp;</span>
280
- <span class="cline-any cline-neutral">&nbsp;</span>
281
- <span class="cline-any cline-yes">8x</span>
282
- <span class="cline-any cline-yes">8x</span>
283
- <span class="cline-any cline-yes">8x</span>
284
- <span class="cline-any cline-neutral">&nbsp;</span>
285
- <span class="cline-any cline-neutral">&nbsp;</span>
286
- <span class="cline-any cline-yes">8x</span>
287
- <span class="cline-any cline-neutral">&nbsp;</span>
288
- <span class="cline-any cline-neutral">&nbsp;</span>
289
- <span class="cline-any cline-yes">10x</span>
290
- <span class="cline-any cline-yes">2x</span>
291
- <span class="cline-any cline-neutral">&nbsp;</span>
292
- <span class="cline-any cline-yes">8x</span>
293
- <span class="cline-any cline-yes">8x</span>
294
- <span class="cline-any cline-neutral">&nbsp;</span>
295
- <span class="cline-any cline-neutral">&nbsp;</span>
296
- <span class="cline-any cline-neutral">&nbsp;</span>
297
- <span class="cline-any cline-no">&nbsp;</span>
298
- <span class="cline-any cline-no">&nbsp;</span>
299
- <span class="cline-any cline-neutral">&nbsp;</span>
300
- <span class="cline-any cline-neutral">&nbsp;</span>
301
- <span class="cline-any cline-neutral">&nbsp;</span>
302
- <span class="cline-any cline-no">&nbsp;</span>
303
- <span class="cline-any cline-no">&nbsp;</span>
304
- <span class="cline-any cline-no">&nbsp;</span>
305
- <span class="cline-any cline-neutral">&nbsp;</span>
306
- <span class="cline-any cline-neutral">&nbsp;</span>
307
- <span class="cline-any cline-neutral">&nbsp;</span>
308
- <span class="cline-any cline-yes">5x</span>
309
- <span class="cline-any cline-neutral">&nbsp;</span>
310
- <span class="cline-any cline-neutral">&nbsp;</span>
311
- <span class="cline-any cline-neutral">&nbsp;</span>
312
- <span class="cline-any cline-yes">2x</span>
313
- <span class="cline-any cline-neutral">&nbsp;</span>
314
- <span class="cline-any cline-neutral">&nbsp;</span>
315
- <span class="cline-any cline-neutral">&nbsp;</span>
316
- <span class="cline-any cline-neutral">&nbsp;</span>
317
- <span class="cline-any cline-neutral">&nbsp;</span>
318
- <span class="cline-any cline-neutral">&nbsp;</span>
319
- <span class="cline-any cline-yes">1x</span>
320
- <span class="cline-any cline-yes">1x</span>
321
- <span class="cline-any cline-yes">1x</span>
322
- <span class="cline-any cline-yes">3x</span>
323
- <span class="cline-any cline-neutral">&nbsp;</span>
324
- <span class="cline-any cline-neutral">&nbsp;</span>
325
- <span class="cline-any cline-neutral">&nbsp;</span>
326
- <span class="cline-any cline-yes">8x</span>
327
- <span class="cline-any cline-neutral">&nbsp;</span>
328
- <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import {
329
- Field,
330
- Struct,
331
- Poseidon,
332
- provable,
333
- InferProvable,
334
- Provable,
335
- } from 'snarkyjs';
336
- &nbsp;
337
- const MAX_BITS_PER_FIELD = 254n;
338
- &nbsp;
339
- export function PackingPlant&lt;A, T extends InferProvable&lt;A&gt; = InferProvable&lt;A&gt;&gt;(
340
- elementType: A,
341
- l: number,
342
- bitSize: bigint
343
- ) {
344
- if (bitSize * BigInt(l) &gt; MAX_BITS_PER_FIELD) {
345
- throw new Error(
346
- `The Packing Plant is only accepting orders that can fit into one Field, try using MultiPackingPlant`
347
- );
348
- }
349
- abstract class Packed_ extends Struct({
350
- packed: Field,
351
- }) {
352
- static type = provable({ packed: Field }, {});
353
- static l: number = l;
354
- packed: Field;
355
- aux: Array&lt;T&gt;;
356
- bitSize: bigint = bitSize;
357
- &nbsp;
358
- constructor(packed: Field, aux: Array&lt;T&gt;) {
359
- if (aux.length &gt; l) {
360
- throw new Error(
361
- `Length of aux data is too long, input of size ${aux.length} is larger than max allowed ${l}`
362
- );
363
- }
364
- super({ packed });
365
- this.aux = aux;
366
- }
367
- &nbsp;
368
- <span class="fstat-no" title="function not covered" > static </span>toAuxiliary(value?: { packed: Field } | undefined): Array&lt;T&gt; {
369
- <span class="cstat-no" title="statement not covered" > throw new Error('Must implement toAuxiliary');</span>
370
- <span class="cstat-no" title="statement not covered" > return [];</span>
371
- }
372
- &nbsp;
373
- <span class="fstat-no" title="function not covered" > static </span>pack(aux: Array&lt;T&gt;): Field {
374
- <span class="cstat-no" title="statement not covered" > throw new Error('Must implement pack');</span>
375
- let f = <span class="cstat-no" title="statement not covered" >Field(0);</span>
376
- <span class="cstat-no" title="statement not covered" > return f;</span>
377
- }
378
- &nbsp;
379
- static unpack(f: Field) {
380
- return this.toAuxiliary({ packed: f });
381
- }
382
- &nbsp;
383
- assertEquals(other: Packed_) {
384
- this.packed.assertEquals(other.packed);
385
- }
386
- &nbsp;
387
- /**
388
- * In-Circuit verifiaction of the packed Field
389
- */
390
- static check(value: { packed: Field }) {
391
- const unpacked = this.toAuxiliary({ packed: value.packed });
392
- const packed = this.pack(unpacked);
393
- packed.assertEquals(value.packed);
394
- }
395
- }
396
- return Packed_;
397
- }
398
- &nbsp;
399
- export function MultiPackingPlant&lt;
400
- A,
401
- T extends InferProvable&lt;A&gt; = InferProvable&lt;A&gt;
402
- &gt;(elementType: A, l: number, bitSize: bigint) {
403
- <span class="missing-if-branch" title="if path not taken" >I</span>if (bitSize * BigInt(l) &gt; 8n * MAX_BITS_PER_FIELD) {
404
- <span class="cstat-no" title="statement not covered" > throw new Error(</span>
405
- `The Packing Plant is only accepting orders that can fit into eight Fields`
406
- );
407
- }
408
- const n = Math.ceil(Number(bitSize * BigInt(l)) / Number(255n));
409
- abstract class Packed_ extends Struct({
410
- packed: Provable.Array(Field, n),
411
- }) {
412
- static type = provable({ packed: Provable.Array(Field, n) }, {});
413
- static l: number = l;
414
- static n: number = n;
415
- packed: Array&lt;Field&gt;;
416
- aux: Array&lt;T&gt;;
417
- bitSize: bigint = bitSize;
418
- &nbsp;
419
- constructor(packed: Array&lt;Field&gt;, aux: Array&lt;T&gt;) {
420
- if (aux.length &gt; l) {
421
- throw new Error('Length of aux data is too long');
422
- }
423
- super({ packed });
424
- this.aux = aux;
425
- }
426
- &nbsp;
427
- <span class="fstat-no" title="function not covered" > static </span>toAuxiliary(value?: { packed: Array&lt;Field&gt; } | undefined): Array&lt;T&gt; {
428
- <span class="cstat-no" title="statement not covered" > throw new Error('Must implement toAuxiliary');</span>
429
- <span class="cstat-no" title="statement not covered" > return [];</span>
430
- }
431
- &nbsp;
432
- <span class="fstat-no" title="function not covered" > static </span>pack(aux: Array&lt;T&gt;): Array&lt;Field&gt; {
433
- <span class="cstat-no" title="statement not covered" > throw new Error('Must implement pack');</span>
434
- let f = <span class="cstat-no" title="statement not covered" >[Field(0)];</span>
435
- <span class="cstat-no" title="statement not covered" > return f;</span>
436
- }
437
- &nbsp;
438
- static unpack(fields: Array&lt;Field&gt;) {
439
- return this.toAuxiliary({ packed: fields });
440
- }
441
- &nbsp;
442
- assertEquals(other: Packed_) {
443
- Poseidon.hash(this.packed).assertEquals(Poseidon.hash(other.packed));
444
- }
445
- &nbsp;
446
- /**
447
- * In-Circuit verifiaction of the packed Field
448
- */
449
- static check(value: { packed: Array&lt;Field&gt; }) {
450
- const unpacked = this.toAuxiliary({ packed: value.packed });
451
- const packed = this.pack(unpacked);
452
- for (let i = 0; i &lt; n; i++) {
453
- packed[i].assertEquals(value.packed[i]);
454
- }
455
- }
456
- }
457
- return Packed_;
458
- }
459
- &nbsp;</pre></td></tr></table></pre>
460
-
461
- <div class='push'></div><!-- for sticky footer -->
462
- </div><!-- /wrapper -->
463
- <div class='footer quiet pad2 space-top1 center small'>
464
- Code coverage generated by
465
- <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
466
- at 2023-07-18T03:31:53.631Z
467
- </div>
468
- <script src="../prettify.js"></script>
469
- <script>
470
- window.onload = function () {
471
- prettyPrint();
472
- };
473
- </script>
474
- <script src="../sorter.js"></script>
475
- <script src="../block-navigation.js"></script>
476
- </body>
477
- </html>
478
-
@@ -1,116 +0,0 @@
1
-
2
- <!doctype html>
3
- <html lang="en">
4
-
5
- <head>
6
- <title>Code coverage report for lib</title>
7
- <meta charset="utf-8" />
8
- <link rel="stylesheet" href="../prettify.css" />
9
- <link rel="stylesheet" href="../base.css" />
10
- <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
11
- <meta name="viewport" content="width=device-width, initial-scale=1" />
12
- <style type='text/css'>
13
- .coverage-summary .sorter {
14
- background-image: url(../sort-arrow-sprite.png);
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div class='wrapper'>
21
- <div class='pad1'>
22
- <h1><a href="../index.html">All files</a> lib</h1>
23
- <div class='clearfix'>
24
-
25
- <div class='fl pad1y space-right2'>
26
- <span class="strong">75.55% </span>
27
- <span class="quiet">Statements</span>
28
- <span class='fraction'>34/45</span>
29
- </div>
30
-
31
-
32
- <div class='fl pad1y space-right2'>
33
- <span class="strong">75% </span>
34
- <span class="quiet">Branches</span>
35
- <span class='fraction'>3/4</span>
36
- </div>
37
-
38
-
39
- <div class='fl pad1y space-right2'>
40
- <span class="strong">71.42% </span>
41
- <span class="quiet">Functions</span>
42
- <span class='fraction'>10/14</span>
43
- </div>
44
-
45
-
46
- <div class='fl pad1y space-right2'>
47
- <span class="strong">75% </span>
48
- <span class="quiet">Lines</span>
49
- <span class='fraction'>33/44</span>
50
- </div>
51
-
52
-
53
- </div>
54
- <p class="quiet">
55
- Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
- </p>
57
- <template id="filterTemplate">
58
- <div class="quiet">
59
- Filter:
60
- <input oninput="onInput()" type="search" id="fileSearch">
61
- </div>
62
- </template>
63
- </div>
64
- <div class='status-line medium'></div>
65
- <div class="pad1">
66
- <table class="coverage-summary">
67
- <thead>
68
- <tr>
69
- <th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
70
- <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
71
- <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
72
- <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
73
- <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
74
- <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
75
- <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
76
- <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
77
- <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
78
- <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
79
- </tr>
80
- </thead>
81
- <tbody><tr>
82
- <td class="file medium" data-value="PackingPlant.ts"><a href="PackingPlant.ts.html">PackingPlant.ts</a></td>
83
- <td data-value="75.55" class="pic medium">
84
- <div class="chart"><div class="cover-fill" style="width: 75%"></div><div class="cover-empty" style="width: 25%"></div></div>
85
- </td>
86
- <td data-value="75.55" class="pct medium">75.55%</td>
87
- <td data-value="45" class="abs medium">34/45</td>
88
- <td data-value="75" class="pct medium">75%</td>
89
- <td data-value="4" class="abs medium">3/4</td>
90
- <td data-value="71.42" class="pct medium">71.42%</td>
91
- <td data-value="14" class="abs medium">10/14</td>
92
- <td data-value="75" class="pct medium">75%</td>
93
- <td data-value="44" class="abs medium">33/44</td>
94
- </tr>
95
-
96
- </tbody>
97
- </table>
98
- </div>
99
- <div class='push'></div><!-- for sticky footer -->
100
- </div><!-- /wrapper -->
101
- <div class='footer quiet pad2 space-top1 center small'>
102
- Code coverage generated by
103
- <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
104
- at 2023-07-18T03:31:53.631Z
105
- </div>
106
- <script src="../prettify.js"></script>
107
- <script>
108
- window.onload = function () {
109
- prettyPrint();
110
- };
111
- </script>
112
- <script src="../sorter.js"></script>
113
- <script src="../block-navigation.js"></script>
114
- </body>
115
- </html>
116
-