@proto-kit/common 0.1.1-develop.187 → 0.1.1-develop.188

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/package.json +2 -2
  2. package/dist/Constants.d.ts +0 -4
  3. package/dist/Constants.d.ts.map +0 -1
  4. package/dist/Constants.js +0 -3
  5. package/dist/config/ConfigurationAggregator.d.ts +0 -10
  6. package/dist/config/ConfigurationAggregator.d.ts.map +0 -1
  7. package/dist/config/ConfigurationAggregator.js +0 -35
  8. package/dist/config/ConfigurationReceiver.d.ts +0 -25
  9. package/dist/config/ConfigurationReceiver.d.ts.map +0 -1
  10. package/dist/config/ConfigurationReceiver.js +0 -36
  11. package/dist/config/types.d.ts +0 -2
  12. package/dist/config/types.d.ts.map +0 -1
  13. package/dist/config/types.js +0 -1
  14. package/dist/model/MethodPublicInput.d.ts +0 -51
  15. package/dist/model/MethodPublicInput.d.ts.map +0 -1
  16. package/dist/model/MethodPublicInput.js +0 -11
  17. package/dist/model/Option.d.ts +0 -89
  18. package/dist/model/Option.d.ts.map +0 -1
  19. package/dist/model/Option.js +0 -86
  20. package/dist/model/Path.d.ts +0 -31
  21. package/dist/model/Path.d.ts.map +0 -1
  22. package/dist/model/Path.js +0 -44
  23. package/dist/model/StateTransition.d.ts +0 -85
  24. package/dist/model/StateTransition.d.ts.map +0 -1
  25. package/dist/model/StateTransition.js +0 -58
  26. package/dist/model/StateTransitionProvableBatch.d.ts +0 -56
  27. package/dist/model/StateTransitionProvableBatch.d.ts.map +0 -1
  28. package/dist/model/StateTransitionProvableBatch.js +0 -20
  29. package/dist/prover/block/BlockProver.d.ts +0 -199
  30. package/dist/prover/block/BlockProver.d.ts.map +0 -1
  31. package/dist/prover/block/BlockProver.js +0 -119
  32. package/dist/prover/block/BlockScopedModule.d.ts +0 -3
  33. package/dist/prover/block/BlockScopedModule.d.ts.map +0 -1
  34. package/dist/prover/block/BlockScopedModule.js +0 -6
  35. package/dist/prover/statetransition/StateTransitionProver.d.ts +0 -92
  36. package/dist/prover/statetransition/StateTransitionProver.d.ts.map +0 -1
  37. package/dist/prover/statetransition/StateTransitionProver.js +0 -127
  38. package/dist/prover/statetransition/StateTransitionWitnessProvider.d.ts +0 -16
  39. package/dist/prover/statetransition/StateTransitionWitnessProvider.d.ts.map +0 -1
  40. package/dist/prover/statetransition/StateTransitionWitnessProvider.js +0 -17
  41. package/dist/src/model/Option.d.ts +0 -158
  42. package/dist/src/model/Option.d.ts.map +0 -1
  43. package/dist/src/model/Option.js +0 -53
  44. package/dist/src/model/Path.d.ts +0 -35
  45. package/dist/src/model/Path.d.ts.map +0 -1
  46. package/dist/src/model/Path.js +0 -51
  47. package/dist/src/model/StateTransition.d.ts +0 -201
  48. package/dist/src/model/StateTransition.d.ts.map +0 -1
  49. package/dist/src/model/StateTransition.js +0 -43
  50. package/dist/src/utils/PrefixedHashList.d.ts +0 -15
  51. package/dist/src/utils/PrefixedHashList.d.ts.map +0 -1
  52. package/dist/src/utils/PrefixedHashList.js +0 -28
  53. package/dist/src/utils/ProvableHashList.d.ts +0 -30
  54. package/dist/src/utils/ProvableHashList.d.ts.map +0 -1
  55. package/dist/src/utils/ProvableHashList.js +0 -43
  56. package/dist/utils/PrefixedHashList.d.ts +0 -14
  57. package/dist/utils/PrefixedHashList.d.ts.map +0 -1
  58. package/dist/utils/PrefixedHashList.js +0 -12
  59. package/dist/utils/PrefixedProvableHashList.d.ts +0 -8
  60. package/dist/utils/PrefixedProvableHashList.d.ts.map +0 -1
  61. package/dist/utils/PrefixedProvableHashList.js +0 -12
  62. package/dist/utils/ProvableHashList.d.ts +0 -26
  63. package/dist/utils/ProvableHashList.d.ts.map +0 -1
  64. package/dist/utils/ProvableHashList.js +0 -35
  65. package/dist/utils/Utils.d.ts +0 -22
  66. package/dist/utils/Utils.d.ts.map +0 -1
  67. package/dist/utils/Utils.js +0 -41
  68. package/dist/utils/merkletree/MemoryMerkleTreeStorage.d.ts +0 -26
  69. package/dist/utils/merkletree/MemoryMerkleTreeStorage.d.ts.map +0 -1
  70. package/dist/utils/merkletree/MemoryMerkleTreeStorage.js +0 -79
  71. package/dist/utils/merkletree/RollupMerkleTree.d.ts +0 -143
  72. package/dist/utils/merkletree/RollupMerkleTree.d.ts.map +0 -1
  73. package/dist/utils/merkletree/RollupMerkleTree.js +0 -246
@@ -1,17 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { injectable } from "tsyringe";
8
- import { RollupMerkleWitness } from "../../utils/merkletree/RollupMerkleTree.js";
9
- let NoOpStateTransitionWitnessProvider = class NoOpStateTransitionWitnessProvider {
10
- getWitness() {
11
- return new RollupMerkleWitness({ path: [], isLeft: [] });
12
- }
13
- };
14
- NoOpStateTransitionWitnessProvider = __decorate([
15
- injectable()
16
- ], NoOpStateTransitionWitnessProvider);
17
- export { NoOpStateTransitionWitnessProvider };
@@ -1,158 +0,0 @@
1
- import { Bool, Field, type FlexibleProvablePure } from "snarkyjs";
2
- export declare function ProvableOption(value: { isSome: Bool; value: Field }): {
3
- isSome: {
4
- toField: {};
5
- not: {};
6
- and: {};
7
- or: {};
8
- assertEquals: {};
9
- assertTrue: {};
10
- assertFalse: {};
11
- equals: {};
12
- sizeInFields: {};
13
- toFields: {};
14
- toString: {};
15
- toJSON: {};
16
- toBoolean: {};
17
- };
18
- value: {
19
- neg: {};
20
- inv: {};
21
- add: {};
22
- sub: {};
23
- mul: {};
24
- div: {};
25
- square: {};
26
- sqrt: {};
27
- toString: {};
28
- toBigInt: {};
29
- toJSON: {};
30
- sizeInFields: {};
31
- toFields: {};
32
- lessThan: {};
33
- lessThanOrEqual: {};
34
- greaterThan: {};
35
- greaterThanOrEqual: {};
36
- assertLessThan: {};
37
- assertLessThanOrEqual: {};
38
- assertGreaterThan: {};
39
- assertGreaterThanOrEqual: {};
40
- lt: {};
41
- lte: {};
42
- gt: {};
43
- gte: {};
44
- assertLt: {};
45
- assertLte: {};
46
- assertGt: {};
47
- assertGte: {};
48
- assertEquals: {};
49
- assertBool: {};
50
- assertBoolean: {};
51
- isZero: {};
52
- toBits: {};
53
- equals: {};
54
- seal: {};
55
- rangeCheckHelper: {};
56
- isConstant: {};
57
- toConstant: {};
58
- fromFields: {};
59
- };
60
- };
61
- export type ProvableOptionStruct = ReturnType<typeof ProvableOption>;
62
- /**
63
- * Option facilitating in-circuit values that may or may not exist.
64
- */
65
- export declare class Option<Value> {
66
- isSome: Bool;
67
- value: Value;
68
- valueType: FlexibleProvablePure<Value>;
69
- /**
70
- * Creates a new Option from the provided parameters
71
- *
72
- * @param isSome
73
- * @param value
74
- * @param valueType
75
- * @returns New option from the provided parameters.
76
- */
77
- static from<Value>(
78
- isSome: Bool,
79
- value: Value,
80
- valueType: FlexibleProvablePure<Value>
81
- ): Option<Value>;
82
- /**
83
- * @returns Empty / none option
84
- */
85
- static none(): Option<Field>;
86
- constructor(
87
- isSome: Bool,
88
- value: Value,
89
- valueType: FlexibleProvablePure<Value>
90
- );
91
- /**
92
- * @returns Tree representation of the current value
93
- */
94
- get treeValue(): Field;
95
- /**
96
- * @returns Provable representation of the current option.
97
- */
98
- toProvable(): {
99
- isSome: {
100
- toField: {};
101
- not: {};
102
- and: {};
103
- or: {};
104
- assertEquals: {};
105
- assertTrue: {};
106
- assertFalse: {};
107
- equals: {};
108
- sizeInFields: {};
109
- toFields: {};
110
- toString: {};
111
- toJSON: {};
112
- toBoolean: {};
113
- };
114
- value: {
115
- neg: {};
116
- inv: {};
117
- add: {};
118
- sub: {};
119
- mul: {};
120
- div: {};
121
- square: {};
122
- sqrt: {};
123
- toString: {};
124
- toBigInt: {};
125
- toJSON: {};
126
- sizeInFields: {};
127
- toFields: {};
128
- lessThan: {};
129
- lessThanOrEqual: {};
130
- greaterThan: {};
131
- greaterThanOrEqual: {};
132
- assertLessThan: {};
133
- assertLessThanOrEqual: {};
134
- assertGreaterThan: {};
135
- assertGreaterThanOrEqual: {};
136
- lt: {};
137
- lte: {};
138
- gt: {};
139
- gte: {};
140
- assertLt: {};
141
- assertLte: {};
142
- assertGt: {};
143
- assertGte: {};
144
- assertEquals: {};
145
- assertBool: {};
146
- assertBoolean: {};
147
- isZero: {};
148
- toBits: {};
149
- equals: {};
150
- seal: {};
151
- rangeCheckHelper: {};
152
- isConstant: {};
153
- toConstant: {};
154
- fromFields: {};
155
- };
156
- };
157
- }
158
- //# sourceMappingURL=Option.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../src/model/Option.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAW,KAAK,EAAE,KAAK,oBAAoB,EAAoB,MAAM,UAAU,CAAC;AAE7F,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAInE;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAErE;;GAEG;AACH,qBAAa,MAAM,CAAC,KAAK;IAoBG,MAAM,EAAE,IAAI;IAAS,KAAK,EAAE,KAAK;IAAS,SAAS,EAAE,oBAAoB,CAAC,KAAK,CAAC;IAnB1G;;;;;;;OAOG;WACW,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,oBAAoB,CAAC,KAAK,CAAC;IAI5F;;OAEG;WACW,IAAI;gBAIQ,MAAM,EAAE,IAAI,EAAS,KAAK,EAAE,KAAK,EAAS,SAAS,EAAE,oBAAoB,CAAC,KAAK,CAAC;IAE1G;;OAEG;IACH,IAAW,SAAS,UAMnB;IAED;;OAEG;IACI,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMlB"}
@@ -1,53 +0,0 @@
1
- /* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
2
- /* eslint-disable new-cap */
3
- /* eslint-disable max-classes-per-file */
4
- import { Bool, Circuit, Field, Poseidon, Struct } from "snarkyjs";
5
- export function ProvableOption(value) {
6
- class ProvableOptionStruct extends Struct(value) {}
7
- return new ProvableOptionStruct(value);
8
- }
9
- /**
10
- * Option facilitating in-circuit values that may or may not exist.
11
- */
12
- export class Option {
13
- /**
14
- * Creates a new Option from the provided parameters
15
- *
16
- * @param isSome
17
- * @param value
18
- * @param valueType
19
- * @returns New option from the provided parameters.
20
- */
21
- static from(isSome, value, valueType) {
22
- return new Option(isSome, value, valueType);
23
- }
24
- /**
25
- * @returns Empty / none option
26
- */
27
- static none() {
28
- return new Option(Bool(false), Field(0), Field);
29
- }
30
- constructor(isSome, value, valueType) {
31
- this.isSome = isSome;
32
- this.value = value;
33
- this.valueType = valueType;
34
- }
35
- /**
36
- * @returns Tree representation of the current value
37
- */
38
- get treeValue() {
39
- const treeValue = Poseidon.hash(this.valueType.toFields(this.value));
40
- // if the sequencer claims the value is `None`,
41
- // then we use Field(0) as the treeValue so it can be proven later
42
- return Circuit.if(this.isSome, treeValue, Field(0));
43
- }
44
- /**
45
- * @returns Provable representation of the current option.
46
- */
47
- toProvable() {
48
- return ProvableOption({
49
- isSome: this.isSome,
50
- value: this.treeValue,
51
- });
52
- }
53
- }
@@ -1,35 +0,0 @@
1
- import { Field, type FlexibleProvablePure } from "snarkyjs";
2
- /**
3
- * Helps manage path (key) identifiers for key-values in trees.
4
- */
5
- export declare class Path {
6
- /**
7
- * Encodes a JS string as a Field
8
- *
9
- * @param value
10
- * @returns Field representation of the provided value
11
- */
12
- static toField(value: string): Field;
13
- /**
14
- * Encodes a class name and its property name into a Field
15
- *
16
- * @param className
17
- * @param propertyKey
18
- * @returns Field representation of class name + property name
19
- */
20
- static fromProperty(className: string, propertyKey: string): Field;
21
- /**
22
- * Encodes an existing path with the provided key into a single Field.
23
- *
24
- * @param path
25
- * @param keyType
26
- * @param key
27
- * @returns Field representation of the leading path + the provided key.
28
- */
29
- static fromKey<KeyType>(
30
- path: Field,
31
- keyType: FlexibleProvablePure<KeyType>,
32
- key: KeyType
33
- ): Field;
34
- }
35
- //# sourceMappingURL=Path.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../../src/model/Path.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,KAAK,oBAAoB,EAAY,MAAM,UAAU,CAAC;AAEtE;;GAEG;AACH,qBAAa,IAAI;IACf;;;;;OAKG;WACW,OAAO,CAAC,KAAK,EAAE,MAAM;IAUnC;;;;;;OAMG;WACW,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,KAAK;IAQzE;;;;;;;OAOG;WACW,OAAO,CAAC,OAAO,EAC3B,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACtC,GAAG,EAAE,OAAO,GACX,KAAK;CAIT"}
@@ -1,51 +0,0 @@
1
- /* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
2
- /* eslint-disable new-cap */
3
- /* eslint-disable @typescript-eslint/no-extraneous-class */
4
- /* eslint-disable @shopify/no-fully-static-classes */
5
- /* eslint-disable import/prefer-default-export */
6
- import { Field, Poseidon } from "snarkyjs";
7
- /**
8
- * Helps manage path (key) identifiers for key-values in trees.
9
- */
10
- export class Path {
11
- /**
12
- * Encodes a JS string as a Field
13
- *
14
- * @param value
15
- * @returns Field representation of the provided value
16
- */
17
- static toField(value) {
18
- const fields = value
19
- .split("")
20
- .map((character) => character.codePointAt(0))
21
- .filter((code) => code !== undefined)
22
- .map((code) => Field(code));
23
- return Poseidon.hash(fields);
24
- }
25
- /**
26
- * Encodes a class name and its property name into a Field
27
- *
28
- * @param className
29
- * @param propertyKey
30
- * @returns Field representation of class name + property name
31
- */
32
- static fromProperty(className, propertyKey) {
33
- return Poseidon.hash([
34
- Path.toField(className),
35
- Path.toField(propertyKey),
36
- Field(0),
37
- ]);
38
- }
39
- /**
40
- * Encodes an existing path with the provided key into a single Field.
41
- *
42
- * @param path
43
- * @param keyType
44
- * @param key
45
- * @returns Field representation of the leading path + the provided key.
46
- */
47
- static fromKey(path, keyType, key) {
48
- const keyHash = Poseidon.hash(keyType.toFields(key));
49
- return Poseidon.hash([path, keyHash]);
50
- }
51
- }
@@ -1,201 +0,0 @@
1
- import { Field } from "snarkyjs";
2
- import { Option, ProvableOptionStruct } from "./Option.js";
3
- /**
4
- * Provable representation of a State Transition, used to
5
- * normalize state transitions of various value types for
6
- * the state transition circuit.
7
- */
8
- export declare function ProvableStateTransition(value: {
9
- path: Field;
10
- from: ProvableOptionStruct;
11
- to: ProvableOptionStruct;
12
- }): {
13
- path: {
14
- neg: {};
15
- inv: {};
16
- add: {};
17
- sub: {};
18
- mul: {};
19
- div: {};
20
- square: {};
21
- sqrt: {};
22
- toString: {};
23
- toBigInt: {};
24
- toJSON: {};
25
- sizeInFields: {};
26
- toFields: {};
27
- lessThan: {};
28
- lessThanOrEqual: {};
29
- greaterThan: {};
30
- greaterThanOrEqual: {};
31
- assertLessThan: {};
32
- assertLessThanOrEqual: {};
33
- assertGreaterThan: {};
34
- assertGreaterThanOrEqual: {};
35
- lt: {};
36
- lte: {};
37
- gt: {};
38
- gte: {};
39
- assertLt: {};
40
- assertLte: {};
41
- assertGt: {};
42
- assertGte: {};
43
- assertEquals: {};
44
- assertBool: {};
45
- assertBoolean: {};
46
- isZero: {};
47
- toBits: {};
48
- equals: {};
49
- seal: {};
50
- rangeCheckHelper: {};
51
- isConstant: {};
52
- toConstant: {};
53
- fromFields: {};
54
- };
55
- from: {
56
- isSome: {
57
- toField: {};
58
- not: {};
59
- and: {};
60
- or: {};
61
- assertEquals: {};
62
- assertTrue: {};
63
- assertFalse: {};
64
- equals: {};
65
- sizeInFields: {};
66
- toFields: {};
67
- toString: {};
68
- toJSON: {};
69
- toBoolean: {};
70
- };
71
- value: {
72
- neg: {};
73
- inv: {};
74
- add: {};
75
- sub: {};
76
- mul: {};
77
- div: {};
78
- square: {};
79
- sqrt: {};
80
- toString: {};
81
- toBigInt: {};
82
- toJSON: {};
83
- sizeInFields: {};
84
- toFields: {};
85
- lessThan: {};
86
- lessThanOrEqual: {};
87
- greaterThan: {};
88
- greaterThanOrEqual: {};
89
- assertLessThan: {};
90
- assertLessThanOrEqual: {};
91
- assertGreaterThan: {};
92
- assertGreaterThanOrEqual: {};
93
- lt: {};
94
- lte: {};
95
- gt: {};
96
- gte: {};
97
- assertLt: {};
98
- assertLte: {};
99
- assertGt: {};
100
- assertGte: {};
101
- assertEquals: {};
102
- assertBool: {};
103
- assertBoolean: {};
104
- isZero: {};
105
- toBits: {};
106
- equals: {};
107
- seal: {};
108
- rangeCheckHelper: {};
109
- isConstant: {};
110
- toConstant: {};
111
- fromFields: {};
112
- };
113
- };
114
- to: {
115
- isSome: {
116
- toField: {};
117
- not: {};
118
- and: {};
119
- or: {};
120
- assertEquals: {};
121
- assertTrue: {};
122
- assertFalse: {};
123
- equals: {};
124
- sizeInFields: {};
125
- toFields: {};
126
- toString: {};
127
- toJSON: {};
128
- toBoolean: {};
129
- };
130
- value: {
131
- neg: {};
132
- inv: {};
133
- add: {};
134
- sub: {};
135
- mul: {};
136
- div: {};
137
- square: {};
138
- sqrt: {};
139
- toString: {};
140
- toBigInt: {};
141
- toJSON: {};
142
- sizeInFields: {};
143
- toFields: {};
144
- lessThan: {};
145
- lessThanOrEqual: {};
146
- greaterThan: {};
147
- greaterThanOrEqual: {};
148
- assertLessThan: {};
149
- assertLessThanOrEqual: {};
150
- assertGreaterThan: {};
151
- assertGreaterThanOrEqual: {};
152
- lt: {};
153
- lte: {};
154
- gt: {};
155
- gte: {};
156
- assertLt: {};
157
- assertLte: {};
158
- assertGt: {};
159
- assertGte: {};
160
- assertEquals: {};
161
- assertBool: {};
162
- assertBoolean: {};
163
- isZero: {};
164
- toBits: {};
165
- equals: {};
166
- seal: {};
167
- rangeCheckHelper: {};
168
- isConstant: {};
169
- toConstant: {};
170
- fromFields: {};
171
- };
172
- };
173
- };
174
- export type ProvableStateTransitionStruct = ReturnType<
175
- typeof ProvableStateTransition
176
- >;
177
- /**
178
- * Generic state transition that constraints the current method circuit
179
- * to external state, by providing a state anchor.
180
- */
181
- export declare class StateTransition<Value> {
182
- path: Field;
183
- from: Option<Field> | Option<Value>;
184
- to: Option<Field> | Option<Value>;
185
- toValue?: Value | undefined;
186
- static from<Value>(path: Field, from: Option<Value>): StateTransition<Value>;
187
- static fromTo<Value>(
188
- path: Field,
189
- from: Option<Field> | Option<Value>,
190
- to: Option<Field> | Option<Value>,
191
- toValue: Value
192
- ): StateTransition<Value>;
193
- constructor(
194
- path: Field,
195
- from: Option<Field> | Option<Value>,
196
- to: Option<Field> | Option<Value>,
197
- toValue?: Value | undefined
198
- );
199
- toProvable(): ProvableStateTransitionStruct;
200
- }
201
- //# sourceMappingURL=StateTransition.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StateTransition.d.ts","sourceRoot":"","sources":["../../../src/model/StateTransition.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAU,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,oBAAoB,CAAC;IAAC,EAAE,EAAE,oBAAoB,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAInH;AAED,MAAM,MAAM,6BAA6B,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAEvF;;;GAGG;AACH,qBAAa,eAAe,CAAC,KAAK;IAYvB,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;IACnC,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;IACjC,OAAO,CAAC;WAdH,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC;WAK5C,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK;gBAMtH,IAAI,EAAE,KAAK,EACX,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EACnC,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EACjC,OAAO,CAAC,mBAAO;IAGjB,UAAU,IAAI,6BAA6B;CAOnD"}
@@ -1,43 +0,0 @@
1
- /* eslint-disable import/no-unused-modules */
2
- /* eslint-disable max-classes-per-file */
3
- /* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
4
- /* eslint-disable new-cap */
5
- /* eslint-disable import/prefer-default-export */
6
- import { Struct } from "snarkyjs";
7
- import { Option } from "./Option.js";
8
- /**
9
- * Provable representation of a State Transition, used to
10
- * normalize state transitions of various value types for
11
- * the state transition circuit.
12
- */
13
- export function ProvableStateTransition(value) {
14
- class ProvableStateTransitionStruct extends Struct(value) {}
15
- return new ProvableStateTransitionStruct(value);
16
- }
17
- /**
18
- * Generic state transition that constraints the current method circuit
19
- * to external state, by providing a state anchor.
20
- */
21
- export class StateTransition {
22
- static from(path, from) {
23
- return new StateTransition(path, from, Option.none());
24
- }
25
- // eslint-disable-next-line max-params
26
- static fromTo(path, from, to, toValue) {
27
- return new StateTransition(path, from, to, toValue);
28
- }
29
- // eslint-disable-next-line max-params
30
- constructor(path, from, to, toValue) {
31
- this.path = path;
32
- this.from = from;
33
- this.to = to;
34
- this.toValue = toValue;
35
- }
36
- toProvable() {
37
- return ProvableStateTransition({
38
- path: this.path,
39
- from: this.from.toProvable(),
40
- to: this.to.toProvable(),
41
- });
42
- }
43
- }
@@ -1,15 +0,0 @@
1
- import { Field, FlexibleProvablePure } from "snarkyjs";
2
- import { ProvableHashList } from "./ProvableHashList.js";
3
- export declare class PrefixedProvableHashList<
4
- Value
5
- > extends ProvableHashList<Value> {
6
- private readonly prefix;
7
- constructor(
8
- valueType: FlexibleProvablePure<Value>,
9
- prefix: string,
10
- internalCommitment?: Field
11
- );
12
- protected hash(e: Field[]): Field;
13
- }
14
- export declare function prefixToField(prefix: string): Field;
15
- //# sourceMappingURL=PrefixedHashList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrefixedHashList.d.ts","sourceRoot":"","sources":["../../../src/utils/PrefixedHashList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAY,MAAM,UAAU,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,qBAAa,wBAAwB,CAAC,KAAK,CAAE,SAAQ,gBAAgB,CAAC,KAAK,CAAC;IAE1E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAG7B,SAAS,EAAE,oBAAoB,CAAC,KAAK,CAAC,EACtC,MAAM,EAAE,MAAM,EACd,kBAAkB,GAAE,KAAgB;IAMtC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK;CAIlC;AAGD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,SAmB3C"}
@@ -1,28 +0,0 @@
1
- import { Field, Poseidon } from "snarkyjs";
2
- import { TextEncoder } from "node:util";
3
- import { ProvableHashList } from "./ProvableHashList.js";
4
- export class PrefixedProvableHashList extends ProvableHashList {
5
- constructor(valueType, prefix, internalCommitment = Field(0)) {
6
- super(valueType, internalCommitment);
7
- this.prefix = prefixToField(prefix);
8
- }
9
- hash(e) {
10
- return Poseidon.hash([this.prefix, ...e]);
11
- }
12
- }
13
- export function prefixToField(prefix) {
14
- const fieldSize = Field.sizeInBytes();
15
- if (prefix.length >= fieldSize) {
16
- throw new Error("prefix too long");
17
- }
18
- const encoder = new TextEncoder();
19
- function stringToBytes(s) {
20
- return Array.from(encoder.encode(s));
21
- }
22
- const stringBytes = stringToBytes(prefix);
23
- const padding = Array.from({ length: fieldSize - stringBytes.length }).fill(
24
- 0
25
- );
26
- const data = stringBytes.concat(padding);
27
- return Field.fromBytes(data);
28
- }
@@ -1,30 +0,0 @@
1
- import { type Bool, Field } from "snarkyjs";
2
- import { FlexibleProvablePure } from "snarkyjs";
3
- /**
4
- * Utilities for creating a hash list from a given value type.
5
- */
6
- export declare abstract class ProvableHashList<Value> {
7
- private readonly valueType;
8
- commitment: Field;
9
- constructor(valueType: FlexibleProvablePure<Value>, commitment?: Field);
10
- protected abstract hash(e: Field[]): Field;
11
- /**
12
- * Converts the provided value to Field[] and appends it to
13
- * the current hashlist.
14
- *
15
- * @param value - Value to be appended to the hash list
16
- * @returns Current hash list.
17
- */
18
- push(value: Value): this;
19
- remove(preimage: Field, value: Value): Bool;
20
- /**
21
- * @returns Traling hash of the current hashlist.
22
- */
23
- toField(): Field;
24
- }
25
- export declare class DefaultProvableHashList<
26
- Value
27
- > extends ProvableHashList<Value> {
28
- hash(e: Field[]): Field;
29
- }
30
- //# sourceMappingURL=ProvableHashList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProvableHashList.d.ts","sourceRoot":"","sources":["../../../src/utils/ProvableHashList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAW,KAAK,EAAY,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGhD;;GAEG;AACH,8BAAsB,gBAAgB,CAAC,KAAK;IAGxC,OAAO,CAAC,QAAQ,CAAC,SAAS;IACnB,UAAU,EAAE,KAAK;gBADP,SAAS,EAAE,oBAAoB,CAAC,KAAK,CAAC,EAChD,UAAU,GAAE,KAAgB;IAIrC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK;IAE1C;;;;;;OAMG;IACI,IAAI,CAAC,KAAK,EAAE,KAAK;IAKjB,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAMlD;;OAEG;IACI,OAAO;CAIf;AAED,qBAAa,uBAAuB,CAAC,KAAK,CAAE,SAAQ,gBAAgB,CAAC,KAAK,CAAC;IAElE,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK;CAI/B"}