@rohan-protocol/sdk 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -97
- package/dist/client.d.ts +1 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +68 -25
- package/dist/client.js.map +1 -1
- package/dist/identity/bundle.d.ts +68 -0
- package/dist/identity/bundle.d.ts.map +1 -0
- package/dist/identity/bundle.js +259 -0
- package/dist/identity/bundle.js.map +1 -0
- package/dist/identity/did.d.ts +6 -0
- package/dist/identity/did.d.ts.map +1 -1
- package/dist/identity/did.js +53 -0
- package/dist/identity/did.js.map +1 -1
- package/dist/identity/envelope.js +1 -1
- package/dist/identity/envelope.js.map +1 -1
- package/dist/identity/index.d.ts +5 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +5 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/security/canonicalize.d.ts +2 -5
- package/dist/security/canonicalize.d.ts.map +1 -1
- package/dist/security/canonicalize.js +2 -24
- package/dist/security/canonicalize.js.map +1 -1
- package/dist/security/jcs.d.ts +6 -0
- package/dist/security/jcs.d.ts.map +1 -0
- package/dist/security/jcs.js +25 -0
- package/dist/security/jcs.js.map +1 -0
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -16
- package/dist/generated/compiler/contract-info.json +0 -84
- package/dist/generated/contract/index.d.ts +0 -66
- package/dist/generated/contract/index.js +0 -569
- package/dist/generated/contract/index.js.map +0 -8
- package/dist/generated/keys/initial_setup.prover +0 -0
- package/dist/generated/keys/initial_setup.verifier +0 -0
- package/dist/generated/keys/verify_batched_handshakes.prover +0 -0
- package/dist/generated/keys/verify_batched_handshakes.verifier +0 -0
- package/dist/generated/zkir/initial_setup.bzkir +0 -0
- package/dist/generated/zkir/initial_setup.zkir +0 -96
- package/dist/generated/zkir/verify_batched_handshakes.bzkir +0 -0
- package/dist/generated/zkir/verify_batched_handshakes.zkir +0 -155
- package/src/generated/compiler/contract-info.json +0 -84
- package/src/generated/contract/index.d.ts +0 -66
- package/src/generated/contract/index.js +0 -569
- package/src/generated/contract/index.js.map +0 -8
- package/src/generated/keys/initial_setup.prover +0 -0
- package/src/generated/keys/initial_setup.verifier +0 -0
- package/src/generated/keys/verify_batched_handshakes.prover +0 -0
- package/src/generated/keys/verify_batched_handshakes.verifier +0 -0
- package/src/generated/zkir/initial_setup.bzkir +0 -0
- package/src/generated/zkir/initial_setup.zkir +0 -96
- package/src/generated/zkir/verify_batched_handshakes.bzkir +0 -0
- package/src/generated/zkir/verify_batched_handshakes.zkir +0 -155
|
@@ -1,569 +0,0 @@
|
|
|
1
|
-
import * as __compactRuntime from '@midnight-ntwrk/compact-runtime';
|
|
2
|
-
__compactRuntime.checkRuntimeVersion('0.16.0');
|
|
3
|
-
|
|
4
|
-
const _descriptor_0 = new __compactRuntime.CompactTypeUnsignedInteger(18446744073709551615n, 8);
|
|
5
|
-
|
|
6
|
-
const _descriptor_1 = new __compactRuntime.CompactTypeBytes(32);
|
|
7
|
-
|
|
8
|
-
const _descriptor_2 = __compactRuntime.CompactTypeBoolean;
|
|
9
|
-
|
|
10
|
-
class _Either_0 {
|
|
11
|
-
alignment() {
|
|
12
|
-
return _descriptor_2.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment()));
|
|
13
|
-
}
|
|
14
|
-
fromValue(value_0) {
|
|
15
|
-
return {
|
|
16
|
-
is_left: _descriptor_2.fromValue(value_0),
|
|
17
|
-
left: _descriptor_1.fromValue(value_0),
|
|
18
|
-
right: _descriptor_1.fromValue(value_0)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
toValue(value_0) {
|
|
22
|
-
return _descriptor_2.toValue(value_0.is_left).concat(_descriptor_1.toValue(value_0.left).concat(_descriptor_1.toValue(value_0.right)));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const _descriptor_3 = new _Either_0();
|
|
27
|
-
|
|
28
|
-
const _descriptor_4 = new __compactRuntime.CompactTypeUnsignedInteger(340282366920938463463374607431768211455n, 16);
|
|
29
|
-
|
|
30
|
-
class _ContractAddress_0 {
|
|
31
|
-
alignment() {
|
|
32
|
-
return _descriptor_1.alignment();
|
|
33
|
-
}
|
|
34
|
-
fromValue(value_0) {
|
|
35
|
-
return {
|
|
36
|
-
bytes: _descriptor_1.fromValue(value_0)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
toValue(value_0) {
|
|
40
|
-
return _descriptor_1.toValue(value_0.bytes);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const _descriptor_5 = new _ContractAddress_0();
|
|
45
|
-
|
|
46
|
-
const _descriptor_6 = new __compactRuntime.CompactTypeUnsignedInteger(255n, 1);
|
|
47
|
-
|
|
48
|
-
export class Contract {
|
|
49
|
-
witnesses;
|
|
50
|
-
constructor(...args_0) {
|
|
51
|
-
if (args_0.length !== 1) {
|
|
52
|
-
throw new __compactRuntime.CompactError(`Contract constructor: expected 1 argument, received ${args_0.length}`);
|
|
53
|
-
}
|
|
54
|
-
const witnesses_0 = args_0[0];
|
|
55
|
-
if (typeof(witnesses_0) !== 'object') {
|
|
56
|
-
throw new __compactRuntime.CompactError('first (witnesses) argument to Contract constructor is not an object');
|
|
57
|
-
}
|
|
58
|
-
this.witnesses = witnesses_0;
|
|
59
|
-
this.circuits = {
|
|
60
|
-
initial_setup: (...args_1) => {
|
|
61
|
-
if (args_1.length !== 3) {
|
|
62
|
-
throw new __compactRuntime.CompactError(`initial_setup: expected 3 arguments (as invoked from Typescript), received ${args_1.length}`);
|
|
63
|
-
}
|
|
64
|
-
const contextOrig_0 = args_1[0];
|
|
65
|
-
const initial_root_0 = args_1[1];
|
|
66
|
-
const relayer_identity_0 = args_1[2];
|
|
67
|
-
if (!(typeof(contextOrig_0) === 'object' && contextOrig_0.currentQueryContext != undefined)) {
|
|
68
|
-
__compactRuntime.typeError('initial_setup',
|
|
69
|
-
'argument 1 (as invoked from Typescript)',
|
|
70
|
-
'rohan_handshake.compact line 17 char 1',
|
|
71
|
-
'CircuitContext',
|
|
72
|
-
contextOrig_0)
|
|
73
|
-
}
|
|
74
|
-
if (!(initial_root_0.buffer instanceof ArrayBuffer && initial_root_0.BYTES_PER_ELEMENT === 1 && initial_root_0.length === 32)) {
|
|
75
|
-
__compactRuntime.typeError('initial_setup',
|
|
76
|
-
'argument 1 (argument 2 as invoked from Typescript)',
|
|
77
|
-
'rohan_handshake.compact line 17 char 1',
|
|
78
|
-
'Bytes<32>',
|
|
79
|
-
initial_root_0)
|
|
80
|
-
}
|
|
81
|
-
if (!(relayer_identity_0.buffer instanceof ArrayBuffer && relayer_identity_0.BYTES_PER_ELEMENT === 1 && relayer_identity_0.length === 32)) {
|
|
82
|
-
__compactRuntime.typeError('initial_setup',
|
|
83
|
-
'argument 2 (argument 3 as invoked from Typescript)',
|
|
84
|
-
'rohan_handshake.compact line 17 char 1',
|
|
85
|
-
'Bytes<32>',
|
|
86
|
-
relayer_identity_0)
|
|
87
|
-
}
|
|
88
|
-
const context = { ...contextOrig_0, gasCost: __compactRuntime.emptyRunningCost() };
|
|
89
|
-
const partialProofData = {
|
|
90
|
-
input: {
|
|
91
|
-
value: _descriptor_1.toValue(initial_root_0).concat(_descriptor_1.toValue(relayer_identity_0)),
|
|
92
|
-
alignment: _descriptor_1.alignment().concat(_descriptor_1.alignment())
|
|
93
|
-
},
|
|
94
|
-
output: undefined,
|
|
95
|
-
publicTranscript: [],
|
|
96
|
-
privateTranscriptOutputs: []
|
|
97
|
-
};
|
|
98
|
-
const result_0 = this._initial_setup_0(context,
|
|
99
|
-
partialProofData,
|
|
100
|
-
initial_root_0,
|
|
101
|
-
relayer_identity_0);
|
|
102
|
-
partialProofData.output = { value: [], alignment: [] };
|
|
103
|
-
return { result: result_0, context: context, proofData: partialProofData, gasCost: context.gasCost };
|
|
104
|
-
},
|
|
105
|
-
verify_batched_handshakes: (...args_1) => {
|
|
106
|
-
if (args_1.length !== 6) {
|
|
107
|
-
throw new __compactRuntime.CompactError(`verify_batched_handshakes: expected 6 arguments (as invoked from Typescript), received ${args_1.length}`);
|
|
108
|
-
}
|
|
109
|
-
const contextOrig_0 = args_1[0];
|
|
110
|
-
const previous_root_0 = args_1[1];
|
|
111
|
-
const new_root_0 = args_1[2];
|
|
112
|
-
const proof_commitment_0 = args_1[3];
|
|
113
|
-
const caller_identity_0 = args_1[4];
|
|
114
|
-
const toll_amount_0 = args_1[5];
|
|
115
|
-
if (!(typeof(contextOrig_0) === 'object' && contextOrig_0.currentQueryContext != undefined)) {
|
|
116
|
-
__compactRuntime.typeError('verify_batched_handshakes',
|
|
117
|
-
'argument 1 (as invoked from Typescript)',
|
|
118
|
-
'rohan_handshake.compact line 35 char 1',
|
|
119
|
-
'CircuitContext',
|
|
120
|
-
contextOrig_0)
|
|
121
|
-
}
|
|
122
|
-
if (!(previous_root_0.buffer instanceof ArrayBuffer && previous_root_0.BYTES_PER_ELEMENT === 1 && previous_root_0.length === 32)) {
|
|
123
|
-
__compactRuntime.typeError('verify_batched_handshakes',
|
|
124
|
-
'argument 1 (argument 2 as invoked from Typescript)',
|
|
125
|
-
'rohan_handshake.compact line 35 char 1',
|
|
126
|
-
'Bytes<32>',
|
|
127
|
-
previous_root_0)
|
|
128
|
-
}
|
|
129
|
-
if (!(new_root_0.buffer instanceof ArrayBuffer && new_root_0.BYTES_PER_ELEMENT === 1 && new_root_0.length === 32)) {
|
|
130
|
-
__compactRuntime.typeError('verify_batched_handshakes',
|
|
131
|
-
'argument 2 (argument 3 as invoked from Typescript)',
|
|
132
|
-
'rohan_handshake.compact line 35 char 1',
|
|
133
|
-
'Bytes<32>',
|
|
134
|
-
new_root_0)
|
|
135
|
-
}
|
|
136
|
-
if (!(proof_commitment_0.buffer instanceof ArrayBuffer && proof_commitment_0.BYTES_PER_ELEMENT === 1 && proof_commitment_0.length === 32)) {
|
|
137
|
-
__compactRuntime.typeError('verify_batched_handshakes',
|
|
138
|
-
'argument 3 (argument 4 as invoked from Typescript)',
|
|
139
|
-
'rohan_handshake.compact line 35 char 1',
|
|
140
|
-
'Bytes<32>',
|
|
141
|
-
proof_commitment_0)
|
|
142
|
-
}
|
|
143
|
-
if (!(caller_identity_0.buffer instanceof ArrayBuffer && caller_identity_0.BYTES_PER_ELEMENT === 1 && caller_identity_0.length === 32)) {
|
|
144
|
-
__compactRuntime.typeError('verify_batched_handshakes',
|
|
145
|
-
'argument 4 (argument 5 as invoked from Typescript)',
|
|
146
|
-
'rohan_handshake.compact line 35 char 1',
|
|
147
|
-
'Bytes<32>',
|
|
148
|
-
caller_identity_0)
|
|
149
|
-
}
|
|
150
|
-
if (!(typeof(toll_amount_0) === 'bigint' && toll_amount_0 >= 0n && toll_amount_0 <= 18446744073709551615n)) {
|
|
151
|
-
__compactRuntime.typeError('verify_batched_handshakes',
|
|
152
|
-
'argument 5 (argument 6 as invoked from Typescript)',
|
|
153
|
-
'rohan_handshake.compact line 35 char 1',
|
|
154
|
-
'Uint<0..18446744073709551616>',
|
|
155
|
-
toll_amount_0)
|
|
156
|
-
}
|
|
157
|
-
const context = { ...contextOrig_0, gasCost: __compactRuntime.emptyRunningCost() };
|
|
158
|
-
const partialProofData = {
|
|
159
|
-
input: {
|
|
160
|
-
value: _descriptor_1.toValue(previous_root_0).concat(_descriptor_1.toValue(new_root_0).concat(_descriptor_1.toValue(proof_commitment_0).concat(_descriptor_1.toValue(caller_identity_0).concat(_descriptor_0.toValue(toll_amount_0))))),
|
|
161
|
-
alignment: _descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_1.alignment().concat(_descriptor_0.alignment()))))
|
|
162
|
-
},
|
|
163
|
-
output: undefined,
|
|
164
|
-
publicTranscript: [],
|
|
165
|
-
privateTranscriptOutputs: []
|
|
166
|
-
};
|
|
167
|
-
const result_0 = this._verify_batched_handshakes_0(context,
|
|
168
|
-
partialProofData,
|
|
169
|
-
previous_root_0,
|
|
170
|
-
new_root_0,
|
|
171
|
-
proof_commitment_0,
|
|
172
|
-
caller_identity_0,
|
|
173
|
-
toll_amount_0);
|
|
174
|
-
partialProofData.output = { value: [], alignment: [] };
|
|
175
|
-
return { result: result_0, context: context, proofData: partialProofData, gasCost: context.gasCost };
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
this.impureCircuits = {
|
|
179
|
-
initial_setup: this.circuits.initial_setup,
|
|
180
|
-
verify_batched_handshakes: this.circuits.verify_batched_handshakes
|
|
181
|
-
};
|
|
182
|
-
this.provableCircuits = {
|
|
183
|
-
initial_setup: this.circuits.initial_setup,
|
|
184
|
-
verify_batched_handshakes: this.circuits.verify_batched_handshakes
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
initialState(...args_0) {
|
|
188
|
-
if (args_0.length !== 1) {
|
|
189
|
-
throw new __compactRuntime.CompactError(`Contract state constructor: expected 1 argument (as invoked from Typescript), received ${args_0.length}`);
|
|
190
|
-
}
|
|
191
|
-
const constructorContext_0 = args_0[0];
|
|
192
|
-
if (typeof(constructorContext_0) !== 'object') {
|
|
193
|
-
throw new __compactRuntime.CompactError(`Contract state constructor: expected 'constructorContext' in argument 1 (as invoked from Typescript) to be an object`);
|
|
194
|
-
}
|
|
195
|
-
if (!('initialZswapLocalState' in constructorContext_0)) {
|
|
196
|
-
throw new __compactRuntime.CompactError(`Contract state constructor: expected 'initialZswapLocalState' in argument 1 (as invoked from Typescript)`);
|
|
197
|
-
}
|
|
198
|
-
if (typeof(constructorContext_0.initialZswapLocalState) !== 'object') {
|
|
199
|
-
throw new __compactRuntime.CompactError(`Contract state constructor: expected 'initialZswapLocalState' in argument 1 (as invoked from Typescript) to be an object`);
|
|
200
|
-
}
|
|
201
|
-
const state_0 = new __compactRuntime.ContractState();
|
|
202
|
-
let stateValue_0 = __compactRuntime.StateValue.newArray();
|
|
203
|
-
stateValue_0 = stateValue_0.arrayPush(__compactRuntime.StateValue.newNull());
|
|
204
|
-
stateValue_0 = stateValue_0.arrayPush(__compactRuntime.StateValue.newNull());
|
|
205
|
-
stateValue_0 = stateValue_0.arrayPush(__compactRuntime.StateValue.newNull());
|
|
206
|
-
stateValue_0 = stateValue_0.arrayPush(__compactRuntime.StateValue.newNull());
|
|
207
|
-
state_0.data = new __compactRuntime.ChargedState(stateValue_0);
|
|
208
|
-
state_0.setOperation('initial_setup', new __compactRuntime.ContractOperation());
|
|
209
|
-
state_0.setOperation('verify_batched_handshakes', new __compactRuntime.ContractOperation());
|
|
210
|
-
const context = __compactRuntime.createCircuitContext(__compactRuntime.dummyContractAddress(), constructorContext_0.initialZswapLocalState.coinPublicKey, state_0.data, constructorContext_0.initialPrivateState);
|
|
211
|
-
const partialProofData = {
|
|
212
|
-
input: { value: [], alignment: [] },
|
|
213
|
-
output: undefined,
|
|
214
|
-
publicTranscript: [],
|
|
215
|
-
privateTranscriptOutputs: []
|
|
216
|
-
};
|
|
217
|
-
__compactRuntime.queryLedgerState(context,
|
|
218
|
-
partialProofData,
|
|
219
|
-
[
|
|
220
|
-
{ push: { storage: false,
|
|
221
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(0n),
|
|
222
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
223
|
-
{ push: { storage: true,
|
|
224
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_1.toValue(new Uint8Array(32)),
|
|
225
|
-
alignment: _descriptor_1.alignment() }).encode() } },
|
|
226
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
227
|
-
__compactRuntime.queryLedgerState(context,
|
|
228
|
-
partialProofData,
|
|
229
|
-
[
|
|
230
|
-
{ push: { storage: false,
|
|
231
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(1n),
|
|
232
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
233
|
-
{ push: { storage: true,
|
|
234
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_0.toValue(0n),
|
|
235
|
-
alignment: _descriptor_0.alignment() }).encode() } },
|
|
236
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
237
|
-
__compactRuntime.queryLedgerState(context,
|
|
238
|
-
partialProofData,
|
|
239
|
-
[
|
|
240
|
-
{ push: { storage: false,
|
|
241
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(2n),
|
|
242
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
243
|
-
{ push: { storage: true,
|
|
244
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_0.toValue(0n),
|
|
245
|
-
alignment: _descriptor_0.alignment() }).encode() } },
|
|
246
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
247
|
-
__compactRuntime.queryLedgerState(context,
|
|
248
|
-
partialProofData,
|
|
249
|
-
[
|
|
250
|
-
{ push: { storage: false,
|
|
251
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(3n),
|
|
252
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
253
|
-
{ push: { storage: true,
|
|
254
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_1.toValue(new Uint8Array(32)),
|
|
255
|
-
alignment: _descriptor_1.alignment() }).encode() } },
|
|
256
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
257
|
-
state_0.data = new __compactRuntime.ChargedState(context.currentQueryContext.state.state);
|
|
258
|
-
return {
|
|
259
|
-
currentContractState: state_0,
|
|
260
|
-
currentPrivateState: context.currentPrivateState,
|
|
261
|
-
currentZswapLocalState: context.currentZswapLocalState
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
_initial_setup_0(context, partialProofData, initial_root_0, relayer_identity_0)
|
|
265
|
-
{
|
|
266
|
-
__compactRuntime.assert(this._equal_0(_descriptor_0.fromValue(__compactRuntime.queryLedgerState(context,
|
|
267
|
-
partialProofData,
|
|
268
|
-
[
|
|
269
|
-
{ dup: { n: 0 } },
|
|
270
|
-
{ idx: { cached: false,
|
|
271
|
-
pushPath: false,
|
|
272
|
-
path: [
|
|
273
|
-
{ tag: 'value',
|
|
274
|
-
value: { value: _descriptor_6.toValue(1n),
|
|
275
|
-
alignment: _descriptor_6.alignment() } }] } },
|
|
276
|
-
{ popeq: { cached: false,
|
|
277
|
-
result: undefined } }]).value),
|
|
278
|
-
0n),
|
|
279
|
-
'Protocol already initialized: Setup circuit is locked');
|
|
280
|
-
__compactRuntime.queryLedgerState(context,
|
|
281
|
-
partialProofData,
|
|
282
|
-
[
|
|
283
|
-
{ push: { storage: false,
|
|
284
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(0n),
|
|
285
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
286
|
-
{ push: { storage: true,
|
|
287
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_1.toValue(initial_root_0),
|
|
288
|
-
alignment: _descriptor_1.alignment() }).encode() } },
|
|
289
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
290
|
-
__compactRuntime.queryLedgerState(context,
|
|
291
|
-
partialProofData,
|
|
292
|
-
[
|
|
293
|
-
{ push: { storage: false,
|
|
294
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(3n),
|
|
295
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
296
|
-
{ push: { storage: true,
|
|
297
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_1.toValue(relayer_identity_0),
|
|
298
|
-
alignment: _descriptor_1.alignment() }).encode() } },
|
|
299
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
300
|
-
const tmp_0 = 1n;
|
|
301
|
-
__compactRuntime.queryLedgerState(context,
|
|
302
|
-
partialProofData,
|
|
303
|
-
[
|
|
304
|
-
{ push: { storage: false,
|
|
305
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(1n),
|
|
306
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
307
|
-
{ push: { storage: true,
|
|
308
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_0.toValue(tmp_0),
|
|
309
|
-
alignment: _descriptor_0.alignment() }).encode() } },
|
|
310
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
311
|
-
const tmp_1 = 0n;
|
|
312
|
-
__compactRuntime.queryLedgerState(context,
|
|
313
|
-
partialProofData,
|
|
314
|
-
[
|
|
315
|
-
{ push: { storage: false,
|
|
316
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(2n),
|
|
317
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
318
|
-
{ push: { storage: true,
|
|
319
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_0.toValue(tmp_1),
|
|
320
|
-
alignment: _descriptor_0.alignment() }).encode() } },
|
|
321
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
322
|
-
return [];
|
|
323
|
-
}
|
|
324
|
-
_verify_batched_handshakes_0(context,
|
|
325
|
-
partialProofData,
|
|
326
|
-
previous_root_0,
|
|
327
|
-
new_root_0,
|
|
328
|
-
proof_commitment_0,
|
|
329
|
-
caller_identity_0,
|
|
330
|
-
toll_amount_0)
|
|
331
|
-
{
|
|
332
|
-
__compactRuntime.assert(this._equal_1(caller_identity_0,
|
|
333
|
-
_descriptor_1.fromValue(__compactRuntime.queryLedgerState(context,
|
|
334
|
-
partialProofData,
|
|
335
|
-
[
|
|
336
|
-
{ dup: { n: 0 } },
|
|
337
|
-
{ idx: { cached: false,
|
|
338
|
-
pushPath: false,
|
|
339
|
-
path: [
|
|
340
|
-
{ tag: 'value',
|
|
341
|
-
value: { value: _descriptor_6.toValue(3n),
|
|
342
|
-
alignment: _descriptor_6.alignment() } }] } },
|
|
343
|
-
{ popeq: { cached: false,
|
|
344
|
-
result: undefined } }]).value)),
|
|
345
|
-
'Unauthorized: Prover is not permitted to submit state transitions');
|
|
346
|
-
__compactRuntime.assert(this._equal_2(previous_root_0,
|
|
347
|
-
_descriptor_1.fromValue(__compactRuntime.queryLedgerState(context,
|
|
348
|
-
partialProofData,
|
|
349
|
-
[
|
|
350
|
-
{ dup: { n: 0 } },
|
|
351
|
-
{ idx: { cached: false,
|
|
352
|
-
pushPath: false,
|
|
353
|
-
path: [
|
|
354
|
-
{ tag: 'value',
|
|
355
|
-
value: { value: _descriptor_6.toValue(0n),
|
|
356
|
-
alignment: _descriptor_6.alignment() } }] } },
|
|
357
|
-
{ popeq: { cached: false,
|
|
358
|
-
result: undefined } }]).value)),
|
|
359
|
-
'Previous root mismatch: Stale state transition rejected');
|
|
360
|
-
__compactRuntime.assert(!this._equal_3(new_root_0, previous_root_0),
|
|
361
|
-
'Invalid transition: New root cannot be identical to previous root');
|
|
362
|
-
__compactRuntime.assert(!this._equal_4(proof_commitment_0,
|
|
363
|
-
Uint8Array.from([0n,
|
|
364
|
-
0n,
|
|
365
|
-
0n,
|
|
366
|
-
0n,
|
|
367
|
-
0n,
|
|
368
|
-
0n,
|
|
369
|
-
0n,
|
|
370
|
-
0n,
|
|
371
|
-
0n,
|
|
372
|
-
0n,
|
|
373
|
-
0n,
|
|
374
|
-
0n,
|
|
375
|
-
0n,
|
|
376
|
-
0n,
|
|
377
|
-
0n,
|
|
378
|
-
0n,
|
|
379
|
-
0n,
|
|
380
|
-
0n,
|
|
381
|
-
0n,
|
|
382
|
-
0n,
|
|
383
|
-
0n,
|
|
384
|
-
0n,
|
|
385
|
-
0n,
|
|
386
|
-
0n,
|
|
387
|
-
0n,
|
|
388
|
-
0n,
|
|
389
|
-
0n,
|
|
390
|
-
0n,
|
|
391
|
-
0n,
|
|
392
|
-
0n,
|
|
393
|
-
0n,
|
|
394
|
-
0n],
|
|
395
|
-
Number)),
|
|
396
|
-
'Cryptographic violation: Empty proof commitment rejected');
|
|
397
|
-
__compactRuntime.assert(toll_amount_0 >= 100n,
|
|
398
|
-
'Insufficient toll fee: Minimum toll of 100 required');
|
|
399
|
-
__compactRuntime.queryLedgerState(context,
|
|
400
|
-
partialProofData,
|
|
401
|
-
[
|
|
402
|
-
{ push: { storage: false,
|
|
403
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(0n),
|
|
404
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
405
|
-
{ push: { storage: true,
|
|
406
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_1.toValue(new_root_0),
|
|
407
|
-
alignment: _descriptor_1.alignment() }).encode() } },
|
|
408
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
409
|
-
const tmp_0 = ((t1) => {
|
|
410
|
-
if (t1 > 18446744073709551615n) {
|
|
411
|
-
throw new __compactRuntime.CompactError('rohan_handshake.compact line 64 char 23: cast from Field or Uint value to smaller Uint value failed: ' + t1 + ' is greater than 18446744073709551615');
|
|
412
|
-
}
|
|
413
|
-
return t1;
|
|
414
|
-
})(_descriptor_0.fromValue(__compactRuntime.queryLedgerState(context,
|
|
415
|
-
partialProofData,
|
|
416
|
-
[
|
|
417
|
-
{ dup: { n: 0 } },
|
|
418
|
-
{ idx: { cached: false,
|
|
419
|
-
pushPath: false,
|
|
420
|
-
path: [
|
|
421
|
-
{ tag: 'value',
|
|
422
|
-
value: { value: _descriptor_6.toValue(1n),
|
|
423
|
-
alignment: _descriptor_6.alignment() } }] } },
|
|
424
|
-
{ popeq: { cached: false,
|
|
425
|
-
result: undefined } }]).value)
|
|
426
|
-
+
|
|
427
|
-
1n);
|
|
428
|
-
__compactRuntime.queryLedgerState(context,
|
|
429
|
-
partialProofData,
|
|
430
|
-
[
|
|
431
|
-
{ push: { storage: false,
|
|
432
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(1n),
|
|
433
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
434
|
-
{ push: { storage: true,
|
|
435
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_0.toValue(tmp_0),
|
|
436
|
-
alignment: _descriptor_0.alignment() }).encode() } },
|
|
437
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
438
|
-
const tmp_1 = ((t1) => {
|
|
439
|
-
if (t1 > 18446744073709551615n) {
|
|
440
|
-
throw new __compactRuntime.CompactError('rohan_handshake.compact line 65 char 18: cast from Field or Uint value to smaller Uint value failed: ' + t1 + ' is greater than 18446744073709551615');
|
|
441
|
-
}
|
|
442
|
-
return t1;
|
|
443
|
-
})(_descriptor_0.fromValue(__compactRuntime.queryLedgerState(context,
|
|
444
|
-
partialProofData,
|
|
445
|
-
[
|
|
446
|
-
{ dup: { n: 0 } },
|
|
447
|
-
{ idx: { cached: false,
|
|
448
|
-
pushPath: false,
|
|
449
|
-
path: [
|
|
450
|
-
{ tag: 'value',
|
|
451
|
-
value: { value: _descriptor_6.toValue(2n),
|
|
452
|
-
alignment: _descriptor_6.alignment() } }] } },
|
|
453
|
-
{ popeq: { cached: false,
|
|
454
|
-
result: undefined } }]).value)
|
|
455
|
-
+
|
|
456
|
-
toll_amount_0);
|
|
457
|
-
__compactRuntime.queryLedgerState(context,
|
|
458
|
-
partialProofData,
|
|
459
|
-
[
|
|
460
|
-
{ push: { storage: false,
|
|
461
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_6.toValue(2n),
|
|
462
|
-
alignment: _descriptor_6.alignment() }).encode() } },
|
|
463
|
-
{ push: { storage: true,
|
|
464
|
-
value: __compactRuntime.StateValue.newCell({ value: _descriptor_0.toValue(tmp_1),
|
|
465
|
-
alignment: _descriptor_0.alignment() }).encode() } },
|
|
466
|
-
{ ins: { cached: false, n: 1 } }]);
|
|
467
|
-
return [];
|
|
468
|
-
}
|
|
469
|
-
_equal_0(x0, y0) {
|
|
470
|
-
if (x0 !== y0) { return false; }
|
|
471
|
-
return true;
|
|
472
|
-
}
|
|
473
|
-
_equal_1(x0, y0) {
|
|
474
|
-
if (!x0.every((x, i) => y0[i] === x)) { return false; }
|
|
475
|
-
return true;
|
|
476
|
-
}
|
|
477
|
-
_equal_2(x0, y0) {
|
|
478
|
-
if (!x0.every((x, i) => y0[i] === x)) { return false; }
|
|
479
|
-
return true;
|
|
480
|
-
}
|
|
481
|
-
_equal_3(x0, y0) {
|
|
482
|
-
if (!x0.every((x, i) => y0[i] === x)) { return false; }
|
|
483
|
-
return true;
|
|
484
|
-
}
|
|
485
|
-
_equal_4(x0, y0) {
|
|
486
|
-
if (!x0.every((x, i) => y0[i] === x)) { return false; }
|
|
487
|
-
return true;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
export function ledger(stateOrChargedState) {
|
|
491
|
-
const state = stateOrChargedState instanceof __compactRuntime.StateValue ? stateOrChargedState : stateOrChargedState.state;
|
|
492
|
-
const chargedState = stateOrChargedState instanceof __compactRuntime.StateValue ? new __compactRuntime.ChargedState(stateOrChargedState) : stateOrChargedState;
|
|
493
|
-
const context = {
|
|
494
|
-
currentQueryContext: new __compactRuntime.QueryContext(chargedState, __compactRuntime.dummyContractAddress()),
|
|
495
|
-
costModel: __compactRuntime.CostModel.initialCostModel()
|
|
496
|
-
};
|
|
497
|
-
const partialProofData = {
|
|
498
|
-
input: { value: [], alignment: [] },
|
|
499
|
-
output: undefined,
|
|
500
|
-
publicTranscript: [],
|
|
501
|
-
privateTranscriptOutputs: []
|
|
502
|
-
};
|
|
503
|
-
return {
|
|
504
|
-
get state_root() {
|
|
505
|
-
return _descriptor_1.fromValue(__compactRuntime.queryLedgerState(context,
|
|
506
|
-
partialProofData,
|
|
507
|
-
[
|
|
508
|
-
{ dup: { n: 0 } },
|
|
509
|
-
{ idx: { cached: false,
|
|
510
|
-
pushPath: false,
|
|
511
|
-
path: [
|
|
512
|
-
{ tag: 'value',
|
|
513
|
-
value: { value: _descriptor_6.toValue(0n),
|
|
514
|
-
alignment: _descriptor_6.alignment() } }] } },
|
|
515
|
-
{ popeq: { cached: false,
|
|
516
|
-
result: undefined } }]).value);
|
|
517
|
-
},
|
|
518
|
-
get sequence_number() {
|
|
519
|
-
return _descriptor_0.fromValue(__compactRuntime.queryLedgerState(context,
|
|
520
|
-
partialProofData,
|
|
521
|
-
[
|
|
522
|
-
{ dup: { n: 0 } },
|
|
523
|
-
{ idx: { cached: false,
|
|
524
|
-
pushPath: false,
|
|
525
|
-
path: [
|
|
526
|
-
{ tag: 'value',
|
|
527
|
-
value: { value: _descriptor_6.toValue(1n),
|
|
528
|
-
alignment: _descriptor_6.alignment() } }] } },
|
|
529
|
-
{ popeq: { cached: false,
|
|
530
|
-
result: undefined } }]).value);
|
|
531
|
-
},
|
|
532
|
-
get total_toll() {
|
|
533
|
-
return _descriptor_0.fromValue(__compactRuntime.queryLedgerState(context,
|
|
534
|
-
partialProofData,
|
|
535
|
-
[
|
|
536
|
-
{ dup: { n: 0 } },
|
|
537
|
-
{ idx: { cached: false,
|
|
538
|
-
pushPath: false,
|
|
539
|
-
path: [
|
|
540
|
-
{ tag: 'value',
|
|
541
|
-
value: { value: _descriptor_6.toValue(2n),
|
|
542
|
-
alignment: _descriptor_6.alignment() } }] } },
|
|
543
|
-
{ popeq: { cached: false,
|
|
544
|
-
result: undefined } }]).value);
|
|
545
|
-
},
|
|
546
|
-
get authorized_relayer() {
|
|
547
|
-
return _descriptor_1.fromValue(__compactRuntime.queryLedgerState(context,
|
|
548
|
-
partialProofData,
|
|
549
|
-
[
|
|
550
|
-
{ dup: { n: 0 } },
|
|
551
|
-
{ idx: { cached: false,
|
|
552
|
-
pushPath: false,
|
|
553
|
-
path: [
|
|
554
|
-
{ tag: 'value',
|
|
555
|
-
value: { value: _descriptor_6.toValue(3n),
|
|
556
|
-
alignment: _descriptor_6.alignment() } }] } },
|
|
557
|
-
{ popeq: { cached: false,
|
|
558
|
-
result: undefined } }]).value);
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
const _emptyContext = {
|
|
563
|
-
currentQueryContext: new __compactRuntime.QueryContext(new __compactRuntime.ContractState().data, __compactRuntime.dummyContractAddress())
|
|
564
|
-
};
|
|
565
|
-
const _dummyContract = new Contract({ });
|
|
566
|
-
export const pureCircuits = {};
|
|
567
|
-
export const contractReferenceLocations =
|
|
568
|
-
{ tag: 'publicLedgerArray', indices: { } };
|
|
569
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"file": "index.js",
|
|
4
|
-
"sourceRoot": "../../../",
|
|
5
|
-
"sources": ["rohan_handshake.compact"],
|
|
6
|
-
"names": [],
|
|
7
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;MAgBA,AAAA,aAYC;;;;;cAXG,cAAuB;cACvB,kBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;yCAD3B,cAAuB,+BACvB,kBAA2B;;;;;;;;;+CAD3B,cAAuB;+CACvB,kBAA2B;;;OAU9B;MAMD,AAAA,yBA+BC;;;;;cA9BG,eAAwB;cACxB,UAAmB;cACnB,kBAA2B;cAC3B,iBAA0B;cAC1B,aAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAJrB,eAAwB,+BACxB,UAAmB,+BACnB,kBAA2B,+BAC3B,iBAA0B,+BAC1B,aAAqB;;;;;;;;;2DAJrB,eAAwB;2DACxB,UAAmB;2DACnB,kBAA2B;2DAC3B,iBAA0B;2DAC1B,aAAqB;;;OA0BxB;;;;;;;;;;GACA;EAlED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQA;;;;;;;;;yEAAoC;IACpC;;;;;;;;;yEAAwC;IACxC;;;;;;;;;yEAAmC;IACnC;;;;;;;;;yEAA4C;;;;;;;GAuD3C;EAlDD,AAAA,gBAYC,4BAXG,cAAuB,EACvB,kBAA2B;;kEAGpB;;;;;;;;;;;uIAAe;;;IAGtB;;;;;;;2HAAsB,cAAY;;yEAAxB;IACV;;;;;;;2HAA8B,kBAAgB;;yEAA5B;UAClB,KAAe;IAAf;;;;;;;2HAAA,KAAe;;yEAAA;UACf,KAAU;IAAV;;;;;;;2HAAA,KAAU;;yEAAA;;GACb;EAMD,AAAA,4BA+BC;;+BA9BG,eAAwB;+BACxB,UAAmB;+BACnB,kBAA2B;+BAC3B,iBAA0B;+BAC1B,aAAqB;;0CAGd,iBAAe;kEAAI;;;;;;;;;;;uIAAkB;;0CAIrC,eAAa;kEAAI;;;;;;;;;;;uIAAU;;2CAI3B,UAAQ,EAAI,eAAa;;2CAIzB,kBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAIhB,aAAW;;IAIlB;;;;;;;2HAAsB,UAAQ;;yEAApB;UACV,KAAe;;;;;6CAAI;;;;;;;;;;;kHAAe;;;IAAlC;;;;;;;2HAAA,KAAe;;yEAAA;UACf,KAAU;;;;;6CAAI;;;;;;;;;;;kHAAU;;qBAAY,aAAW;IAA/C;;;;;;;2HAAA,KAAU;;yEAAA;;GACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAzDD;qCAAA;;;;;;;;;;;0GAAoC;KAAA;IACpC;qCAAA;;;;;;;;;;;0GAAwC;KAAA;IACxC;qCAAA;;;;;;;;;;;0GAAmC;KAAA;IACnC;qCAAA;;;;;;;;;;;0GAA4C;KAAA;;;;;;;;;;"
|
|
8
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|