@typeberry/lib 0.0.1-1c07527 → 0.0.1-53acce8

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 (4) hide show
  1. package/configs/index.d.ts +74 -0
  2. package/index.d.ts +394 -541
  3. package/index.js +1634 -1048
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -59,8 +59,6 @@ declare namespace index$s {
59
59
  }
60
60
 
61
61
  declare enum GpVersion {
62
- V0_6_5 = "0.6.5",
63
- V0_6_6 = "0.6.6",
64
62
  V0_6_7 = "0.6.7",
65
63
  V0_7_0 = "0.7.0-preview",
66
64
  V0_7_1 = "0.7.1-preview",
@@ -73,13 +71,7 @@ declare enum TestSuite {
73
71
 
74
72
  declare const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
75
73
 
76
- declare const ALL_VERSIONS_IN_ORDER = [
77
- GpVersion.V0_6_5,
78
- GpVersion.V0_6_6,
79
- GpVersion.V0_6_7,
80
- GpVersion.V0_7_0,
81
- GpVersion.V0_7_1,
82
- ];
74
+ declare const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
83
75
 
84
76
  declare const env = typeof process === "undefined" ? {} : process.env;
85
77
  declare const DEFAULT_VERSION = GpVersion.V0_6_7;
@@ -168,6 +160,10 @@ declare class Compatibility {
168
160
  }
169
161
  }
170
162
 
163
+ declare function isBrowser() {
164
+ return typeof process === "undefined" || typeof process.abort === "undefined";
165
+ }
166
+
171
167
  /**
172
168
  * A function to perform runtime assertions.
173
169
  *
@@ -286,20 +282,19 @@ declare function inspect<T>(val: T): string {
286
282
  }
287
283
 
288
284
  /** Utility function to measure time taken for some operation [ms]. */
289
- declare const measure =
290
- typeof process === "undefined"
291
- ? (id: string) => {
292
- const start = performance.now();
293
- return () => `${id} took ${performance.now() - start}ms`;
294
- }
295
- : (id: string) => {
296
- const start = process.hrtime.bigint();
297
- return () => {
298
- const tookNano = process.hrtime.bigint() - start;
299
- const tookMilli = Number(tookNano / 1_000_000n).toFixed(2);
300
- return `${id} took ${tookMilli}ms`;
301
- };
285
+ declare const measure = isBrowser()
286
+ ? (id: string) => {
287
+ const start = performance.now();
288
+ return () => `${id} took ${performance.now() - start}ms`;
289
+ }
290
+ : (id: string) => {
291
+ const start = process.hrtime.bigint();
292
+ return () => {
293
+ const tookNano = process.hrtime.bigint() - start;
294
+ const tookMilli = Number(tookNano / 1_000_000n).toFixed(2);
295
+ return `${id} took ${tookMilli}ms`;
302
296
  };
297
+ };
303
298
 
304
299
  /** A class that adds `toString` method that prints all properties of an object. */
305
300
  declare abstract class WithDebug {
@@ -786,6 +781,7 @@ declare const index$r_ensure: typeof ensure;
786
781
  declare const index$r_env: typeof env;
787
782
  declare const index$r_getAllKeysSorted: typeof getAllKeysSorted;
788
783
  declare const index$r_inspect: typeof inspect;
784
+ declare const index$r_isBrowser: typeof isBrowser;
789
785
  declare const index$r_isResult: typeof isResult;
790
786
  declare const index$r_isTaggedError: typeof isTaggedError;
791
787
  declare const index$r_maybeTaggedErrorToString: typeof maybeTaggedErrorToString;
@@ -796,7 +792,7 @@ declare const index$r_resultToString: typeof resultToString;
796
792
  declare const index$r_seeThrough: typeof seeThrough;
797
793
  declare const index$r_trimStack: typeof trimStack;
798
794
  declare namespace index$r {
799
- export { index$r_ALL_VERSIONS_IN_ORDER as ALL_VERSIONS_IN_ORDER, index$r_CURRENT_SUITE as CURRENT_SUITE, index$r_CURRENT_VERSION as CURRENT_VERSION, index$r_Compatibility as Compatibility, index$r_DEFAULT_SUITE as DEFAULT_SUITE, index$r_DEFAULT_VERSION as DEFAULT_VERSION, index$r_ErrorsCollector as ErrorsCollector, index$r_GpVersion as GpVersion, Result$2 as Result, index$r_RichTaggedError as RichTaggedError, index$r_TEST_COMPARE_USING as TEST_COMPARE_USING, index$r_TestSuite as TestSuite, index$r_WithDebug as WithDebug, index$r___OPAQUE_TYPE__ as __OPAQUE_TYPE__, index$r_asOpaqueType as asOpaqueType, index$r_assertEmpty as assertEmpty, index$r_assertNever as assertNever, index$r_callCompareFunction as callCompareFunction, index$r_cast as cast, index$r_check as check, index$r_deepEqual as deepEqual, index$r_ensure as ensure, index$r_env as env, index$r_getAllKeysSorted as getAllKeysSorted, index$r_inspect as inspect, index$r_isResult as isResult, index$r_isTaggedError as isTaggedError, index$r_maybeTaggedErrorToString as maybeTaggedErrorToString, index$r_measure as measure, index$r_parseCurrentSuite as parseCurrentSuite, index$r_parseCurrentVersion as parseCurrentVersion, index$r_resultToString as resultToString, index$r_seeThrough as seeThrough, index$r_trimStack as trimStack };
795
+ export { index$r_ALL_VERSIONS_IN_ORDER as ALL_VERSIONS_IN_ORDER, index$r_CURRENT_SUITE as CURRENT_SUITE, index$r_CURRENT_VERSION as CURRENT_VERSION, index$r_Compatibility as Compatibility, index$r_DEFAULT_SUITE as DEFAULT_SUITE, index$r_DEFAULT_VERSION as DEFAULT_VERSION, index$r_ErrorsCollector as ErrorsCollector, index$r_GpVersion as GpVersion, Result$2 as Result, index$r_RichTaggedError as RichTaggedError, index$r_TEST_COMPARE_USING as TEST_COMPARE_USING, index$r_TestSuite as TestSuite, index$r_WithDebug as WithDebug, index$r___OPAQUE_TYPE__ as __OPAQUE_TYPE__, index$r_asOpaqueType as asOpaqueType, index$r_assertEmpty as assertEmpty, index$r_assertNever as assertNever, index$r_callCompareFunction as callCompareFunction, index$r_cast as cast, index$r_check as check, index$r_deepEqual as deepEqual, index$r_ensure as ensure, index$r_env as env, index$r_getAllKeysSorted as getAllKeysSorted, index$r_inspect as inspect, index$r_isBrowser as isBrowser, index$r_isResult as isResult, index$r_isTaggedError as isTaggedError, index$r_maybeTaggedErrorToString as maybeTaggedErrorToString, index$r_measure as measure, index$r_parseCurrentSuite as parseCurrentSuite, index$r_parseCurrentVersion as parseCurrentVersion, index$r_resultToString as resultToString, index$r_seeThrough as seeThrough, index$r_trimStack as trimStack };
800
796
  export type { index$r_DeepEqualOptions as DeepEqualOptions, index$r_EnumMapping as EnumMapping, index$r_ErrorResult as ErrorResult, index$r_OK as OK, index$r_OkResult as OkResult, index$r_Opaque as Opaque, index$r_StringLiteral as StringLiteral, index$r_TaggedError as TaggedError, index$r_TokenOf as TokenOf, index$r_Uninstantiable as Uninstantiable, index$r_WithOpaque as WithOpaque };
801
797
  }
802
798
 
@@ -2332,6 +2328,141 @@ declare class Skipper {
2332
2328
  }
2333
2329
  }
2334
2330
 
2331
+ /** Infer the type that is described by given descriptor `T` */
2332
+ type DescribedBy<T> = T extends Descriptor<infer V> ? V : never;
2333
+
2334
+ /**
2335
+ * Converts a class `T` into an object with the same fields as the class.
2336
+ */
2337
+ type CodecRecord<T> = {
2338
+ [K in PropertyKeys<T>]: T[K];
2339
+ };
2340
+
2341
+ /**
2342
+ * Same as `CodecRecord<T>`, but the fields are all optional.
2343
+ */
2344
+ type OptionalRecord<T> = {
2345
+ [K in PropertyKeys<T>]?: T[K];
2346
+ };
2347
+
2348
+ /**
2349
+ * `Descriptor` of a complex type of some class with a bunch of public fields.
2350
+ */
2351
+ type DescriptorRecord<T> = {
2352
+ [K in PropertyKeys<T>]: Descriptor<T[K], unknown>;
2353
+ };
2354
+
2355
+ /**
2356
+ * Simplified `DescriptorRecord`, where all keys must be used as descriptor keys.
2357
+ */
2358
+ type SimpleDescriptorRecord<T> = {
2359
+ [K in keyof T]: Descriptor<T[K], unknown>;
2360
+ };
2361
+
2362
+ /** Only keys that contain properties, not methods. */
2363
+ type PropertyKeys<T> = {
2364
+ // biome-ignore lint/complexity/noBannedTypes: We want to skip any function-like types here.
2365
+ [K in Extract<keyof T, string>]: T[K] extends Function ? never : K;
2366
+ }[Extract<keyof T, string>];
2367
+
2368
+ /** A constructor of basic data object that takes a `Record<T>`. */
2369
+ type ClassConstructor<T> = {
2370
+ name: string;
2371
+ create: (o: CodecRecord<T>) => T;
2372
+ };
2373
+
2374
+ /**
2375
+ * A full codec type, i.e. the `Encode` and `Decode`.
2376
+ */
2377
+ type Codec<T> = Encode<T> & Decode<T>;
2378
+
2379
+ /**
2380
+ * Type descriptor definition.
2381
+ *
2382
+ * The type descriptor can encode & decode given type `T`, but
2383
+ * also have a `name` and a byte-size hint.
2384
+ *
2385
+ * Descriptors can be composed to form more complex typings.
2386
+ */
2387
+ declare class Descriptor<T, V = T> implements Codec<T>, Skip {
2388
+ /** A "lightweight" version of the object. */
2389
+ public readonly View: Descriptor<V>;
2390
+
2391
+ /** New descriptor with specialized `View`. */
2392
+ public static withView<T, V>(
2393
+ name: string,
2394
+ sizeHint: SizeHint,
2395
+ encode: Descriptor<T, V>["encode"],
2396
+ decode: Descriptor<T, V>["decode"],
2397
+ skip: Descriptor<T, V>["skip"],
2398
+ view: Descriptor<V>,
2399
+ ) {
2400
+ return new Descriptor(name, sizeHint, encode, decode, skip, view);
2401
+ }
2402
+
2403
+ /** Create a new descriptor without a specialized `View`. */
2404
+ public static new<T>(
2405
+ name: string,
2406
+ sizeHint: SizeHint,
2407
+ encode: Descriptor<T>["encode"],
2408
+ decode: Descriptor<T>["decode"],
2409
+ skip: Descriptor<T>["skip"],
2410
+ ) {
2411
+ return new Descriptor(name, sizeHint, encode, decode, skip, null);
2412
+ }
2413
+
2414
+ private constructor(
2415
+ /** Descriptive name of the coded data. */
2416
+ public readonly name: string,
2417
+ /** A byte size hint for encoded data. */
2418
+ public readonly sizeHint: SizeHint,
2419
+ /** Encoding function. */
2420
+ public readonly encode: (e: Encoder, elem: T) => void,
2421
+ /** Decoding function. */
2422
+ public readonly decode: (d: Decoder) => T,
2423
+ /** Skipping function. */
2424
+ public readonly skip: (s: Skipper) => void,
2425
+ /** view object. It can be `null` iff T===V. */
2426
+ view: Descriptor<V> | null,
2427
+ ) {
2428
+ // We cast here to make sure that the field is always set.
2429
+ this.View = view ?? (this as unknown as Descriptor<V>);
2430
+ }
2431
+
2432
+ /**
2433
+ * Extract an encoded version of this type from the decoder.
2434
+ *
2435
+ * This function skips the object instead of decoding it,
2436
+ * allowing to retrieve the encoded portion of the object from `Decoder`.
2437
+ */
2438
+ public skipEncoded(decoder: Decoder) {
2439
+ const initBytes = decoder.bytesRead();
2440
+ this.skip(new Skipper(decoder));
2441
+ const endBytes = decoder.bytesRead();
2442
+ return BytesBlob.blobFrom(decoder.source.subarray(initBytes, endBytes));
2443
+ }
2444
+
2445
+ /** Return a new descriptor that converts data into some other type. */
2446
+ public convert<F>(input: (i: F) => T, output: (i: T) => F): Descriptor<F, V> {
2447
+ return new Descriptor(
2448
+ this.name,
2449
+ this.sizeHint,
2450
+ (e: Encoder, elem: F) => this.encode(e, input(elem)),
2451
+ (d: Decoder) => output(this.decode(d)),
2452
+ this.skip,
2453
+ this.View,
2454
+ );
2455
+ }
2456
+
2457
+ /** Safely cast the descriptor value to a opaque type. */
2458
+ public asOpaque<R>(): Descriptor<Opaque<T, TokenOf<R, T>>, V> {
2459
+ return this.convert(
2460
+ (i) => seeThrough(i),
2461
+ (o) => asOpaqueType<T, TokenOf<R, T>>(o),
2462
+ );
2463
+ }
2464
+ }
2465
+
2335
2466
  type LengthRange = {
2336
2467
  /** Inclusive value of minimal length of the sequence. */
2337
2468
  minLength: number;
@@ -2624,98 +2755,6 @@ declare const TYPICAL_SEQUENCE_LENGTH = 64;
2624
2755
  */
2625
2756
  declare const TYPICAL_DICTIONARY_LENGTH = 32;
2626
2757
 
2627
- /**
2628
- * A full codec type, i.e. the `Encode` and `Decode`.
2629
- */
2630
- type Codec<T> = Encode<T> & Decode<T>;
2631
-
2632
- /**
2633
- * Type descriptor definition.
2634
- *
2635
- * The type descriptor can encode & decode given type `T`, but
2636
- * also have a `name` and a byte-size hint.
2637
- *
2638
- * Descriptors can be composed to form more complex typings.
2639
- */
2640
- declare class Descriptor<T, V = T> implements Codec<T>, Skip {
2641
- /** A "lightweight" version of the object. */
2642
- public readonly View: Descriptor<V>;
2643
-
2644
- /** New descriptor with specialized `View`. */
2645
- public static withView<T, V>(
2646
- name: string,
2647
- sizeHint: SizeHint,
2648
- encode: Descriptor<T, V>["encode"],
2649
- decode: Descriptor<T, V>["decode"],
2650
- skip: Descriptor<T, V>["skip"],
2651
- view: Descriptor<V>,
2652
- ) {
2653
- return new Descriptor(name, sizeHint, encode, decode, skip, view);
2654
- }
2655
-
2656
- /** Create a new descriptor without a specialized `View`. */
2657
- public static new<T>(
2658
- name: string,
2659
- sizeHint: SizeHint,
2660
- encode: Descriptor<T>["encode"],
2661
- decode: Descriptor<T>["decode"],
2662
- skip: Descriptor<T>["skip"],
2663
- ) {
2664
- return new Descriptor(name, sizeHint, encode, decode, skip, null);
2665
- }
2666
-
2667
- private constructor(
2668
- /** Descriptive name of the coded data. */
2669
- public readonly name: string,
2670
- /** A byte size hint for encoded data. */
2671
- public readonly sizeHint: SizeHint,
2672
- /** Encoding function. */
2673
- public readonly encode: (e: Encoder, elem: T) => void,
2674
- /** Decoding function. */
2675
- public readonly decode: (d: Decoder) => T,
2676
- /** Skipping function. */
2677
- public readonly skip: (s: Skipper) => void,
2678
- /** view object. It can be `null` iff T===V. */
2679
- view: Descriptor<V> | null,
2680
- ) {
2681
- // We cast here to make sure that the field is always set.
2682
- this.View = view ?? (this as unknown as Descriptor<V>);
2683
- }
2684
-
2685
- /**
2686
- * Extract an encoded version of this type from the decoder.
2687
- *
2688
- * This function skips the object instead of decoding it,
2689
- * allowing to retrieve the encoded portion of the object from `Decoder`.
2690
- */
2691
- public skipEncoded(decoder: Decoder) {
2692
- const initBytes = decoder.bytesRead();
2693
- this.skip(new Skipper(decoder));
2694
- const endBytes = decoder.bytesRead();
2695
- return BytesBlob.blobFrom(decoder.source.subarray(initBytes, endBytes));
2696
- }
2697
-
2698
- /** Return a new descriptor that converts data into some other type. */
2699
- public convert<F>(input: (i: F) => T, output: (i: T) => F): Descriptor<F, V> {
2700
- return new Descriptor(
2701
- this.name,
2702
- this.sizeHint,
2703
- (e: Encoder, elem: F) => this.encode(e, input(elem)),
2704
- (d: Decoder) => output(this.decode(d)),
2705
- this.skip,
2706
- this.View,
2707
- );
2708
- }
2709
-
2710
- /** Safely cast the descriptor value to a opaque type. */
2711
- public asOpaque<R>(): Descriptor<Opaque<T, TokenOf<R, T>>, V> {
2712
- return this.convert(
2713
- (i) => seeThrough(i),
2714
- (o) => asOpaqueType<T, TokenOf<R, T>>(o),
2715
- );
2716
- }
2717
- }
2718
-
2719
2758
  /**
2720
2759
  * Convert a descriptor for regular array into readonly one.
2721
2760
  *
@@ -2736,49 +2775,6 @@ declare function readonlyArray<T, V>(desc: Descriptor<T[], V>): Descriptor<reado
2736
2775
  );
2737
2776
  }
2738
2777
 
2739
- /** Infer the type that is described by given descriptor `T` */
2740
- type DescribedBy<T> = T extends Descriptor<infer V> ? V : never;
2741
-
2742
- /**
2743
- * Converts a class `T` into an object with the same fields as the class.
2744
- */
2745
- type CodecRecord<T> = {
2746
- [K in PropertyKeys<T>]: T[K];
2747
- };
2748
-
2749
- /**
2750
- * Same as `CodecRecord<T>`, but the fields are all optional.
2751
- */
2752
- type OptionalRecord<T> = {
2753
- [K in PropertyKeys<T>]?: T[K];
2754
- };
2755
-
2756
- /**
2757
- * `Descriptor` of a complex type of some class with a bunch of public fields.
2758
- */
2759
- type DescriptorRecord<T> = {
2760
- [K in PropertyKeys<T>]: Descriptor<T[K], unknown>;
2761
- };
2762
-
2763
- /**
2764
- * Simplified `DescriptorRecord`, where all keys must be used as descriptor keys.
2765
- */
2766
- type SimpleDescriptorRecord<T> = {
2767
- [K in keyof T]: Descriptor<T[K], unknown>;
2768
- };
2769
-
2770
- /** Only keys that contain properties, not methods. */
2771
- type PropertyKeys<T> = {
2772
- // biome-ignore lint/complexity/noBannedTypes: We want to skip any function-like types here.
2773
- [K in Extract<keyof T, string>]: T[K] extends Function ? never : K;
2774
- }[Extract<keyof T, string>];
2775
-
2776
- /** A constructor of basic data object that takes a `Record<T>`. */
2777
- type ClassConstructor<T> = {
2778
- name: string;
2779
- create: (o: CodecRecord<T>) => T;
2780
- };
2781
-
2782
2778
  declare function exactHint(bytes: number): SizeHint {
2783
2779
  return {
2784
2780
  bytes,
@@ -3399,6 +3395,9 @@ type index$o_SimpleDescriptorRecord<T> = SimpleDescriptorRecord<T>;
3399
3395
  type index$o_SizeHint = SizeHint;
3400
3396
  declare const index$o_TYPICAL_DICTIONARY_LENGTH: typeof TYPICAL_DICTIONARY_LENGTH;
3401
3397
  declare const index$o_TYPICAL_SEQUENCE_LENGTH: typeof TYPICAL_SEQUENCE_LENGTH;
3398
+ type index$o_ViewField<T, V> = ViewField<T, V>;
3399
+ declare const index$o_ViewField: typeof ViewField;
3400
+ type index$o_ViewOf<T, D extends DescriptorRecord<T>> = ViewOf<T, D>;
3402
3401
  declare const index$o_addSizeHints: typeof addSizeHints;
3403
3402
  declare const index$o_decodeVariableLengthExtraBytes: typeof decodeVariableLengthExtraBytes;
3404
3403
  declare const index$o_exactHint: typeof exactHint;
@@ -3411,8 +3410,8 @@ declare const index$o_sequenceViewVarLen: typeof sequenceViewVarLen;
3411
3410
  declare const index$o_tryAsExactBytes: typeof tryAsExactBytes;
3412
3411
  declare const index$o_validateLength: typeof validateLength;
3413
3412
  declare namespace index$o {
3414
- export { index$o_DEFAULT_START_LENGTH as DEFAULT_START_LENGTH, index$o_Decoder as Decoder, index$o_Descriptor as Descriptor, index$o_Encoder as Encoder, index$o_MASKS as MASKS, index$o_MAX_LENGTH as MAX_LENGTH, index$o_ObjectView as ObjectView, index$o_SequenceView as SequenceView, index$o_TYPICAL_DICTIONARY_LENGTH as TYPICAL_DICTIONARY_LENGTH, index$o_TYPICAL_SEQUENCE_LENGTH as TYPICAL_SEQUENCE_LENGTH, index$o_addSizeHints as addSizeHints, codec$1 as codec, index$o_decodeVariableLengthExtraBytes as decodeVariableLengthExtraBytes, index$o_exactHint as exactHint, index$o_forEachDescriptor as forEachDescriptor, index$o_hasUniqueView as hasUniqueView, index$o_objectView as objectView, index$o_readonlyArray as readonlyArray, index$o_sequenceViewFixLen as sequenceViewFixLen, index$o_sequenceViewVarLen as sequenceViewVarLen, index$o_tryAsExactBytes as tryAsExactBytes, index$o_validateLength as validateLength };
3415
- export type { index$o_ClassConstructor as ClassConstructor, index$o_Codec as Codec, index$o_CodecRecord as CodecRecord, index$o_Decode as Decode, index$o_DescribedBy as DescribedBy, index$o_DescriptorRecord as DescriptorRecord, index$o_Encode as Encode, index$o_LengthRange as LengthRange, index$o_OptionalRecord as OptionalRecord, Options$1 as Options, index$o_PropertyKeys as PropertyKeys, index$o_SimpleDescriptorRecord as SimpleDescriptorRecord, index$o_SizeHint as SizeHint };
3413
+ export { index$o_DEFAULT_START_LENGTH as DEFAULT_START_LENGTH, index$o_Decoder as Decoder, index$o_Descriptor as Descriptor, index$o_Encoder as Encoder, index$o_MASKS as MASKS, index$o_MAX_LENGTH as MAX_LENGTH, index$o_ObjectView as ObjectView, index$o_SequenceView as SequenceView, index$o_TYPICAL_DICTIONARY_LENGTH as TYPICAL_DICTIONARY_LENGTH, index$o_TYPICAL_SEQUENCE_LENGTH as TYPICAL_SEQUENCE_LENGTH, index$o_ViewField as ViewField, index$o_addSizeHints as addSizeHints, codec$1 as codec, index$o_decodeVariableLengthExtraBytes as decodeVariableLengthExtraBytes, index$o_exactHint as exactHint, index$o_forEachDescriptor as forEachDescriptor, index$o_hasUniqueView as hasUniqueView, index$o_objectView as objectView, index$o_readonlyArray as readonlyArray, index$o_sequenceViewFixLen as sequenceViewFixLen, index$o_sequenceViewVarLen as sequenceViewVarLen, index$o_tryAsExactBytes as tryAsExactBytes, index$o_validateLength as validateLength };
3414
+ export type { index$o_ClassConstructor as ClassConstructor, index$o_Codec as Codec, index$o_CodecRecord as CodecRecord, index$o_Decode as Decode, index$o_DescribedBy as DescribedBy, index$o_DescriptorRecord as DescriptorRecord, index$o_Encode as Encode, index$o_LengthRange as LengthRange, index$o_OptionalRecord as OptionalRecord, Options$1 as Options, index$o_PropertyKeys as PropertyKeys, index$o_SimpleDescriptorRecord as SimpleDescriptorRecord, index$o_SizeHint as SizeHint, index$o_ViewOf as ViewOf };
3416
3415
  }
3417
3416
 
3418
3417
  /**
@@ -4461,6 +4460,84 @@ declare namespace index$m {
4461
4460
  export type { index$m_HashWithZeroedBit as HashWithZeroedBit, index$m_ImmutableHashDictionary as ImmutableHashDictionary, index$m_ImmutableHashSet as ImmutableHashSet, index$m_ImmutableSortedArray as ImmutableSortedArray, index$m_ImmutableSortedSet as ImmutableSortedSet, index$m_KeyMapper as KeyMapper, index$m_KeyMappers as KeyMappers, index$m_KnownSize as KnownSize, index$m_KnownSizeArray as KnownSizeArray, index$m_KnownSizeId as KnownSizeId, index$m_NestedMaps as NestedMaps };
4462
4461
  }
4463
4462
 
4463
+ declare namespace bandersnatch_d_exports {
4464
+ export { batch_verify_tickets, __wbg_init$2 as default, derive_public_key, initSync$2 as initSync, ring_commitment, verify_seal };
4465
+ export type { InitInput$2 as InitInput, InitOutput$2 as InitOutput, SyncInitInput$2 as SyncInitInput };
4466
+ }
4467
+ /* tslint:disable */
4468
+ /* eslint-disable */
4469
+ /**
4470
+ * @param {Uint8Array} keys
4471
+ * @returns {Uint8Array}
4472
+ */
4473
+ declare function ring_commitment(keys: Uint8Array): Uint8Array;
4474
+ /**
4475
+ * Derive Private and Public Key from Seed
4476
+ *
4477
+ * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
4478
+ * @param {Uint8Array} seed
4479
+ * @returns {Uint8Array}
4480
+ */
4481
+ declare function derive_public_key(seed: Uint8Array): Uint8Array;
4482
+ /**
4483
+ * Seal verification as defined in:
4484
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
4485
+ * or
4486
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
4487
+ * @param {Uint8Array} keys
4488
+ * @param {number} signer_key_index
4489
+ * @param {Uint8Array} seal_data
4490
+ * @param {Uint8Array} payload
4491
+ * @param {Uint8Array} aux_data
4492
+ * @returns {Uint8Array}
4493
+ */
4494
+ declare function verify_seal(keys: Uint8Array, signer_key_index: number, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
4495
+ /**
4496
+ * Verify multiple tickets at once as defined in:
4497
+ * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
4498
+ *
4499
+ * NOTE: the aux_data of VRF function is empty!
4500
+ * @param {Uint8Array} keys
4501
+ * @param {Uint8Array} tickets_data
4502
+ * @param {number} vrf_input_data_len
4503
+ * @returns {Uint8Array}
4504
+ */
4505
+ declare function batch_verify_tickets(keys: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
4506
+ type InitInput$2 = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
4507
+ interface InitOutput$2 {
4508
+ readonly memory: WebAssembly.Memory;
4509
+ readonly ring_commitment: (a: number, b: number, c: number) => void;
4510
+ readonly derive_public_key: (a: number, b: number, c: number) => void;
4511
+ readonly verify_seal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
4512
+ readonly batch_verify_tickets: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
4513
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
4514
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
4515
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
4516
+ }
4517
+ type SyncInitInput$2 = BufferSource | WebAssembly.Module;
4518
+ /**
4519
+ * Instantiates the given `module`, which can either be bytes or
4520
+ * a precompiled `WebAssembly.Module`.
4521
+ *
4522
+ * @param {SyncInitInput} module
4523
+ *
4524
+ * @returns {InitOutput}
4525
+ */
4526
+ declare function initSync$2(module: SyncInitInput$2): InitOutput$2;
4527
+
4528
+ /**
4529
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
4530
+ * for everything else, calls `WebAssembly.instantiate` directly.
4531
+ *
4532
+ * @param {InitInput | Promise<InitInput>} module_or_path
4533
+ *
4534
+ * @returns {Promise<InitOutput>}
4535
+ */
4536
+ declare function __wbg_init$2(module_or_path?: InitInput$2 | Promise<InitInput$2>): Promise<InitOutput$2>;
4537
+ //#endregion
4538
+ //#region native/index.d.ts
4539
+ declare function initAll(): Promise<void>;
4540
+
4464
4541
  /** ED25519 private key size. */
4465
4542
  declare const ED25519_PRIV_KEY_BYTES = 32;
4466
4543
  type ED25519_PRIV_KEY_BYTES = typeof ED25519_PRIV_KEY_BYTES;
@@ -4553,7 +4630,7 @@ declare async function verify<T extends BytesBlob>(input: Input<T>[]): Promise<b
4553
4630
  offset += messageLength;
4554
4631
  }
4555
4632
 
4556
- const result = Array.from(verify_ed25519(data)).map((x) => x === 1);
4633
+ const result = Array.from(ed25519.verify_ed25519(data)).map((x) => x === 1);
4557
4634
  return Promise.resolve(result);
4558
4635
  }
4559
4636
 
@@ -4575,7 +4652,7 @@ declare async function verifyBatch<T extends BytesBlob>(input: Input<T>[]): Prom
4575
4652
 
4576
4653
  const data = BytesBlob.blobFromParts(first, ...rest).raw;
4577
4654
 
4578
- return Promise.resolve(verify_ed25519_batch(data));
4655
+ return Promise.resolve(ed25519.verify_ed25519_batch(data));
4579
4656
  }
4580
4657
 
4581
4658
  type ed25519_ED25519_KEY_BYTES = ED25519_KEY_BYTES;
@@ -4595,59 +4672,6 @@ declare namespace ed25519 {
4595
4672
  export type { ed25519_ED25519_KEY_BYTES as ED25519_KEY_BYTES, ed25519_ED25519_PRIV_KEY_BYTES as ED25519_PRIV_KEY_BYTES, ed25519_ED25519_SIGNATURE_BYTES as ED25519_SIGNATURE_BYTES, ed25519_Ed25519Key as Ed25519Key, ed25519_Ed25519Signature as Ed25519Signature, ed25519_Input as Input };
4596
4673
  }
4597
4674
 
4598
- /* tslint:disable */
4599
- /* eslint-disable */
4600
- /**
4601
- * @param {Uint8Array} keys
4602
- * @returns {Uint8Array}
4603
- */
4604
- declare function ring_commitment(keys: Uint8Array): Uint8Array;
4605
- /**
4606
- * Derive Private and Public Key from Seed
4607
- *
4608
- * returns: `Vec<u8>` containing the exit (1 byte) status followed by the (32 bytes) public key
4609
- * @param {Uint8Array} seed
4610
- * @returns {Uint8Array}
4611
- */
4612
- declare function derive_public_key(seed: Uint8Array): Uint8Array;
4613
- /**
4614
- * Seal verification as defined in:
4615
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0eff000eff00?v=0.6.4
4616
- * or
4617
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0e54010e5401?v=0.6.4
4618
- * @param {Uint8Array} keys
4619
- * @param {number} signer_key_index
4620
- * @param {Uint8Array} seal_data
4621
- * @param {Uint8Array} payload
4622
- * @param {Uint8Array} aux_data
4623
- * @returns {Uint8Array}
4624
- */
4625
- declare function verify_seal(keys: Uint8Array, signer_key_index: number, seal_data: Uint8Array, payload: Uint8Array, aux_data: Uint8Array): Uint8Array;
4626
- /**
4627
- * Verify multiple tickets at once as defined in:
4628
- * https://graypaper.fluffylabs.dev/#/68eaa1f/0f3e000f3e00?v=0.6.4
4629
- *
4630
- * NOTE: the aux_data of VRF function is empty!
4631
- * @param {Uint8Array} keys
4632
- * @param {Uint8Array} tickets_data
4633
- * @param {number} vrf_input_data_len
4634
- * @returns {Uint8Array}
4635
- */
4636
- declare function batch_verify_tickets(keys: Uint8Array, tickets_data: Uint8Array, vrf_input_data_len: number): Uint8Array;
4637
-
4638
- declare const bandersnatch_d_batch_verify_tickets: typeof batch_verify_tickets;
4639
- declare const bandersnatch_d_derive_public_key: typeof derive_public_key;
4640
- declare const bandersnatch_d_ring_commitment: typeof ring_commitment;
4641
- declare const bandersnatch_d_verify_seal: typeof verify_seal;
4642
- declare namespace bandersnatch_d {
4643
- export {
4644
- bandersnatch_d_batch_verify_tickets as batch_verify_tickets,
4645
- bandersnatch_d_derive_public_key as derive_public_key,
4646
- bandersnatch_d_ring_commitment as ring_commitment,
4647
- bandersnatch_d_verify_seal as verify_seal,
4648
- };
4649
- }
4650
-
4651
4675
  /** Bandersnatch public key size. */
4652
4676
  declare const BANDERSNATCH_KEY_BYTES = 32;
4653
4677
  type BANDERSNATCH_KEY_BYTES = typeof BANDERSNATCH_KEY_BYTES;
@@ -4705,7 +4729,7 @@ type BlsKey = Opaque<Bytes<BLS_KEY_BYTES>, "BlsKey">;
4705
4729
 
4706
4730
  /** Derive a Bandersnatch public key from a seed. */
4707
4731
  declare function publicKey(seed: Uint8Array): BandersnatchKey {
4708
- const key = derive_public_key(seed);
4732
+ const key = bandersnatch.derive_public_key(seed);
4709
4733
 
4710
4734
  check(key[0] === 0, "Invalid Bandersnatch public key derived from seed");
4711
4735
 
@@ -4831,7 +4855,7 @@ declare const index$l_bandersnatch: typeof bandersnatch;
4831
4855
  declare const index$l_ed25519: typeof ed25519;
4832
4856
  declare const index$l_keyDerivation: typeof keyDerivation;
4833
4857
  declare namespace index$l {
4834
- export { index$l_Ed25519Pair as Ed25519Pair, index$l_bandersnatch as bandersnatch, bandersnatch_d as bandersnatchWasm, index$l_ed25519 as ed25519, index$l_keyDerivation as keyDerivation };
4858
+ export { index$l_Ed25519Pair as Ed25519Pair, index$l_bandersnatch as bandersnatch, bandersnatch_d_exports as bandersnatchWasm, index$l_ed25519 as ed25519, initAll as initWasm, index$l_keyDerivation as keyDerivation };
4835
4859
  export type { index$l_BANDERSNATCH_KEY_BYTES as BANDERSNATCH_KEY_BYTES, index$l_BANDERSNATCH_PROOF_BYTES as BANDERSNATCH_PROOF_BYTES, index$l_BANDERSNATCH_RING_ROOT_BYTES as BANDERSNATCH_RING_ROOT_BYTES, index$l_BANDERSNATCH_VRF_SIGNATURE_BYTES as BANDERSNATCH_VRF_SIGNATURE_BYTES, index$l_BLS_KEY_BYTES as BLS_KEY_BYTES, index$l_BandersnatchKey as BandersnatchKey, index$l_BandersnatchProof as BandersnatchProof, index$l_BandersnatchRingRoot as BandersnatchRingRoot, index$l_BandersnatchSecretSeed as BandersnatchSecretSeed, index$l_BandersnatchVrfSignature as BandersnatchVrfSignature, index$l_BlsKey as BlsKey, index$l_ED25519_KEY_BYTES as ED25519_KEY_BYTES, index$l_ED25519_PRIV_KEY_BYTES as ED25519_PRIV_KEY_BYTES, index$l_ED25519_SIGNATURE_BYTES as ED25519_SIGNATURE_BYTES, index$l_Ed25519Key as Ed25519Key, index$l_Ed25519SecretSeed as Ed25519SecretSeed, index$l_Ed25519Signature as Ed25519Signature, KeySeed as PublicKeySeed, index$l_SEED_SIZE as SEED_SIZE };
4836
4860
  }
4837
4861
 
@@ -5550,6 +5574,39 @@ declare namespace disputes {
5550
5574
  */
5551
5575
  type BeefyHash = Opaque<OpaqueHash, "BeefyHash">;
5552
5576
 
5577
+ /** Authorizer hash. */
5578
+ type AuthorizerHash = Opaque<OpaqueHash, "AuthorizerHash">;
5579
+
5580
+ /** Blake2B hash of a work package. */
5581
+ type WorkPackageHash = Opaque<OpaqueHash, "WorkPackageHash">;
5582
+
5583
+ /** Work package exported segments merkle root hash. */
5584
+ type ExportsRootHash = Opaque<OpaqueHash, "ExportsRootHash">;
5585
+
5586
+ /**
5587
+ * Mapping between work package hash and root hash of it's exports.
5588
+ *
5589
+ * Used to construct a dictionary.
5590
+ */
5591
+ declare class WorkPackageInfo extends WithDebug {
5592
+ static Codec = codec.Class(WorkPackageInfo, {
5593
+ workPackageHash: codec.bytes(HASH_SIZE).asOpaque<WorkPackageHash>(),
5594
+ segmentTreeRoot: codec.bytes(HASH_SIZE).asOpaque<ExportsRootHash>(),
5595
+ });
5596
+
5597
+ private constructor(
5598
+ /** Hash of the described work package. */
5599
+ readonly workPackageHash: WorkPackageHash,
5600
+ /** Exports root hash. */
5601
+ readonly segmentTreeRoot: ExportsRootHash,
5602
+ ) {
5603
+ super();
5604
+ }
5605
+
5606
+ static create({ workPackageHash, segmentTreeRoot }: CodecRecord<WorkPackageInfo>) {
5607
+ return new WorkPackageInfo(workPackageHash, segmentTreeRoot);
5608
+ }
5609
+ }
5553
5610
  /**
5554
5611
  * `X`: Refinement Context - state of the chain at the point
5555
5612
  * that the report's corresponding work-package was evaluated.
@@ -5595,12 +5652,17 @@ declare class RefineContext extends WithDebug {
5595
5652
  }
5596
5653
  }
5597
5654
 
5655
+ type refineContext_AuthorizerHash = AuthorizerHash;
5598
5656
  type refineContext_BeefyHash = BeefyHash;
5657
+ type refineContext_ExportsRootHash = ExportsRootHash;
5599
5658
  type refineContext_RefineContext = RefineContext;
5600
5659
  declare const refineContext_RefineContext: typeof RefineContext;
5660
+ type refineContext_WorkPackageHash = WorkPackageHash;
5661
+ type refineContext_WorkPackageInfo = WorkPackageInfo;
5662
+ declare const refineContext_WorkPackageInfo: typeof WorkPackageInfo;
5601
5663
  declare namespace refineContext {
5602
- export { refineContext_RefineContext as RefineContext };
5603
- export type { refineContext_BeefyHash as BeefyHash };
5664
+ export { refineContext_RefineContext as RefineContext, refineContext_WorkPackageInfo as WorkPackageInfo };
5665
+ export type { refineContext_AuthorizerHash as AuthorizerHash, refineContext_BeefyHash as BeefyHash, refineContext_ExportsRootHash as ExportsRootHash, refineContext_WorkPackageHash as WorkPackageHash };
5604
5666
  }
5605
5667
 
5606
5668
  /** `W_E`: The basic size of erasure-coded pieces in octets. See equation H.6. */
@@ -5925,17 +5987,13 @@ declare enum WorkExecResultKind {
5925
5987
  /** `☇`: unexpected program termination. */
5926
5988
  panic = 2,
5927
5989
  /** `⊚`: the number of exports made was invalidly reported. */
5928
- // biome-ignore lint/style/useLiteralEnumMembers: Compatibility
5929
- incorrectNumberOfExports = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? 3 : -1,
5990
+ incorrectNumberOfExports = 3,
5930
5991
  /** `⊖`: the size of the digest (refinement output) would cross the acceptable limit. */
5931
- // biome-ignore lint/style/useLiteralEnumMembers: Compatibility
5932
- digestTooBig = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? 4 : -1,
5992
+ digestTooBig = 4,
5933
5993
  /** `BAD`: service code was not available for lookup in state. */
5934
- // biome-ignore lint/style/useLiteralEnumMembers: Compatibility
5935
- badCode = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? 5 : 3,
5994
+ badCode = 5,
5936
5995
  /** `BIG`: the code was too big (beyond the maximum allowed size `W_C`) */
5937
- // biome-ignore lint/style/useLiteralEnumMembers: Compatibility
5938
- codeOversize = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? 6 : 4,
5996
+ codeOversize = 6,
5939
5997
  }
5940
5998
 
5941
5999
  /** The execution result of some work-package. */
@@ -6093,14 +6151,6 @@ declare namespace workResult {
6093
6151
  };
6094
6152
  }
6095
6153
 
6096
- /** Authorizer hash. */
6097
- type AuthorizerHash = Opaque<OpaqueHash, "AuthorizerHash">;
6098
-
6099
- /** Blake2B hash of a work package. */
6100
- type WorkPackageHash = Opaque<OpaqueHash, "WorkPackageHash">;
6101
- /** Work package exported segments merkle root hash. */
6102
- type ExportsRootHash = Opaque<OpaqueHash, "ExportsRootHash">;
6103
-
6104
6154
  /**
6105
6155
  * Details about the work package being reported on.
6106
6156
  *
@@ -6135,31 +6185,6 @@ declare class WorkPackageSpec extends WithDebug {
6135
6185
  }
6136
6186
  }
6137
6187
 
6138
- /**
6139
- * Mapping between work package hash and root hash of it's exports.
6140
- *
6141
- * Used to construct a dictionary.
6142
- */
6143
- declare class WorkPackageInfo extends WithDebug {
6144
- static Codec = codec.Class(WorkPackageInfo, {
6145
- workPackageHash: codec.bytes(HASH_SIZE).asOpaque<WorkPackageHash>(),
6146
- segmentTreeRoot: codec.bytes(HASH_SIZE).asOpaque<ExportsRootHash>(),
6147
- });
6148
-
6149
- private constructor(
6150
- /** Hash of the described work package. */
6151
- readonly workPackageHash: WorkPackageHash,
6152
- /** Exports root hash. */
6153
- readonly segmentTreeRoot: ExportsRootHash,
6154
- ) {
6155
- super();
6156
- }
6157
-
6158
- static create({ workPackageHash, segmentTreeRoot }: CodecRecord<WorkPackageInfo>) {
6159
- return new WorkPackageInfo(workPackageHash, segmentTreeRoot);
6160
- }
6161
- }
6162
-
6163
6188
  /**
6164
6189
  * A report of execution of some work package.
6165
6190
  *
@@ -6238,18 +6263,15 @@ declare const WorkReportCodec = codec.Class(WorkReportNoCodec, {
6238
6263
  declare const WorkReportCodecPre070 = codec.Class(WorkReportNoCodec, {
6239
6264
  workPackageSpec: WorkPackageSpec.Codec,
6240
6265
  context: RefineContext.Codec,
6241
- coreIndex:
6242
- Compatibility.isGreaterOrEqual(GpVersion.V0_6_5) && !Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_5)
6243
- ? codec.varU32.convert(
6244
- (o) => tryAsU32(o),
6245
- (i) => {
6246
- if (!isU16(i)) {
6247
- throw new Error(`Core index exceeds U16: ${i}`);
6248
- }
6249
- return tryAsCoreIndex(i);
6250
- },
6251
- )
6252
- : codec.u16.asOpaque<CoreIndex>(),
6266
+ coreIndex: codec.varU32.convert(
6267
+ (o) => tryAsU32(o),
6268
+ (i) => {
6269
+ if (!isU16(i)) {
6270
+ throw new Error(`Core index exceeds U16: ${i}`);
6271
+ }
6272
+ return tryAsCoreIndex(i);
6273
+ },
6274
+ ),
6253
6275
  authorizerHash: codec.bytes(HASH_SIZE).asOpaque<AuthorizerHash>(),
6254
6276
  authorizationOutput: codec.blob,
6255
6277
  segmentRootLookup: readonlyArray(codec.sequenceVarLen(WorkPackageInfo.Codec)),
@@ -6266,11 +6288,6 @@ declare class WorkReport extends WorkReportNoCodec {
6266
6288
  : WorkReportCodecPre070;
6267
6289
  }
6268
6290
 
6269
- type workReport_AuthorizerHash = AuthorizerHash;
6270
- type workReport_ExportsRootHash = ExportsRootHash;
6271
- type workReport_WorkPackageHash = WorkPackageHash;
6272
- type workReport_WorkPackageInfo = WorkPackageInfo;
6273
- declare const workReport_WorkPackageInfo: typeof WorkPackageInfo;
6274
6291
  type workReport_WorkPackageSpec = WorkPackageSpec;
6275
6292
  declare const workReport_WorkPackageSpec: typeof WorkPackageSpec;
6276
6293
  type workReport_WorkReport = WorkReport;
@@ -6280,8 +6297,13 @@ declare const workReport_WorkReportCodecPre070: typeof WorkReportCodecPre070;
6280
6297
  type workReport_WorkReportNoCodec = WorkReportNoCodec;
6281
6298
  declare const workReport_WorkReportNoCodec: typeof WorkReportNoCodec;
6282
6299
  declare namespace workReport {
6283
- export { workReport_WorkPackageInfo as WorkPackageInfo, workReport_WorkPackageSpec as WorkPackageSpec, workReport_WorkReport as WorkReport, workReport_WorkReportCodec as WorkReportCodec, workReport_WorkReportCodecPre070 as WorkReportCodecPre070, workReport_WorkReportNoCodec as WorkReportNoCodec };
6284
- export type { workReport_AuthorizerHash as AuthorizerHash, workReport_ExportsRootHash as ExportsRootHash, workReport_WorkPackageHash as WorkPackageHash };
6300
+ export {
6301
+ workReport_WorkPackageSpec as WorkPackageSpec,
6302
+ workReport_WorkReport as WorkReport,
6303
+ workReport_WorkReportCodec as WorkReportCodec,
6304
+ workReport_WorkReportCodecPre070 as WorkReportCodecPre070,
6305
+ workReport_WorkReportNoCodec as WorkReportNoCodec,
6306
+ };
6285
6307
  }
6286
6308
 
6287
6309
  /**
@@ -7827,7 +7849,7 @@ declare const DEV_CONFIG = "dev";
7827
7849
  declare const DEFAULT_CONFIG = "default";
7828
7850
 
7829
7851
  declare const NODE_DEFAULTS = {
7830
- name: os.hostname(),
7852
+ name: isBrowser() ? "browser" : os.hostname(),
7831
7853
  config: DEFAULT_CONFIG,
7832
7854
  };
7833
7855
 
@@ -7882,11 +7904,11 @@ declare class NodeConfiguration {
7882
7904
 
7883
7905
  declare function loadConfig(configPath: string): NodeConfiguration {
7884
7906
  if (configPath === DEFAULT_CONFIG) {
7885
- return parseFromJson(defaultConfigJson, NodeConfiguration.fromJson);
7907
+ return parseFromJson(configs.default, NodeConfiguration.fromJson);
7886
7908
  }
7887
7909
 
7888
7910
  if (configPath === DEV_CONFIG) {
7889
- return parseFromJson(devConfigJson, NodeConfiguration.fromJson);
7911
+ return parseFromJson(configs.dev, NodeConfiguration.fromJson);
7890
7912
  }
7891
7913
 
7892
7914
  try {
@@ -8432,60 +8454,6 @@ declare namespace index$f {
8432
8454
  declare const MAX_RECENT_HISTORY = 8;
8433
8455
  type MAX_RECENT_HISTORY = typeof MAX_RECENT_HISTORY;
8434
8456
 
8435
- type LegacyBlocksState = KnownSizeArray<LegacyBlockState, `0..${typeof MAX_RECENT_HISTORY}`>;
8436
-
8437
- declare class LegacyBlockState extends WithDebug {
8438
- static Codec = codec.Class(LegacyBlockState, {
8439
- headerHash: codec.bytes(HASH_SIZE).asOpaque<HeaderHash>(),
8440
- mmr: codec.object({
8441
- peaks: readonlyArray(codec.sequenceVarLen(codec.optional(codec.bytes(HASH_SIZE)))),
8442
- }),
8443
- postStateRoot: codec.bytes(HASH_SIZE).asOpaque<StateRootHash>(),
8444
- reported: codecHashDictionary(WorkPackageInfo.Codec, (x) => x.workPackageHash),
8445
- });
8446
-
8447
- static create({ headerHash, mmr, postStateRoot, reported }: CodecRecord<LegacyBlockState>) {
8448
- return new LegacyBlockState(headerHash, mmr, postStateRoot, reported);
8449
- }
8450
-
8451
- private constructor(
8452
- /** Header hash. */
8453
- public readonly headerHash: HeaderHash,
8454
- /** Merkle mountain range peaks. */
8455
- public readonly mmr: MmrPeaks<KeccakHash>,
8456
- /** Posterior state root filled in with a 1-block delay. */
8457
- public postStateRoot: StateRootHash,
8458
- /** Reported work packages (no more than number of cores). */
8459
- public readonly reported: HashDictionary<WorkPackageHash, WorkPackageInfo>,
8460
- ) {
8461
- super();
8462
- }
8463
- }
8464
-
8465
- declare class LegacyRecentBlocks extends WithDebug {
8466
- static Codec = codec.Class(LegacyRecentBlocks, {
8467
- blocks: codecKnownSizeArray(LegacyBlockState.Codec, {
8468
- minLength: 0,
8469
- maxLength: MAX_RECENT_HISTORY,
8470
- typicalLength: MAX_RECENT_HISTORY,
8471
- }),
8472
- });
8473
-
8474
- static create(a: CodecRecord<LegacyRecentBlocks>) {
8475
- return new LegacyRecentBlocks(a.blocks);
8476
- }
8477
-
8478
- private constructor(
8479
- /**
8480
- * Most recent blocks.
8481
- * https://graypaper.fluffylabs.dev/#/85129da/0fb6010fb601?v=0.6.3
8482
- */
8483
- public readonly blocks: LegacyBlocksState,
8484
- ) {
8485
- super();
8486
- }
8487
- }
8488
-
8489
8457
  /** Array of recent blocks with maximum size of `MAX_RECENT_HISTORY` */
8490
8458
  type BlocksState = KnownSizeArray<BlockState, `0..${typeof MAX_RECENT_HISTORY}`>;
8491
8459
 
@@ -8549,87 +8517,54 @@ declare class RecentBlocks extends WithDebug {
8549
8517
  }
8550
8518
 
8551
8519
  /**
8552
- * Unified recent history of blocks that handles both legacy and current formats.
8520
+ * Recent history of blocks.
8553
8521
  *
8554
- * https://graypaper.fluffylabs.dev/#/85129da/38cb0138cb01?v=0.6.3
8555
8522
  * https://graypaper.fluffylabs.dev/#/7e6ff6a/0fc9010fc901?v=0.6.7
8556
8523
  */
8557
8524
  declare class RecentBlocksHistory extends WithDebug {
8558
8525
  static Codec = Descriptor.new<RecentBlocksHistory>(
8559
8526
  "RecentBlocksHistory",
8560
- Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? RecentBlocks.Codec.sizeHint : LegacyRecentBlocks.Codec.sizeHint,
8561
- (encoder, value) =>
8562
- Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
8563
- ? RecentBlocks.Codec.encode(encoder, value.asCurrent())
8564
- : LegacyRecentBlocks.Codec.encode(encoder, value.asLegacy()),
8527
+ RecentBlocks.Codec.sizeHint,
8528
+ (encoder, value) => RecentBlocks.Codec.encode(encoder, value.asCurrent()),
8565
8529
  (decoder) => {
8566
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)) {
8567
- const recentBlocks = RecentBlocks.Codec.decode(decoder);
8568
- return RecentBlocksHistory.create(recentBlocks);
8569
- }
8570
- const legacyBlocks = LegacyRecentBlocks.Codec.decode(decoder);
8571
- return RecentBlocksHistory.legacyCreate(legacyBlocks);
8530
+ const recentBlocks = RecentBlocks.Codec.decode(decoder);
8531
+ return RecentBlocksHistory.create(recentBlocks);
8572
8532
  },
8573
- (_sizer) => {
8574
- return Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
8575
- ? RecentBlocks.Codec.sizeHint
8576
- : LegacyRecentBlocks.Codec.sizeHint;
8533
+ (skip) => {
8534
+ return RecentBlocks.Codec.skip(skip);
8577
8535
  },
8578
8536
  );
8579
8537
 
8580
8538
  static create(recentBlocks: RecentBlocks) {
8581
- return new RecentBlocksHistory(recentBlocks, null);
8582
- }
8583
-
8584
- static legacyCreate(legacyRecentBlocks: LegacyRecentBlocks) {
8585
- return new RecentBlocksHistory(null, legacyRecentBlocks);
8539
+ return new RecentBlocksHistory(recentBlocks);
8586
8540
  }
8587
8541
 
8588
8542
  static empty() {
8589
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)) {
8590
- return RecentBlocksHistory.create(
8591
- RecentBlocks.create({
8592
- blocks: asKnownSize([]),
8593
- accumulationLog: { peaks: [] },
8594
- }),
8595
- );
8596
- }
8597
- return RecentBlocksHistory.legacyCreate(LegacyRecentBlocks.create({ blocks: asKnownSize([]) }));
8543
+ return RecentBlocksHistory.create(
8544
+ RecentBlocks.create({
8545
+ blocks: asKnownSize([]),
8546
+ accumulationLog: { peaks: [] },
8547
+ }),
8548
+ );
8598
8549
  }
8599
8550
 
8600
8551
  /**
8601
8552
  * Returns the block's BEEFY super peak.
8602
- *
8603
- * NOTE: The `hasher` parameter exists solely for backward compatibility with legacy block format.
8604
8553
  */
8605
- static accumulationResult(
8606
- block: BlockState | LegacyBlockState,
8607
- {
8608
- hasher,
8609
- }: {
8610
- hasher: MmrHasher<KeccakHash>;
8611
- },
8612
- ): KeccakHash {
8613
- return Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
8614
- ? (block as BlockState).accumulationResult
8615
- : MerkleMountainRange.fromPeaks(hasher, (block as LegacyBlockState).mmr).getSuperPeakHash();
8554
+ static accumulationResult(block: BlockState): KeccakHash {
8555
+ return (block as BlockState).accumulationResult;
8616
8556
  }
8617
8557
 
8618
- private constructor(
8619
- private readonly current: RecentBlocks | null,
8620
- private readonly legacy: LegacyRecentBlocks | null,
8621
- ) {
8558
+ private constructor(private readonly current: RecentBlocks | null) {
8622
8559
  super();
8623
8560
  }
8624
8561
 
8625
8562
  /** History of recent blocks with maximum size of `MAX_RECENT_HISTORY` */
8626
- get blocks(): readonly (BlockState | LegacyBlockState)[] {
8627
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) && this.current !== null) {
8563
+ get blocks(): readonly BlockState[] {
8564
+ if (this.current !== null) {
8628
8565
  return this.current.blocks;
8629
8566
  }
8630
- if (this.legacy !== null) {
8631
- return this.legacy.blocks;
8632
- }
8567
+
8633
8568
  throw new Error("RecentBlocksHistory is in invalid state");
8634
8569
  }
8635
8570
 
@@ -8640,15 +8575,8 @@ declare class RecentBlocksHistory extends WithDebug {
8640
8575
  return this.current;
8641
8576
  }
8642
8577
 
8643
- asLegacy() {
8644
- if (this.legacy === null) {
8645
- throw new Error("Cannot access legacy RecentBlocks format");
8646
- }
8647
- return this.legacy;
8648
- }
8649
-
8650
- updateBlocks(blocks: (BlockState | LegacyBlockState)[]): RecentBlocksHistory {
8651
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) && this.current !== null) {
8578
+ updateBlocks(blocks: BlockState[]): RecentBlocksHistory {
8579
+ if (this.current !== null) {
8652
8580
  return RecentBlocksHistory.create(
8653
8581
  RecentBlocks.create({
8654
8582
  ...this.current,
@@ -8656,13 +8584,7 @@ declare class RecentBlocksHistory extends WithDebug {
8656
8584
  }),
8657
8585
  );
8658
8586
  }
8659
- if (this.legacy !== null) {
8660
- return RecentBlocksHistory.legacyCreate(
8661
- LegacyRecentBlocks.create({
8662
- blocks: asOpaqueType(blocks as LegacyBlockState[]),
8663
- }),
8664
- );
8665
- }
8587
+
8666
8588
  throw new Error("RecentBlocksHistory is in invalid state. Cannot be updated!");
8667
8589
  }
8668
8590
  }
@@ -8850,31 +8772,18 @@ declare const ignoreValueWithDefault = <T>(defaultValue: T) =>
8850
8772
  * https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
8851
8773
  */
8852
8774
  declare class ServiceAccountInfo extends WithDebug {
8853
- static Codec = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
8854
- ? codec.Class(ServiceAccountInfo, {
8855
- codeHash: codec.bytes(HASH_SIZE).asOpaque<CodeHash>(),
8856
- balance: codec.u64,
8857
- accumulateMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8858
- onTransferMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8859
- storageUtilisationBytes: codec.u64,
8860
- gratisStorage: codec.u64,
8861
- storageUtilisationCount: codec.u32,
8862
- created: codec.u32.convert((x) => x, tryAsTimeSlot),
8863
- lastAccumulation: codec.u32.convert((x) => x, tryAsTimeSlot),
8864
- parentService: codec.u32.convert((x) => x, tryAsServiceId),
8865
- })
8866
- : codec.Class(ServiceAccountInfo, {
8867
- codeHash: codec.bytes(HASH_SIZE).asOpaque<CodeHash>(),
8868
- balance: codec.u64,
8869
- accumulateMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8870
- onTransferMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8871
- storageUtilisationBytes: codec.u64,
8872
- storageUtilisationCount: codec.u32,
8873
- gratisStorage: ignoreValueWithDefault(tryAsU64(0)),
8874
- created: ignoreValueWithDefault(tryAsTimeSlot(0)),
8875
- lastAccumulation: ignoreValueWithDefault(tryAsTimeSlot(0)),
8876
- parentService: ignoreValueWithDefault(tryAsServiceId(0)),
8877
- });
8775
+ static Codec = codec.Class(ServiceAccountInfo, {
8776
+ codeHash: codec.bytes(HASH_SIZE).asOpaque<CodeHash>(),
8777
+ balance: codec.u64,
8778
+ accumulateMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8779
+ onTransferMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8780
+ storageUtilisationBytes: codec.u64,
8781
+ gratisStorage: codec.u64,
8782
+ storageUtilisationCount: codec.u32,
8783
+ created: codec.u32.convert((x) => x, tryAsTimeSlot),
8784
+ lastAccumulation: codec.u32.convert((x) => x, tryAsTimeSlot),
8785
+ parentService: codec.u32.convert((x) => x, tryAsServiceId),
8786
+ });
8878
8787
 
8879
8788
  static create(a: CodecRecord<ServiceAccountInfo>) {
8880
8789
  return new ServiceAccountInfo(
@@ -9211,9 +9120,7 @@ type ServicesUpdate = {
9211
9120
  };
9212
9121
 
9213
9122
  declare const codecServiceId: Descriptor<ServiceId> =
9214
- Compatibility.isSuite(TestSuite.W3F_DAVXY) ||
9215
- Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_5) ||
9216
- Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_7)
9123
+ Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_7)
9217
9124
  ? codec.u32.asOpaque<ServiceId>()
9218
9125
  : codec.varU32.convert(
9219
9126
  (s) => tryAsU32(s),
@@ -10255,11 +10162,6 @@ declare const index$e_InMemoryService: typeof InMemoryService;
10255
10162
  type index$e_InMemoryState = InMemoryState;
10256
10163
  declare const index$e_InMemoryState: typeof InMemoryState;
10257
10164
  type index$e_InMemoryStateFields = InMemoryStateFields;
10258
- type index$e_LegacyBlockState = LegacyBlockState;
10259
- declare const index$e_LegacyBlockState: typeof LegacyBlockState;
10260
- type index$e_LegacyBlocksState = LegacyBlocksState;
10261
- type index$e_LegacyRecentBlocks = LegacyRecentBlocks;
10262
- declare const index$e_LegacyRecentBlocks: typeof LegacyRecentBlocks;
10263
10165
  type index$e_LookupHistoryItem = LookupHistoryItem;
10264
10166
  declare const index$e_LookupHistoryItem: typeof LookupHistoryItem;
10265
10167
  type index$e_LookupHistorySlots = LookupHistorySlots;
@@ -10330,8 +10232,8 @@ declare const index$e_tryAsPerCore: typeof tryAsPerCore;
10330
10232
  declare const index$e_workReportsSortedSetCodec: typeof workReportsSortedSetCodec;
10331
10233
  declare const index$e_zeroSizeHint: typeof zeroSizeHint;
10332
10234
  declare namespace index$e {
10333
- export { index$e_AccumulationOutput as AccumulationOutput, index$e_AutoAccumulate as AutoAccumulate, index$e_AvailabilityAssignment as AvailabilityAssignment, index$e_BASE_SERVICE_BALANCE as BASE_SERVICE_BALANCE, index$e_BlockState as BlockState, index$e_CoreStatistics as CoreStatistics, index$e_DisputesRecords as DisputesRecords, index$e_ELECTIVE_BYTE_BALANCE as ELECTIVE_BYTE_BALANCE, index$e_ELECTIVE_ITEM_BALANCE as ELECTIVE_ITEM_BALANCE, index$e_InMemoryService as InMemoryService, index$e_InMemoryState as InMemoryState, index$e_LegacyBlockState as LegacyBlockState, index$e_LegacyRecentBlocks as LegacyRecentBlocks, index$e_LookupHistoryItem as LookupHistoryItem, index$e_MAX_LOOKUP_HISTORY_SLOTS as MAX_LOOKUP_HISTORY_SLOTS, index$e_PreimageItem as PreimageItem, index$e_PrivilegedServices as PrivilegedServices, index$e_RecentBlocks as RecentBlocks, index$e_RecentBlocksHistory as RecentBlocksHistory, index$e_SafroleData as SafroleData, index$e_SafroleSealingKeysData as SafroleSealingKeysData, index$e_SafroleSealingKeysKind as SafroleSealingKeysKind, index$e_ServiceAccountInfo as ServiceAccountInfo, index$e_ServiceStatistics as ServiceStatistics, index$e_StatisticsData as StatisticsData, index$e_StorageItem as StorageItem, index$e_UpdateError as UpdateError, index$e_UpdatePreimage as UpdatePreimage, index$e_UpdatePreimageKind as UpdatePreimageKind, index$e_UpdateService as UpdateService, index$e_UpdateServiceKind as UpdateServiceKind, index$e_UpdateStorage as UpdateStorage, index$e_UpdateStorageKind as UpdateStorageKind, index$e_ValidatorData as ValidatorData, index$e_ValidatorStatistics as ValidatorStatistics, index$e_codecBandersnatchKey as codecBandersnatchKey, index$e_codecPerCore as codecPerCore, index$e_codecServiceId as codecServiceId, index$e_codecVarGas as codecVarGas, index$e_codecVarU16 as codecVarU16, index$e_codecWithHash as codecWithHash, index$e_hashComparator as hashComparator, index$e_ignoreValueWithDefault as ignoreValueWithDefault, index$e_serviceDataCodec as serviceDataCodec, index$e_serviceEntriesCodec as serviceEntriesCodec, index$e_sortedSetCodec as sortedSetCodec, index$e_tryAsLookupHistorySlots as tryAsLookupHistorySlots, index$e_tryAsPerCore as tryAsPerCore, index$e_workReportsSortedSetCodec as workReportsSortedSetCodec, index$e_zeroSizeHint as zeroSizeHint };
10334
- export type { index$e_BlocksState as BlocksState, index$e_ENTROPY_ENTRIES as ENTROPY_ENTRIES, index$e_EnumerableState as EnumerableState, index$e_FieldNames as FieldNames, index$e_InMemoryStateFields as InMemoryStateFields, index$e_LegacyBlocksState as LegacyBlocksState, index$e_LookupHistorySlots as LookupHistorySlots, index$e_MAX_RECENT_HISTORY as MAX_RECENT_HISTORY, index$e_PerCore as PerCore, index$e_SafroleSealingKeys as SafroleSealingKeys, index$e_Service as Service, index$e_ServiceData as ServiceData, index$e_ServiceEntries as ServiceEntries, index$e_ServicesUpdate as ServicesUpdate, index$e_State as State, index$e_StorageKey as StorageKey, index$e_VALIDATOR_META_BYTES as VALIDATOR_META_BYTES };
10235
+ export { index$e_AccumulationOutput as AccumulationOutput, index$e_AutoAccumulate as AutoAccumulate, index$e_AvailabilityAssignment as AvailabilityAssignment, index$e_BASE_SERVICE_BALANCE as BASE_SERVICE_BALANCE, index$e_BlockState as BlockState, index$e_CoreStatistics as CoreStatistics, index$e_DisputesRecords as DisputesRecords, index$e_ELECTIVE_BYTE_BALANCE as ELECTIVE_BYTE_BALANCE, index$e_ELECTIVE_ITEM_BALANCE as ELECTIVE_ITEM_BALANCE, index$e_InMemoryService as InMemoryService, index$e_InMemoryState as InMemoryState, index$e_LookupHistoryItem as LookupHistoryItem, index$e_MAX_LOOKUP_HISTORY_SLOTS as MAX_LOOKUP_HISTORY_SLOTS, index$e_PreimageItem as PreimageItem, index$e_PrivilegedServices as PrivilegedServices, index$e_RecentBlocks as RecentBlocks, index$e_RecentBlocksHistory as RecentBlocksHistory, index$e_SafroleData as SafroleData, index$e_SafroleSealingKeysData as SafroleSealingKeysData, index$e_SafroleSealingKeysKind as SafroleSealingKeysKind, index$e_ServiceAccountInfo as ServiceAccountInfo, index$e_ServiceStatistics as ServiceStatistics, index$e_StatisticsData as StatisticsData, index$e_StorageItem as StorageItem, index$e_UpdateError as UpdateError, index$e_UpdatePreimage as UpdatePreimage, index$e_UpdatePreimageKind as UpdatePreimageKind, index$e_UpdateService as UpdateService, index$e_UpdateServiceKind as UpdateServiceKind, index$e_UpdateStorage as UpdateStorage, index$e_UpdateStorageKind as UpdateStorageKind, index$e_ValidatorData as ValidatorData, index$e_ValidatorStatistics as ValidatorStatistics, index$e_codecBandersnatchKey as codecBandersnatchKey, index$e_codecPerCore as codecPerCore, index$e_codecServiceId as codecServiceId, index$e_codecVarGas as codecVarGas, index$e_codecVarU16 as codecVarU16, index$e_codecWithHash as codecWithHash, index$e_hashComparator as hashComparator, index$e_ignoreValueWithDefault as ignoreValueWithDefault, index$e_serviceDataCodec as serviceDataCodec, index$e_serviceEntriesCodec as serviceEntriesCodec, index$e_sortedSetCodec as sortedSetCodec, index$e_tryAsLookupHistorySlots as tryAsLookupHistorySlots, index$e_tryAsPerCore as tryAsPerCore, index$e_workReportsSortedSetCodec as workReportsSortedSetCodec, index$e_zeroSizeHint as zeroSizeHint };
10236
+ export type { index$e_BlocksState as BlocksState, index$e_ENTROPY_ENTRIES as ENTROPY_ENTRIES, index$e_EnumerableState as EnumerableState, index$e_FieldNames as FieldNames, index$e_InMemoryStateFields as InMemoryStateFields, index$e_LookupHistorySlots as LookupHistorySlots, index$e_MAX_RECENT_HISTORY as MAX_RECENT_HISTORY, index$e_PerCore as PerCore, index$e_SafroleSealingKeys as SafroleSealingKeys, index$e_Service as Service, index$e_ServiceData as ServiceData, index$e_ServiceEntries as ServiceEntries, index$e_ServicesUpdate as ServicesUpdate, index$e_State as State, index$e_StorageKey as StorageKey, index$e_VALIDATOR_META_BYTES as VALIDATOR_META_BYTES };
10335
10237
  }
10336
10238
 
10337
10239
  type StateKey$1 = Opaque<OpaqueHash, "stateKey">;
@@ -10475,7 +10377,7 @@ type StateCodec<T> = {
10475
10377
 
10476
10378
  /** Serialization for particular state entries. */
10477
10379
  declare namespace serialize {
10478
- /** C(1): https://graypaper.fluffylabs.dev/#/85129da/38a20138a201?v=0.6.3 */
10380
+ /** C(1): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b15013b1501?v=0.6.7 */
10479
10381
  export const authPools: StateCodec<State["authPools"]> = {
10480
10382
  key: stateKeys.index(StateKeyIdx.Alpha),
10481
10383
  Codec: codecPerCore(
@@ -10488,7 +10390,7 @@ declare namespace serialize {
10488
10390
  extract: (s) => s.authPools,
10489
10391
  };
10490
10392
 
10491
- /** C(2): https://graypaper.fluffylabs.dev/#/85129da/38be0138be01?v=0.6.3 */
10393
+ /** C(2): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b31013b3101?v=0.6.7 */
10492
10394
  export const authQueues: StateCodec<State["authQueues"]> = {
10493
10395
  key: stateKeys.index(StateKeyIdx.Phi),
10494
10396
  Codec: codecPerCore(
@@ -10499,7 +10401,6 @@ declare namespace serialize {
10499
10401
 
10500
10402
  /**
10501
10403
  * C(3): Recent blocks with compatibility
10502
- * https://graypaper.fluffylabs.dev/#/85129da/38cb0138cb01?v=0.6.3
10503
10404
  * https://graypaper.fluffylabs.dev/#/7e6ff6a/3b3e013b3e01?v=0.6.7
10504
10405
  */
10505
10406
  export const recentBlocks: StateCodec<State["recentBlocks"]> = {
@@ -10508,7 +10409,7 @@ declare namespace serialize {
10508
10409
  extract: (s) => s.recentBlocks,
10509
10410
  };
10510
10411
 
10511
- /** C(4): https://graypaper.fluffylabs.dev/#/85129da/38e60138e601?v=0.6.3 */
10412
+ /** C(4): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b63013b6301?v=0.6.7 */
10512
10413
  export const safrole: StateCodec<SafroleData> = {
10513
10414
  key: stateKeys.index(StateKeyIdx.Gamma),
10514
10415
  Codec: SafroleData.Codec,
@@ -10521,63 +10422,63 @@ declare namespace serialize {
10521
10422
  }),
10522
10423
  };
10523
10424
 
10524
- /** C(5): https://graypaper.fluffylabs.dev/#/85129da/383d02383d02?v=0.6.3 */
10425
+ /** C(5): https://graypaper.fluffylabs.dev/#/7e6ff6a/3bba013bba01?v=0.6.7 */
10525
10426
  export const disputesRecords: StateCodec<State["disputesRecords"]> = {
10526
10427
  key: stateKeys.index(StateKeyIdx.Psi),
10527
10428
  Codec: DisputesRecords.Codec,
10528
10429
  extract: (s) => s.disputesRecords,
10529
10430
  };
10530
10431
 
10531
- /** C(6): https://graypaper.fluffylabs.dev/#/85129da/387602387602?v=0.6.3 */
10432
+ /** C(6): https://graypaper.fluffylabs.dev/#/7e6ff6a/3bf3013bf301?v=0.6.7 */
10532
10433
  export const entropy: StateCodec<State["entropy"]> = {
10533
10434
  key: stateKeys.index(StateKeyIdx.Eta),
10534
10435
  Codec: codecFixedSizeArray(codec.bytes(HASH_SIZE).asOpaque<EntropyHash>(), ENTROPY_ENTRIES),
10535
10436
  extract: (s) => s.entropy,
10536
10437
  };
10537
10438
 
10538
- /** C(7): https://graypaper.fluffylabs.dev/#/85129da/388302388302?v=0.6.3 */
10439
+ /** C(7): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b00023b0002?v=0.6.7 */
10539
10440
  export const designatedValidators: StateCodec<State["designatedValidatorData"]> = {
10540
10441
  key: stateKeys.index(StateKeyIdx.Iota),
10541
10442
  Codec: codecPerValidator(ValidatorData.Codec),
10542
10443
  extract: (s) => s.designatedValidatorData,
10543
10444
  };
10544
10445
 
10545
- /** C(8): https://graypaper.fluffylabs.dev/#/85129da/389002389002?v=0.6.3 */
10446
+ /** C(8): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b0d023b0d02?v=0.6.7 */
10546
10447
  export const currentValidators: StateCodec<State["currentValidatorData"]> = {
10547
10448
  key: stateKeys.index(StateKeyIdx.Kappa),
10548
10449
  Codec: codecPerValidator(ValidatorData.Codec),
10549
10450
  extract: (s) => s.currentValidatorData,
10550
10451
  };
10551
10452
 
10552
- /** C(9): https://graypaper.fluffylabs.dev/#/85129da/389d02389d02?v=0.6.3 */
10453
+ /** C(9): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b1a023b1a02?v=0.6.7 */
10553
10454
  export const previousValidators: StateCodec<State["previousValidatorData"]> = {
10554
10455
  key: stateKeys.index(StateKeyIdx.Lambda),
10555
10456
  Codec: codecPerValidator(ValidatorData.Codec),
10556
10457
  extract: (s) => s.previousValidatorData,
10557
10458
  };
10558
10459
 
10559
- /** C(10): https://graypaper.fluffylabs.dev/#/85129da/38aa0238aa02?v=0.6.3 */
10460
+ /** C(10): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b27023b2702?v=0.6.7 */
10560
10461
  export const availabilityAssignment: StateCodec<State["availabilityAssignment"]> = {
10561
10462
  key: stateKeys.index(StateKeyIdx.Rho),
10562
10463
  Codec: codecPerCore(codec.optional(AvailabilityAssignment.Codec)),
10563
10464
  extract: (s) => s.availabilityAssignment,
10564
10465
  };
10565
10466
 
10566
- /** C(11): https://graypaper.fluffylabs.dev/#/85129da/38c10238c102?v=0.6.3 */
10467
+ /** C(11): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b3e023b3e02?v=0.6.7 */
10567
10468
  export const timeslot: StateCodec<State["timeslot"]> = {
10568
10469
  key: stateKeys.index(StateKeyIdx.Tau),
10569
10470
  Codec: codec.u32.asOpaque<TimeSlot>(),
10570
10471
  extract: (s) => s.timeslot,
10571
10472
  };
10572
10473
 
10573
- /** C(12): https://graypaper.fluffylabs.dev/#/85129da/38cf0238cf02?v=0.6.3 */
10474
+ /** C(12): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b4c023b4c02?v=0.6.7 */
10574
10475
  export const privilegedServices: StateCodec<State["privilegedServices"]> = {
10575
10476
  key: stateKeys.index(StateKeyIdx.Chi),
10576
10477
  Codec: PrivilegedServices.Codec,
10577
10478
  extract: (s) => s.privilegedServices,
10578
10479
  };
10579
10480
 
10580
- /** C(13): https://graypaper.fluffylabs.dev/#/85129da/38e10238e102?v=0.6.3 */
10481
+ /** C(13): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b5e023b5e02?v=0.6.7 */
10581
10482
  export const statistics: StateCodec<State["statistics"]> = {
10582
10483
  key: stateKeys.index(StateKeyIdx.Pi),
10583
10484
  Codec: StatisticsData.Codec,
@@ -10591,7 +10492,7 @@ declare namespace serialize {
10591
10492
  extract: (s) => s.accumulationQueue,
10592
10493
  };
10593
10494
 
10594
- /** C(15): https://graypaper.fluffylabs.dev/#/85129da/381903381903?v=0.6.3 */
10495
+ /** C(15): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b96023b9602?v=0.6.7 */
10595
10496
  export const recentlyAccumulated: StateCodec<State["recentlyAccumulated"]> = {
10596
10497
  key: stateKeys.index(StateKeyIdx.Xi),
10597
10498
  Codec: codecPerEpochBlock(
@@ -12359,8 +12260,8 @@ declare function encodePoints(input: Bytes<PIECE_SIZE>): FixedSizeArray<Bytes<PO
12359
12260
  }
12360
12261
 
12361
12262
  // encode and add redundancy shards
12362
- const points = new ShardsCollection(POINT_ALIGNMENT, data);
12363
- const encodedResult = encode(N_CHUNKS_REDUNDANCY, POINT_ALIGNMENT, points);
12263
+ const points = new reedSolomon.ShardsCollection(POINT_ALIGNMENT, data);
12264
+ const encodedResult = reedSolomon.encode(N_CHUNKS_REDUNDANCY, points);
12364
12265
  const encodedData = encodedResult.take_data();
12365
12266
 
12366
12267
  for (let i = 0; i < N_CHUNKS_REDUNDANCY; i++) {
@@ -12402,9 +12303,9 @@ declare function decodePiece(
12402
12303
  result.raw.set(points.raw, pointStartInResult);
12403
12304
  }
12404
12305
  }
12405
- const points = new ShardsCollection(POINT_ALIGNMENT, data, indices);
12306
+ const points = new reedSolomon.ShardsCollection(POINT_ALIGNMENT, data, indices);
12406
12307
 
12407
- const decodingResult = decode(N_CHUNKS_REQUIRED, N_CHUNKS_REDUNDANCY, POINT_ALIGNMENT, points);
12308
+ const decodingResult = reedSolomon.decode(N_CHUNKS_REQUIRED, N_CHUNKS_REDUNDANCY, points);
12408
12309
  const resultIndices = decodingResult.take_indices(); // it has to be called before take_data
12409
12310
  const resultData = decodingResult.take_data(); // it destroys the result object in rust
12410
12311
 
@@ -12641,6 +12542,10 @@ declare function chunksToShards(
12641
12542
  return tryAsPerValidator(result, spec);
12642
12543
  }
12643
12544
 
12545
+ declare const initEc = async () => {
12546
+ await init.reedSolomon();
12547
+ };
12548
+
12644
12549
  declare const index$a_HALF_POINT_SIZE: typeof HALF_POINT_SIZE;
12645
12550
  declare const index$a_N_CHUNKS_REDUNDANCY: typeof N_CHUNKS_REDUNDANCY;
12646
12551
  type index$a_N_CHUNKS_REQUIRED = N_CHUNKS_REQUIRED;
@@ -12654,6 +12559,7 @@ declare const index$a_decodeData: typeof decodeData;
12654
12559
  declare const index$a_decodeDataAndTrim: typeof decodeDataAndTrim;
12655
12560
  declare const index$a_decodePiece: typeof decodePiece;
12656
12561
  declare const index$a_encodePoints: typeof encodePoints;
12562
+ declare const index$a_initEc: typeof initEc;
12657
12563
  declare const index$a_join: typeof join;
12658
12564
  declare const index$a_lace: typeof lace;
12659
12565
  declare const index$a_padAndEncodeData: typeof padAndEncodeData;
@@ -12662,7 +12568,7 @@ declare const index$a_split: typeof split;
12662
12568
  declare const index$a_transpose: typeof transpose;
12663
12569
  declare const index$a_unzip: typeof unzip;
12664
12570
  declare namespace index$a {
12665
- export { index$a_HALF_POINT_SIZE as HALF_POINT_SIZE, index$a_N_CHUNKS_REDUNDANCY as N_CHUNKS_REDUNDANCY, index$a_POINT_ALIGNMENT as POINT_ALIGNMENT, index$a_chunkingFunction as chunkingFunction, index$a_chunksToShards as chunksToShards, index$a_decodeData as decodeData, index$a_decodeDataAndTrim as decodeDataAndTrim, index$a_decodePiece as decodePiece, index$a_encodePoints as encodePoints, index$a_join as join, index$a_lace as lace, index$a_padAndEncodeData as padAndEncodeData, index$a_shardsToChunks as shardsToChunks, index$a_split as split, index$a_transpose as transpose, index$a_unzip as unzip };
12571
+ export { index$a_HALF_POINT_SIZE as HALF_POINT_SIZE, index$a_N_CHUNKS_REDUNDANCY as N_CHUNKS_REDUNDANCY, index$a_POINT_ALIGNMENT as POINT_ALIGNMENT, index$a_chunkingFunction as chunkingFunction, index$a_chunksToShards as chunksToShards, index$a_decodeData as decodeData, index$a_decodeDataAndTrim as decodeDataAndTrim, index$a_decodePiece as decodePiece, index$a_encodePoints as encodePoints, index$a_initEc as initEc, index$a_join as join, index$a_lace as lace, index$a_padAndEncodeData as padAndEncodeData, index$a_shardsToChunks as shardsToChunks, index$a_split as split, index$a_transpose as transpose, index$a_unzip as unzip };
12666
12572
  export type { index$a_N_CHUNKS_REQUIRED as N_CHUNKS_REQUIRED, index$a_N_CHUNKS_TOTAL as N_CHUNKS_TOTAL, index$a_PIECE_SIZE as PIECE_SIZE, index$a_POINT_LENGTH as POINT_LENGTH };
12667
12573
  }
12668
12574
 
@@ -13953,13 +13859,14 @@ declare abstract class MemoryPage {
13953
13859
  * And then a new version of TypeScript is released.
13954
13860
  */
13955
13861
  declare global {
13956
- interface ArrayBufferConstructor {
13957
- new (length: number, options?: { maxByteLength: number }): ArrayBuffer;
13958
- }
13959
-
13960
- interface ArrayBuffer {
13961
- resize(length: number): void;
13962
- }
13862
+ interface ArrayBufferConstructor {
13863
+ new (length: number, options?: {
13864
+ maxByteLength: number;
13865
+ }): ArrayBuffer;
13866
+ }
13867
+ interface ArrayBuffer {
13868
+ resize(length: number): void;
13869
+ }
13963
13870
  }
13964
13871
 
13965
13872
  type InitialMemoryState = {
@@ -16237,12 +16144,10 @@ declare enum Status {
16237
16144
 
16238
16145
  type InterpreterOptions = {
16239
16146
  useSbrkGas?: boolean;
16240
- ignoreInstructionGas?: boolean;
16241
16147
  };
16242
16148
 
16243
16149
  declare class Interpreter {
16244
16150
  private readonly useSbrkGas: boolean;
16245
- private readonly ignoreInstructionGas: boolean;
16246
16151
  private registers = new Registers();
16247
16152
  private code: Uint8Array = new Uint8Array();
16248
16153
  private mask = Mask.empty();
@@ -16270,9 +16175,8 @@ declare class Interpreter {
16270
16175
  private basicBlocks: BasicBlocks;
16271
16176
  private jumpTable = JumpTable.empty();
16272
16177
 
16273
- constructor({ useSbrkGas = false, ignoreInstructionGas = false }: InterpreterOptions = {}) {
16178
+ constructor({ useSbrkGas = false }: InterpreterOptions = {}) {
16274
16179
  this.useSbrkGas = useSbrkGas;
16275
- this.ignoreInstructionGas = ignoreInstructionGas;
16276
16180
  this.argsDecoder = new ArgsDecoder();
16277
16181
  this.basicBlocks = new BasicBlocks();
16278
16182
  const mathOps = new MathOps(this.registers);
@@ -16368,7 +16272,7 @@ declare class Interpreter {
16368
16272
  const currentInstruction = this.code[this.pc] ?? Instruction.TRAP;
16369
16273
  const isValidInstruction = Instruction[currentInstruction] !== undefined;
16370
16274
  const gasCost = instructionGasMap[currentInstruction] ?? instructionGasMap[Instruction.TRAP];
16371
- const underflow = this.ignoreInstructionGas ? false : this.gas.sub(gasCost);
16275
+ const underflow = this.gas.sub(gasCost);
16372
16276
  if (underflow) {
16373
16277
  this.status = Status.OOG;
16374
16278
  return this.status;
@@ -16437,12 +16341,6 @@ declare class Interpreter {
16437
16341
  }
16438
16342
 
16439
16343
  if (this.instructionResult.status !== null) {
16440
- // All abnormal terminations should be interpreted as TRAP and we should subtract the gas. In case of FAULT we have to do it manually at the very end.
16441
- if (this.instructionResult.status === Result.FAULT || this.instructionResult.status === Result.FAULT_ACCESS) {
16442
- // TODO [ToDr] underflow?
16443
- this.gas.sub(instructionGasMap[Instruction.TRAP]);
16444
- }
16445
-
16446
16344
  switch (this.instructionResult.status) {
16447
16345
  case Result.FAULT:
16448
16346
  this.status = Status.FAULT;
@@ -16618,7 +16516,7 @@ interface HostCallHandler {
16618
16516
  readonly gasCost: SmallGas | ((reg: IHostCallRegisters) => Gas);
16619
16517
 
16620
16518
  /** Currently executing service id. */
16621
- readonly currentServiceId: ServiceId;
16519
+ readonly currentServiceId: U32;
16622
16520
 
16623
16521
  /** Input&Output registers that we should add to tracing log. */
16624
16522
  readonly tracedRegisters: RegisterIndex[];
@@ -16631,14 +16529,21 @@ interface HostCallHandler {
16631
16529
  execute(gas: GasCounter, regs: IHostCallRegisters, memory: IHostCallMemory): Promise<undefined | PvmExecution>;
16632
16530
  }
16633
16531
 
16634
- // TODO [ToDr] Rename to just `HostCalls`
16635
16532
  /** Container for all available host calls. */
16636
16533
  declare class HostCallsManager {
16637
16534
  private readonly hostCalls = new Map<HostCallIndex, HostCallHandler>();
16638
- private readonly missing = new Missing();
16535
+ private readonly missing;
16536
+
16537
+ constructor({
16538
+ missing,
16539
+ handlers = [],
16540
+ }: {
16541
+ missing: HostCallHandler;
16542
+ handlers?: HostCallHandler[];
16543
+ }) {
16544
+ this.missing = missing;
16639
16545
 
16640
- constructor(...hostCallHandlers: HostCallHandler[]) {
16641
- for (const handler of hostCallHandlers) {
16546
+ for (const handler of handlers) {
16642
16547
  check(this.hostCalls.get(handler.index) === undefined, `Overwriting host call handler at index ${handler.index}`);
16643
16548
  this.hostCalls.set(handler.index, handler);
16644
16549
  }
@@ -16677,16 +16582,10 @@ declare class InterpreterInstanceManager {
16677
16582
  private waitingQueue: ResolveFn[] = [];
16678
16583
 
16679
16584
  constructor(noOfPvmInstances: number) {
16680
- const shouldCountGas =
16681
- Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ||
16682
- Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_5) ||
16683
- Compatibility.isSuite(TestSuite.W3F_DAVXY, GpVersion.V0_6_6);
16684
-
16685
16585
  for (let i = 0; i < noOfPvmInstances; i++) {
16686
16586
  this.instances.push(
16687
16587
  new Interpreter({
16688
16588
  useSbrkGas: false,
16689
- ignoreInstructionGas: !shouldCountGas,
16690
16589
  }),
16691
16590
  );
16692
16591
  }
@@ -16800,7 +16699,7 @@ declare class HostCalls {
16800
16699
  this.hostCalls.traceHostCall("Invoking", index, hostCall, regs, gasBefore);
16801
16700
  const result = await hostCall.execute(gas, regs, memory);
16802
16701
  this.hostCalls.traceHostCall(
16803
- result === undefined ? "Result" : `Status(${result})`,
16702
+ result === undefined ? "Result" : `Status(${PvmExecution[result]})`,
16804
16703
  index,
16805
16704
  hostCall,
16806
16705
  regs,
@@ -18152,6 +18051,7 @@ declare const index$3_getServiceId: typeof getServiceId;
18152
18051
  declare const index$3_getServiceIdOrCurrent: typeof getServiceIdOrCurrent;
18153
18052
  declare const index$3_inspect: typeof inspect;
18154
18053
  declare const index$3_instructionArgumentTypeMap: typeof instructionArgumentTypeMap;
18054
+ declare const index$3_isBrowser: typeof isBrowser;
18155
18055
  declare const index$3_isTaggedError: typeof isTaggedError;
18156
18056
  declare const index$3_maybeTaggedErrorToString: typeof maybeTaggedErrorToString;
18157
18057
  declare const index$3_measure: typeof measure;
@@ -18164,7 +18064,7 @@ declare const index$3_tryAsMachineId: typeof tryAsMachineId;
18164
18064
  declare const index$3_tryAsProgramCounter: typeof tryAsProgramCounter;
18165
18065
  declare const index$3_writeServiceIdAsLeBytes: typeof writeServiceIdAsLeBytes;
18166
18066
  declare namespace index$3 {
18167
- export { index$3_AccumulationStateUpdate as AccumulationStateUpdate, index$3_ArgsDecoder as ArgsDecoder, index$3_ArgumentType as ArgumentType, index$3_BasicBlocks as BasicBlocks, index$3_CURRENT_SERVICE_ID as CURRENT_SERVICE_ID, index$3_EjectError as EjectError, index$3_ExtendedWitdthImmediateDecoder as ExtendedWitdthImmediateDecoder, index$3_ForgetPreimageError as ForgetPreimageError, index$3_HostCallMemory as HostCallMemory, index$3_HostCallRegisters as HostCallRegisters, index$3_HostCallResult as HostCallResult, index$3_ImmediateDecoder as ImmediateDecoder, index$3_MAX_U32 as MAX_U32, index$3_MAX_U32_BIG_INT as MAX_U32_BIG_INT, index$3_MachineInstance as MachineInstance, index$3_Mask as Mask, index$3_MemoryOperation as MemoryOperation, index$3_MemorySegment as MemorySegment, NO_OF_REGISTERS$1 as NO_OF_REGISTERS, index$3_NewServiceError as NewServiceError, index$3_NibblesDecoder as NibblesDecoder, index$3_PagesError as PagesError, index$3_PartiallyUpdatedState as PartiallyUpdatedState, index$3_PeekPokeError as PeekPokeError, index$3_PendingTransfer as PendingTransfer, index$3_PreimageStatusKind as PreimageStatusKind, index$3_Program as Program, index$3_ProgramDecoder as ProgramDecoder, index$3_ProvidePreimageError as ProvidePreimageError, DebuggerAdapter as Pvm, index$3_Registers as Registers, index$3_RequestPreimageError as RequestPreimageError, Result$2 as Result, index$3_RichTaggedError as RichTaggedError, index$3_SERVICE_ID_BYTES as SERVICE_ID_BYTES, index$3_SpiMemory as SpiMemory, index$3_SpiProgram as SpiProgram, index$3_TransferError as TransferError, index$3_UpdatePrivilegesError as UpdatePrivilegesError, index$3_WithDebug as WithDebug, index$3_ZeroVoidError as ZeroVoidError, index$3___OPAQUE_TYPE__ as __OPAQUE_TYPE__, index$3_asOpaqueType as asOpaqueType, index$3_assertEmpty as assertEmpty, index$3_assertNever as assertNever, index$j as block, index$q as bytes, index$3_cast as cast, index$3_check as check, index$3_clampU64ToU32 as clampU64ToU32, index$3_createResults as createResults, index$3_decodeStandardProgram as decodeStandardProgram, index$3_ensure as ensure, index$3_extractCodeAndMetadata as extractCodeAndMetadata, index$3_getServiceId as getServiceId, index$3_getServiceIdOrCurrent as getServiceIdOrCurrent, index$n as hash, index$3_inspect as inspect, index$3_instructionArgumentTypeMap as instructionArgumentTypeMap, index$8 as interpreter, index$3_isTaggedError as isTaggedError, index$3_maybeTaggedErrorToString as maybeTaggedErrorToString, index$3_measure as measure, index$p as numbers, index$3_preimageLenAsU32 as preimageLenAsU32, index$3_resultToString as resultToString, index$3_seeThrough as seeThrough, index$3_slotsToPreimageStatus as slotsToPreimageStatus, index$3_toMemoryOperation as toMemoryOperation, index$3_tryAsMachineId as tryAsMachineId, index$3_tryAsProgramCounter as tryAsProgramCounter, index$3_writeServiceIdAsLeBytes as writeServiceIdAsLeBytes };
18067
+ export { index$3_AccumulationStateUpdate as AccumulationStateUpdate, index$3_ArgsDecoder as ArgsDecoder, index$3_ArgumentType as ArgumentType, index$3_BasicBlocks as BasicBlocks, index$3_CURRENT_SERVICE_ID as CURRENT_SERVICE_ID, index$3_EjectError as EjectError, index$3_ExtendedWitdthImmediateDecoder as ExtendedWitdthImmediateDecoder, index$3_ForgetPreimageError as ForgetPreimageError, index$3_HostCallMemory as HostCallMemory, index$3_HostCallRegisters as HostCallRegisters, index$3_HostCallResult as HostCallResult, index$3_ImmediateDecoder as ImmediateDecoder, index$3_MAX_U32 as MAX_U32, index$3_MAX_U32_BIG_INT as MAX_U32_BIG_INT, index$3_MachineInstance as MachineInstance, index$3_Mask as Mask, index$3_MemoryOperation as MemoryOperation, index$3_MemorySegment as MemorySegment, NO_OF_REGISTERS$1 as NO_OF_REGISTERS, index$3_NewServiceError as NewServiceError, index$3_NibblesDecoder as NibblesDecoder, index$3_PagesError as PagesError, index$3_PartiallyUpdatedState as PartiallyUpdatedState, index$3_PeekPokeError as PeekPokeError, index$3_PendingTransfer as PendingTransfer, index$3_PreimageStatusKind as PreimageStatusKind, index$3_Program as Program, index$3_ProgramDecoder as ProgramDecoder, index$3_ProvidePreimageError as ProvidePreimageError, DebuggerAdapter as Pvm, index$3_Registers as Registers, index$3_RequestPreimageError as RequestPreimageError, Result$2 as Result, index$3_RichTaggedError as RichTaggedError, index$3_SERVICE_ID_BYTES as SERVICE_ID_BYTES, index$3_SpiMemory as SpiMemory, index$3_SpiProgram as SpiProgram, index$3_TransferError as TransferError, index$3_UpdatePrivilegesError as UpdatePrivilegesError, index$3_WithDebug as WithDebug, index$3_ZeroVoidError as ZeroVoidError, index$3___OPAQUE_TYPE__ as __OPAQUE_TYPE__, index$3_asOpaqueType as asOpaqueType, index$3_assertEmpty as assertEmpty, index$3_assertNever as assertNever, index$j as block, index$q as bytes, index$3_cast as cast, index$3_check as check, index$3_clampU64ToU32 as clampU64ToU32, index$3_createResults as createResults, index$3_decodeStandardProgram as decodeStandardProgram, index$3_ensure as ensure, index$3_extractCodeAndMetadata as extractCodeAndMetadata, index$3_getServiceId as getServiceId, index$3_getServiceIdOrCurrent as getServiceIdOrCurrent, index$n as hash, index$3_inspect as inspect, index$3_instructionArgumentTypeMap as instructionArgumentTypeMap, index$8 as interpreter, index$3_isBrowser as isBrowser, index$3_isTaggedError as isTaggedError, index$3_maybeTaggedErrorToString as maybeTaggedErrorToString, index$3_measure as measure, index$p as numbers, index$3_preimageLenAsU32 as preimageLenAsU32, index$3_resultToString as resultToString, index$3_seeThrough as seeThrough, index$3_slotsToPreimageStatus as slotsToPreimageStatus, index$3_toMemoryOperation as toMemoryOperation, index$3_tryAsMachineId as tryAsMachineId, index$3_tryAsProgramCounter as tryAsProgramCounter, index$3_writeServiceIdAsLeBytes as writeServiceIdAsLeBytes };
18168
18068
  export type { index$3_Args as Args, index$3_EnumMapping as EnumMapping, index$3_ErrorResult as ErrorResult, index$3_IHostCallMemory as IHostCallMemory, index$3_IHostCallRegisters as IHostCallRegisters, index$3_InsufficientFundsError as InsufficientFundsError, index$3_MachineId as MachineId, index$3_MachineResult as MachineResult, index$3_MachineStatus as MachineStatus, index$3_NoMachineError as NoMachineError, index$3_OK as OK, index$3_OkResult as OkResult, index$3_Opaque as Opaque, index$3_PartialState as PartialState, index$3_PreimageStatus as PreimageStatus, index$3_ProgramCounter as ProgramCounter, index$3_RefineExternalities as RefineExternalities, index$3_SegmentExportError as SegmentExportError, index$3_ServiceStateUpdate as ServiceStateUpdate, index$3_StateSlice as StateSlice, index$3_StringLiteral as StringLiteral, index$3_TRANSFER_MEMO_BYTES as TRANSFER_MEMO_BYTES, index$3_TaggedError as TaggedError, index$3_TokenOf as TokenOf, index$3_Uninstantiable as Uninstantiable, index$3_UnprivilegedError as UnprivilegedError, index$3_WithOpaque as WithOpaque };
18169
18069
  }
18170
18070
 
@@ -18470,7 +18370,7 @@ type JsonRecentBlockState = {
18470
18370
  reported: WorkPackageInfo[];
18471
18371
  };
18472
18372
 
18473
- declare const recentBlocksFromJson = json.object<JsonRecentBlocks, RecentBlocksHistory>(
18373
+ declare const recentBlocksHistoryFromJson = json.object<JsonRecentBlocks, RecentBlocksHistory>(
18474
18374
  {
18475
18375
  history: json.array(recentBlockStateFromJson),
18476
18376
  mmr: {
@@ -18494,49 +18394,6 @@ type JsonRecentBlocks = {
18494
18394
  };
18495
18395
  };
18496
18396
 
18497
- declare const legacyRecentBlockStateFromJson = json.object<JsonRecentBlockStateLegacy, LegacyBlockState>(
18498
- {
18499
- header_hash: fromJson.bytes32(),
18500
- mmr: {
18501
- peaks: json.array(json.nullable(fromJson.bytes32())),
18502
- },
18503
- state_root: fromJson.bytes32(),
18504
- reported: json.array(reportedWorkPackageFromJson),
18505
- },
18506
- ({ header_hash, mmr, state_root, reported }) => {
18507
- return {
18508
- headerHash: header_hash,
18509
- mmr,
18510
- postStateRoot: state_root,
18511
- reported: HashDictionary.fromEntries(reported.map((x) => [x.workPackageHash, x])),
18512
- };
18513
- },
18514
- );
18515
-
18516
- type JsonRecentBlockStateLegacy = {
18517
- header_hash: HeaderHash;
18518
- mmr: {
18519
- peaks: Array<KeccakHash | null>;
18520
- };
18521
- state_root: StateRootHash;
18522
- reported: WorkPackageInfo[];
18523
- };
18524
-
18525
- declare const legacyRecentBlocksFromJson = json.object<LegacyBlocksState, RecentBlocksHistory>(
18526
- json.array(legacyRecentBlockStateFromJson),
18527
- (blocks) => {
18528
- return RecentBlocksHistory.legacyCreate(
18529
- LegacyRecentBlocks.create({
18530
- blocks,
18531
- }),
18532
- );
18533
- },
18534
- );
18535
-
18536
- declare const recentBlocksHistoryFromJson = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
18537
- ? recentBlocksFromJson
18538
- : legacyRecentBlocksFromJson;
18539
-
18540
18397
  declare const ticketFromJson: FromJson<Ticket> = json.object<Ticket>(
18541
18398
  {
18542
18399
  id: fromJson.bytes32(),
@@ -19019,7 +18876,6 @@ type index$1_JsonLookupMeta = JsonLookupMeta;
19019
18876
  type index$1_JsonPreimageItem = JsonPreimageItem;
19020
18877
  declare const index$1_JsonPreimageItem: typeof JsonPreimageItem;
19021
18878
  type index$1_JsonRecentBlockState = JsonRecentBlockState;
19022
- type index$1_JsonRecentBlockStateLegacy = JsonRecentBlockStateLegacy;
19023
18879
  type index$1_JsonRecentBlocks = JsonRecentBlocks;
19024
18880
  type index$1_JsonReportedWorkPackageInfo = JsonReportedWorkPackageInfo;
19025
18881
  type index$1_JsonService = JsonService;
@@ -19045,20 +18901,17 @@ declare const index$1_availabilityAssignmentFromJson: typeof availabilityAssignm
19045
18901
  declare const index$1_disputesRecordsFromJson: typeof disputesRecordsFromJson;
19046
18902
  declare const index$1_fullStateDumpFromJson: typeof fullStateDumpFromJson;
19047
18903
  declare const index$1_fullStateDumpFromJsonPre067: typeof fullStateDumpFromJsonPre067;
19048
- declare const index$1_legacyRecentBlockStateFromJson: typeof legacyRecentBlockStateFromJson;
19049
- declare const index$1_legacyRecentBlocksFromJson: typeof legacyRecentBlocksFromJson;
19050
18904
  declare const index$1_lookupMetaFromJson: typeof lookupMetaFromJson;
19051
18905
  declare const index$1_notYetAccumulatedFromJson: typeof notYetAccumulatedFromJson;
19052
18906
  declare const index$1_recentBlockStateFromJson: typeof recentBlockStateFromJson;
19053
- declare const index$1_recentBlocksFromJson: typeof recentBlocksFromJson;
19054
18907
  declare const index$1_recentBlocksHistoryFromJson: typeof recentBlocksHistoryFromJson;
19055
18908
  declare const index$1_reportedWorkPackageFromJson: typeof reportedWorkPackageFromJson;
19056
18909
  declare const index$1_serviceStatisticsEntryFromJson: typeof serviceStatisticsEntryFromJson;
19057
18910
  declare const index$1_ticketFromJson: typeof ticketFromJson;
19058
18911
  declare const index$1_validatorDataFromJson: typeof validatorDataFromJson;
19059
18912
  declare namespace index$1 {
19060
- export { index$1_JsonCoreStatistics as JsonCoreStatistics, index$1_JsonDisputesRecords as JsonDisputesRecords, index$1_JsonPreimageItem as JsonPreimageItem, index$1_JsonService as JsonService, index$1_JsonServiceInfo as JsonServiceInfo, index$1_JsonServiceInfoPre067 as JsonServiceInfoPre067, index$1_JsonServiceStatistics as JsonServiceStatistics, index$1_JsonStatisticsData as JsonStatisticsData, index$1_JsonStorageItem as JsonStorageItem, index$1_JsonValidatorStatistics as JsonValidatorStatistics, index$1_TicketsOrKeys as TicketsOrKeys, index$1_availabilityAssignmentFromJson as availabilityAssignmentFromJson, index$1_disputesRecordsFromJson as disputesRecordsFromJson, index$1_fullStateDumpFromJson as fullStateDumpFromJson, index$1_fullStateDumpFromJsonPre067 as fullStateDumpFromJsonPre067, index$1_legacyRecentBlockStateFromJson as legacyRecentBlockStateFromJson, index$1_legacyRecentBlocksFromJson as legacyRecentBlocksFromJson, index$1_lookupMetaFromJson as lookupMetaFromJson, index$1_notYetAccumulatedFromJson as notYetAccumulatedFromJson, index$1_recentBlockStateFromJson as recentBlockStateFromJson, index$1_recentBlocksFromJson as recentBlocksFromJson, index$1_recentBlocksHistoryFromJson as recentBlocksHistoryFromJson, index$1_reportedWorkPackageFromJson as reportedWorkPackageFromJson, index$1_serviceStatisticsEntryFromJson as serviceStatisticsEntryFromJson, index$1_ticketFromJson as ticketFromJson, index$1_validatorDataFromJson as validatorDataFromJson };
19061
- export type { index$1_JsonAvailabilityAssignment as JsonAvailabilityAssignment, index$1_JsonLookupMeta as JsonLookupMeta, index$1_JsonRecentBlockState as JsonRecentBlockState, index$1_JsonRecentBlockStateLegacy as JsonRecentBlockStateLegacy, index$1_JsonRecentBlocks as JsonRecentBlocks, index$1_JsonReportedWorkPackageInfo as JsonReportedWorkPackageInfo, index$1_JsonStateDump as JsonStateDump, index$1_JsonStateDumpPre067 as JsonStateDumpPre067, index$1_ServiceStatisticsEntry as ServiceStatisticsEntry };
18913
+ export { index$1_JsonCoreStatistics as JsonCoreStatistics, index$1_JsonDisputesRecords as JsonDisputesRecords, index$1_JsonPreimageItem as JsonPreimageItem, index$1_JsonService as JsonService, index$1_JsonServiceInfo as JsonServiceInfo, index$1_JsonServiceInfoPre067 as JsonServiceInfoPre067, index$1_JsonServiceStatistics as JsonServiceStatistics, index$1_JsonStatisticsData as JsonStatisticsData, index$1_JsonStorageItem as JsonStorageItem, index$1_JsonValidatorStatistics as JsonValidatorStatistics, index$1_TicketsOrKeys as TicketsOrKeys, index$1_availabilityAssignmentFromJson as availabilityAssignmentFromJson, index$1_disputesRecordsFromJson as disputesRecordsFromJson, index$1_fullStateDumpFromJson as fullStateDumpFromJson, index$1_fullStateDumpFromJsonPre067 as fullStateDumpFromJsonPre067, index$1_lookupMetaFromJson as lookupMetaFromJson, index$1_notYetAccumulatedFromJson as notYetAccumulatedFromJson, index$1_recentBlockStateFromJson as recentBlockStateFromJson, index$1_recentBlocksHistoryFromJson as recentBlocksHistoryFromJson, index$1_reportedWorkPackageFromJson as reportedWorkPackageFromJson, index$1_serviceStatisticsEntryFromJson as serviceStatisticsEntryFromJson, index$1_ticketFromJson as ticketFromJson, index$1_validatorDataFromJson as validatorDataFromJson };
18914
+ export type { index$1_JsonAvailabilityAssignment as JsonAvailabilityAssignment, index$1_JsonLookupMeta as JsonLookupMeta, index$1_JsonRecentBlockState as JsonRecentBlockState, index$1_JsonRecentBlocks as JsonRecentBlocks, index$1_JsonReportedWorkPackageInfo as JsonReportedWorkPackageInfo, index$1_JsonStateDump as JsonStateDump, index$1_JsonStateDumpPre067 as JsonStateDumpPre067, index$1_ServiceStatisticsEntry as ServiceStatisticsEntry };
19062
18915
  }
19063
18916
 
19064
18917
  /** Helper function to create most used hashes in the block */
@@ -19257,7 +19110,7 @@ declare class WorkPackageExecutor {
19257
19110
 
19258
19111
  declare class PvmExecutor {
19259
19112
  private readonly pvm: HostCalls;
19260
- private hostCalls = new HostCalls();
19113
+ private hostCalls = new HostCallsManager({ missing: new Missing() });
19261
19114
  private pvmInstanceManager = new PvmInstanceManager(4);
19262
19115
 
19263
19116
  constructor(private serviceCode: BytesBlob) {