@typeberry/lib 0.5.2 → 0.5.3-aa4626d
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/package.json +9 -5
- package/packages/core/collections/blob-dictionary.d.ts.map +1 -1
- package/packages/core/collections/blob-dictionary.js +3 -3
- package/packages/core/crypto/bandersnatch.d.ts +2 -1
- package/packages/core/crypto/bandersnatch.d.ts.map +1 -1
- package/packages/core/crypto/bandersnatch.js +9 -2
- package/packages/core/crypto/key-derivation.test.js +8 -7
- package/packages/core/hash/hash.d.ts.map +1 -1
- package/packages/core/hash/hash.js +1 -0
- package/packages/core/networking/package.json +1 -1
- package/packages/core/numbers/index.d.ts +4 -0
- package/packages/core/numbers/index.d.ts.map +1 -1
- package/packages/core/numbers/index.js +4 -4
- package/packages/core/pvm-host-calls/bin.js +6 -6
- package/packages/core/pvm-host-calls/ecalli-io-tracker.d.ts +32 -0
- package/packages/core/pvm-host-calls/ecalli-io-tracker.d.ts.map +1 -0
- package/packages/core/pvm-host-calls/ecalli-io-tracker.js +14 -0
- package/packages/core/pvm-host-calls/ecalli-trace-logger.d.ts +139 -0
- package/packages/core/pvm-host-calls/ecalli-trace-logger.d.ts.map +1 -0
- package/packages/core/pvm-host-calls/ecalli-trace-logger.js +209 -0
- package/packages/core/pvm-host-calls/ecalli-trace-logger.test.d.ts +2 -0
- package/packages/core/pvm-host-calls/ecalli-trace-logger.test.d.ts.map +1 -0
- package/packages/core/pvm-host-calls/ecalli-trace-logger.test.js +231 -0
- package/packages/core/pvm-host-calls/host-call-memory.d.ts +2 -0
- package/packages/core/pvm-host-calls/host-call-memory.d.ts.map +1 -1
- package/packages/core/pvm-host-calls/host-call-memory.js +12 -2
- package/packages/core/pvm-host-calls/host-call-registers.d.ts +6 -0
- package/packages/core/pvm-host-calls/host-call-registers.d.ts.map +1 -1
- package/packages/core/pvm-host-calls/host-call-registers.js +24 -0
- package/packages/core/pvm-host-calls/host-calls-executor.d.ts +37 -0
- package/packages/core/pvm-host-calls/host-calls-executor.d.ts.map +1 -0
- package/packages/core/pvm-host-calls/host-calls-executor.js +129 -0
- package/packages/core/pvm-host-calls/host-calls.d.ts +20 -26
- package/packages/core/pvm-host-calls/host-calls.d.ts.map +1 -1
- package/packages/core/pvm-host-calls/host-calls.js +40 -112
- package/packages/core/pvm-host-calls/index.d.ts +7 -6
- package/packages/core/pvm-host-calls/index.d.ts.map +1 -1
- package/packages/core/pvm-host-calls/index.js +7 -6
- package/packages/core/pvm-host-calls/{interpreter-instance-manager.d.ts → pvm-instance-manager.d.ts} +3 -3
- package/packages/core/pvm-host-calls/pvm-instance-manager.d.ts.map +1 -0
- package/packages/core/pvm-host-calls/{interpreter-instance-manager.js → pvm-instance-manager.js} +2 -2
- package/packages/core/pvm-interpreter/ops/math-consts.d.ts +2 -3
- package/packages/core/pvm-interpreter/ops/math-consts.d.ts.map +1 -1
- package/packages/core/pvm-interpreter/ops/math-consts.js +2 -3
- package/packages/core/pvm-interpreter/ops/math-ops.js +3 -3
- package/packages/core/pvm-interpreter/ops/math-utils.js +13 -13
- package/packages/core/pvm-interpreter/ops/math-utils.test.js +17 -16
- package/packages/core/telemetry/package.json +1 -1
- package/packages/jam/block/work-item.d.ts +13 -4
- package/packages/jam/block/work-item.d.ts.map +1 -1
- package/packages/jam/block/work-result.d.ts +3 -5
- package/packages/jam/block/work-result.d.ts.map +1 -1
- package/packages/jam/block/work-result.js +6 -0
- package/packages/jam/block-json/work-result.d.ts.map +1 -1
- package/packages/jam/block-json/work-result.js +6 -6
- package/packages/jam/database-lmdb/states.test.js +4 -3
- package/packages/jam/executor/index.d.ts +4 -0
- package/packages/jam/executor/index.d.ts.map +1 -0
- package/packages/jam/executor/index.js +2 -0
- package/packages/jam/{transition/accumulate → executor}/pvm-executor.d.ts +19 -16
- package/packages/jam/executor/pvm-executor.d.ts.map +1 -0
- package/packages/jam/{transition/accumulate → executor}/pvm-executor.js +48 -5
- package/packages/jam/in-core/externalities/refine.d.ts +24 -0
- package/packages/jam/in-core/externalities/refine.d.ts.map +1 -0
- package/packages/jam/in-core/externalities/refine.js +36 -0
- package/packages/jam/in-core/in-core.d.ts +60 -0
- package/packages/jam/in-core/in-core.d.ts.map +1 -0
- package/packages/jam/in-core/in-core.js +294 -0
- package/packages/jam/in-core/in-core.test.d.ts +2 -0
- package/packages/jam/in-core/in-core.test.d.ts.map +1 -0
- package/packages/jam/in-core/in-core.test.js +81 -0
- package/packages/jam/in-core/index.d.ts +2 -0
- package/packages/jam/in-core/index.d.ts.map +1 -0
- package/packages/jam/in-core/index.js +1 -0
- package/packages/jam/jam-host-calls/accumulate/bless.test.js +4 -5
- package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.d.ts +3 -3
- package/packages/jam/jamnp-s/protocol/ce-133-work-package-submission.d.ts.map +1 -1
- package/packages/jam/jamnp-s/protocol/ce-135-work-report-distribution.test.js +2 -2
- package/packages/jam/node/main-importer.d.ts.map +1 -1
- package/packages/jam/node/main-importer.js +3 -1
- package/packages/jam/node/package.json +1 -1
- package/packages/jam/rpc-validation/types.d.ts +7 -3
- package/packages/jam/rpc-validation/types.d.ts.map +1 -1
- package/packages/jam/rpc-validation/validation.d.ts +254 -36
- package/packages/jam/rpc-validation/validation.d.ts.map +1 -1
- package/packages/jam/rpc-validation/validation.js +20 -2
- package/packages/jam/safrole/bandersnatch-vrf.d.ts +2 -0
- package/packages/jam/safrole/bandersnatch-vrf.d.ts.map +1 -1
- package/packages/jam/safrole/bandersnatch-vrf.js +11 -0
- package/packages/jam/safrole/bandersnatch-vrf.test.js +3 -3
- package/packages/jam/safrole/bandersnatch-wasm.d.ts +1 -0
- package/packages/jam/safrole/bandersnatch-wasm.d.ts.map +1 -1
- package/packages/jam/safrole/bandersnatch-wasm.js +8 -5
- package/packages/jam/safrole/safrole-seal.d.ts +1 -3
- package/packages/jam/safrole/safrole-seal.d.ts.map +1 -1
- package/packages/jam/safrole/safrole-seal.js +14 -25
- package/packages/jam/safrole/safrole-seal.test.js +4 -10
- package/packages/jam/state/in-memory-state.d.ts.map +1 -1
- package/packages/jam/state/in-memory-state.js +2 -3
- package/packages/jam/state/test.utils.d.ts.map +1 -1
- package/packages/jam/state/test.utils.js +2 -3
- package/packages/jam/transition/accumulate/accumulate-data.d.ts.map +1 -1
- package/packages/jam/transition/accumulate/accumulate-data.js +1 -2
- package/packages/jam/transition/accumulate/accumulate-queue.test.js +2 -2
- package/packages/jam/transition/accumulate/accumulate-utils.test.js +2 -2
- package/packages/jam/transition/accumulate/accumulate.d.ts.map +1 -1
- package/packages/jam/transition/accumulate/accumulate.js +8 -13
- package/packages/jam/transition/accumulate/accumulate.test.js +2 -2
- package/packages/jam/transition/accumulate/accumulation-result-merge-utils.d.ts.map +1 -1
- package/packages/jam/transition/accumulate/accumulation-result-merge-utils.js +1 -2
- package/packages/jam/transition/accumulate/accumulation-result-merge-utils.test.js +1 -2
- package/packages/jam/transition/accumulate/deferred-transfers.d.ts +1 -1
- package/packages/jam/transition/accumulate/deferred-transfers.d.ts.map +1 -1
- package/packages/jam/transition/accumulate/deferred-transfers.js +6 -7
- package/packages/jam/transition/disputes/disputes.d.ts.map +1 -1
- package/packages/jam/transition/disputes/disputes.js +5 -4
- package/packages/jam/transition/disputes/disputes.test.data2.js +2 -2
- package/packages/jam/transition/externalities/fetch-externalities.d.ts +7 -1
- package/packages/jam/transition/externalities/fetch-externalities.d.ts.map +1 -1
- package/packages/jam/transition/externalities/fetch-externalities.js +4 -0
- package/packages/jam/transition/externalities/fetch-externalities.test.js +2 -2
- package/packages/jam/transition/hasher.test.js +2 -2
- package/packages/jam/transition/reports/test.utils.d.ts.map +1 -1
- package/packages/jam/transition/reports/test.utils.js +2 -2
- package/packages/workers/block-authorship/package.json +1 -1
- package/packages/workers/importer/package.json +1 -1
- package/packages/core/pvm-host-calls/host-calls-manager.d.ts +0 -23
- package/packages/core/pvm-host-calls/host-calls-manager.d.ts.map +0 -1
- package/packages/core/pvm-host-calls/host-calls-manager.js +0 -44
- package/packages/core/pvm-host-calls/interpreter-instance-manager.d.ts.map +0 -1
- package/packages/jam/transition/accumulate/pvm-executor.d.ts.map +0 -1
|
@@ -3,6 +3,7 @@ export declare const JSON_RPC_VERSION = "2.0";
|
|
|
3
3
|
export declare namespace validation {
|
|
4
4
|
const hash: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
5
5
|
const slot: z.ZodNumber;
|
|
6
|
+
const coreIndex: z.ZodNumber;
|
|
6
7
|
const blobArray: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
7
8
|
const serviceId: z.ZodNumber;
|
|
8
9
|
const preimageLength: z.ZodNumber;
|
|
@@ -11,6 +12,10 @@ export declare namespace validation {
|
|
|
11
12
|
header_hash: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
12
13
|
slot: z.ZodNumber;
|
|
13
14
|
}, z.z.core.$strip>;
|
|
15
|
+
const refineResult: z.ZodObject<{
|
|
16
|
+
report: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
17
|
+
exports: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
18
|
+
}, z.z.core.$strip>;
|
|
14
19
|
const parameters: z.ZodObject<{
|
|
15
20
|
V1: z.ZodObject<{
|
|
16
21
|
deposit_per_account: z.ZodNumber;
|
|
@@ -60,6 +65,212 @@ export declare namespace validation {
|
|
|
60
65
|
input: z.ZodTuple<[z.ZodString], null>;
|
|
61
66
|
output: z.ZodBoolean;
|
|
62
67
|
};
|
|
68
|
+
/** Non-standard typeberry extension methods. */
|
|
69
|
+
const customSchemas: {
|
|
70
|
+
typeberry_refineWorkPackage: {
|
|
71
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodArray<z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>>], null>;
|
|
72
|
+
output: z.ZodObject<{
|
|
73
|
+
report: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
74
|
+
exports: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
75
|
+
}, z.z.core.$strip>;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/** JIP-2 (standardized) methods */
|
|
79
|
+
const jip2Schemas: {
|
|
80
|
+
beefyRoot: {
|
|
81
|
+
input: z.ZodTuple<[], null>;
|
|
82
|
+
output: z.ZodAny;
|
|
83
|
+
};
|
|
84
|
+
submitPreimage: {
|
|
85
|
+
input: z.ZodTuple<[], null>;
|
|
86
|
+
output: z.ZodAny;
|
|
87
|
+
};
|
|
88
|
+
submitWorkPackage: {
|
|
89
|
+
input: z.ZodTuple<[], null>;
|
|
90
|
+
output: z.ZodAny;
|
|
91
|
+
};
|
|
92
|
+
workReport: {
|
|
93
|
+
input: z.ZodTuple<[], null>;
|
|
94
|
+
output: z.ZodAny;
|
|
95
|
+
};
|
|
96
|
+
submitWorkPackageBundle: {
|
|
97
|
+
input: z.ZodTuple<[], null>;
|
|
98
|
+
output: z.ZodAny;
|
|
99
|
+
};
|
|
100
|
+
workPackageStatus: {
|
|
101
|
+
input: z.ZodTuple<[], null>;
|
|
102
|
+
output: z.ZodAny;
|
|
103
|
+
};
|
|
104
|
+
subscribeWorkPackageStatus: {
|
|
105
|
+
input: z.ZodTuple<[], null>;
|
|
106
|
+
output: z.ZodAny;
|
|
107
|
+
};
|
|
108
|
+
fetchWorkPackageSegments: {
|
|
109
|
+
input: z.ZodTuple<[], null>;
|
|
110
|
+
output: z.ZodAny;
|
|
111
|
+
};
|
|
112
|
+
fetchSegments: {
|
|
113
|
+
input: z.ZodTuple<[], null>;
|
|
114
|
+
output: z.ZodAny;
|
|
115
|
+
};
|
|
116
|
+
syncState: {
|
|
117
|
+
input: z.ZodTuple<[], null>;
|
|
118
|
+
output: z.ZodAny;
|
|
119
|
+
};
|
|
120
|
+
subscribeSyncStatus: {
|
|
121
|
+
input: z.ZodTuple<[], null>;
|
|
122
|
+
output: z.ZodAny;
|
|
123
|
+
};
|
|
124
|
+
bestBlock: {
|
|
125
|
+
input: z.ZodTuple<[], null>;
|
|
126
|
+
output: z.ZodObject<{
|
|
127
|
+
header_hash: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
128
|
+
slot: z.ZodNumber;
|
|
129
|
+
}, z.z.core.$strip>;
|
|
130
|
+
};
|
|
131
|
+
finalizedBlock: {
|
|
132
|
+
input: z.ZodTuple<[], null>;
|
|
133
|
+
output: z.ZodObject<{
|
|
134
|
+
header_hash: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
135
|
+
slot: z.ZodNumber;
|
|
136
|
+
}, z.z.core.$strip>;
|
|
137
|
+
};
|
|
138
|
+
listServices: {
|
|
139
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
140
|
+
output: z.ZodArray<z.ZodNumber>;
|
|
141
|
+
};
|
|
142
|
+
parameters: {
|
|
143
|
+
input: z.ZodTuple<[], null>;
|
|
144
|
+
output: z.ZodObject<{
|
|
145
|
+
V1: z.ZodObject<{
|
|
146
|
+
deposit_per_account: z.ZodNumber;
|
|
147
|
+
deposit_per_item: z.ZodNumber;
|
|
148
|
+
deposit_per_byte: z.ZodNumber;
|
|
149
|
+
min_turnaround_period: z.ZodNumber;
|
|
150
|
+
epoch_period: z.ZodNumber;
|
|
151
|
+
max_accumulate_gas: z.ZodNumber;
|
|
152
|
+
max_is_authorized_gas: z.ZodNumber;
|
|
153
|
+
max_refine_gas: z.ZodNumber;
|
|
154
|
+
block_gas_limit: z.ZodNumber;
|
|
155
|
+
recent_block_count: z.ZodNumber;
|
|
156
|
+
max_work_items: z.ZodNumber;
|
|
157
|
+
max_dependencies: z.ZodNumber;
|
|
158
|
+
max_tickets_per_block: z.ZodNumber;
|
|
159
|
+
max_lookup_anchor_age: z.ZodNumber;
|
|
160
|
+
tickets_attempts_number: z.ZodNumber;
|
|
161
|
+
auth_window: z.ZodNumber;
|
|
162
|
+
auth_queue_len: z.ZodNumber;
|
|
163
|
+
rotation_period: z.ZodNumber;
|
|
164
|
+
max_extrinsics: z.ZodNumber;
|
|
165
|
+
availability_timeout: z.ZodNumber;
|
|
166
|
+
val_count: z.ZodNumber;
|
|
167
|
+
max_input: z.ZodNumber;
|
|
168
|
+
max_refine_code_size: z.ZodNumber;
|
|
169
|
+
basic_piece_len: z.ZodNumber;
|
|
170
|
+
max_imports: z.ZodNumber;
|
|
171
|
+
max_is_authorized_code_size: z.ZodNumber;
|
|
172
|
+
max_exports: z.ZodNumber;
|
|
173
|
+
max_refine_memory: z.ZodNumber;
|
|
174
|
+
max_is_authorized_memory: z.ZodNumber;
|
|
175
|
+
segment_piece_count: z.ZodNumber;
|
|
176
|
+
max_report_elective_data: z.ZodNumber;
|
|
177
|
+
transfer_memo_size: z.ZodNumber;
|
|
178
|
+
epoch_tail_start: z.ZodNumber;
|
|
179
|
+
core_count: z.ZodNumber;
|
|
180
|
+
slot_period_sec: z.ZodNumber;
|
|
181
|
+
max_authorizer_code_size: z.ZodNumber;
|
|
182
|
+
max_service_code_size: z.ZodNumber;
|
|
183
|
+
}, z.z.core.$strip>;
|
|
184
|
+
}, z.z.core.$strip>;
|
|
185
|
+
};
|
|
186
|
+
parent: {
|
|
187
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
188
|
+
output: z.ZodObject<{
|
|
189
|
+
header_hash: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
190
|
+
slot: z.ZodNumber;
|
|
191
|
+
}, z.z.core.$strip>;
|
|
192
|
+
};
|
|
193
|
+
serviceData: {
|
|
194
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber], null>;
|
|
195
|
+
output: z.ZodUnion<readonly [z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNull]>;
|
|
196
|
+
};
|
|
197
|
+
servicePreimage: {
|
|
198
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
199
|
+
output: z.ZodUnion<readonly [z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNull]>;
|
|
200
|
+
};
|
|
201
|
+
serviceRequest: {
|
|
202
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber], null>;
|
|
203
|
+
output: z.ZodUnion<readonly [z.ZodReadonly<z.ZodArray<z.ZodNumber>>, z.ZodNull]>;
|
|
204
|
+
};
|
|
205
|
+
serviceValue: {
|
|
206
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
207
|
+
output: z.ZodUnion<readonly [z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNull]>;
|
|
208
|
+
};
|
|
209
|
+
stateRoot: {
|
|
210
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
211
|
+
output: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
212
|
+
};
|
|
213
|
+
statistics: {
|
|
214
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
215
|
+
output: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
216
|
+
};
|
|
217
|
+
subscribeBestBlock: {
|
|
218
|
+
input: z.ZodTuple<[], null>;
|
|
219
|
+
output: z.ZodString;
|
|
220
|
+
};
|
|
221
|
+
subscribeFinalizedBlock: {
|
|
222
|
+
input: z.ZodTuple<[], null>;
|
|
223
|
+
output: z.ZodString;
|
|
224
|
+
};
|
|
225
|
+
subscribeServiceData: {
|
|
226
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodBoolean], null>;
|
|
227
|
+
output: z.ZodString;
|
|
228
|
+
};
|
|
229
|
+
subscribeServicePreimage: {
|
|
230
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodBoolean], null>;
|
|
231
|
+
output: z.ZodString;
|
|
232
|
+
};
|
|
233
|
+
subscribeServiceRequest: {
|
|
234
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber, z.ZodBoolean], null>;
|
|
235
|
+
output: z.ZodString;
|
|
236
|
+
};
|
|
237
|
+
subscribeServiceValue: {
|
|
238
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodBoolean], null>;
|
|
239
|
+
output: z.ZodString;
|
|
240
|
+
};
|
|
241
|
+
subscribeStatistics: {
|
|
242
|
+
input: z.ZodTuple<[z.ZodBoolean], null>;
|
|
243
|
+
output: z.ZodString;
|
|
244
|
+
};
|
|
245
|
+
unsubscribeBestBlock: {
|
|
246
|
+
input: z.ZodTuple<[z.ZodString], null>;
|
|
247
|
+
output: z.ZodBoolean;
|
|
248
|
+
};
|
|
249
|
+
unsubscribeFinalizedBlock: {
|
|
250
|
+
input: z.ZodTuple<[z.ZodString], null>;
|
|
251
|
+
output: z.ZodBoolean;
|
|
252
|
+
};
|
|
253
|
+
unsubscribeServiceData: {
|
|
254
|
+
input: z.ZodTuple<[z.ZodString], null>;
|
|
255
|
+
output: z.ZodBoolean;
|
|
256
|
+
};
|
|
257
|
+
unsubscribeServicePreimage: {
|
|
258
|
+
input: z.ZodTuple<[z.ZodString], null>;
|
|
259
|
+
output: z.ZodBoolean;
|
|
260
|
+
};
|
|
261
|
+
unsubscribeServiceRequest: {
|
|
262
|
+
input: z.ZodTuple<[z.ZodString], null>;
|
|
263
|
+
output: z.ZodBoolean;
|
|
264
|
+
};
|
|
265
|
+
unsubscribeServiceValue: {
|
|
266
|
+
input: z.ZodTuple<[z.ZodString], null>;
|
|
267
|
+
output: z.ZodBoolean;
|
|
268
|
+
};
|
|
269
|
+
unsubscribeStatistics: {
|
|
270
|
+
input: z.ZodTuple<[z.ZodString], null>;
|
|
271
|
+
output: z.ZodBoolean;
|
|
272
|
+
};
|
|
273
|
+
};
|
|
63
274
|
const schemas: {
|
|
64
275
|
readonly beefyRoot: {
|
|
65
276
|
input: z.ZodTuple<[], null>;
|
|
@@ -106,26 +317,26 @@ export declare namespace validation {
|
|
|
106
317
|
output: z.ZodAny;
|
|
107
318
|
};
|
|
108
319
|
readonly bestBlock: {
|
|
109
|
-
|
|
110
|
-
|
|
320
|
+
input: z.ZodTuple<[], null>;
|
|
321
|
+
output: z.ZodObject<{
|
|
111
322
|
header_hash: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
112
323
|
slot: z.ZodNumber;
|
|
113
324
|
}, z.z.core.$strip>;
|
|
114
325
|
};
|
|
115
326
|
readonly finalizedBlock: {
|
|
116
|
-
|
|
117
|
-
|
|
327
|
+
input: z.ZodTuple<[], null>;
|
|
328
|
+
output: z.ZodObject<{
|
|
118
329
|
header_hash: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
119
330
|
slot: z.ZodNumber;
|
|
120
331
|
}, z.z.core.$strip>;
|
|
121
332
|
};
|
|
122
333
|
readonly listServices: {
|
|
123
|
-
|
|
124
|
-
|
|
334
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
335
|
+
output: z.ZodArray<z.ZodNumber>;
|
|
125
336
|
};
|
|
126
337
|
readonly parameters: {
|
|
127
|
-
|
|
128
|
-
|
|
338
|
+
input: z.ZodTuple<[], null>;
|
|
339
|
+
output: z.ZodObject<{
|
|
129
340
|
V1: z.ZodObject<{
|
|
130
341
|
deposit_per_account: z.ZodNumber;
|
|
131
342
|
deposit_per_item: z.ZodNumber;
|
|
@@ -168,63 +379,63 @@ export declare namespace validation {
|
|
|
168
379
|
}, z.z.core.$strip>;
|
|
169
380
|
};
|
|
170
381
|
readonly parent: {
|
|
171
|
-
|
|
172
|
-
|
|
382
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
383
|
+
output: z.ZodObject<{
|
|
173
384
|
header_hash: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
174
385
|
slot: z.ZodNumber;
|
|
175
386
|
}, z.z.core.$strip>;
|
|
176
387
|
};
|
|
177
388
|
readonly serviceData: {
|
|
178
|
-
|
|
179
|
-
|
|
389
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber], null>;
|
|
390
|
+
output: z.ZodUnion<readonly [z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNull]>;
|
|
180
391
|
};
|
|
181
392
|
readonly servicePreimage: {
|
|
182
|
-
|
|
183
|
-
|
|
393
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
394
|
+
output: z.ZodUnion<readonly [z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNull]>;
|
|
184
395
|
};
|
|
185
396
|
readonly serviceRequest: {
|
|
186
|
-
|
|
187
|
-
|
|
397
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber], null>;
|
|
398
|
+
output: z.ZodUnion<readonly [z.ZodReadonly<z.ZodArray<z.ZodNumber>>, z.ZodNull]>;
|
|
188
399
|
};
|
|
189
400
|
readonly serviceValue: {
|
|
190
|
-
|
|
191
|
-
|
|
401
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
402
|
+
output: z.ZodUnion<readonly [z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNull]>;
|
|
192
403
|
};
|
|
193
404
|
readonly stateRoot: {
|
|
194
|
-
|
|
195
|
-
|
|
405
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
406
|
+
output: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
196
407
|
};
|
|
197
408
|
readonly statistics: {
|
|
198
|
-
|
|
199
|
-
|
|
409
|
+
input: z.ZodTuple<[z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>], null>;
|
|
410
|
+
output: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
200
411
|
};
|
|
201
412
|
readonly subscribeBestBlock: {
|
|
202
|
-
|
|
203
|
-
|
|
413
|
+
input: z.ZodTuple<[], null>;
|
|
414
|
+
output: z.ZodString;
|
|
204
415
|
};
|
|
205
416
|
readonly subscribeFinalizedBlock: {
|
|
206
|
-
|
|
207
|
-
|
|
417
|
+
input: z.ZodTuple<[], null>;
|
|
418
|
+
output: z.ZodString;
|
|
208
419
|
};
|
|
209
420
|
readonly subscribeServiceData: {
|
|
210
|
-
|
|
211
|
-
|
|
421
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodBoolean], null>;
|
|
422
|
+
output: z.ZodString;
|
|
212
423
|
};
|
|
213
424
|
readonly subscribeServicePreimage: {
|
|
214
|
-
|
|
215
|
-
|
|
425
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodBoolean], null>;
|
|
426
|
+
output: z.ZodString;
|
|
216
427
|
};
|
|
217
428
|
readonly subscribeServiceRequest: {
|
|
218
|
-
|
|
219
|
-
|
|
429
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodNumber, z.ZodBoolean], null>;
|
|
430
|
+
output: z.ZodString;
|
|
220
431
|
};
|
|
221
432
|
readonly subscribeServiceValue: {
|
|
222
|
-
|
|
223
|
-
|
|
433
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodBoolean], null>;
|
|
434
|
+
output: z.ZodString;
|
|
224
435
|
};
|
|
225
436
|
readonly subscribeStatistics: {
|
|
226
|
-
|
|
227
|
-
|
|
437
|
+
input: z.ZodTuple<[z.ZodBoolean], null>;
|
|
438
|
+
output: z.ZodString;
|
|
228
439
|
};
|
|
229
440
|
readonly unsubscribeBestBlock: {
|
|
230
441
|
input: z.ZodTuple<[z.ZodString], null>;
|
|
@@ -254,6 +465,13 @@ export declare namespace validation {
|
|
|
254
465
|
input: z.ZodTuple<[z.ZodString], null>;
|
|
255
466
|
output: z.ZodBoolean;
|
|
256
467
|
};
|
|
468
|
+
readonly typeberry_refineWorkPackage: {
|
|
469
|
+
input: z.ZodTuple<[z.ZodNumber, z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>, z.ZodArray<z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>>], null>;
|
|
470
|
+
output: z.ZodObject<{
|
|
471
|
+
report: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
472
|
+
exports: z.ZodCodec<z.ZodBase64, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
|
|
473
|
+
}, z.z.core.$strip>;
|
|
474
|
+
};
|
|
257
475
|
};
|
|
258
476
|
const jsonRpcRequest: z.ZodObject<{
|
|
259
477
|
jsonrpc: z.ZodLiteral<"2.0">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/rpc-validation/validation.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AACtC,yBAAiB,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/rpc-validation/validation.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,gBAAgB,QAAQ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 @@ import z from "zod";
|
|
|
3
3
|
export const JSON_RPC_VERSION = "2.0";
|
|
4
4
|
export var validation;
|
|
5
5
|
(function (validation) {
|
|
6
|
-
const
|
|
6
|
+
const u16 = z.number().int().min(0).max(0xffff);
|
|
7
|
+
const u32 = z.number().int().min(0).max(0xffff_ffff);
|
|
7
8
|
const uint8Array = z.custom((v) => v instanceof Uint8Array); // this is needed because a simple z.instanceof(Uint8Array) automatically narrows the type down to Uint8Array<ArrayBuffer> whereas our Bytes.raw are effectively Uint8Array<ArrayBufferLike>
|
|
8
9
|
validation.hash = z.codec(z.base64(), uint8Array.refine((v) => v.length === HASH_SIZE, "Invalid hash length."), {
|
|
9
10
|
decode: (v) => Uint8Array.from(Buffer.from(v, "base64")),
|
|
10
11
|
encode: (v) => Buffer.from(v).toString("base64"),
|
|
11
12
|
});
|
|
12
13
|
validation.slot = u32;
|
|
14
|
+
validation.coreIndex = u16;
|
|
13
15
|
validation.blobArray = z.codec(z.base64(), uint8Array, {
|
|
14
16
|
decode: (v) => Uint8Array.from(Buffer.from(v, "base64")),
|
|
15
17
|
encode: (v) => Buffer.from(v).toString("base64"),
|
|
@@ -21,6 +23,10 @@ export var validation;
|
|
|
21
23
|
header_hash: validation.hash,
|
|
22
24
|
slot: validation.slot,
|
|
23
25
|
});
|
|
26
|
+
validation.refineResult = z.object({
|
|
27
|
+
report: validation.blobArray,
|
|
28
|
+
exports: validation.blobArray,
|
|
29
|
+
});
|
|
24
30
|
validation.parameters = z.object({
|
|
25
31
|
V1: z.object({
|
|
26
32
|
deposit_per_account: z.number(),
|
|
@@ -70,7 +76,15 @@ export var validation;
|
|
|
70
76
|
input: z.tuple([z.string()]),
|
|
71
77
|
output: z.boolean(),
|
|
72
78
|
};
|
|
73
|
-
|
|
79
|
+
/** Non-standard typeberry extension methods. */
|
|
80
|
+
validation.customSchemas = {
|
|
81
|
+
typeberry_refineWorkPackage: {
|
|
82
|
+
input: z.tuple([validation.coreIndex, validation.blobArray, z.array(validation.blobArray)]),
|
|
83
|
+
output: validation.refineResult,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
/** JIP-2 (standardized) methods */
|
|
87
|
+
validation.jip2Schemas = {
|
|
74
88
|
beefyRoot: validation.notImplementedSchema,
|
|
75
89
|
submitPreimage: validation.notImplementedSchema,
|
|
76
90
|
submitWorkPackage: validation.notImplementedSchema,
|
|
@@ -162,6 +176,10 @@ export var validation;
|
|
|
162
176
|
unsubscribeServiceValue: validation.unsubscribeSchema,
|
|
163
177
|
unsubscribeStatistics: validation.unsubscribeSchema,
|
|
164
178
|
};
|
|
179
|
+
validation.schemas = {
|
|
180
|
+
...validation.customSchemas,
|
|
181
|
+
...validation.jip2Schemas,
|
|
182
|
+
};
|
|
165
183
|
validation.jsonRpcRequest = z.object({
|
|
166
184
|
jsonrpc: z.literal(JSON_RPC_VERSION),
|
|
167
185
|
method: z.string(),
|
|
@@ -8,12 +8,14 @@ import { type Opaque, Result } from "#@typeberry/utils";
|
|
|
8
8
|
import type { BandernsatchWasm } from "./bandersnatch-wasm.js";
|
|
9
9
|
declare const FUNCTIONS: {
|
|
10
10
|
verifySeal: typeof verifySeal;
|
|
11
|
+
verifyHeaderSeals: typeof verifyHeaderSeals;
|
|
11
12
|
verifyTickets: typeof verifyTickets;
|
|
12
13
|
getRingCommitment: typeof getRingCommitment;
|
|
13
14
|
generateSeal: typeof generateSeal;
|
|
14
15
|
getVrfOutputHash: typeof getVrfOutputHash;
|
|
15
16
|
};
|
|
16
17
|
export default FUNCTIONS;
|
|
18
|
+
declare function verifyHeaderSeals(bandersnatch: BandernsatchWasm, authorKey: BandersnatchKey, signature: BandersnatchVrfSignature, payload: BytesBlob, encodedUnsealedHeader: BytesBlob, entropySignature: BandersnatchVrfSignature, entropyPayloadPrefix: BytesBlob): Promise<Result<[EntropyHash, EntropyHash], null>>;
|
|
17
19
|
declare function verifySeal(bandersnatch: BandernsatchWasm, authorKey: BandersnatchKey, signature: BandersnatchVrfSignature, payload: BytesBlob, encodedUnsealedHeader: BytesBlob): Promise<Result<EntropyHash, null>>;
|
|
18
20
|
declare function getRingCommitment(bandersnatch: BandernsatchWasm, validators: BandersnatchKey[]): Promise<Result<BandersnatchRingRoot, null>>;
|
|
19
21
|
declare function verifyTickets(bandersnatch: BandernsatchWasm, numberOfValidators: number, epochRoot: BandersnatchRingRoot, tickets: readonly SignedTicket[], entropy: EntropyHash): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bandersnatch-vrf.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/safrole/bandersnatch-vrf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAS,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAwB/D,QAAA,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"bandersnatch-vrf.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/safrole/bandersnatch-vrf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAS,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,E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,OAAO,CAAC;IAAC,WAAW,EAAE,WAAW,CAAA;CAAE,EAAE,CAAC,CAqB3D;AAED,iBAAe,YAAY,CACzB,YAAY,EAAE,gBAAgB,EAC9B,SAAS,EAAE,sBAAsB,EACjC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,MAAM,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC,CAQjD;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAElE,iBAAe,gBAAgB,CAC7B,YAAY,EAAE,gBAAgB,EAC9B,SAAS,EAAE,sBAAsB,EACjC,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAQtC"}
|
|
@@ -20,6 +20,7 @@ var ResultValues;
|
|
|
20
20
|
const ringCommitmentCache = [];
|
|
21
21
|
const FUNCTIONS = {
|
|
22
22
|
verifySeal,
|
|
23
|
+
verifyHeaderSeals,
|
|
23
24
|
verifyTickets,
|
|
24
25
|
getRingCommitment,
|
|
25
26
|
generateSeal,
|
|
@@ -29,6 +30,16 @@ const FUNCTIONS = {
|
|
|
29
30
|
// Ideally we would just export functions and figure out how to mock
|
|
30
31
|
// properly in ESM.
|
|
31
32
|
export default FUNCTIONS;
|
|
33
|
+
async function verifyHeaderSeals(bandersnatch, authorKey, signature, payload, encodedUnsealedHeader, entropySignature, entropyPayloadPrefix) {
|
|
34
|
+
const sealResult = await bandersnatch.verifyHeaderSeals(authorKey.raw, signature.raw, payload.raw, encodedUnsealedHeader.raw, entropySignature.raw, entropyPayloadPrefix.raw);
|
|
35
|
+
if (sealResult[RESULT_INDEX] === ResultValues.Error) {
|
|
36
|
+
return Result.error(null, () => "Bandersnatch VRF seal verification failed");
|
|
37
|
+
}
|
|
38
|
+
return Result.ok([
|
|
39
|
+
Bytes.fromBlob(sealResult.subarray(1, 33), HASH_SIZE).asOpaque(),
|
|
40
|
+
Bytes.fromBlob(sealResult.subarray(33), HASH_SIZE).asOpaque(),
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
32
43
|
async function verifySeal(bandersnatch, authorKey, signature, payload, encodedUnsealedHeader) {
|
|
33
44
|
const sealResult = await bandersnatch.verifySeal(authorKey.raw, signature.raw, payload.raw, encodedUnsealedHeader.raw);
|
|
34
45
|
if (sealResult[RESULT_INDEX] === ResultValues.Error) {
|
|
@@ -27,7 +27,7 @@ describe("Bandersnatch verification", () => {
|
|
|
27
27
|
const result = await bandersnatchVrf.getRingCommitment(await bandersnatchWasm, bandersnatchKeys);
|
|
28
28
|
const expectedCommitment = Bytes.parseBytes("0x8387a131593447e4e1c3d4e220c322e42d33207fa77cd0fedb39fc3491479ca47a2d82295252e278fa3eec78185982ed82ae0c8fd691335e703d663fb5be02b3def15380789320636b2479beab5a03ccb3f0909ffea59d859fcdc7e187e45a8c92e630ae2b14e758ab0960e372172203f4c9a41777dadd529971d7ab9d23ab29fe0e9c85ec450505dde7f5ac038274cf", BANDERSNATCH_RING_ROOT_BYTES);
|
|
29
29
|
assert.strictEqual(result.isOk, true);
|
|
30
|
-
assert.
|
|
30
|
+
assert.strictEqual(result.ok.toString(), expectedCommitment.toString());
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
describe("verifyTickets", () => {
|
|
@@ -72,7 +72,7 @@ describe("Bandersnatch verification", () => {
|
|
|
72
72
|
].map((x) => Bytes.parseBytes(x, HASH_SIZE));
|
|
73
73
|
const result = await bandersnatchVrf.verifyTickets(await bandersnatchWasm, bandersnatchKeys.length, commitment, tickets, entropy);
|
|
74
74
|
assert.strictEqual(result.every((x) => x.isValid), true);
|
|
75
|
-
assert.deepStrictEqual(result.map((x) => x.entropyHash), expectedIds);
|
|
75
|
+
assert.deepStrictEqual(result.map((x) => x.entropyHash.toString()), expectedIds.map((x) => x.toString()));
|
|
76
76
|
});
|
|
77
77
|
it("should detect that one signature is incorrect", async () => {
|
|
78
78
|
const tickets = [
|
|
@@ -97,7 +97,7 @@ describe("Bandersnatch verification", () => {
|
|
|
97
97
|
].map((x) => Bytes.parseBytes(x, HASH_SIZE));
|
|
98
98
|
const result = await bandersnatchVrf.verifyTickets(await bandersnatchWasm, bandersnatchKeys.length, commitment, tickets, entropy);
|
|
99
99
|
assert.deepStrictEqual(result.map((x) => x.isValid), [false, true, true]);
|
|
100
|
-
assert.deepStrictEqual(result.map((x) => x.entropyHash), expectedIds);
|
|
100
|
+
assert.deepStrictEqual(result.map((x) => x.entropyHash.toString()), expectedIds.map((x) => x.toString()));
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
describe("verifySeal", () => {
|
|
@@ -2,6 +2,7 @@ export declare class BandernsatchWasm {
|
|
|
2
2
|
private constructor();
|
|
3
3
|
static new(): Promise<BandernsatchWasm>;
|
|
4
4
|
verifySeal(authorKey: Uint8Array, signature: Uint8Array, payload: Uint8Array, auxData: Uint8Array): Promise<Uint8Array<ArrayBufferLike>>;
|
|
5
|
+
verifyHeaderSeals(authorKey: Uint8Array, headerSeal: Uint8Array, headerSealPayload: Uint8Array, unsealedHeader: Uint8Array, entropySeal: Uint8Array, entropyPayloadPrefix: Uint8Array): Promise<Uint8Array<ArrayBufferLike>>;
|
|
5
6
|
getRingCommitment(keys: Uint8Array): Promise<Uint8Array<ArrayBufferLike>>;
|
|
6
7
|
batchVerifyTicket(ringSize: number, commitment: Uint8Array, ticketsData: Uint8Array, contextLength: number): Promise<Uint8Array<ArrayBufferLike>>;
|
|
7
8
|
generateSeal(authorKey: Uint8Array, input: Uint8Array, auxData: Uint8Array): Promise<Uint8Array<ArrayBufferLike>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bandersnatch-wasm.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/safrole/bandersnatch-wasm.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IAC3B,OAAO;WAEM,GAAG;IAKV,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU;IAIjG,iBAAiB,CAAC,IAAI,EAAE,UAAU;IAIlC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM;IAI1G,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU;IAI1E,gBAAgB,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;CAGhE"}
|
|
1
|
+
{"version":3,"file":"bandersnatch-wasm.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/safrole/bandersnatch-wasm.ts"],"names":[],"mappings":"AAEA,qBAAa,gBAAgB;IAC3B,OAAO;WAEM,GAAG;IAKV,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU;IAIjG,iBAAiB,CACrB,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,UAAU,EAC7B,cAAc,EAAE,UAAU,EAC1B,WAAW,EAAE,UAAU,EACvB,oBAAoB,EAAE,UAAU;IAY5B,iBAAiB,CAAC,IAAI,EAAE,UAAU;IAIlC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM;IAI1G,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU;IAI1E,gBAAgB,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU;CAGhE"}
|
|
@@ -6,18 +6,21 @@ export class BandernsatchWasm {
|
|
|
6
6
|
return new BandernsatchWasm();
|
|
7
7
|
}
|
|
8
8
|
async verifySeal(authorKey, signature, payload, auxData) {
|
|
9
|
-
return bandersnatchWasm.
|
|
9
|
+
return bandersnatchWasm.verifySeal(authorKey, signature, payload, auxData);
|
|
10
|
+
}
|
|
11
|
+
async verifyHeaderSeals(authorKey, headerSeal, headerSealPayload, unsealedHeader, entropySeal, entropyPayloadPrefix) {
|
|
12
|
+
return bandersnatchWasm.verifyHeaderSeals(authorKey, headerSeal, headerSealPayload, unsealedHeader, entropySeal, entropyPayloadPrefix);
|
|
10
13
|
}
|
|
11
14
|
async getRingCommitment(keys) {
|
|
12
|
-
return bandersnatchWasm.
|
|
15
|
+
return bandersnatchWasm.ringCommitment(keys);
|
|
13
16
|
}
|
|
14
17
|
async batchVerifyTicket(ringSize, commitment, ticketsData, contextLength) {
|
|
15
|
-
return bandersnatchWasm.
|
|
18
|
+
return bandersnatchWasm.batchVerifyTickets(ringSize, commitment, ticketsData, contextLength);
|
|
16
19
|
}
|
|
17
20
|
async generateSeal(authorKey, input, auxData) {
|
|
18
|
-
return bandersnatchWasm.
|
|
21
|
+
return bandersnatchWasm.generateSeal(authorKey, input, auxData);
|
|
19
22
|
}
|
|
20
23
|
async getVrfOutputHash(authorKey, input) {
|
|
21
|
-
return bandersnatchWasm.
|
|
24
|
+
return bandersnatchWasm.vrfOutputHash(authorKey, input);
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -8,8 +8,7 @@ export declare enum SafroleSealError {
|
|
|
8
8
|
InvalidValidatorIndex = 0,
|
|
9
9
|
InvalidValidator = 1,
|
|
10
10
|
InvalidTicket = 2,
|
|
11
|
-
IncorrectSeal = 3
|
|
12
|
-
IncorrectEntropySource = 4
|
|
11
|
+
IncorrectSeal = 3
|
|
13
12
|
}
|
|
14
13
|
export type SafroleSealState = Pick<State, "currentValidatorData" | "sealingKeySeries"> & {
|
|
15
14
|
currentEntropy: EntropyHash;
|
|
@@ -22,7 +21,6 @@ export declare class SafroleSeal {
|
|
|
22
21
|
* hence the state is passed as an argument for more control.
|
|
23
22
|
*/
|
|
24
23
|
verifyHeaderSeal(headerView: HeaderView, state: SafroleSealState): Promise<Result<EntropyHash, SafroleSealError>>;
|
|
25
|
-
private verifySeal;
|
|
26
24
|
/** Regular (non-fallback) mode of Safrole. */
|
|
27
25
|
verifySealWithTicket(tickets: PerEpochBlock<Ticket>, timeSlot: TimeSlot, entropy: EntropyHash, validatorData: ValidatorData, headerView: HeaderView): Promise<Result<EntropyHash, SafroleSealError>>;
|
|
28
26
|
/** Fallback mode of Safrole. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safrole-seal.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/safrole/safrole-seal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,QAAQ,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,oBAAY,gBAAgB;IAC1B,qBAAqB,IAAI;IACzB,gBAAgB,IAAI;IACpB,aAAa,IAAI;IACjB,aAAa,IAAI;
|
|
1
|
+
{"version":3,"file":"safrole-seal.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/safrole/safrole-seal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,QAAQ,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAA0B,KAAK,eAAe,EAAE,M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