@typeberry/lib 0.0.1-5e4911c → 0.0.1-cf41358
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/index.d.ts +200 -185
- package/index.js +111 -108
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2332,6 +2332,141 @@ declare class Skipper {
|
|
|
2332
2332
|
}
|
|
2333
2333
|
}
|
|
2334
2334
|
|
|
2335
|
+
/** Infer the type that is described by given descriptor `T` */
|
|
2336
|
+
type DescribedBy<T> = T extends Descriptor<infer V> ? V : never;
|
|
2337
|
+
|
|
2338
|
+
/**
|
|
2339
|
+
* Converts a class `T` into an object with the same fields as the class.
|
|
2340
|
+
*/
|
|
2341
|
+
type CodecRecord<T> = {
|
|
2342
|
+
[K in PropertyKeys<T>]: T[K];
|
|
2343
|
+
};
|
|
2344
|
+
|
|
2345
|
+
/**
|
|
2346
|
+
* Same as `CodecRecord<T>`, but the fields are all optional.
|
|
2347
|
+
*/
|
|
2348
|
+
type OptionalRecord<T> = {
|
|
2349
|
+
[K in PropertyKeys<T>]?: T[K];
|
|
2350
|
+
};
|
|
2351
|
+
|
|
2352
|
+
/**
|
|
2353
|
+
* `Descriptor` of a complex type of some class with a bunch of public fields.
|
|
2354
|
+
*/
|
|
2355
|
+
type DescriptorRecord<T> = {
|
|
2356
|
+
[K in PropertyKeys<T>]: Descriptor<T[K], unknown>;
|
|
2357
|
+
};
|
|
2358
|
+
|
|
2359
|
+
/**
|
|
2360
|
+
* Simplified `DescriptorRecord`, where all keys must be used as descriptor keys.
|
|
2361
|
+
*/
|
|
2362
|
+
type SimpleDescriptorRecord<T> = {
|
|
2363
|
+
[K in keyof T]: Descriptor<T[K], unknown>;
|
|
2364
|
+
};
|
|
2365
|
+
|
|
2366
|
+
/** Only keys that contain properties, not methods. */
|
|
2367
|
+
type PropertyKeys<T> = {
|
|
2368
|
+
// biome-ignore lint/complexity/noBannedTypes: We want to skip any function-like types here.
|
|
2369
|
+
[K in Extract<keyof T, string>]: T[K] extends Function ? never : K;
|
|
2370
|
+
}[Extract<keyof T, string>];
|
|
2371
|
+
|
|
2372
|
+
/** A constructor of basic data object that takes a `Record<T>`. */
|
|
2373
|
+
type ClassConstructor<T> = {
|
|
2374
|
+
name: string;
|
|
2375
|
+
create: (o: CodecRecord<T>) => T;
|
|
2376
|
+
};
|
|
2377
|
+
|
|
2378
|
+
/**
|
|
2379
|
+
* A full codec type, i.e. the `Encode` and `Decode`.
|
|
2380
|
+
*/
|
|
2381
|
+
type Codec<T> = Encode<T> & Decode<T>;
|
|
2382
|
+
|
|
2383
|
+
/**
|
|
2384
|
+
* Type descriptor definition.
|
|
2385
|
+
*
|
|
2386
|
+
* The type descriptor can encode & decode given type `T`, but
|
|
2387
|
+
* also have a `name` and a byte-size hint.
|
|
2388
|
+
*
|
|
2389
|
+
* Descriptors can be composed to form more complex typings.
|
|
2390
|
+
*/
|
|
2391
|
+
declare class Descriptor<T, V = T> implements Codec<T>, Skip {
|
|
2392
|
+
/** A "lightweight" version of the object. */
|
|
2393
|
+
public readonly View: Descriptor<V>;
|
|
2394
|
+
|
|
2395
|
+
/** New descriptor with specialized `View`. */
|
|
2396
|
+
public static withView<T, V>(
|
|
2397
|
+
name: string,
|
|
2398
|
+
sizeHint: SizeHint,
|
|
2399
|
+
encode: Descriptor<T, V>["encode"],
|
|
2400
|
+
decode: Descriptor<T, V>["decode"],
|
|
2401
|
+
skip: Descriptor<T, V>["skip"],
|
|
2402
|
+
view: Descriptor<V>,
|
|
2403
|
+
) {
|
|
2404
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, view);
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
/** Create a new descriptor without a specialized `View`. */
|
|
2408
|
+
public static new<T>(
|
|
2409
|
+
name: string,
|
|
2410
|
+
sizeHint: SizeHint,
|
|
2411
|
+
encode: Descriptor<T>["encode"],
|
|
2412
|
+
decode: Descriptor<T>["decode"],
|
|
2413
|
+
skip: Descriptor<T>["skip"],
|
|
2414
|
+
) {
|
|
2415
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, null);
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
private constructor(
|
|
2419
|
+
/** Descriptive name of the coded data. */
|
|
2420
|
+
public readonly name: string,
|
|
2421
|
+
/** A byte size hint for encoded data. */
|
|
2422
|
+
public readonly sizeHint: SizeHint,
|
|
2423
|
+
/** Encoding function. */
|
|
2424
|
+
public readonly encode: (e: Encoder, elem: T) => void,
|
|
2425
|
+
/** Decoding function. */
|
|
2426
|
+
public readonly decode: (d: Decoder) => T,
|
|
2427
|
+
/** Skipping function. */
|
|
2428
|
+
public readonly skip: (s: Skipper) => void,
|
|
2429
|
+
/** view object. It can be `null` iff T===V. */
|
|
2430
|
+
view: Descriptor<V> | null,
|
|
2431
|
+
) {
|
|
2432
|
+
// We cast here to make sure that the field is always set.
|
|
2433
|
+
this.View = view ?? (this as unknown as Descriptor<V>);
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
/**
|
|
2437
|
+
* Extract an encoded version of this type from the decoder.
|
|
2438
|
+
*
|
|
2439
|
+
* This function skips the object instead of decoding it,
|
|
2440
|
+
* allowing to retrieve the encoded portion of the object from `Decoder`.
|
|
2441
|
+
*/
|
|
2442
|
+
public skipEncoded(decoder: Decoder) {
|
|
2443
|
+
const initBytes = decoder.bytesRead();
|
|
2444
|
+
this.skip(new Skipper(decoder));
|
|
2445
|
+
const endBytes = decoder.bytesRead();
|
|
2446
|
+
return BytesBlob.blobFrom(decoder.source.subarray(initBytes, endBytes));
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
/** Return a new descriptor that converts data into some other type. */
|
|
2450
|
+
public convert<F>(input: (i: F) => T, output: (i: T) => F): Descriptor<F, V> {
|
|
2451
|
+
return new Descriptor(
|
|
2452
|
+
this.name,
|
|
2453
|
+
this.sizeHint,
|
|
2454
|
+
(e: Encoder, elem: F) => this.encode(e, input(elem)),
|
|
2455
|
+
(d: Decoder) => output(this.decode(d)),
|
|
2456
|
+
this.skip,
|
|
2457
|
+
this.View,
|
|
2458
|
+
);
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
/** Safely cast the descriptor value to a opaque type. */
|
|
2462
|
+
public asOpaque<R>(): Descriptor<Opaque<T, TokenOf<R, T>>, V> {
|
|
2463
|
+
return this.convert(
|
|
2464
|
+
(i) => seeThrough(i),
|
|
2465
|
+
(o) => asOpaqueType<T, TokenOf<R, T>>(o),
|
|
2466
|
+
);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2335
2470
|
type LengthRange = {
|
|
2336
2471
|
/** Inclusive value of minimal length of the sequence. */
|
|
2337
2472
|
minLength: number;
|
|
@@ -2624,98 +2759,6 @@ declare const TYPICAL_SEQUENCE_LENGTH = 64;
|
|
|
2624
2759
|
*/
|
|
2625
2760
|
declare const TYPICAL_DICTIONARY_LENGTH = 32;
|
|
2626
2761
|
|
|
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
2762
|
/**
|
|
2720
2763
|
* Convert a descriptor for regular array into readonly one.
|
|
2721
2764
|
*
|
|
@@ -2736,49 +2779,6 @@ declare function readonlyArray<T, V>(desc: Descriptor<T[], V>): Descriptor<reado
|
|
|
2736
2779
|
);
|
|
2737
2780
|
}
|
|
2738
2781
|
|
|
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
2782
|
declare function exactHint(bytes: number): SizeHint {
|
|
2783
2783
|
return {
|
|
2784
2784
|
bytes,
|
|
@@ -3399,6 +3399,9 @@ type index$o_SimpleDescriptorRecord<T> = SimpleDescriptorRecord<T>;
|
|
|
3399
3399
|
type index$o_SizeHint = SizeHint;
|
|
3400
3400
|
declare const index$o_TYPICAL_DICTIONARY_LENGTH: typeof TYPICAL_DICTIONARY_LENGTH;
|
|
3401
3401
|
declare const index$o_TYPICAL_SEQUENCE_LENGTH: typeof TYPICAL_SEQUENCE_LENGTH;
|
|
3402
|
+
type index$o_ViewField<T, V> = ViewField<T, V>;
|
|
3403
|
+
declare const index$o_ViewField: typeof ViewField;
|
|
3404
|
+
type index$o_ViewOf<T, D extends DescriptorRecord<T>> = ViewOf<T, D>;
|
|
3402
3405
|
declare const index$o_addSizeHints: typeof addSizeHints;
|
|
3403
3406
|
declare const index$o_decodeVariableLengthExtraBytes: typeof decodeVariableLengthExtraBytes;
|
|
3404
3407
|
declare const index$o_exactHint: typeof exactHint;
|
|
@@ -3411,8 +3414,8 @@ declare const index$o_sequenceViewVarLen: typeof sequenceViewVarLen;
|
|
|
3411
3414
|
declare const index$o_tryAsExactBytes: typeof tryAsExactBytes;
|
|
3412
3415
|
declare const index$o_validateLength: typeof validateLength;
|
|
3413
3416
|
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 };
|
|
3417
|
+
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 };
|
|
3418
|
+
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
3419
|
}
|
|
3417
3420
|
|
|
3418
3421
|
/**
|
|
@@ -5550,6 +5553,39 @@ declare namespace disputes {
|
|
|
5550
5553
|
*/
|
|
5551
5554
|
type BeefyHash = Opaque<OpaqueHash, "BeefyHash">;
|
|
5552
5555
|
|
|
5556
|
+
/** Authorizer hash. */
|
|
5557
|
+
type AuthorizerHash = Opaque<OpaqueHash, "AuthorizerHash">;
|
|
5558
|
+
|
|
5559
|
+
/** Blake2B hash of a work package. */
|
|
5560
|
+
type WorkPackageHash = Opaque<OpaqueHash, "WorkPackageHash">;
|
|
5561
|
+
|
|
5562
|
+
/** Work package exported segments merkle root hash. */
|
|
5563
|
+
type ExportsRootHash = Opaque<OpaqueHash, "ExportsRootHash">;
|
|
5564
|
+
|
|
5565
|
+
/**
|
|
5566
|
+
* Mapping between work package hash and root hash of it's exports.
|
|
5567
|
+
*
|
|
5568
|
+
* Used to construct a dictionary.
|
|
5569
|
+
*/
|
|
5570
|
+
declare class WorkPackageInfo extends WithDebug {
|
|
5571
|
+
static Codec = codec.Class(WorkPackageInfo, {
|
|
5572
|
+
workPackageHash: codec.bytes(HASH_SIZE).asOpaque<WorkPackageHash>(),
|
|
5573
|
+
segmentTreeRoot: codec.bytes(HASH_SIZE).asOpaque<ExportsRootHash>(),
|
|
5574
|
+
});
|
|
5575
|
+
|
|
5576
|
+
private constructor(
|
|
5577
|
+
/** Hash of the described work package. */
|
|
5578
|
+
readonly workPackageHash: WorkPackageHash,
|
|
5579
|
+
/** Exports root hash. */
|
|
5580
|
+
readonly segmentTreeRoot: ExportsRootHash,
|
|
5581
|
+
) {
|
|
5582
|
+
super();
|
|
5583
|
+
}
|
|
5584
|
+
|
|
5585
|
+
static create({ workPackageHash, segmentTreeRoot }: CodecRecord<WorkPackageInfo>) {
|
|
5586
|
+
return new WorkPackageInfo(workPackageHash, segmentTreeRoot);
|
|
5587
|
+
}
|
|
5588
|
+
}
|
|
5553
5589
|
/**
|
|
5554
5590
|
* `X`: Refinement Context - state of the chain at the point
|
|
5555
5591
|
* that the report's corresponding work-package was evaluated.
|
|
@@ -5595,12 +5631,17 @@ declare class RefineContext extends WithDebug {
|
|
|
5595
5631
|
}
|
|
5596
5632
|
}
|
|
5597
5633
|
|
|
5634
|
+
type refineContext_AuthorizerHash = AuthorizerHash;
|
|
5598
5635
|
type refineContext_BeefyHash = BeefyHash;
|
|
5636
|
+
type refineContext_ExportsRootHash = ExportsRootHash;
|
|
5599
5637
|
type refineContext_RefineContext = RefineContext;
|
|
5600
5638
|
declare const refineContext_RefineContext: typeof RefineContext;
|
|
5639
|
+
type refineContext_WorkPackageHash = WorkPackageHash;
|
|
5640
|
+
type refineContext_WorkPackageInfo = WorkPackageInfo;
|
|
5641
|
+
declare const refineContext_WorkPackageInfo: typeof WorkPackageInfo;
|
|
5601
5642
|
declare namespace refineContext {
|
|
5602
|
-
export { refineContext_RefineContext as RefineContext };
|
|
5603
|
-
export type { refineContext_BeefyHash as BeefyHash };
|
|
5643
|
+
export { refineContext_RefineContext as RefineContext, refineContext_WorkPackageInfo as WorkPackageInfo };
|
|
5644
|
+
export type { refineContext_AuthorizerHash as AuthorizerHash, refineContext_BeefyHash as BeefyHash, refineContext_ExportsRootHash as ExportsRootHash, refineContext_WorkPackageHash as WorkPackageHash };
|
|
5604
5645
|
}
|
|
5605
5646
|
|
|
5606
5647
|
/** `W_E`: The basic size of erasure-coded pieces in octets. See equation H.6. */
|
|
@@ -6093,14 +6134,6 @@ declare namespace workResult {
|
|
|
6093
6134
|
};
|
|
6094
6135
|
}
|
|
6095
6136
|
|
|
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
6137
|
/**
|
|
6105
6138
|
* Details about the work package being reported on.
|
|
6106
6139
|
*
|
|
@@ -6135,31 +6168,6 @@ declare class WorkPackageSpec extends WithDebug {
|
|
|
6135
6168
|
}
|
|
6136
6169
|
}
|
|
6137
6170
|
|
|
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
6171
|
/**
|
|
6164
6172
|
* A report of execution of some work package.
|
|
6165
6173
|
*
|
|
@@ -6266,11 +6274,6 @@ declare class WorkReport extends WorkReportNoCodec {
|
|
|
6266
6274
|
: WorkReportCodecPre070;
|
|
6267
6275
|
}
|
|
6268
6276
|
|
|
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
6277
|
type workReport_WorkPackageSpec = WorkPackageSpec;
|
|
6275
6278
|
declare const workReport_WorkPackageSpec: typeof WorkPackageSpec;
|
|
6276
6279
|
type workReport_WorkReport = WorkReport;
|
|
@@ -6280,8 +6283,13 @@ declare const workReport_WorkReportCodecPre070: typeof WorkReportCodecPre070;
|
|
|
6280
6283
|
type workReport_WorkReportNoCodec = WorkReportNoCodec;
|
|
6281
6284
|
declare const workReport_WorkReportNoCodec: typeof WorkReportNoCodec;
|
|
6282
6285
|
declare namespace workReport {
|
|
6283
|
-
export {
|
|
6284
|
-
|
|
6286
|
+
export {
|
|
6287
|
+
workReport_WorkPackageSpec as WorkPackageSpec,
|
|
6288
|
+
workReport_WorkReport as WorkReport,
|
|
6289
|
+
workReport_WorkReportCodec as WorkReportCodec,
|
|
6290
|
+
workReport_WorkReportCodecPre070 as WorkReportCodecPre070,
|
|
6291
|
+
workReport_WorkReportNoCodec as WorkReportNoCodec,
|
|
6292
|
+
};
|
|
6285
6293
|
}
|
|
6286
6294
|
|
|
6287
6295
|
/**
|
|
@@ -16618,7 +16626,7 @@ interface HostCallHandler {
|
|
|
16618
16626
|
readonly gasCost: SmallGas | ((reg: IHostCallRegisters) => Gas);
|
|
16619
16627
|
|
|
16620
16628
|
/** Currently executing service id. */
|
|
16621
|
-
readonly currentServiceId:
|
|
16629
|
+
readonly currentServiceId: U32;
|
|
16622
16630
|
|
|
16623
16631
|
/** Input&Output registers that we should add to tracing log. */
|
|
16624
16632
|
readonly tracedRegisters: RegisterIndex[];
|
|
@@ -16631,14 +16639,21 @@ interface HostCallHandler {
|
|
|
16631
16639
|
execute(gas: GasCounter, regs: IHostCallRegisters, memory: IHostCallMemory): Promise<undefined | PvmExecution>;
|
|
16632
16640
|
}
|
|
16633
16641
|
|
|
16634
|
-
// TODO [ToDr] Rename to just `HostCalls`
|
|
16635
16642
|
/** Container for all available host calls. */
|
|
16636
16643
|
declare class HostCallsManager {
|
|
16637
16644
|
private readonly hostCalls = new Map<HostCallIndex, HostCallHandler>();
|
|
16638
|
-
private readonly missing
|
|
16645
|
+
private readonly missing;
|
|
16646
|
+
|
|
16647
|
+
constructor({
|
|
16648
|
+
missing,
|
|
16649
|
+
handlers = [],
|
|
16650
|
+
}: {
|
|
16651
|
+
missing: HostCallHandler;
|
|
16652
|
+
handlers?: HostCallHandler[];
|
|
16653
|
+
}) {
|
|
16654
|
+
this.missing = missing;
|
|
16639
16655
|
|
|
16640
|
-
|
|
16641
|
-
for (const handler of hostCallHandlers) {
|
|
16656
|
+
for (const handler of handlers) {
|
|
16642
16657
|
check(this.hostCalls.get(handler.index) === undefined, `Overwriting host call handler at index ${handler.index}`);
|
|
16643
16658
|
this.hostCalls.set(handler.index, handler);
|
|
16644
16659
|
}
|
|
@@ -19257,7 +19272,7 @@ declare class WorkPackageExecutor {
|
|
|
19257
19272
|
|
|
19258
19273
|
declare class PvmExecutor {
|
|
19259
19274
|
private readonly pvm: HostCalls;
|
|
19260
|
-
private hostCalls = new
|
|
19275
|
+
private hostCalls = new HostCallsManager({ missing: new Missing() });
|
|
19261
19276
|
private pvmInstanceManager = new PvmInstanceManager(4);
|
|
19262
19277
|
|
|
19263
19278
|
constructor(private serviceCode: BytesBlob) {
|
package/index.js
CHANGED
|
@@ -1847,6 +1847,73 @@ class Skipper {
|
|
|
1847
1847
|
}
|
|
1848
1848
|
}
|
|
1849
1849
|
|
|
1850
|
+
/**
|
|
1851
|
+
* Type descriptor definition.
|
|
1852
|
+
*
|
|
1853
|
+
* The type descriptor can encode & decode given type `T`, but
|
|
1854
|
+
* also have a `name` and a byte-size hint.
|
|
1855
|
+
*
|
|
1856
|
+
* Descriptors can be composed to form more complex typings.
|
|
1857
|
+
*/
|
|
1858
|
+
class Descriptor {
|
|
1859
|
+
name;
|
|
1860
|
+
sizeHint;
|
|
1861
|
+
encode;
|
|
1862
|
+
decode;
|
|
1863
|
+
skip;
|
|
1864
|
+
/** A "lightweight" version of the object. */
|
|
1865
|
+
View;
|
|
1866
|
+
/** New descriptor with specialized `View`. */
|
|
1867
|
+
static withView(name, sizeHint, encode, decode, skip, view) {
|
|
1868
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, view);
|
|
1869
|
+
}
|
|
1870
|
+
/** Create a new descriptor without a specialized `View`. */
|
|
1871
|
+
static new(name, sizeHint, encode, decode, skip) {
|
|
1872
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, null);
|
|
1873
|
+
}
|
|
1874
|
+
constructor(
|
|
1875
|
+
/** Descriptive name of the coded data. */
|
|
1876
|
+
name,
|
|
1877
|
+
/** A byte size hint for encoded data. */
|
|
1878
|
+
sizeHint,
|
|
1879
|
+
/** Encoding function. */
|
|
1880
|
+
encode,
|
|
1881
|
+
/** Decoding function. */
|
|
1882
|
+
decode,
|
|
1883
|
+
/** Skipping function. */
|
|
1884
|
+
skip,
|
|
1885
|
+
/** view object. It can be `null` iff T===V. */
|
|
1886
|
+
view) {
|
|
1887
|
+
this.name = name;
|
|
1888
|
+
this.sizeHint = sizeHint;
|
|
1889
|
+
this.encode = encode;
|
|
1890
|
+
this.decode = decode;
|
|
1891
|
+
this.skip = skip;
|
|
1892
|
+
// We cast here to make sure that the field is always set.
|
|
1893
|
+
this.View = view ?? this;
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Extract an encoded version of this type from the decoder.
|
|
1897
|
+
*
|
|
1898
|
+
* This function skips the object instead of decoding it,
|
|
1899
|
+
* allowing to retrieve the encoded portion of the object from `Decoder`.
|
|
1900
|
+
*/
|
|
1901
|
+
skipEncoded(decoder) {
|
|
1902
|
+
const initBytes = decoder.bytesRead();
|
|
1903
|
+
this.skip(new Skipper(decoder));
|
|
1904
|
+
const endBytes = decoder.bytesRead();
|
|
1905
|
+
return BytesBlob.blobFrom(decoder.source.subarray(initBytes, endBytes));
|
|
1906
|
+
}
|
|
1907
|
+
/** Return a new descriptor that converts data into some other type. */
|
|
1908
|
+
convert(input, output) {
|
|
1909
|
+
return new Descriptor(this.name, this.sizeHint, (e, elem) => this.encode(e, input(elem)), (d) => output(this.decode(d)), this.skip, this.View);
|
|
1910
|
+
}
|
|
1911
|
+
/** Safely cast the descriptor value to a opaque type. */
|
|
1912
|
+
asOpaque() {
|
|
1913
|
+
return this.convert((i) => seeThrough(i), (o) => asOpaqueType(o));
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1850
1917
|
/** Validate that given sequence length is within expected range. */
|
|
1851
1918
|
function validateLength(range, length, context) {
|
|
1852
1919
|
if (length < range.minLength) {
|
|
@@ -2078,72 +2145,6 @@ const TYPICAL_SEQUENCE_LENGTH = 64;
|
|
|
2078
2145
|
* TODO [ToDr] [opti] This value should be updated when we run some real-data bechmarks.
|
|
2079
2146
|
*/
|
|
2080
2147
|
const TYPICAL_DICTIONARY_LENGTH = 32;
|
|
2081
|
-
/**
|
|
2082
|
-
* Type descriptor definition.
|
|
2083
|
-
*
|
|
2084
|
-
* The type descriptor can encode & decode given type `T`, but
|
|
2085
|
-
* also have a `name` and a byte-size hint.
|
|
2086
|
-
*
|
|
2087
|
-
* Descriptors can be composed to form more complex typings.
|
|
2088
|
-
*/
|
|
2089
|
-
class Descriptor {
|
|
2090
|
-
name;
|
|
2091
|
-
sizeHint;
|
|
2092
|
-
encode;
|
|
2093
|
-
decode;
|
|
2094
|
-
skip;
|
|
2095
|
-
/** A "lightweight" version of the object. */
|
|
2096
|
-
View;
|
|
2097
|
-
/** New descriptor with specialized `View`. */
|
|
2098
|
-
static withView(name, sizeHint, encode, decode, skip, view) {
|
|
2099
|
-
return new Descriptor(name, sizeHint, encode, decode, skip, view);
|
|
2100
|
-
}
|
|
2101
|
-
/** Create a new descriptor without a specialized `View`. */
|
|
2102
|
-
static new(name, sizeHint, encode, decode, skip) {
|
|
2103
|
-
return new Descriptor(name, sizeHint, encode, decode, skip, null);
|
|
2104
|
-
}
|
|
2105
|
-
constructor(
|
|
2106
|
-
/** Descriptive name of the coded data. */
|
|
2107
|
-
name,
|
|
2108
|
-
/** A byte size hint for encoded data. */
|
|
2109
|
-
sizeHint,
|
|
2110
|
-
/** Encoding function. */
|
|
2111
|
-
encode,
|
|
2112
|
-
/** Decoding function. */
|
|
2113
|
-
decode,
|
|
2114
|
-
/** Skipping function. */
|
|
2115
|
-
skip,
|
|
2116
|
-
/** view object. It can be `null` iff T===V. */
|
|
2117
|
-
view) {
|
|
2118
|
-
this.name = name;
|
|
2119
|
-
this.sizeHint = sizeHint;
|
|
2120
|
-
this.encode = encode;
|
|
2121
|
-
this.decode = decode;
|
|
2122
|
-
this.skip = skip;
|
|
2123
|
-
// We cast here to make sure that the field is always set.
|
|
2124
|
-
this.View = view ?? this;
|
|
2125
|
-
}
|
|
2126
|
-
/**
|
|
2127
|
-
* Extract an encoded version of this type from the decoder.
|
|
2128
|
-
*
|
|
2129
|
-
* This function skips the object instead of decoding it,
|
|
2130
|
-
* allowing to retrieve the encoded portion of the object from `Decoder`.
|
|
2131
|
-
*/
|
|
2132
|
-
skipEncoded(decoder) {
|
|
2133
|
-
const initBytes = decoder.bytesRead();
|
|
2134
|
-
this.skip(new Skipper(decoder));
|
|
2135
|
-
const endBytes = decoder.bytesRead();
|
|
2136
|
-
return BytesBlob.blobFrom(decoder.source.subarray(initBytes, endBytes));
|
|
2137
|
-
}
|
|
2138
|
-
/** Return a new descriptor that converts data into some other type. */
|
|
2139
|
-
convert(input, output) {
|
|
2140
|
-
return new Descriptor(this.name, this.sizeHint, (e, elem) => this.encode(e, input(elem)), (d) => output(this.decode(d)), this.skip, this.View);
|
|
2141
|
-
}
|
|
2142
|
-
/** Safely cast the descriptor value to a opaque type. */
|
|
2143
|
-
asOpaque() {
|
|
2144
|
-
return this.convert((i) => seeThrough(i), (o) => asOpaqueType(o));
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
2148
|
/**
|
|
2148
2149
|
* Convert a descriptor for regular array into readonly one.
|
|
2149
2150
|
*
|
|
@@ -2452,6 +2453,7 @@ var index$o = /*#__PURE__*/Object.freeze({
|
|
|
2452
2453
|
ObjectView: ObjectView,
|
|
2453
2454
|
SequenceView: SequenceView,
|
|
2454
2455
|
TYPICAL_DICTIONARY_LENGTH: TYPICAL_DICTIONARY_LENGTH,
|
|
2456
|
+
ViewField: ViewField,
|
|
2455
2457
|
addSizeHints: addSizeHints,
|
|
2456
2458
|
get codec () { return codec$1; },
|
|
2457
2459
|
decodeVariableLengthExtraBytes: decodeVariableLengthExtraBytes,
|
|
@@ -5752,6 +5754,31 @@ const codecPerEpochBlock = (val) => codecWithContext((context) => {
|
|
|
5752
5754
|
return codecKnownSizeArray(val, { fixedLength: context.epochLength });
|
|
5753
5755
|
});
|
|
5754
5756
|
|
|
5757
|
+
/**
|
|
5758
|
+
* Mapping between work package hash and root hash of it's exports.
|
|
5759
|
+
*
|
|
5760
|
+
* Used to construct a dictionary.
|
|
5761
|
+
*/
|
|
5762
|
+
class WorkPackageInfo extends WithDebug {
|
|
5763
|
+
workPackageHash;
|
|
5764
|
+
segmentTreeRoot;
|
|
5765
|
+
static Codec = codec$1.Class(WorkPackageInfo, {
|
|
5766
|
+
workPackageHash: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
5767
|
+
segmentTreeRoot: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
5768
|
+
});
|
|
5769
|
+
constructor(
|
|
5770
|
+
/** Hash of the described work package. */
|
|
5771
|
+
workPackageHash,
|
|
5772
|
+
/** Exports root hash. */
|
|
5773
|
+
segmentTreeRoot) {
|
|
5774
|
+
super();
|
|
5775
|
+
this.workPackageHash = workPackageHash;
|
|
5776
|
+
this.segmentTreeRoot = segmentTreeRoot;
|
|
5777
|
+
}
|
|
5778
|
+
static create({ workPackageHash, segmentTreeRoot }) {
|
|
5779
|
+
return new WorkPackageInfo(workPackageHash, segmentTreeRoot);
|
|
5780
|
+
}
|
|
5781
|
+
}
|
|
5755
5782
|
/**
|
|
5756
5783
|
* `X`: Refinement Context - state of the chain at the point
|
|
5757
5784
|
* that the report's corresponding work-package was evaluated.
|
|
@@ -5801,7 +5828,8 @@ class RefineContext extends WithDebug {
|
|
|
5801
5828
|
|
|
5802
5829
|
var refineContext = /*#__PURE__*/Object.freeze({
|
|
5803
5830
|
__proto__: null,
|
|
5804
|
-
RefineContext: RefineContext
|
|
5831
|
+
RefineContext: RefineContext,
|
|
5832
|
+
WorkPackageInfo: WorkPackageInfo
|
|
5805
5833
|
});
|
|
5806
5834
|
|
|
5807
5835
|
/** `W_E`: The basic size of erasure-coded pieces in octets. See equation H.6. */
|
|
@@ -6272,31 +6300,6 @@ class WorkPackageSpec extends WithDebug {
|
|
|
6272
6300
|
this.exportsCount = exportsCount;
|
|
6273
6301
|
}
|
|
6274
6302
|
}
|
|
6275
|
-
/**
|
|
6276
|
-
* Mapping between work package hash and root hash of it's exports.
|
|
6277
|
-
*
|
|
6278
|
-
* Used to construct a dictionary.
|
|
6279
|
-
*/
|
|
6280
|
-
class WorkPackageInfo extends WithDebug {
|
|
6281
|
-
workPackageHash;
|
|
6282
|
-
segmentTreeRoot;
|
|
6283
|
-
static Codec = codec$1.Class(WorkPackageInfo, {
|
|
6284
|
-
workPackageHash: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
6285
|
-
segmentTreeRoot: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
6286
|
-
});
|
|
6287
|
-
constructor(
|
|
6288
|
-
/** Hash of the described work package. */
|
|
6289
|
-
workPackageHash,
|
|
6290
|
-
/** Exports root hash. */
|
|
6291
|
-
segmentTreeRoot) {
|
|
6292
|
-
super();
|
|
6293
|
-
this.workPackageHash = workPackageHash;
|
|
6294
|
-
this.segmentTreeRoot = segmentTreeRoot;
|
|
6295
|
-
}
|
|
6296
|
-
static create({ workPackageHash, segmentTreeRoot }) {
|
|
6297
|
-
return new WorkPackageInfo(workPackageHash, segmentTreeRoot);
|
|
6298
|
-
}
|
|
6299
|
-
}
|
|
6300
6303
|
/**
|
|
6301
6304
|
* A report of execution of some work package.
|
|
6302
6305
|
*
|
|
@@ -6385,7 +6388,6 @@ class WorkReport extends WorkReportNoCodec {
|
|
|
6385
6388
|
|
|
6386
6389
|
var workReport = /*#__PURE__*/Object.freeze({
|
|
6387
6390
|
__proto__: null,
|
|
6388
|
-
WorkPackageInfo: WorkPackageInfo,
|
|
6389
6391
|
WorkPackageSpec: WorkPackageSpec,
|
|
6390
6392
|
WorkReport: WorkReport,
|
|
6391
6393
|
WorkReportNoCodec: WorkReportNoCodec
|
|
@@ -16598,13 +16600,13 @@ class InterpreterInstanceManager {
|
|
|
16598
16600
|
}
|
|
16599
16601
|
|
|
16600
16602
|
const logger = Logger.new(undefined, "host-calls-pvm");
|
|
16601
|
-
// TODO [ToDr] Rename to just `HostCalls`
|
|
16602
16603
|
/** Container for all available host calls. */
|
|
16603
16604
|
class HostCallsManager {
|
|
16604
16605
|
hostCalls = new Map();
|
|
16605
|
-
missing
|
|
16606
|
-
constructor(
|
|
16607
|
-
|
|
16606
|
+
missing;
|
|
16607
|
+
constructor({ missing, handlers = [], }) {
|
|
16608
|
+
this.missing = missing;
|
|
16609
|
+
for (const handler of handlers) {
|
|
16608
16610
|
check(this.hostCalls.get(handler.index) === undefined, `Overwriting host call handler at index ${handler.index}`);
|
|
16609
16611
|
this.hostCalls.set(handler.index, handler);
|
|
16610
16612
|
}
|
|
@@ -16627,16 +16629,6 @@ class HostCallsManager {
|
|
|
16627
16629
|
logger.trace(`[${currentServiceId}] ${context} ${name}${requested}. Gas: ${gas}. Regs: ${registerValues}.`);
|
|
16628
16630
|
}
|
|
16629
16631
|
}
|
|
16630
|
-
class Missing {
|
|
16631
|
-
index = tryAsHostCallIndex(2 ** 32 - 1);
|
|
16632
|
-
gasCost = tryAsSmallGas(10);
|
|
16633
|
-
currentServiceId = CURRENT_SERVICE_ID;
|
|
16634
|
-
tracedRegisters = traceRegisters(7);
|
|
16635
|
-
execute(_gas, regs, _memory) {
|
|
16636
|
-
regs.set(7, HostCallResult.WHAT);
|
|
16637
|
-
return Promise.resolve(undefined);
|
|
16638
|
-
}
|
|
16639
|
-
}
|
|
16640
16632
|
|
|
16641
16633
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
16642
16634
|
__proto__: null,
|
|
@@ -17288,6 +17280,17 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
17288
17280
|
validatorDataFromJson: validatorDataFromJson
|
|
17289
17281
|
});
|
|
17290
17282
|
|
|
17283
|
+
class Missing {
|
|
17284
|
+
index = tryAsHostCallIndex(2 ** 32 - 1);
|
|
17285
|
+
gasCost = tryAsSmallGas(10);
|
|
17286
|
+
currentServiceId = CURRENT_SERVICE_ID;
|
|
17287
|
+
tracedRegisters = traceRegisters(7);
|
|
17288
|
+
execute(_gas, regs, _memory) {
|
|
17289
|
+
regs.set(7, HostCallResult.WHAT);
|
|
17290
|
+
return Promise.resolve(undefined);
|
|
17291
|
+
}
|
|
17292
|
+
}
|
|
17293
|
+
|
|
17291
17294
|
var ServiceExecutorError;
|
|
17292
17295
|
(function (ServiceExecutorError) {
|
|
17293
17296
|
ServiceExecutorError[ServiceExecutorError["NoLookup"] = 0] = "NoLookup";
|
|
@@ -17395,7 +17398,7 @@ class WorkPackageExecutor {
|
|
|
17395
17398
|
class PvmExecutor {
|
|
17396
17399
|
serviceCode;
|
|
17397
17400
|
pvm;
|
|
17398
|
-
hostCalls = new HostCallsManager();
|
|
17401
|
+
hostCalls = new HostCallsManager({ missing: new Missing() });
|
|
17399
17402
|
pvmInstanceManager = new InterpreterInstanceManager(4);
|
|
17400
17403
|
constructor(serviceCode) {
|
|
17401
17404
|
this.serviceCode = serviceCode;
|