@typeberry/lib 0.0.1-1c07527 → 0.0.1-96e327b

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 (3) hide show
  1. package/index.d.ts +244 -407
  2. package/index.js +302 -437
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -68,8 +68,6 @@ var index$s = /*#__PURE__*/Object.freeze({
68
68
 
69
69
  var GpVersion;
70
70
  (function (GpVersion) {
71
- GpVersion["V0_6_5"] = "0.6.5";
72
- GpVersion["V0_6_6"] = "0.6.6";
73
71
  GpVersion["V0_6_7"] = "0.6.7";
74
72
  GpVersion["V0_7_0"] = "0.7.0-preview";
75
73
  GpVersion["V0_7_1"] = "0.7.1-preview";
@@ -80,13 +78,7 @@ var TestSuite;
80
78
  TestSuite["JAMDUNA"] = "jamduna";
81
79
  })(TestSuite || (TestSuite = {}));
82
80
  const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
83
- const ALL_VERSIONS_IN_ORDER = [
84
- GpVersion.V0_6_5,
85
- GpVersion.V0_6_6,
86
- GpVersion.V0_6_7,
87
- GpVersion.V0_7_0,
88
- GpVersion.V0_7_1,
89
- ];
81
+ const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
90
82
  const env = typeof process === "undefined" ? {} : process.env;
91
83
  const DEFAULT_VERSION = GpVersion.V0_6_7;
92
84
  let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
@@ -1847,6 +1839,73 @@ class Skipper {
1847
1839
  }
1848
1840
  }
1849
1841
 
1842
+ /**
1843
+ * Type descriptor definition.
1844
+ *
1845
+ * The type descriptor can encode & decode given type `T`, but
1846
+ * also have a `name` and a byte-size hint.
1847
+ *
1848
+ * Descriptors can be composed to form more complex typings.
1849
+ */
1850
+ class Descriptor {
1851
+ name;
1852
+ sizeHint;
1853
+ encode;
1854
+ decode;
1855
+ skip;
1856
+ /** A "lightweight" version of the object. */
1857
+ View;
1858
+ /** New descriptor with specialized `View`. */
1859
+ static withView(name, sizeHint, encode, decode, skip, view) {
1860
+ return new Descriptor(name, sizeHint, encode, decode, skip, view);
1861
+ }
1862
+ /** Create a new descriptor without a specialized `View`. */
1863
+ static new(name, sizeHint, encode, decode, skip) {
1864
+ return new Descriptor(name, sizeHint, encode, decode, skip, null);
1865
+ }
1866
+ constructor(
1867
+ /** Descriptive name of the coded data. */
1868
+ name,
1869
+ /** A byte size hint for encoded data. */
1870
+ sizeHint,
1871
+ /** Encoding function. */
1872
+ encode,
1873
+ /** Decoding function. */
1874
+ decode,
1875
+ /** Skipping function. */
1876
+ skip,
1877
+ /** view object. It can be `null` iff T===V. */
1878
+ view) {
1879
+ this.name = name;
1880
+ this.sizeHint = sizeHint;
1881
+ this.encode = encode;
1882
+ this.decode = decode;
1883
+ this.skip = skip;
1884
+ // We cast here to make sure that the field is always set.
1885
+ this.View = view ?? this;
1886
+ }
1887
+ /**
1888
+ * Extract an encoded version of this type from the decoder.
1889
+ *
1890
+ * This function skips the object instead of decoding it,
1891
+ * allowing to retrieve the encoded portion of the object from `Decoder`.
1892
+ */
1893
+ skipEncoded(decoder) {
1894
+ const initBytes = decoder.bytesRead();
1895
+ this.skip(new Skipper(decoder));
1896
+ const endBytes = decoder.bytesRead();
1897
+ return BytesBlob.blobFrom(decoder.source.subarray(initBytes, endBytes));
1898
+ }
1899
+ /** Return a new descriptor that converts data into some other type. */
1900
+ convert(input, output) {
1901
+ return new Descriptor(this.name, this.sizeHint, (e, elem) => this.encode(e, input(elem)), (d) => output(this.decode(d)), this.skip, this.View);
1902
+ }
1903
+ /** Safely cast the descriptor value to a opaque type. */
1904
+ asOpaque() {
1905
+ return this.convert((i) => seeThrough(i), (o) => asOpaqueType(o));
1906
+ }
1907
+ }
1908
+
1850
1909
  /** Validate that given sequence length is within expected range. */
1851
1910
  function validateLength(range, length, context) {
1852
1911
  if (length < range.minLength) {
@@ -2078,72 +2137,6 @@ const TYPICAL_SEQUENCE_LENGTH = 64;
2078
2137
  * TODO [ToDr] [opti] This value should be updated when we run some real-data bechmarks.
2079
2138
  */
2080
2139
  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
2140
  /**
2148
2141
  * Convert a descriptor for regular array into readonly one.
2149
2142
  *
@@ -2452,6 +2445,7 @@ var index$o = /*#__PURE__*/Object.freeze({
2452
2445
  ObjectView: ObjectView,
2453
2446
  SequenceView: SequenceView,
2454
2447
  TYPICAL_DICTIONARY_LENGTH: TYPICAL_DICTIONARY_LENGTH,
2448
+ ViewField: ViewField,
2455
2449
  addSizeHints: addSizeHints,
2456
2450
  get codec () { return codec$1; },
2457
2451
  decodeVariableLengthExtraBytes: decodeVariableLengthExtraBytes,
@@ -5752,6 +5746,31 @@ const codecPerEpochBlock = (val) => codecWithContext((context) => {
5752
5746
  return codecKnownSizeArray(val, { fixedLength: context.epochLength });
5753
5747
  });
5754
5748
 
5749
+ /**
5750
+ * Mapping between work package hash and root hash of it's exports.
5751
+ *
5752
+ * Used to construct a dictionary.
5753
+ */
5754
+ class WorkPackageInfo extends WithDebug {
5755
+ workPackageHash;
5756
+ segmentTreeRoot;
5757
+ static Codec = codec$1.Class(WorkPackageInfo, {
5758
+ workPackageHash: codec$1.bytes(HASH_SIZE).asOpaque(),
5759
+ segmentTreeRoot: codec$1.bytes(HASH_SIZE).asOpaque(),
5760
+ });
5761
+ constructor(
5762
+ /** Hash of the described work package. */
5763
+ workPackageHash,
5764
+ /** Exports root hash. */
5765
+ segmentTreeRoot) {
5766
+ super();
5767
+ this.workPackageHash = workPackageHash;
5768
+ this.segmentTreeRoot = segmentTreeRoot;
5769
+ }
5770
+ static create({ workPackageHash, segmentTreeRoot }) {
5771
+ return new WorkPackageInfo(workPackageHash, segmentTreeRoot);
5772
+ }
5773
+ }
5755
5774
  /**
5756
5775
  * `X`: Refinement Context - state of the chain at the point
5757
5776
  * that the report's corresponding work-package was evaluated.
@@ -5801,7 +5820,8 @@ class RefineContext extends WithDebug {
5801
5820
 
5802
5821
  var refineContext = /*#__PURE__*/Object.freeze({
5803
5822
  __proto__: null,
5804
- RefineContext: RefineContext
5823
+ RefineContext: RefineContext,
5824
+ WorkPackageInfo: WorkPackageInfo
5805
5825
  });
5806
5826
 
5807
5827
  /** `W_E`: The basic size of erasure-coded pieces in octets. See equation H.6. */
@@ -6070,17 +6090,13 @@ var WorkExecResultKind;
6070
6090
  /** `☇`: unexpected program termination. */
6071
6091
  WorkExecResultKind[WorkExecResultKind["panic"] = 2] = "panic";
6072
6092
  /** `⊚`: the number of exports made was invalidly reported. */
6073
- // biome-ignore lint/style/useLiteralEnumMembers: Compatibility
6074
- WorkExecResultKind[WorkExecResultKind["incorrectNumberOfExports"] = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? 3 : -1] = "incorrectNumberOfExports";
6093
+ WorkExecResultKind[WorkExecResultKind["incorrectNumberOfExports"] = 3] = "incorrectNumberOfExports";
6075
6094
  /** `⊖`: the size of the digest (refinement output) would cross the acceptable limit. */
6076
- // biome-ignore lint/style/useLiteralEnumMembers: Compatibility
6077
- WorkExecResultKind[WorkExecResultKind["digestTooBig"] = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? 4 : -1] = "digestTooBig";
6095
+ WorkExecResultKind[WorkExecResultKind["digestTooBig"] = 4] = "digestTooBig";
6078
6096
  /** `BAD`: service code was not available for lookup in state. */
6079
- // biome-ignore lint/style/useLiteralEnumMembers: Compatibility
6080
- WorkExecResultKind[WorkExecResultKind["badCode"] = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? 5 : 3] = "badCode";
6097
+ WorkExecResultKind[WorkExecResultKind["badCode"] = 5] = "badCode";
6081
6098
  /** `BIG`: the code was too big (beyond the maximum allowed size `W_C`) */
6082
- // biome-ignore lint/style/useLiteralEnumMembers: Compatibility
6083
- WorkExecResultKind[WorkExecResultKind["codeOversize"] = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? 6 : 4] = "codeOversize";
6099
+ WorkExecResultKind[WorkExecResultKind["codeOversize"] = 6] = "codeOversize";
6084
6100
  })(WorkExecResultKind || (WorkExecResultKind = {}));
6085
6101
  /** The execution result of some work-package. */
6086
6102
  class WorkExecResult extends WithDebug {
@@ -6272,31 +6288,6 @@ class WorkPackageSpec extends WithDebug {
6272
6288
  this.exportsCount = exportsCount;
6273
6289
  }
6274
6290
  }
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
6291
  /**
6301
6292
  * A report of execution of some work package.
6302
6293
  *
@@ -6363,14 +6354,12 @@ const WorkReportCodec = codec$1.Class(WorkReportNoCodec, {
6363
6354
  const WorkReportCodecPre070 = codec$1.Class(WorkReportNoCodec, {
6364
6355
  workPackageSpec: WorkPackageSpec.Codec,
6365
6356
  context: RefineContext.Codec,
6366
- coreIndex: Compatibility.isGreaterOrEqual(GpVersion.V0_6_5) && !Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_5)
6367
- ? codec$1.varU32.convert((o) => tryAsU32(o), (i) => {
6368
- if (!isU16(i)) {
6369
- throw new Error(`Core index exceeds U16: ${i}`);
6370
- }
6371
- return tryAsCoreIndex(i);
6372
- })
6373
- : codec$1.u16.asOpaque(),
6357
+ coreIndex: codec$1.varU32.convert((o) => tryAsU32(o), (i) => {
6358
+ if (!isU16(i)) {
6359
+ throw new Error(`Core index exceeds U16: ${i}`);
6360
+ }
6361
+ return tryAsCoreIndex(i);
6362
+ }),
6374
6363
  authorizerHash: codec$1.bytes(HASH_SIZE).asOpaque(),
6375
6364
  authorizationOutput: codec$1.blob,
6376
6365
  segmentRootLookup: readonlyArray(codec$1.sequenceVarLen(WorkPackageInfo.Codec)),
@@ -6385,7 +6374,6 @@ class WorkReport extends WorkReportNoCodec {
6385
6374
 
6386
6375
  var workReport = /*#__PURE__*/Object.freeze({
6387
6376
  __proto__: null,
6388
- WorkPackageInfo: WorkPackageInfo,
6389
6377
  WorkPackageSpec: WorkPackageSpec,
6390
6378
  WorkReport: WorkReport,
6391
6379
  WorkReportNoCodec: WorkReportNoCodec
@@ -7830,215 +7818,39 @@ class PrivilegedServices {
7830
7818
  const array = new Array(ctx.coresCount).fill(serviceId);
7831
7819
  return tryAsPerCore(array, ctx);
7832
7820
  })),
7833
- validatorsManager: codec$1.u32.asOpaque(),
7834
- autoAccumulateServices: readonlyArray(codec$1.sequenceVarLen(AutoAccumulate.Codec)),
7835
- });
7836
- static create({ manager, authManager, validatorsManager, autoAccumulateServices }) {
7837
- return new PrivilegedServices(manager, authManager, validatorsManager, autoAccumulateServices);
7838
- }
7839
- constructor(
7840
- /**
7841
- * `chi_m`: The first, χm, is the index of the manager service which is
7842
- * the service able to effect an alteration of χ from block to block,
7843
- * as well as bestow services with storage deposit credits.
7844
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/11a40111a801?v=0.6.7
7845
- */
7846
- manager,
7847
- /** `chi_a`: Manages authorization queue one for each core. */
7848
- authManager,
7849
- /** `chi_v`: Managers validator keys. */
7850
- validatorsManager,
7851
- /** `chi_g`: Dictionary of services that auto-accumulate every block with their gas limit. */
7852
- autoAccumulateServices) {
7853
- this.manager = manager;
7854
- this.authManager = authManager;
7855
- this.validatorsManager = validatorsManager;
7856
- this.autoAccumulateServices = autoAccumulateServices;
7857
- }
7858
- }
7859
-
7860
- const SUPER_PEAK_STRING = BytesBlob.blobFromString("peak");
7861
- /**
7862
- * Merkle Mountain Range.
7863
- *
7864
- * https://graypaper.fluffylabs.dev/#/5f542d7/3aa0023aa002?v=0.6.2
7865
- */
7866
- class MerkleMountainRange {
7867
- hasher;
7868
- mountains;
7869
- /** Construct an empty MMR. */
7870
- static empty(hasher) {
7871
- return new MerkleMountainRange(hasher);
7872
- }
7873
- /** Construct a new MMR from existing peaks. */
7874
- static fromPeaks(hasher, mmr) {
7875
- return new MerkleMountainRange(hasher, mmr.peaks
7876
- .reduce((acc, peak, index) => {
7877
- if (peak !== null) {
7878
- acc.push(Mountain.fromPeak(peak, 2 ** index));
7879
- }
7880
- return acc;
7881
- }, [])
7882
- .reverse());
7883
- }
7884
- constructor(hasher,
7885
- /** Store non-empty merkle tries (mountains) ordered by descending size. */
7886
- mountains = []) {
7887
- this.hasher = hasher;
7888
- this.mountains = mountains;
7889
- }
7890
- /**
7891
- * Append a new hash to the MMR structure.
7892
- *
7893
- * https://graypaper.fluffylabs.dev/#/5f542d7/3b11003b1100?v=0.6.2
7894
- */
7895
- append(hash) {
7896
- let newMountain = Mountain.fromPeak(hash, 1);
7897
- for (;;) {
7898
- const last = this.mountains.pop();
7899
- if (last === undefined) {
7900
- this.mountains.push(newMountain);
7901
- return;
7902
- }
7903
- if (last.size !== newMountain.size) {
7904
- this.mountains.push(last);
7905
- this.mountains.push(newMountain);
7906
- return;
7907
- }
7908
- newMountain = last.mergeWith(this.hasher, newMountain);
7909
- }
7910
- }
7911
- /**
7912
- * Root of the entire structure.
7913
- *
7914
- * https://graypaper.fluffylabs.dev/#/5f542d7/3b20013b2001?v=0.6.2
7915
- */
7916
- getSuperPeakHash() {
7917
- if (this.mountains.length === 0) {
7918
- return Bytes.zero(HASH_SIZE).asOpaque();
7919
- }
7920
- const revMountains = this.mountains.slice().reverse();
7921
- const length = revMountains.length;
7922
- let lastHash = revMountains[0].peak;
7923
- for (let i = 1; i < length; i++) {
7924
- const mountain = revMountains[i];
7925
- lastHash = this.hasher.hashConcatPrepend(SUPER_PEAK_STRING, lastHash, mountain.peak);
7926
- }
7927
- return lastHash;
7928
- }
7929
- /** Get current peaks. */
7930
- getPeaks() {
7931
- const peaks = [];
7932
- const mountains = this.mountains;
7933
- // always 2**index
7934
- let currentSize = 1;
7935
- let currentIdx = mountains.length - 1;
7936
- while (currentIdx >= 0) {
7937
- const currentItem = mountains[currentIdx];
7938
- if (currentItem.size >= currentSize && currentItem.size < 2 * currentSize) {
7939
- peaks.push(currentItem.peak);
7940
- currentIdx -= 1;
7941
- }
7942
- else {
7943
- peaks.push(null);
7944
- }
7945
- // move to the next index.
7946
- currentSize = currentSize << 1;
7947
- }
7948
- return { peaks };
7949
- }
7950
- }
7951
- /** An internal helper structure to represent a merkle trie for MMR. */
7952
- class Mountain {
7953
- peak;
7954
- size;
7955
- constructor(peak, size) {
7956
- this.peak = peak;
7957
- this.size = size;
7958
- }
7959
- static fromPeak(peak, size) {
7960
- return new Mountain(peak, size);
7961
- }
7962
- static fromChildren(hasher, children) {
7963
- const [left, right] = children;
7964
- const peak = hasher.hashConcat(left.peak, right.peak);
7965
- const size = left.size + right.size;
7966
- return new Mountain(peak, size);
7967
- }
7968
- /** Merge with another montain of the same size. */
7969
- mergeWith(hasher, other) {
7970
- return Mountain.fromChildren(hasher, [this, other]);
7821
+ validatorsManager: codec$1.u32.asOpaque(),
7822
+ autoAccumulateServices: readonlyArray(codec$1.sequenceVarLen(AutoAccumulate.Codec)),
7823
+ });
7824
+ static create({ manager, authManager, validatorsManager, autoAccumulateServices }) {
7825
+ return new PrivilegedServices(manager, authManager, validatorsManager, autoAccumulateServices);
7971
7826
  }
7972
- toString() {
7973
- return `${this.size} @ ${this.peak}`;
7827
+ constructor(
7828
+ /**
7829
+ * `chi_m`: The first, χm, is the index of the manager service which is
7830
+ * the service able to effect an alteration of χ from block to block,
7831
+ * as well as bestow services with storage deposit credits.
7832
+ * https://graypaper.fluffylabs.dev/#/7e6ff6a/11a40111a801?v=0.6.7
7833
+ */
7834
+ manager,
7835
+ /** `chi_a`: Manages authorization queue one for each core. */
7836
+ authManager,
7837
+ /** `chi_v`: Managers validator keys. */
7838
+ validatorsManager,
7839
+ /** `chi_g`: Dictionary of services that auto-accumulate every block with their gas limit. */
7840
+ autoAccumulateServices) {
7841
+ this.manager = manager;
7842
+ this.authManager = authManager;
7843
+ this.validatorsManager = validatorsManager;
7844
+ this.autoAccumulateServices = autoAccumulateServices;
7974
7845
  }
7975
7846
  }
7976
7847
 
7977
- var index$f = /*#__PURE__*/Object.freeze({
7978
- __proto__: null,
7979
- MerkleMountainRange: MerkleMountainRange
7980
- });
7981
-
7982
7848
  /**
7983
7849
  * `H = 8`: The size of recent history, in blocks.
7984
7850
  *
7985
7851
  * https://graypaper.fluffylabs.dev/#/579bd12/416300416500
7986
7852
  */
7987
7853
  const MAX_RECENT_HISTORY = 8;
7988
- class LegacyBlockState extends WithDebug {
7989
- headerHash;
7990
- mmr;
7991
- postStateRoot;
7992
- reported;
7993
- static Codec = codec$1.Class(LegacyBlockState, {
7994
- headerHash: codec$1.bytes(HASH_SIZE).asOpaque(),
7995
- mmr: codec$1.object({
7996
- peaks: readonlyArray(codec$1.sequenceVarLen(codec$1.optional(codec$1.bytes(HASH_SIZE)))),
7997
- }),
7998
- postStateRoot: codec$1.bytes(HASH_SIZE).asOpaque(),
7999
- reported: codecHashDictionary(WorkPackageInfo.Codec, (x) => x.workPackageHash),
8000
- });
8001
- static create({ headerHash, mmr, postStateRoot, reported }) {
8002
- return new LegacyBlockState(headerHash, mmr, postStateRoot, reported);
8003
- }
8004
- constructor(
8005
- /** Header hash. */
8006
- headerHash,
8007
- /** Merkle mountain range peaks. */
8008
- mmr,
8009
- /** Posterior state root filled in with a 1-block delay. */
8010
- postStateRoot,
8011
- /** Reported work packages (no more than number of cores). */
8012
- reported) {
8013
- super();
8014
- this.headerHash = headerHash;
8015
- this.mmr = mmr;
8016
- this.postStateRoot = postStateRoot;
8017
- this.reported = reported;
8018
- }
8019
- }
8020
- class LegacyRecentBlocks extends WithDebug {
8021
- blocks;
8022
- static Codec = codec$1.Class(LegacyRecentBlocks, {
8023
- blocks: codecKnownSizeArray(LegacyBlockState.Codec, {
8024
- minLength: 0,
8025
- maxLength: MAX_RECENT_HISTORY,
8026
- typicalLength: MAX_RECENT_HISTORY,
8027
- }),
8028
- });
8029
- static create(a) {
8030
- return new LegacyRecentBlocks(a.blocks);
8031
- }
8032
- constructor(
8033
- /**
8034
- * Most recent blocks.
8035
- * https://graypaper.fluffylabs.dev/#/85129da/0fb6010fb601?v=0.6.3
8036
- */
8037
- blocks) {
8038
- super();
8039
- this.blocks = blocks;
8040
- }
8041
- }
8042
7854
  /** Recent history of a single block. */
8043
7855
  class BlockState extends WithDebug {
8044
7856
  headerHash;
@@ -8103,66 +7915,42 @@ class RecentBlocks extends WithDebug {
8103
7915
  }
8104
7916
  }
8105
7917
  /**
8106
- * Unified recent history of blocks that handles both legacy and current formats.
7918
+ * Recent history of blocks.
8107
7919
  *
8108
- * https://graypaper.fluffylabs.dev/#/85129da/38cb0138cb01?v=0.6.3
8109
7920
  * https://graypaper.fluffylabs.dev/#/7e6ff6a/0fc9010fc901?v=0.6.7
8110
7921
  */
8111
7922
  class RecentBlocksHistory extends WithDebug {
8112
7923
  current;
8113
- legacy;
8114
- static Codec = Descriptor.new("RecentBlocksHistory", Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ? RecentBlocks.Codec.sizeHint : LegacyRecentBlocks.Codec.sizeHint, (encoder, value) => Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
8115
- ? RecentBlocks.Codec.encode(encoder, value.asCurrent())
8116
- : LegacyRecentBlocks.Codec.encode(encoder, value.asLegacy()), (decoder) => {
8117
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)) {
8118
- const recentBlocks = RecentBlocks.Codec.decode(decoder);
8119
- return RecentBlocksHistory.create(recentBlocks);
8120
- }
8121
- const legacyBlocks = LegacyRecentBlocks.Codec.decode(decoder);
8122
- return RecentBlocksHistory.legacyCreate(legacyBlocks);
7924
+ static Codec = Descriptor.new("RecentBlocksHistory", RecentBlocks.Codec.sizeHint, (encoder, value) => RecentBlocks.Codec.encode(encoder, value.asCurrent()), (decoder) => {
7925
+ const recentBlocks = RecentBlocks.Codec.decode(decoder);
7926
+ return RecentBlocksHistory.create(recentBlocks);
8123
7927
  }, (_sizer) => {
8124
- return Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
8125
- ? RecentBlocks.Codec.sizeHint
8126
- : LegacyRecentBlocks.Codec.sizeHint;
7928
+ return RecentBlocks.Codec.sizeHint;
8127
7929
  });
8128
7930
  static create(recentBlocks) {
8129
- return new RecentBlocksHistory(recentBlocks, null);
8130
- }
8131
- static legacyCreate(legacyRecentBlocks) {
8132
- return new RecentBlocksHistory(null, legacyRecentBlocks);
7931
+ return new RecentBlocksHistory(recentBlocks);
8133
7932
  }
8134
7933
  static empty() {
8135
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)) {
8136
- return RecentBlocksHistory.create(RecentBlocks.create({
8137
- blocks: asKnownSize([]),
8138
- accumulationLog: { peaks: [] },
8139
- }));
8140
- }
8141
- return RecentBlocksHistory.legacyCreate(LegacyRecentBlocks.create({ blocks: asKnownSize([]) }));
7934
+ return RecentBlocksHistory.create(RecentBlocks.create({
7935
+ blocks: asKnownSize([]),
7936
+ accumulationLog: { peaks: [] },
7937
+ }));
8142
7938
  }
8143
7939
  /**
8144
7940
  * Returns the block's BEEFY super peak.
8145
- *
8146
- * NOTE: The `hasher` parameter exists solely for backward compatibility with legacy block format.
8147
7941
  */
8148
- static accumulationResult(block, { hasher, }) {
8149
- return Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
8150
- ? block.accumulationResult
8151
- : MerkleMountainRange.fromPeaks(hasher, block.mmr).getSuperPeakHash();
7942
+ static accumulationResult(block) {
7943
+ return block.accumulationResult;
8152
7944
  }
8153
- constructor(current, legacy) {
7945
+ constructor(current) {
8154
7946
  super();
8155
7947
  this.current = current;
8156
- this.legacy = legacy;
8157
7948
  }
8158
7949
  /** History of recent blocks with maximum size of `MAX_RECENT_HISTORY` */
8159
7950
  get blocks() {
8160
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) && this.current !== null) {
7951
+ if (this.current !== null) {
8161
7952
  return this.current.blocks;
8162
7953
  }
8163
- if (this.legacy !== null) {
8164
- return this.legacy.blocks;
8165
- }
8166
7954
  throw new Error("RecentBlocksHistory is in invalid state");
8167
7955
  }
8168
7956
  asCurrent() {
@@ -8171,24 +7959,13 @@ class RecentBlocksHistory extends WithDebug {
8171
7959
  }
8172
7960
  return this.current;
8173
7961
  }
8174
- asLegacy() {
8175
- if (this.legacy === null) {
8176
- throw new Error("Cannot access legacy RecentBlocks format");
8177
- }
8178
- return this.legacy;
8179
- }
8180
7962
  updateBlocks(blocks) {
8181
- if (Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) && this.current !== null) {
7963
+ if (this.current !== null) {
8182
7964
  return RecentBlocksHistory.create(RecentBlocks.create({
8183
7965
  ...this.current,
8184
7966
  blocks: asOpaqueType(blocks),
8185
7967
  }));
8186
7968
  }
8187
- if (this.legacy !== null) {
8188
- return RecentBlocksHistory.legacyCreate(LegacyRecentBlocks.create({
8189
- blocks: asOpaqueType(blocks),
8190
- }));
8191
- }
8192
7969
  throw new Error("RecentBlocksHistory is in invalid state. Cannot be updated!");
8193
7970
  }
8194
7971
  }
@@ -8662,9 +8439,7 @@ class UpdateStorage {
8662
8439
  */
8663
8440
  const ENTROPY_ENTRIES = 4;
8664
8441
 
8665
- const codecServiceId = Compatibility.isSuite(TestSuite.W3F_DAVXY) ||
8666
- Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_5) ||
8667
- Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_7)
8442
+ const codecServiceId = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_7)
8668
8443
  ? codec$1.u32.asOpaque()
8669
8444
  : codec$1.varU32.convert((s) => tryAsU32(s), (i) => tryAsServiceId(i));
8670
8445
  /**
@@ -9332,7 +9107,7 @@ const serviceDataCodec = codec$1.dictionary(codec$1.u32.asOpaque(), serviceEntri
9332
9107
  sortKeys: (a, b) => a - b,
9333
9108
  });
9334
9109
 
9335
- var index$e = /*#__PURE__*/Object.freeze({
9110
+ var index$f = /*#__PURE__*/Object.freeze({
9336
9111
  __proto__: null,
9337
9112
  AccumulationOutput: AccumulationOutput,
9338
9113
  AutoAccumulate: AutoAccumulate,
@@ -9346,8 +9121,6 @@ var index$e = /*#__PURE__*/Object.freeze({
9346
9121
  ENTROPY_ENTRIES: ENTROPY_ENTRIES,
9347
9122
  InMemoryService: InMemoryService,
9348
9123
  InMemoryState: InMemoryState,
9349
- LegacyBlockState: LegacyBlockState,
9350
- LegacyRecentBlocks: LegacyRecentBlocks,
9351
9124
  LookupHistoryItem: LookupHistoryItem,
9352
9125
  MAX_RECENT_HISTORY: MAX_RECENT_HISTORY,
9353
9126
  PreimageItem: PreimageItem,
@@ -10555,7 +10328,7 @@ function trieStringify(root, nodes) {
10555
10328
  return `\nLeaf('${leaf.getKey().toString()}',${value})`;
10556
10329
  }
10557
10330
 
10558
- var index$d = /*#__PURE__*/Object.freeze({
10331
+ var index$e = /*#__PURE__*/Object.freeze({
10559
10332
  __proto__: null,
10560
10333
  BranchNode: BranchNode,
10561
10334
  InMemoryTrie: InMemoryTrie,
@@ -10775,7 +10548,7 @@ function loadState(spec, entries) {
10775
10548
  * hashmap of `key -> value` entries.
10776
10549
  */
10777
10550
 
10778
- var index$c = /*#__PURE__*/Object.freeze({
10551
+ var index$d = /*#__PURE__*/Object.freeze({
10779
10552
  __proto__: null,
10780
10553
  SerializedService: SerializedService,
10781
10554
  SerializedState: SerializedState,
@@ -11061,7 +10834,7 @@ var LookupKind;
11061
10834
  LookupKind[LookupKind["DbKey"] = 1] = "DbKey";
11062
10835
  })(LookupKind || (LookupKind = {}));
11063
10836
 
11064
- var index$b = /*#__PURE__*/Object.freeze({
10837
+ var index$c = /*#__PURE__*/Object.freeze({
11065
10838
  __proto__: null,
11066
10839
  InMemoryBlocks: InMemoryBlocks,
11067
10840
  InMemoryStates: InMemoryStates,
@@ -11720,7 +11493,7 @@ function chunksToShards(spec, chunks) {
11720
11493
  return tryAsPerValidator(result, spec);
11721
11494
  }
11722
11495
 
11723
- var index$a = /*#__PURE__*/Object.freeze({
11496
+ var index$b = /*#__PURE__*/Object.freeze({
11724
11497
  __proto__: null,
11725
11498
  N_CHUNKS_REDUNDANCY: N_CHUNKS_REDUNDANCY,
11726
11499
  N_CHUNKS_REQUIRED: N_CHUNKS_REQUIRED,
@@ -12292,7 +12065,7 @@ function preimageLenAsU32(length) {
12292
12065
  return length >= 2n ** 32n ? null : tryAsU32(Number(length));
12293
12066
  }
12294
12067
 
12295
- var index$9 = /*#__PURE__*/Object.freeze({
12068
+ var index$a = /*#__PURE__*/Object.freeze({
12296
12069
  __proto__: null,
12297
12070
  AccumulationStateUpdate: AccumulationStateUpdate,
12298
12071
  CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
@@ -12603,13 +12376,135 @@ class Logger {
12603
12376
  }
12604
12377
  }
12605
12378
 
12606
- var index$8 = /*#__PURE__*/Object.freeze({
12379
+ var index$9 = /*#__PURE__*/Object.freeze({
12607
12380
  __proto__: null,
12608
12381
  get Level () { return Level; },
12609
12382
  Logger: Logger,
12610
12383
  parseLoggerOptions: parseLoggerOptions
12611
12384
  });
12612
12385
 
12386
+ const SUPER_PEAK_STRING = BytesBlob.blobFromString("peak");
12387
+ /**
12388
+ * Merkle Mountain Range.
12389
+ *
12390
+ * https://graypaper.fluffylabs.dev/#/5f542d7/3aa0023aa002?v=0.6.2
12391
+ */
12392
+ class MerkleMountainRange {
12393
+ hasher;
12394
+ mountains;
12395
+ /** Construct an empty MMR. */
12396
+ static empty(hasher) {
12397
+ return new MerkleMountainRange(hasher);
12398
+ }
12399
+ /** Construct a new MMR from existing peaks. */
12400
+ static fromPeaks(hasher, mmr) {
12401
+ return new MerkleMountainRange(hasher, mmr.peaks
12402
+ .reduce((acc, peak, index) => {
12403
+ if (peak !== null) {
12404
+ acc.push(Mountain.fromPeak(peak, 2 ** index));
12405
+ }
12406
+ return acc;
12407
+ }, [])
12408
+ .reverse());
12409
+ }
12410
+ constructor(hasher,
12411
+ /** Store non-empty merkle tries (mountains) ordered by descending size. */
12412
+ mountains = []) {
12413
+ this.hasher = hasher;
12414
+ this.mountains = mountains;
12415
+ }
12416
+ /**
12417
+ * Append a new hash to the MMR structure.
12418
+ *
12419
+ * https://graypaper.fluffylabs.dev/#/5f542d7/3b11003b1100?v=0.6.2
12420
+ */
12421
+ append(hash) {
12422
+ let newMountain = Mountain.fromPeak(hash, 1);
12423
+ for (;;) {
12424
+ const last = this.mountains.pop();
12425
+ if (last === undefined) {
12426
+ this.mountains.push(newMountain);
12427
+ return;
12428
+ }
12429
+ if (last.size !== newMountain.size) {
12430
+ this.mountains.push(last);
12431
+ this.mountains.push(newMountain);
12432
+ return;
12433
+ }
12434
+ newMountain = last.mergeWith(this.hasher, newMountain);
12435
+ }
12436
+ }
12437
+ /**
12438
+ * Root of the entire structure.
12439
+ *
12440
+ * https://graypaper.fluffylabs.dev/#/5f542d7/3b20013b2001?v=0.6.2
12441
+ */
12442
+ getSuperPeakHash() {
12443
+ if (this.mountains.length === 0) {
12444
+ return Bytes.zero(HASH_SIZE).asOpaque();
12445
+ }
12446
+ const revMountains = this.mountains.slice().reverse();
12447
+ const length = revMountains.length;
12448
+ let lastHash = revMountains[0].peak;
12449
+ for (let i = 1; i < length; i++) {
12450
+ const mountain = revMountains[i];
12451
+ lastHash = this.hasher.hashConcatPrepend(SUPER_PEAK_STRING, lastHash, mountain.peak);
12452
+ }
12453
+ return lastHash;
12454
+ }
12455
+ /** Get current peaks. */
12456
+ getPeaks() {
12457
+ const peaks = [];
12458
+ const mountains = this.mountains;
12459
+ // always 2**index
12460
+ let currentSize = 1;
12461
+ let currentIdx = mountains.length - 1;
12462
+ while (currentIdx >= 0) {
12463
+ const currentItem = mountains[currentIdx];
12464
+ if (currentItem.size >= currentSize && currentItem.size < 2 * currentSize) {
12465
+ peaks.push(currentItem.peak);
12466
+ currentIdx -= 1;
12467
+ }
12468
+ else {
12469
+ peaks.push(null);
12470
+ }
12471
+ // move to the next index.
12472
+ currentSize = currentSize << 1;
12473
+ }
12474
+ return { peaks };
12475
+ }
12476
+ }
12477
+ /** An internal helper structure to represent a merkle trie for MMR. */
12478
+ class Mountain {
12479
+ peak;
12480
+ size;
12481
+ constructor(peak, size) {
12482
+ this.peak = peak;
12483
+ this.size = size;
12484
+ }
12485
+ static fromPeak(peak, size) {
12486
+ return new Mountain(peak, size);
12487
+ }
12488
+ static fromChildren(hasher, children) {
12489
+ const [left, right] = children;
12490
+ const peak = hasher.hashConcat(left.peak, right.peak);
12491
+ const size = left.size + right.size;
12492
+ return new Mountain(peak, size);
12493
+ }
12494
+ /** Merge with another montain of the same size. */
12495
+ mergeWith(hasher, other) {
12496
+ return Mountain.fromChildren(hasher, [this, other]);
12497
+ }
12498
+ toString() {
12499
+ return `${this.size} @ ${this.peak}`;
12500
+ }
12501
+ }
12502
+
12503
+ var index$8 = /*#__PURE__*/Object.freeze({
12504
+ __proto__: null,
12505
+ MerkleMountainRange: MerkleMountainRange
12506
+ });
12507
+
12613
12508
  /**
12614
12509
  * Upper bound of instruction distance - it is equal to max value of GP's skip function + 1
12615
12510
  */
@@ -13445,9 +13340,7 @@ const instructionsWithoutArgs = [
13445
13340
  [Instruction.TRAP, 1],
13446
13341
  [Instruction.FALLTHROUGH, 1],
13447
13342
  ];
13448
- const instructionsWithOneImmediate = [
13449
- [Instruction.ECALLI, Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_5) ? 0 : 1],
13450
- ];
13343
+ const instructionsWithOneImmediate = [[Instruction.ECALLI, 1]];
13451
13344
  const instructionsWithOneRegisterAndOneExtendedWidthImmediate = [[Instruction.LOAD_IMM_64, 1]];
13452
13345
  const instructionsWithTwoImmediates = [
13453
13346
  [Instruction.STORE_IMM_U8, 1],
@@ -15923,7 +15816,6 @@ class ProgramDecoder {
15923
15816
 
15924
15817
  class Interpreter {
15925
15818
  useSbrkGas;
15926
- ignoreInstructionGas;
15927
15819
  registers = new Registers();
15928
15820
  code = new Uint8Array();
15929
15821
  mask = Mask.empty();
@@ -15950,9 +15842,8 @@ class Interpreter {
15950
15842
  argsDecodingResults = createResults();
15951
15843
  basicBlocks;
15952
15844
  jumpTable = JumpTable.empty();
15953
- constructor({ useSbrkGas = false, ignoreInstructionGas = false } = {}) {
15845
+ constructor({ useSbrkGas = false } = {}) {
15954
15846
  this.useSbrkGas = useSbrkGas;
15955
- this.ignoreInstructionGas = ignoreInstructionGas;
15956
15847
  this.argsDecoder = new ArgsDecoder();
15957
15848
  this.basicBlocks = new BasicBlocks();
15958
15849
  const mathOps = new MathOps(this.registers);
@@ -16032,7 +15923,7 @@ class Interpreter {
16032
15923
  const currentInstruction = this.code[this.pc] ?? Instruction.TRAP;
16033
15924
  const isValidInstruction = Instruction[currentInstruction] !== undefined;
16034
15925
  const gasCost = instructionGasMap[currentInstruction] ?? instructionGasMap[Instruction.TRAP];
16035
- const underflow = this.ignoreInstructionGas ? false : this.gas.sub(gasCost);
15926
+ const underflow = this.gas.sub(gasCost);
16036
15927
  if (underflow) {
16037
15928
  this.status = Status.OOG;
16038
15929
  return this.status;
@@ -16569,13 +16460,9 @@ class InterpreterInstanceManager {
16569
16460
  instances = [];
16570
16461
  waitingQueue = [];
16571
16462
  constructor(noOfPvmInstances) {
16572
- const shouldCountGas = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7) ||
16573
- Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_5) ||
16574
- Compatibility.isSuite(TestSuite.W3F_DAVXY, GpVersion.V0_6_6);
16575
16463
  for (let i = 0; i < noOfPvmInstances; i++) {
16576
16464
  this.instances.push(new Interpreter({
16577
16465
  useSbrkGas: false,
16578
- ignoreInstructionGas: !shouldCountGas,
16579
16466
  }));
16580
16467
  }
16581
16468
  }
@@ -16598,13 +16485,13 @@ class InterpreterInstanceManager {
16598
16485
  }
16599
16486
 
16600
16487
  const logger = Logger.new(undefined, "host-calls-pvm");
16601
- // TODO [ToDr] Rename to just `HostCalls`
16602
16488
  /** Container for all available host calls. */
16603
16489
  class HostCallsManager {
16604
16490
  hostCalls = new Map();
16605
- missing = new Missing();
16606
- constructor(...hostCallHandlers) {
16607
- for (const handler of hostCallHandlers) {
16491
+ missing;
16492
+ constructor({ missing, handlers = [], }) {
16493
+ this.missing = missing;
16494
+ for (const handler of handlers) {
16608
16495
  check(this.hostCalls.get(handler.index) === undefined, `Overwriting host call handler at index ${handler.index}`);
16609
16496
  this.hostCalls.set(handler.index, handler);
16610
16497
  }
@@ -16627,16 +16514,6 @@ class HostCallsManager {
16627
16514
  logger.trace(`[${currentServiceId}] ${context} ${name}${requested}. Gas: ${gas}. Regs: ${registerValues}.`);
16628
16515
  }
16629
16516
  }
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
16517
 
16641
16518
  var index$4 = /*#__PURE__*/Object.freeze({
16642
16519
  __proto__: null,
@@ -16938,7 +16815,7 @@ const recentBlockStateFromJson = json.object({
16938
16815
  reported: HashDictionary.fromEntries(reported.map((x) => [x.workPackageHash, x])),
16939
16816
  });
16940
16817
  });
16941
- const recentBlocksFromJson = json.object({
16818
+ const recentBlocksHistoryFromJson = json.object({
16942
16819
  history: json.array(recentBlockStateFromJson),
16943
16820
  mmr: {
16944
16821
  peaks: json.array(json.nullable(fromJson.bytes32())),
@@ -16949,29 +16826,6 @@ const recentBlocksFromJson = json.object({
16949
16826
  accumulationLog: mmr,
16950
16827
  }));
16951
16828
  });
16952
- const legacyRecentBlockStateFromJson = json.object({
16953
- header_hash: fromJson.bytes32(),
16954
- mmr: {
16955
- peaks: json.array(json.nullable(fromJson.bytes32())),
16956
- },
16957
- state_root: fromJson.bytes32(),
16958
- reported: json.array(reportedWorkPackageFromJson),
16959
- }, ({ header_hash, mmr, state_root, reported }) => {
16960
- return {
16961
- headerHash: header_hash,
16962
- mmr,
16963
- postStateRoot: state_root,
16964
- reported: HashDictionary.fromEntries(reported.map((x) => [x.workPackageHash, x])),
16965
- };
16966
- });
16967
- const legacyRecentBlocksFromJson = json.object(json.array(legacyRecentBlockStateFromJson), (blocks) => {
16968
- return RecentBlocksHistory.legacyCreate(LegacyRecentBlocks.create({
16969
- blocks,
16970
- }));
16971
- });
16972
- const recentBlocksHistoryFromJson = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
16973
- ? recentBlocksFromJson
16974
- : legacyRecentBlocksFromJson;
16975
16829
 
16976
16830
  const ticketFromJson = json.object({
16977
16831
  id: fromJson.bytes32(),
@@ -17288,6 +17142,17 @@ var index$1 = /*#__PURE__*/Object.freeze({
17288
17142
  validatorDataFromJson: validatorDataFromJson
17289
17143
  });
17290
17144
 
17145
+ class Missing {
17146
+ index = tryAsHostCallIndex(2 ** 32 - 1);
17147
+ gasCost = tryAsSmallGas(10);
17148
+ currentServiceId = CURRENT_SERVICE_ID;
17149
+ tracedRegisters = traceRegisters(7);
17150
+ execute(_gas, regs, _memory) {
17151
+ regs.set(7, HostCallResult.WHAT);
17152
+ return Promise.resolve(undefined);
17153
+ }
17154
+ }
17155
+
17291
17156
  var ServiceExecutorError;
17292
17157
  (function (ServiceExecutorError) {
17293
17158
  ServiceExecutorError[ServiceExecutorError["NoLookup"] = 0] = "NoLookup";
@@ -17395,7 +17260,7 @@ class WorkPackageExecutor {
17395
17260
  class PvmExecutor {
17396
17261
  serviceCode;
17397
17262
  pvm;
17398
- hostCalls = new HostCallsManager();
17263
+ hostCalls = new HostCallsManager({ missing: new Missing() });
17399
17264
  pvmInstanceManager = new InterpreterInstanceManager(4);
17400
17265
  constructor(serviceCode) {
17401
17266
  this.serviceCode = serviceCode;
@@ -17544,13 +17409,13 @@ exports.collections = index$l;
17544
17409
  exports.config = index$k;
17545
17410
  exports.config_node = index$g;
17546
17411
  exports.crypto = index$m;
17547
- exports.database = index$b;
17548
- exports.erasure_coding = index$a;
17412
+ exports.database = index$c;
17413
+ exports.erasure_coding = index$b;
17549
17414
  exports.hash = index$n;
17550
- exports.jam_host_calls = index$9;
17415
+ exports.jam_host_calls = index$a;
17551
17416
  exports.json_parser = index$i;
17552
- exports.logger = index$8;
17553
- exports.mmr = index$f;
17417
+ exports.logger = index$9;
17418
+ exports.mmr = index$8;
17554
17419
  exports.numbers = index$p;
17555
17420
  exports.ordering = index$s;
17556
17421
  exports.pvm = index$3;
@@ -17559,9 +17424,9 @@ exports.pvm_interpreter = index$7;
17559
17424
  exports.pvm_program = index$5;
17560
17425
  exports.pvm_spi_decoder = index$6;
17561
17426
  exports.shuffling = index$2;
17562
- exports.state = index$e;
17427
+ exports.state = index$f;
17563
17428
  exports.state_json = index$1;
17564
- exports.state_merkleization = index$c;
17429
+ exports.state_merkleization = index$d;
17565
17430
  exports.transition = index;
17566
- exports.trie = index$d;
17431
+ exports.trie = index$e;
17567
17432
  exports.utils = index$r;