@typeberry/lib 0.4.0 → 0.4.1-dae2283

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/index.cjs +255 -311
  2. package/index.d.ts +912 -1372
  3. package/index.js +230 -285
  4. package/package.json +1 -1
package/index.js CHANGED
@@ -16,7 +16,11 @@ var TestSuite;
16
16
  })(TestSuite || (TestSuite = {}));
17
17
  const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
18
18
  const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
19
- const DEFAULT_VERSION = GpVersion.V0_7_2;
19
+ /**
20
+ * Current version is set to track the jam-conformance testing.
21
+ * Since we are currently at 0.7.1 not 0.7.2, we set our default version accordingly.
22
+ */
23
+ const DEFAULT_VERSION = GpVersion.V0_7_1;
20
24
  const env$1 = typeof process === "undefined" ? {} : process.env;
21
25
  let CURRENT_VERSION = parseCurrentVersion(env$1.GP_VERSION) ?? DEFAULT_VERSION;
22
26
  let CURRENT_SUITE = parseCurrentSuite(env$1.TEST_SUITE) ?? DEFAULT_SUITE;
@@ -75,8 +79,8 @@ class Compatibility {
75
79
  /**
76
80
  * Allows selecting different values for different Gray Paper versions from one record.
77
81
  *
78
- * @param fallback The default value to return if no value is found for the current.
79
- * @param record A record mapping versions to values, checking if the version is greater or equal to the current version.
82
+ * fallback The default value to return if no value is found for the current.
83
+ * versions A record mapping versions to values, checking if the version is greater or equal to the current version.
80
84
  * @returns The value for the current version, or the default value.
81
85
  */
82
86
  static selectIfGreaterOrEqual({ fallback, versions, }) {
@@ -236,7 +240,7 @@ const workspacePathFix = env.NODE_ENV === "development"
236
240
  : () => (p) => p;
237
241
 
238
242
  /**
239
- * @fileoverview `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
243
+ * `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
240
244
  * specified unique token Token. It means that base type cannot be assigned to unique type by accident.
241
245
  * Good examples of opaque types include:
242
246
  * - JWTs or other tokens - these are special kinds of string used for authorization purposes.
@@ -579,7 +583,7 @@ function isResult(x) {
579
583
  * as an afterthought.
580
584
  */
581
585
 
582
- var index$v = /*#__PURE__*/Object.freeze({
586
+ var index$u = /*#__PURE__*/Object.freeze({
583
587
  __proto__: null,
584
588
  get CURRENT_SUITE () { return CURRENT_SUITE; },
585
589
  get CURRENT_VERSION () { return CURRENT_VERSION; },
@@ -736,7 +740,7 @@ class Ordering {
736
740
  }
737
741
  }
738
742
 
739
- var index$u = /*#__PURE__*/Object.freeze({
743
+ var index$t = /*#__PURE__*/Object.freeze({
740
744
  __proto__: null,
741
745
  Ordering: Ordering
742
746
  });
@@ -988,7 +992,7 @@ function u8ArraySameLengthEqual(self, other) {
988
992
  }
989
993
  const bytesBlobComparator = (a, b) => a.compare(b);
990
994
 
991
- var index$t = /*#__PURE__*/Object.freeze({
995
+ var index$s = /*#__PURE__*/Object.freeze({
992
996
  __proto__: null,
993
997
  BitVec: BitVec,
994
998
  Bytes: Bytes,
@@ -1090,7 +1094,7 @@ const minU64 = (a, ...values) => values.reduce((min, value) => (value > min ? mi
1090
1094
  /** Get the biggest value between U64 a and values given as input parameters. */
1091
1095
  const maxU64 = (a, ...values) => values.reduce((max, value) => (value < max ? max : value), a);
1092
1096
 
1093
- var index$s = /*#__PURE__*/Object.freeze({
1097
+ var index$r = /*#__PURE__*/Object.freeze({
1094
1098
  __proto__: null,
1095
1099
  isU16: isU16,
1096
1100
  isU32: isU32,
@@ -2529,7 +2533,7 @@ function sequenceViewFixLen(type, { fixedLength }) {
2529
2533
  }, skipper);
2530
2534
  }
2531
2535
 
2532
- var index$r = /*#__PURE__*/Object.freeze({
2536
+ var index$q = /*#__PURE__*/Object.freeze({
2533
2537
  __proto__: null,
2534
2538
  Decoder: Decoder,
2535
2539
  Descriptor: Descriptor,
@@ -3730,7 +3734,7 @@ var keyDerivation = /*#__PURE__*/Object.freeze({
3730
3734
  trivialSeed: trivialSeed
3731
3735
  });
3732
3736
 
3733
- var index$q = /*#__PURE__*/Object.freeze({
3737
+ var index$p = /*#__PURE__*/Object.freeze({
3734
3738
  __proto__: null,
3735
3739
  BANDERSNATCH_KEY_BYTES: BANDERSNATCH_KEY_BYTES,
3736
3740
  BANDERSNATCH_PROOF_BYTES: BANDERSNATCH_PROOF_BYTES,
@@ -4368,7 +4372,7 @@ var keccak = /*#__PURE__*/Object.freeze({
4368
4372
  // TODO [ToDr] (#213) this should most likely be moved to a separate
4369
4373
  // package to avoid pulling in unnecessary deps.
4370
4374
 
4371
- var index$p = /*#__PURE__*/Object.freeze({
4375
+ var index$o = /*#__PURE__*/Object.freeze({
4372
4376
  __proto__: null,
4373
4377
  Blake2b: Blake2b,
4374
4378
  HASH_SIZE: HASH_SIZE,
@@ -5005,7 +5009,7 @@ class TruncatedHashDictionary {
5005
5009
  }
5006
5010
  }
5007
5011
 
5008
- var index$o = /*#__PURE__*/Object.freeze({
5012
+ var index$n = /*#__PURE__*/Object.freeze({
5009
5013
  __proto__: null,
5010
5014
  ArrayView: ArrayView,
5011
5015
  FixedSizeArray: FixedSizeArray,
@@ -5192,7 +5196,7 @@ var PvmBackend;
5192
5196
  PvmBackend[PvmBackend["Ananas"] = 1] = "Ananas";
5193
5197
  })(PvmBackend || (PvmBackend = {}));
5194
5198
 
5195
- var index$n = /*#__PURE__*/Object.freeze({
5199
+ var index$m = /*#__PURE__*/Object.freeze({
5196
5200
  __proto__: null,
5197
5201
  Bootnode: Bootnode,
5198
5202
  ChainSpec: ChainSpec,
@@ -6699,7 +6703,7 @@ function reencodeAsView(codec, object, chainSpec) {
6699
6703
  return Decoder.decodeObject(codec.View, encoded, chainSpec);
6700
6704
  }
6701
6705
 
6702
- var index$m = /*#__PURE__*/Object.freeze({
6706
+ var index$l = /*#__PURE__*/Object.freeze({
6703
6707
  __proto__: null,
6704
6708
  Block: Block,
6705
6709
  EpochMarker: EpochMarker,
@@ -6709,6 +6713,8 @@ var index$m = /*#__PURE__*/Object.freeze({
6709
6713
  SEGMENT_BYTES: SEGMENT_BYTES,
6710
6714
  TicketsMarker: TicketsMarker,
6711
6715
  ValidatorKeys: ValidatorKeys,
6716
+ W_E: W_E,
6717
+ W_S: W_S,
6712
6718
  assurances: assurances,
6713
6719
  codecPerEpochBlock: codecPerEpochBlock,
6714
6720
  codecPerValidator: codecPerValidator,
@@ -6969,7 +6975,7 @@ var json;
6969
6975
  json.object = object;
6970
6976
  })(json || (json = {}));
6971
6977
 
6972
- var index$l = /*#__PURE__*/Object.freeze({
6978
+ var index$k = /*#__PURE__*/Object.freeze({
6973
6979
  __proto__: null,
6974
6980
  get json () { return json; },
6975
6981
  parseFromJson: parseFromJson
@@ -7097,12 +7103,12 @@ const workRefineLoadFromJson = json.object({
7097
7103
  extrinsic_count: "number",
7098
7104
  extrinsic_size: "number",
7099
7105
  exports: "number",
7100
- }, ({ gas_used, imports, extrinsic_count, extrinsic_size, exports }) => WorkRefineLoad.create({
7106
+ }, ({ gas_used, imports, extrinsic_count, extrinsic_size, exports: exports$1 }) => WorkRefineLoad.create({
7101
7107
  gasUsed: tryAsServiceGas(gas_used),
7102
7108
  importedSegments: tryAsU32(imports),
7103
7109
  extrinsicCount: tryAsU32(extrinsic_count),
7104
7110
  extrinsicSize: tryAsU32(extrinsic_size),
7105
- exportedSegments: tryAsU32(exports),
7111
+ exportedSegments: tryAsU32(exports$1),
7106
7112
  }));
7107
7113
  const workResultFromJson = json.object({
7108
7114
  service_id: "number",
@@ -7239,7 +7245,7 @@ const blockFromJson = (spec) => json.object({
7239
7245
  extrinsic: getExtrinsicFromJson(spec),
7240
7246
  }, ({ header, extrinsic }) => Block.create({ header, extrinsic }));
7241
7247
 
7242
- var index$k = /*#__PURE__*/Object.freeze({
7248
+ var index$j = /*#__PURE__*/Object.freeze({
7243
7249
  __proto__: null,
7244
7250
  blockFromJson: blockFromJson,
7245
7251
  disputesExtrinsicFromJson: disputesExtrinsicFromJson,
@@ -7264,7 +7270,7 @@ function parseBootnode(v) {
7264
7270
  if (name === "" || ip === "" || port === "") {
7265
7271
  throw new Error(`Invalid bootnode format, expected: <name>@<ip>:<port>, got: "${v}"`);
7266
7272
  }
7267
- const portNumber = Number.parseInt(port);
7273
+ const portNumber = Number.parseInt(port, 10);
7268
7274
  if (!isU16(portNumber)) {
7269
7275
  throw new Error(`Invalid port number: "${port}"`);
7270
7276
  }
@@ -7733,7 +7739,7 @@ class Logger {
7733
7739
  }
7734
7740
  }
7735
7741
 
7736
- var index$j = /*#__PURE__*/Object.freeze({
7742
+ var index$i = /*#__PURE__*/Object.freeze({
7737
7743
  __proto__: null,
7738
7744
  get Level () { return Level; },
7739
7745
  Logger: Logger,
@@ -7948,7 +7954,7 @@ function isJsonObject(value) {
7948
7954
  return typeof value === "object" && value !== null && !Array.isArray(value);
7949
7955
  }
7950
7956
 
7951
- var index$i = /*#__PURE__*/Object.freeze({
7957
+ var index$h = /*#__PURE__*/Object.freeze({
7952
7958
  __proto__: null,
7953
7959
  DEFAULT_CONFIG: DEFAULT_CONFIG,
7954
7960
  DEV_CONFIG: DEV_CONFIG,
@@ -8869,7 +8875,7 @@ class CoreStatistics {
8869
8875
  /** `i` */
8870
8876
  imports,
8871
8877
  /** `e` */
8872
- exports,
8878
+ exports$1,
8873
8879
  /** `z` */
8874
8880
  extrinsicSize,
8875
8881
  /** `x` */
@@ -8881,7 +8887,7 @@ class CoreStatistics {
8881
8887
  this.dataAvailabilityLoad = dataAvailabilityLoad;
8882
8888
  this.popularity = popularity;
8883
8889
  this.imports = imports;
8884
- this.exports = exports;
8890
+ this.exports = exports$1;
8885
8891
  this.extrinsicSize = extrinsicSize;
8886
8892
  this.extrinsicCount = extrinsicCount;
8887
8893
  this.bundleSize = bundleSize;
@@ -8974,7 +8980,7 @@ class ServiceStatistics {
8974
8980
  /** `i` */
8975
8981
  imports,
8976
8982
  /** `e` */
8977
- exports,
8983
+ exports$1,
8978
8984
  /** `z` */
8979
8985
  extrinsicSize,
8980
8986
  /** `x` */
@@ -8992,7 +8998,7 @@ class ServiceStatistics {
8992
8998
  this.refinementCount = refinementCount;
8993
8999
  this.refinementGasUsed = refinementGasUsed;
8994
9000
  this.imports = imports;
8995
- this.exports = exports;
9001
+ this.exports = exports$1;
8996
9002
  this.extrinsicSize = extrinsicSize;
8997
9003
  this.extrinsicCount = extrinsicCount;
8998
9004
  this.accumulateCount = accumulateCount;
@@ -9157,11 +9163,32 @@ const ENTROPY_ENTRIES = 4;
9157
9163
 
9158
9164
  var UpdatePreimageKind;
9159
9165
  (function (UpdatePreimageKind) {
9160
- /** Insert new preimage and optionally update it's lookup history. */
9166
+ /**
9167
+ * Insert new preimage and optionally update it's lookup history.
9168
+ *
9169
+ * Used in: `provide`
9170
+ *
9171
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/383904383904?v=0.7.2
9172
+ */
9161
9173
  UpdatePreimageKind[UpdatePreimageKind["Provide"] = 0] = "Provide";
9162
- /** Remove a preimage and it's lookup history. */
9174
+ /**
9175
+ * Remove a preimage and it's lookup history.
9176
+ *
9177
+ * Used in: `forget` and `eject`
9178
+ *
9179
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/38c701380202?v=0.7.2
9180
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/379102379302?v=0.7.2
9181
+ */
9163
9182
  UpdatePreimageKind[UpdatePreimageKind["Remove"] = 1] = "Remove";
9164
- /** update or add lookup history for preimage hash/len to given value. */
9183
+ /**
9184
+ * Update or add lookup history for preimage hash/len to given value.
9185
+ *
9186
+ * Used in: `solicit` and `forget`
9187
+ *
9188
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/382802382802?v=0.7.2
9189
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/384002384b02?v=0.7.2
9190
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/38c60038ea00?v=0.7.2
9191
+ */
9165
9192
  UpdatePreimageKind[UpdatePreimageKind["UpdateOrAdd"] = 2] = "UpdateOrAdd";
9166
9193
  })(UpdatePreimageKind || (UpdatePreimageKind = {}));
9167
9194
  /**
@@ -9169,7 +9196,7 @@ var UpdatePreimageKind;
9169
9196
  *
9170
9197
  * Can be one of the following cases:
9171
9198
  * 1. Provide a new preimage blob and set the lookup history to available at `slot`.
9172
- * 2. Remove (expunge) a preimage and it's lookup history.
9199
+ * 2. Remove (forget) a preimage and it's lookup history.
9173
9200
  * 3. Update `LookupHistory` with given value.
9174
9201
  */
9175
9202
  class UpdatePreimage {
@@ -9742,7 +9769,7 @@ const serviceDataCodec = codec$1.dictionary(codec$1.u32.asOpaque(), serviceEntri
9742
9769
  sortKeys: (a, b) => a - b,
9743
9770
  });
9744
9771
 
9745
- var index$h = /*#__PURE__*/Object.freeze({
9772
+ var index$g = /*#__PURE__*/Object.freeze({
9746
9773
  __proto__: null,
9747
9774
  AUTHORIZATION_QUEUE_SIZE: AUTHORIZATION_QUEUE_SIZE,
9748
9775
  AccumulationOutput: AccumulationOutput,
@@ -10373,7 +10400,6 @@ class LeafNode {
10373
10400
  /**
10374
10401
  * Get the byte length of embedded value.
10375
10402
  *
10376
- * @remark
10377
10403
  * Note in case this node only contains hash this is going to be 0.
10378
10404
  */
10379
10405
  getValueLength() {
@@ -10384,7 +10410,6 @@ class LeafNode {
10384
10410
  /**
10385
10411
  * Returns the embedded value.
10386
10412
  *
10387
- * @remark
10388
10413
  * Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
10389
10414
  */
10390
10415
  getValue() {
@@ -10394,7 +10419,6 @@ class LeafNode {
10394
10419
  /**
10395
10420
  * Returns contained value hash.
10396
10421
  *
10397
- * @remark
10398
10422
  * Note that for embedded value this is going to be full 0-padded 32 bytes.
10399
10423
  */
10400
10424
  getValueHash() {
@@ -10816,7 +10840,7 @@ const bitLookup = [
10816
10840
  [0b00000000, 8],
10817
10841
  ];
10818
10842
 
10819
- var index$g = /*#__PURE__*/Object.freeze({
10843
+ var index$f = /*#__PURE__*/Object.freeze({
10820
10844
  __proto__: null,
10821
10845
  BranchNode: BranchNode,
10822
10846
  InMemoryTrie: InMemoryTrie,
@@ -11183,7 +11207,7 @@ function loadState(spec, blake2b, entries) {
11183
11207
  * hashmap of `key -> value` entries.
11184
11208
  */
11185
11209
 
11186
- var index$f = /*#__PURE__*/Object.freeze({
11210
+ var index$e = /*#__PURE__*/Object.freeze({
11187
11211
  __proto__: null,
11188
11212
  SerializedService: SerializedService,
11189
11213
  SerializedState: SerializedState,
@@ -11432,7 +11456,7 @@ class InMemoryStates {
11432
11456
  async close() { }
11433
11457
  }
11434
11458
 
11435
- var index$e = /*#__PURE__*/Object.freeze({
11459
+ var index$d = /*#__PURE__*/Object.freeze({
11436
11460
  __proto__: null,
11437
11461
  InMemoryBlocks: InMemoryBlocks,
11438
11462
  InMemorySerializedStates: InMemorySerializedStates,
@@ -11796,7 +11820,7 @@ const initEc = async () => {
11796
11820
  await init.reedSolomon();
11797
11821
  };
11798
11822
 
11799
- var index$d = /*#__PURE__*/Object.freeze({
11823
+ var index$c = /*#__PURE__*/Object.freeze({
11800
11824
  __proto__: null,
11801
11825
  N_CHUNKS_REDUNDANCY: N_CHUNKS_REDUNDANCY,
11802
11826
  N_CHUNKS_REQUIRED: N_CHUNKS_REQUIRED,
@@ -12230,7 +12254,7 @@ class FuzzTarget {
12230
12254
  }
12231
12255
  }
12232
12256
 
12233
- var index$c = /*#__PURE__*/Object.freeze({
12257
+ var index$b = /*#__PURE__*/Object.freeze({
12234
12258
  __proto__: null,
12235
12259
  AncestryItem: AncestryItem,
12236
12260
  ErrorMessage: ErrorMessage,
@@ -12248,9 +12272,9 @@ var index$c = /*#__PURE__*/Object.freeze({
12248
12272
  stateRootCodec: stateRootCodec
12249
12273
  });
12250
12274
 
12251
- var index$b = /*#__PURE__*/Object.freeze({
12275
+ var index$a = /*#__PURE__*/Object.freeze({
12252
12276
  __proto__: null,
12253
- v1: index$c
12277
+ v1: index$b
12254
12278
  });
12255
12279
 
12256
12280
  /** Size of the transfer memo. */
@@ -12679,7 +12703,11 @@ class PartiallyUpdatedState {
12679
12703
  const service = this.state.getService(serviceId);
12680
12704
  return service?.getPreimage(hash) ?? null;
12681
12705
  }
12682
- /** Get status of a preimage of current service taking into account any updates. */
12706
+ /**
12707
+ * Get status of a preimage of current service taking into account any updates.
12708
+ *
12709
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/110201110201?v=0.7.2
12710
+ */
12683
12711
  getLookupHistory(currentTimeslot, serviceId, hash, length) {
12684
12712
  const updatedService = this.stateUpdate.services.updated.get(serviceId);
12685
12713
  /** Return lookup history item for newly created service */
@@ -12716,12 +12744,7 @@ class PartiallyUpdatedState {
12716
12744
  return new LookupHistoryItem(hash, updatedPreimage.length, tryAsLookupHistorySlots([currentTimeslot]));
12717
12745
  }
12718
12746
  case UpdatePreimageKind.Remove: {
12719
- const state = stateFallback();
12720
- // kinda impossible, since we know it's there because it's removed.
12721
- if (state === null) {
12722
- return null;
12723
- }
12724
- return new LookupHistoryItem(hash, state.length, tryAsLookupHistorySlots([...state.slots, currentTimeslot]));
12747
+ return null;
12725
12748
  }
12726
12749
  case UpdatePreimageKind.UpdateOrAdd: {
12727
12750
  return action.item;
@@ -13113,42 +13136,6 @@ class HostCallsManager {
13113
13136
  }
13114
13137
  }
13115
13138
 
13116
- /** Create a new gas counter instance depending on the gas value. */
13117
- function gasCounter(gas) {
13118
- return new GasCounterU64(tryAsU64(gas));
13119
- }
13120
- class GasCounterU64 {
13121
- gas;
13122
- initialGas;
13123
- constructor(gas) {
13124
- this.gas = gas;
13125
- this.initialGas = tryAsGas(gas);
13126
- }
13127
- set(g) {
13128
- this.gas = tryAsU64(g);
13129
- }
13130
- get() {
13131
- return tryAsGas(this.gas);
13132
- }
13133
- sub(g) {
13134
- const result = this.gas - tryAsU64(g);
13135
- if (result >= 0n) {
13136
- this.gas = tryAsU64(result);
13137
- return false;
13138
- }
13139
- this.gas = tryAsU64(0n);
13140
- return true;
13141
- }
13142
- used() {
13143
- const gasConsumed = tryAsU64(this.initialGas) - this.gas;
13144
- // In we have less than zero left we assume that all gas has been consumed.
13145
- if (gasConsumed < 0) {
13146
- return this.initialGas;
13147
- }
13148
- return tryAsGas(gasConsumed);
13149
- }
13150
- }
13151
-
13152
13139
  const tryAsMemoryIndex = (index) => {
13153
13140
  check `${index >= 0 && index <= MAX_MEMORY_INDEX} Incorrect memory index: ${index}!`;
13154
13141
  return asOpaqueType(index);
@@ -13871,7 +13858,7 @@ function getRegisters(argsLength) {
13871
13858
  return regs;
13872
13859
  }
13873
13860
 
13874
- var index$a = /*#__PURE__*/Object.freeze({
13861
+ var index$9 = /*#__PURE__*/Object.freeze({
13875
13862
  __proto__: null,
13876
13863
  MemorySegment: MemorySegment,
13877
13864
  SpiMemory: SpiMemory,
@@ -13930,7 +13917,7 @@ function extractCodeAndMetadata(blobWithMetadata) {
13930
13917
  return { metadata, code };
13931
13918
  }
13932
13919
 
13933
- var index$9 = /*#__PURE__*/Object.freeze({
13920
+ var index$8 = /*#__PURE__*/Object.freeze({
13934
13921
  __proto__: null,
13935
13922
  Program: Program,
13936
13923
  extractCodeAndMetadata: extractCodeAndMetadata
@@ -14894,6 +14881,42 @@ class BasicBlocks {
14894
14881
  }
14895
14882
  }
14896
14883
 
14884
+ /** Create a new gas counter instance depending on the gas value. */
14885
+ function gasCounter(gas) {
14886
+ return new GasCounterU64(tryAsU64(gas));
14887
+ }
14888
+ class GasCounterU64 {
14889
+ gas;
14890
+ initialGas;
14891
+ constructor(gas) {
14892
+ this.gas = gas;
14893
+ this.initialGas = tryAsGas(gas);
14894
+ }
14895
+ set(g) {
14896
+ this.gas = tryAsU64(g);
14897
+ }
14898
+ get() {
14899
+ return tryAsGas(this.gas);
14900
+ }
14901
+ sub(g) {
14902
+ const result = this.gas - tryAsU64(g);
14903
+ if (result >= 0n) {
14904
+ this.gas = tryAsU64(result);
14905
+ return false;
14906
+ }
14907
+ this.gas = tryAsU64(0n);
14908
+ return true;
14909
+ }
14910
+ used() {
14911
+ const gasConsumed = tryAsU64(this.initialGas) - this.gas;
14912
+ // In we have less than zero left we assume that all gas has been consumed.
14913
+ if (gasConsumed < 0) {
14914
+ return this.initialGas;
14915
+ }
14916
+ return tryAsGas(gasConsumed);
14917
+ }
14918
+ }
14919
+
14897
14920
  const instructionGasMap = (() => {
14898
14921
  const instructionGasMap = new Array(HIGHEST_INSTRUCTION_NUMBER + 1);
14899
14922
  for (let i = 0; i < HIGHEST_INSTRUCTION_NUMBER + 1; i++) {
@@ -16802,8 +16825,77 @@ class Interpreter {
16802
16825
  }
16803
16826
  }
16804
16827
 
16805
- var index$8 = /*#__PURE__*/Object.freeze({
16828
+ class DebuggerAdapter {
16829
+ pvm;
16830
+ constructor(useSbrkGas = false) {
16831
+ this.pvm = new Interpreter({ useSbrkGas });
16832
+ }
16833
+ resetGeneric(rawProgram, flatRegisters, initialGas) {
16834
+ this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
16835
+ }
16836
+ reset(rawProgram, pc, gas, maybeRegisters, maybeMemory) {
16837
+ this.pvm.resetGeneric(rawProgram, pc, tryAsGas(gas), maybeRegisters, maybeMemory);
16838
+ }
16839
+ getPageDump(pageNumber) {
16840
+ const page = this.pvm.getMemoryPage(pageNumber);
16841
+ if (page === null) {
16842
+ // page wasn't allocated so we return an empty page
16843
+ return safeAllocUint8Array(PAGE_SIZE$1);
16844
+ }
16845
+ if (page.length === PAGE_SIZE$1) {
16846
+ // page was allocated and has a proper size so we can simply return it
16847
+ return page;
16848
+ }
16849
+ // page was allocated but it is shorter than PAGE_SIZE so we have to extend it
16850
+ const fullPage = safeAllocUint8Array(PAGE_SIZE$1);
16851
+ fullPage.set(page);
16852
+ return fullPage;
16853
+ }
16854
+ setMemory(address, value) {
16855
+ this.pvm.memory.storeFrom(tryAsMemoryIndex(address), value);
16856
+ }
16857
+ getExitArg() {
16858
+ return this.pvm.getExitParam() ?? 0;
16859
+ }
16860
+ getStatus() {
16861
+ return this.pvm.getStatus();
16862
+ }
16863
+ nextStep() {
16864
+ return this.pvm.nextStep() === Status.OK;
16865
+ }
16866
+ nSteps(steps) {
16867
+ check `${steps >>> 0 > 0} Expected a positive integer got ${steps}`;
16868
+ for (let i = 0; i < steps; i++) {
16869
+ const isOk = this.nextStep();
16870
+ if (!isOk) {
16871
+ return false;
16872
+ }
16873
+ }
16874
+ return true;
16875
+ }
16876
+ getRegisters() {
16877
+ return this.pvm.registers.getAllU64();
16878
+ }
16879
+ setRegisters(registers) {
16880
+ this.pvm.registers.copyFrom(new Registers(registers));
16881
+ }
16882
+ getProgramCounter() {
16883
+ return this.pvm.getPC();
16884
+ }
16885
+ setNextProgramCounter(nextPc) {
16886
+ this.pvm.setNextPC(nextPc);
16887
+ }
16888
+ getGasLeft() {
16889
+ return BigInt(this.pvm.gas.get());
16890
+ }
16891
+ setGasLeft(gas) {
16892
+ this.pvm.gas.set(tryAsGas(gas));
16893
+ }
16894
+ }
16895
+
16896
+ var index$7 = /*#__PURE__*/Object.freeze({
16806
16897
  __proto__: null,
16898
+ DebuggerAdapter: DebuggerAdapter,
16807
16899
  Interpreter: Interpreter,
16808
16900
  Memory: Memory,
16809
16901
  MemoryBuilder: MemoryBuilder,
@@ -16834,18 +16926,18 @@ async function instantiate$1(module, imports = {}) {
16834
16926
  },
16835
16927
  }, Object.assign(Object.create(globalThis), imports.env || {})),
16836
16928
  };
16837
- const { exports } = await WebAssembly.instantiate(module, adaptedImports);
16838
- const memory = exports.memory || imports.env.memory;
16929
+ const { exports: exports$1 } = await WebAssembly.instantiate(module, adaptedImports);
16930
+ const memory = exports$1.memory || imports.env.memory;
16839
16931
  const adaptedExports = Object.setPrototypeOf({
16840
16932
  getAssembly(p) {
16841
16933
  // assembly/api-internal/getAssembly(assembly/program/Program) => ~lib/string/String
16842
16934
  p = __lowerInternref(p) || __notnull();
16843
- return __liftString(exports.getAssembly(p) >>> 0);
16935
+ return __liftString(exports$1.getAssembly(p) >>> 0);
16844
16936
  },
16845
16937
  wrapAsProgram(bytecode) {
16846
16938
  // assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
16847
16939
  bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
16848
- return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
16940
+ return __liftTypedArray(Uint8Array, exports$1.wrapAsProgram(bytecode) >>> 0);
16849
16941
  },
16850
16942
  resetJAM(program, pc, initialGas, args, hasMetadata) {
16851
16943
  // assembly/api-debugger/resetJAM(~lib/array/Array<u8>, f64, i64, ~lib/array/Array<u8>, bool?) => void
@@ -16854,8 +16946,8 @@ async function instantiate$1(module, imports = {}) {
16854
16946
  args = __lowerArray(__setU8, 6, 0, args) || __notnull();
16855
16947
  hasMetadata = hasMetadata ? 1 : 0;
16856
16948
  try {
16857
- exports.__setArgumentsLength(arguments.length);
16858
- exports.resetJAM(program, pc, initialGas, args, hasMetadata);
16949
+ exports$1.__setArgumentsLength(arguments.length);
16950
+ exports$1.resetJAM(program, pc, initialGas, args, hasMetadata);
16859
16951
  } finally {
16860
16952
  __release(program);
16861
16953
  }
@@ -16867,8 +16959,8 @@ async function instantiate$1(module, imports = {}) {
16867
16959
  initialGas = initialGas || 0n;
16868
16960
  hasMetadata = hasMetadata ? 1 : 0;
16869
16961
  try {
16870
- exports.__setArgumentsLength(arguments.length);
16871
- exports.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
16962
+ exports$1.__setArgumentsLength(arguments.length);
16963
+ exports$1.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
16872
16964
  } finally {
16873
16965
  __release(program);
16874
16966
  }
@@ -16882,8 +16974,8 @@ async function instantiate$1(module, imports = {}) {
16882
16974
  initialGas = initialGas || 0n;
16883
16975
  hasMetadata = hasMetadata ? 1 : 0;
16884
16976
  try {
16885
- exports.__setArgumentsLength(arguments.length);
16886
- exports.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
16977
+ exports$1.__setArgumentsLength(arguments.length);
16978
+ exports$1.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
16887
16979
  } finally {
16888
16980
  __release(program);
16889
16981
  __release(flatRegisters);
@@ -16892,68 +16984,68 @@ async function instantiate$1(module, imports = {}) {
16892
16984
  },
16893
16985
  nextStep() {
16894
16986
  // assembly/api-debugger/nextStep() => bool
16895
- return exports.nextStep() != 0;
16987
+ return exports$1.nextStep() != 0;
16896
16988
  },
16897
16989
  nSteps(steps) {
16898
16990
  // assembly/api-debugger/nSteps(u32) => bool
16899
- return exports.nSteps(steps) != 0;
16991
+ return exports$1.nSteps(steps) != 0;
16900
16992
  },
16901
16993
  getProgramCounter() {
16902
16994
  // assembly/api-debugger/getProgramCounter() => u32
16903
- return exports.getProgramCounter() >>> 0;
16995
+ return exports$1.getProgramCounter() >>> 0;
16904
16996
  },
16905
16997
  getExitArg() {
16906
16998
  // assembly/api-debugger/getExitArg() => u32
16907
- return exports.getExitArg() >>> 0;
16999
+ return exports$1.getExitArg() >>> 0;
16908
17000
  },
16909
17001
  setGasLeft(gas) {
16910
17002
  // assembly/api-debugger/setGasLeft(i64) => void
16911
17003
  gas = gas || 0n;
16912
- exports.setGasLeft(gas);
17004
+ exports$1.setGasLeft(gas);
16913
17005
  },
16914
17006
  getRegisters() {
16915
17007
  // assembly/api-debugger/getRegisters() => ~lib/typedarray/Uint8Array
16916
- return __liftTypedArray(Uint8Array, exports.getRegisters() >>> 0);
17008
+ return __liftTypedArray(Uint8Array, exports$1.getRegisters() >>> 0);
16917
17009
  },
16918
17010
  setRegisters(flatRegisters) {
16919
17011
  // assembly/api-debugger/setRegisters(~lib/array/Array<u8>) => void
16920
17012
  flatRegisters = __lowerArray(__setU8, 6, 0, flatRegisters) || __notnull();
16921
- exports.setRegisters(flatRegisters);
17013
+ exports$1.setRegisters(flatRegisters);
16922
17014
  },
16923
17015
  getPageDump(index) {
16924
17016
  // assembly/api-debugger/getPageDump(u32) => ~lib/typedarray/Uint8Array
16925
- return __liftTypedArray(Uint8Array, exports.getPageDump(index) >>> 0);
17017
+ return __liftTypedArray(Uint8Array, exports$1.getPageDump(index) >>> 0);
16926
17018
  },
16927
17019
  getMemory(address, length) {
16928
17020
  // assembly/api-debugger/getMemory(u32, u32) => ~lib/typedarray/Uint8Array | null
16929
- return __liftTypedArray(Uint8Array, exports.getMemory(address, length) >>> 0);
17021
+ return __liftTypedArray(Uint8Array, exports$1.getMemory(address, length) >>> 0);
16930
17022
  },
16931
17023
  setMemory(address, data) {
16932
17024
  // assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => bool
16933
17025
  data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
16934
- return exports.setMemory(address, data) != 0;
17026
+ return exports$1.setMemory(address, data) != 0;
16935
17027
  },
16936
17028
  InputKind: (values => (
16937
17029
  // assembly/api-utils/InputKind
16938
- values[values.Generic = exports["InputKind.Generic"].valueOf()] = "Generic",
16939
- values[values.SPI = exports["InputKind.SPI"].valueOf()] = "SPI",
17030
+ values[values.Generic = exports$1["InputKind.Generic"].valueOf()] = "Generic",
17031
+ values[values.SPI = exports$1["InputKind.SPI"].valueOf()] = "SPI",
16940
17032
  values
16941
17033
  ))({}),
16942
17034
  HasMetadata: (values => (
16943
17035
  // assembly/api-utils/HasMetadata
16944
- values[values.Yes = exports["HasMetadata.Yes"].valueOf()] = "Yes",
16945
- values[values.No = exports["HasMetadata.No"].valueOf()] = "No",
17036
+ values[values.Yes = exports$1["HasMetadata.Yes"].valueOf()] = "Yes",
17037
+ values[values.No = exports$1["HasMetadata.No"].valueOf()] = "No",
16946
17038
  values
16947
17039
  ))({}),
16948
17040
  getGasCosts(input, kind, withMetadata) {
16949
17041
  // assembly/api-utils/getGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/gas-costs/BlockGasCost>
16950
17042
  input = __lowerArray(__setU8, 6, 0, input) || __notnull();
16951
- return __liftArray(pointer => __liftRecord50(__getU32(pointer)), 2, exports.getGasCosts(input, kind, withMetadata) >>> 0);
17043
+ return __liftArray(pointer => __liftRecord50(__getU32(pointer)), 2, exports$1.getGasCosts(input, kind, withMetadata) >>> 0);
16952
17044
  },
16953
17045
  disassemble(input, kind, withMetadata) {
16954
17046
  // assembly/api-utils/disassemble(~lib/array/Array<u8>, i32, i32) => ~lib/string/String
16955
17047
  input = __lowerArray(__setU8, 6, 0, input) || __notnull();
16956
- return __liftString(exports.disassemble(input, kind, withMetadata) >>> 0);
17048
+ return __liftString(exports$1.disassemble(input, kind, withMetadata) >>> 0);
16957
17049
  },
16958
17050
  prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) {
16959
17051
  // assembly/api-utils/prepareProgram(i32, i32, ~lib/array/Array<u8>, ~lib/array/Array<u64>, ~lib/array/Array<assembly/api-internal/InitialPage>, ~lib/array/Array<assembly/api-internal/InitialChunk>, ~lib/array/Array<u8>) => assembly/spi/StandardProgram
@@ -16963,7 +17055,7 @@ async function instantiate$1(module, imports = {}) {
16963
17055
  initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord48(value) || __notnull()); }, 49, 2, initialMemory) || __notnull());
16964
17056
  args = __lowerArray(__setU8, 6, 0, args) || __notnull();
16965
17057
  try {
16966
- return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
17058
+ return __liftInternref(exports$1.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
16967
17059
  } finally {
16968
17060
  __release(program);
16969
17061
  __release(initialRegisters);
@@ -16977,10 +17069,10 @@ async function instantiate$1(module, imports = {}) {
16977
17069
  initialGas = initialGas || 0n;
16978
17070
  logs = logs ? 1 : 0;
16979
17071
  useSbrkGas = useSbrkGas ? 1 : 0;
16980
- exports.__setArgumentsLength(arguments.length);
16981
- return __liftRecord55(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
17072
+ exports$1.__setArgumentsLength(arguments.length);
17073
+ return __liftRecord55(exports$1.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
16982
17074
  },
16983
- }, exports);
17075
+ }, exports$1);
16984
17076
  function __liftRecord50(pointer) {
16985
17077
  // assembly/gas-costs/BlockGasCost
16986
17078
  // Hint: Opt-out from lifting as a record by providing an empty constructor
@@ -16994,21 +17086,21 @@ async function instantiate$1(module, imports = {}) {
16994
17086
  // assembly/api-internal/InitialPage
16995
17087
  // Hint: Opt-out from lowering as a record by providing an empty constructor
16996
17088
  if (value == null) return 0;
16997
- const pointer = exports.__pin(exports.__new(12, 46));
17089
+ const pointer = exports$1.__pin(exports$1.__new(12, 46));
16998
17090
  __setU32(pointer + 0, value.address);
16999
17091
  __setU32(pointer + 4, value.length);
17000
17092
  __setU32(pointer + 8, value.access);
17001
- exports.__unpin(pointer);
17093
+ exports$1.__unpin(pointer);
17002
17094
  return pointer;
17003
17095
  }
17004
17096
  function __lowerRecord48(value) {
17005
17097
  // assembly/api-internal/InitialChunk
17006
17098
  // Hint: Opt-out from lowering as a record by providing an empty constructor
17007
17099
  if (value == null) return 0;
17008
- const pointer = exports.__pin(exports.__new(8, 48));
17100
+ const pointer = exports$1.__pin(exports$1.__new(8, 48));
17009
17101
  __setU32(pointer + 0, value.address);
17010
17102
  __setU32(pointer + 4, __lowerArray(__setU8, 6, 0, value.data) || __notnull());
17011
- exports.__unpin(pointer);
17103
+ exports$1.__unpin(pointer);
17012
17104
  return pointer;
17013
17105
  }
17014
17106
  function __liftRecord48(pointer) {
@@ -17057,15 +17149,15 @@ async function instantiate$1(module, imports = {}) {
17057
17149
  if (values == null) return 0;
17058
17150
  const
17059
17151
  length = values.length,
17060
- buffer = exports.__pin(exports.__new(length << align, 1)) >>> 0,
17061
- header = exports.__pin(exports.__new(16, id)) >>> 0;
17152
+ buffer = exports$1.__pin(exports$1.__new(length << align, 1)) >>> 0,
17153
+ header = exports$1.__pin(exports$1.__new(16, id)) >>> 0;
17062
17154
  __setU32(header + 0, buffer);
17063
17155
  __dataview.setUint32(header + 4, buffer, true);
17064
17156
  __dataview.setUint32(header + 8, length << align, true);
17065
17157
  __dataview.setUint32(header + 12, length, true);
17066
17158
  for (let i = 0; i < length; ++i) lowerElement(buffer + (i << align >>> 0), values[i]);
17067
- exports.__unpin(buffer);
17068
- exports.__unpin(header);
17159
+ exports$1.__unpin(buffer);
17160
+ exports$1.__unpin(header);
17069
17161
  return header;
17070
17162
  }
17071
17163
  function __liftTypedArray(constructor, pointer) {
@@ -17080,13 +17172,13 @@ async function instantiate$1(module, imports = {}) {
17080
17172
  if (values == null) return 0;
17081
17173
  const
17082
17174
  length = values.length,
17083
- buffer = exports.__pin(exports.__new(length << align, 1)) >>> 0,
17084
- header = exports.__new(12, id) >>> 0;
17175
+ buffer = exports$1.__pin(exports$1.__new(length << align, 1)) >>> 0,
17176
+ header = exports$1.__new(12, id) >>> 0;
17085
17177
  __setU32(header + 0, buffer);
17086
17178
  __dataview.setUint32(header + 4, buffer, true);
17087
17179
  __dataview.setUint32(header + 8, length << align, true);
17088
17180
  new constructor(memory.buffer, buffer, length).set(values);
17089
- exports.__unpin(buffer);
17181
+ exports$1.__unpin(buffer);
17090
17182
  return header;
17091
17183
  }
17092
17184
  class Internref extends Number {}
@@ -17107,14 +17199,14 @@ async function instantiate$1(module, imports = {}) {
17107
17199
  if (pointer) {
17108
17200
  const refcount = refcounts.get(pointer);
17109
17201
  if (refcount) refcounts.set(pointer, refcount + 1);
17110
- else refcounts.set(exports.__pin(pointer), 1);
17202
+ else refcounts.set(exports$1.__pin(pointer), 1);
17111
17203
  }
17112
17204
  return pointer;
17113
17205
  }
17114
17206
  function __release(pointer) {
17115
17207
  if (pointer) {
17116
17208
  const refcount = refcounts.get(pointer);
17117
- if (refcount === 1) exports.__unpin(pointer), refcounts.delete(pointer);
17209
+ if (refcount === 1) exports$1.__unpin(pointer), refcounts.delete(pointer);
17118
17210
  else if (refcount) refcounts.set(pointer, refcount - 1);
17119
17211
  else throw Error(`invalid refcount '${refcount}' for reference '${pointer}'`);
17120
17212
  }
@@ -17393,7 +17485,7 @@ class InterpreterInstanceManager {
17393
17485
  }
17394
17486
  }
17395
17487
 
17396
- var index$7 = /*#__PURE__*/Object.freeze({
17488
+ var index$6 = /*#__PURE__*/Object.freeze({
17397
17489
  __proto__: null,
17398
17490
  HostCallMemory: HostCallMemory,
17399
17491
  HostCallRegisters: HostCallRegisters,
@@ -17486,7 +17578,7 @@ const codecServiceAccountInfoWithThresholdBalance = codec$1.object({
17486
17578
  parentService: codec$1.u32.convert((x) => x, tryAsServiceId),
17487
17579
  }, "ServiceAccountInfoWithThresholdBalance");
17488
17580
 
17489
- var index$6 = /*#__PURE__*/Object.freeze({
17581
+ var index$5 = /*#__PURE__*/Object.freeze({
17490
17582
  __proto__: null,
17491
17583
  AccumulationStateUpdate: AccumulationStateUpdate,
17492
17584
  CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
@@ -17641,154 +17733,9 @@ class Mountain {
17641
17733
  }
17642
17734
  }
17643
17735
 
17644
- var index$5 = /*#__PURE__*/Object.freeze({
17645
- __proto__: null,
17646
- MerkleMountainRange: MerkleMountainRange
17647
- });
17648
-
17649
- class DebuggerAdapter {
17650
- pvm;
17651
- constructor(useSbrkGas = false) {
17652
- this.pvm = new Interpreter({ useSbrkGas });
17653
- }
17654
- resetGeneric(rawProgram, flatRegisters, initialGas) {
17655
- this.pvm.resetGeneric(rawProgram, 0, tryAsGas(initialGas), new Registers(flatRegisters));
17656
- }
17657
- reset(rawProgram, pc, gas, maybeRegisters, maybeMemory) {
17658
- this.pvm.resetGeneric(rawProgram, pc, tryAsGas(gas), maybeRegisters, maybeMemory);
17659
- }
17660
- getPageDump(pageNumber) {
17661
- const page = this.pvm.getMemoryPage(pageNumber);
17662
- if (page === null) {
17663
- // page wasn't allocated so we return an empty page
17664
- return safeAllocUint8Array(PAGE_SIZE$1);
17665
- }
17666
- if (page.length === PAGE_SIZE$1) {
17667
- // page was allocated and has a proper size so we can simply return it
17668
- return page;
17669
- }
17670
- // page was allocated but it is shorter than PAGE_SIZE so we have to extend it
17671
- const fullPage = safeAllocUint8Array(PAGE_SIZE$1);
17672
- fullPage.set(page);
17673
- return fullPage;
17674
- }
17675
- setMemory(address, value) {
17676
- this.pvm.memory.storeFrom(tryAsMemoryIndex(address), value);
17677
- }
17678
- getExitArg() {
17679
- return this.pvm.getExitParam() ?? 0;
17680
- }
17681
- getStatus() {
17682
- return this.pvm.getStatus();
17683
- }
17684
- nextStep() {
17685
- return this.pvm.nextStep() === Status.OK;
17686
- }
17687
- nSteps(steps) {
17688
- check `${steps >>> 0 > 0} Expected a positive integer got ${steps}`;
17689
- for (let i = 0; i < steps; i++) {
17690
- const isOk = this.nextStep();
17691
- if (!isOk) {
17692
- return false;
17693
- }
17694
- }
17695
- return true;
17696
- }
17697
- getRegisters() {
17698
- return this.pvm.registers.getAllU64();
17699
- }
17700
- setRegisters(registers) {
17701
- this.pvm.registers.copyFrom(new Registers(registers));
17702
- }
17703
- getProgramCounter() {
17704
- return this.pvm.getPC();
17705
- }
17706
- setNextProgramCounter(nextPc) {
17707
- this.pvm.setNextPC(nextPc);
17708
- }
17709
- getGasLeft() {
17710
- return BigInt(this.pvm.gas.get());
17711
- }
17712
- setGasLeft(gas) {
17713
- this.pvm.gas.set(tryAsGas(gas));
17714
- }
17715
- }
17716
-
17717
17736
  var index$4 = /*#__PURE__*/Object.freeze({
17718
17737
  __proto__: null,
17719
- AccumulationStateUpdate: AccumulationStateUpdate,
17720
- ArgsDecoder: ArgsDecoder,
17721
- get ArgumentType () { return ArgumentType; },
17722
- BasicBlocks: BasicBlocks,
17723
- CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
17724
- get EjectError () { return EjectError; },
17725
- ExtendedWitdthImmediateDecoder: ExtendedWitdthImmediateDecoder,
17726
- get ForgetPreimageError () { return ForgetPreimageError; },
17727
- HostCallMemory: HostCallMemory,
17728
- HostCallRegisters: HostCallRegisters,
17729
- HostCallResult: HostCallResult,
17730
- ImmediateDecoder: ImmediateDecoder,
17731
- InsufficientFundsError: InsufficientFundsError,
17732
- MachineInstance: MachineInstance,
17733
- Mask: Mask,
17734
- get MemoryOperation () { return MemoryOperation; },
17735
- MemorySegment: MemorySegment,
17736
- NO_OF_REGISTERS: NO_OF_REGISTERS$1,
17737
- get NewServiceError () { return NewServiceError; },
17738
- NibblesDecoder: NibblesDecoder,
17739
- NoMachineError: NoMachineError,
17740
- OK: OK,
17741
- get PagesError () { return PagesError; },
17742
- PartiallyUpdatedState: PartiallyUpdatedState,
17743
- get PeekPokeError () { return PeekPokeError; },
17744
- PendingTransfer: PendingTransfer,
17745
- get PreimageStatusKind () { return PreimageStatusKind; },
17746
- Program: Program,
17747
- ProgramDecoder: ProgramDecoder,
17748
- get ProvidePreimageError () { return ProvidePreimageError; },
17749
- Pvm: DebuggerAdapter,
17750
- Registers: Registers,
17751
- get RequestPreimageError () { return RequestPreimageError; },
17752
- Result: Result$1,
17753
- SERVICE_ID_BYTES: SERVICE_ID_BYTES,
17754
- SegmentExportError: SegmentExportError,
17755
- SpiMemory: SpiMemory,
17756
- SpiProgram: SpiProgram,
17757
- TRANSFER_MEMO_BYTES: TRANSFER_MEMO_BYTES,
17758
- get TransferError () { return TransferError; },
17759
- UnprivilegedError: UnprivilegedError,
17760
- get UpdatePrivilegesError () { return UpdatePrivilegesError; },
17761
- WithDebug: WithDebug,
17762
- get ZeroVoidError () { return ZeroVoidError; },
17763
- asOpaqueType: asOpaqueType,
17764
- assertEmpty: assertEmpty,
17765
- assertNever: assertNever,
17766
- block: index$m,
17767
- bytes: index$t,
17768
- check: check,
17769
- clampU64ToU32: clampU64ToU32,
17770
- createResults: createResults,
17771
- decodeStandardProgram: decodeStandardProgram,
17772
- emptyRegistersBuffer: emptyRegistersBuffer,
17773
- extractCodeAndMetadata: extractCodeAndMetadata,
17774
- getServiceId: getServiceId,
17775
- getServiceIdOrCurrent: getServiceIdOrCurrent,
17776
- hash: index$p,
17777
- hostCallInfoAccount: codecServiceAccountInfoWithThresholdBalance,
17778
- inspect: inspect,
17779
- instructionArgumentTypeMap: instructionArgumentTypeMap,
17780
- interpreter: index$8,
17781
- isBrowser: isBrowser,
17782
- lazyInspect: lazyInspect,
17783
- measure: measure,
17784
- numbers: index$s,
17785
- resultToString: resultToString,
17786
- seeThrough: seeThrough,
17787
- slotsToPreimageStatus: slotsToPreimageStatus,
17788
- toMemoryOperation: toMemoryOperation,
17789
- tryAsMachineId: tryAsMachineId,
17790
- tryAsProgramCounter: tryAsProgramCounter,
17791
- writeServiceIdAsLeBytes: writeServiceIdAsLeBytes
17738
+ MerkleMountainRange: MerkleMountainRange
17792
17739
  });
17793
17740
 
17794
17741
  const ENTROPY_BYTES = 32;
@@ -18062,12 +18009,12 @@ class JsonCoreStatistics {
18062
18009
  extrinsic_count: "number",
18063
18010
  bundle_size: "number",
18064
18011
  gas_used: json.fromBigInt(tryAsServiceGas),
18065
- }, ({ da_load, popularity, imports, exports, extrinsic_size, extrinsic_count, bundle_size, gas_used }) => {
18012
+ }, ({ da_load, popularity, imports, exports: exports$1, extrinsic_size, extrinsic_count, bundle_size, gas_used }) => {
18066
18013
  return CoreStatistics.create({
18067
18014
  dataAvailabilityLoad: da_load,
18068
18015
  popularity,
18069
18016
  imports,
18070
- exports,
18017
+ exports: exports$1,
18071
18018
  extrinsicSize: extrinsic_size,
18072
18019
  extrinsicCount: extrinsic_count,
18073
18020
  bundleSize: bundle_size,
@@ -18101,14 +18048,14 @@ class JsonServiceStatistics {
18101
18048
  on_transfers_gas_used: json.fromBigInt(tryAsServiceGas),
18102
18049
  }
18103
18050
  : {}),
18104
- }, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, on_transfers_count, on_transfers_gas_used, }) => {
18051
+ }, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports: exports$1, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, on_transfers_count, on_transfers_gas_used, }) => {
18105
18052
  return ServiceStatistics.create({
18106
18053
  providedCount: provided_count,
18107
18054
  providedSize: provided_size,
18108
18055
  refinementCount: refinement_count,
18109
18056
  refinementGasUsed: refinement_gas_used,
18110
18057
  imports,
18111
- exports,
18058
+ exports: exports$1,
18112
18059
  extrinsicSize: extrinsic_size,
18113
18060
  extrinsicCount: extrinsic_count,
18114
18061
  accumulateCount: accumulate_count,
@@ -18316,11 +18263,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
18316
18263
 
18317
18264
  /** Helper function to create most used hashes in the block */
18318
18265
  class TransitionHasher {
18319
- context;
18320
18266
  keccakHasher;
18321
18267
  blake2b;
18322
- constructor(context, keccakHasher, blake2b) {
18323
- this.context = context;
18268
+ constructor(keccakHasher, blake2b) {
18324
18269
  this.keccakHasher = keccakHasher;
18325
18270
  this.blake2b = blake2b;
18326
18271
  }
@@ -18432,4 +18377,4 @@ var index = /*#__PURE__*/Object.freeze({
18432
18377
  TransitionHasher: TransitionHasher
18433
18378
  });
18434
18379
 
18435
- export { index$m as block, index$k as block_json, index$t as bytes, index$r as codec, index$o as collections, index$n as config, index$i as config_node, index$q as crypto, index$e as database, index$d as erasure_coding, index$b as fuzz_proto, index$p as hash, index$6 as jam_host_calls, index$l as json_parser, index$j as logger, index$5 as mmr, index$s as numbers, index$u as ordering, index$4 as pvm, index$7 as pvm_host_calls, index$8 as pvm_interpreter, index$9 as pvm_program, index$a as pvm_spi_decoder, index$3 as shuffling, index$h as state, index$2 as state_json, index$f as state_merkleization, index$1 as state_vectors, index as transition, index$g as trie, index$v as utils };
18380
+ export { index$l as block, index$j as block_json, index$s as bytes, index$q as codec, index$n as collections, index$m as config, index$h as config_node, index$p as crypto, index$d as database, index$c as erasure_coding, index$a as fuzz_proto, index$o as hash, index$5 as jam_host_calls, index$k as json_parser, index$i as logger, index$4 as mmr, index$r as numbers, index$t as ordering, index$7 as pvm, index$6 as pvm_host_calls, index$8 as pvm_program, index$9 as pvm_spi_decoder, index$3 as shuffling, index$g as state, index$2 as state_json, index$e as state_merkleization, index$1 as state_vectors, index as transition, index$f as trie, index$u as utils };