@typeberry/jam 0.4.1-9e565b9 → 0.4.1-bb6dbac

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.
@@ -15433,6 +15433,349 @@ exports.fromBER = fromBER;
15433
15433
  exports.verifySchema = verifySchema;
15434
15434
 
15435
15435
 
15436
+ /***/ }),
15437
+
15438
+ /***/ 952:
15439
+ /***/ ((module) => {
15440
+
15441
+
15442
+
15443
+ var has = Object.prototype.hasOwnProperty
15444
+ , prefix = '~';
15445
+
15446
+ /**
15447
+ * Constructor to create a storage for our `EE` objects.
15448
+ * An `Events` instance is a plain object whose properties are event names.
15449
+ *
15450
+ * @constructor
15451
+ * @private
15452
+ */
15453
+ function Events() {}
15454
+
15455
+ //
15456
+ // We try to not inherit from `Object.prototype`. In some engines creating an
15457
+ // instance in this way is faster than calling `Object.create(null)` directly.
15458
+ // If `Object.create(null)` is not supported we prefix the event names with a
15459
+ // character to make sure that the built-in object properties are not
15460
+ // overridden or used as an attack vector.
15461
+ //
15462
+ if (Object.create) {
15463
+ Events.prototype = Object.create(null);
15464
+
15465
+ //
15466
+ // This hack is needed because the `__proto__` property is still inherited in
15467
+ // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
15468
+ //
15469
+ if (!new Events().__proto__) prefix = false;
15470
+ }
15471
+
15472
+ /**
15473
+ * Representation of a single event listener.
15474
+ *
15475
+ * @param {Function} fn The listener function.
15476
+ * @param {*} context The context to invoke the listener with.
15477
+ * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
15478
+ * @constructor
15479
+ * @private
15480
+ */
15481
+ function EE(fn, context, once) {
15482
+ this.fn = fn;
15483
+ this.context = context;
15484
+ this.once = once || false;
15485
+ }
15486
+
15487
+ /**
15488
+ * Add a listener for a given event.
15489
+ *
15490
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
15491
+ * @param {(String|Symbol)} event The event name.
15492
+ * @param {Function} fn The listener function.
15493
+ * @param {*} context The context to invoke the listener with.
15494
+ * @param {Boolean} once Specify if the listener is a one-time listener.
15495
+ * @returns {EventEmitter}
15496
+ * @private
15497
+ */
15498
+ function addListener(emitter, event, fn, context, once) {
15499
+ if (typeof fn !== 'function') {
15500
+ throw new TypeError('The listener must be a function');
15501
+ }
15502
+
15503
+ var listener = new EE(fn, context || emitter, once)
15504
+ , evt = prefix ? prefix + event : event;
15505
+
15506
+ if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
15507
+ else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
15508
+ else emitter._events[evt] = [emitter._events[evt], listener];
15509
+
15510
+ return emitter;
15511
+ }
15512
+
15513
+ /**
15514
+ * Clear event by name.
15515
+ *
15516
+ * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
15517
+ * @param {(String|Symbol)} evt The Event name.
15518
+ * @private
15519
+ */
15520
+ function clearEvent(emitter, evt) {
15521
+ if (--emitter._eventsCount === 0) emitter._events = new Events();
15522
+ else delete emitter._events[evt];
15523
+ }
15524
+
15525
+ /**
15526
+ * Minimal `EventEmitter` interface that is molded against the Node.js
15527
+ * `EventEmitter` interface.
15528
+ *
15529
+ * @constructor
15530
+ * @public
15531
+ */
15532
+ function EventEmitter() {
15533
+ this._events = new Events();
15534
+ this._eventsCount = 0;
15535
+ }
15536
+
15537
+ /**
15538
+ * Return an array listing the events for which the emitter has registered
15539
+ * listeners.
15540
+ *
15541
+ * @returns {Array}
15542
+ * @public
15543
+ */
15544
+ EventEmitter.prototype.eventNames = function eventNames() {
15545
+ var names = []
15546
+ , events
15547
+ , name;
15548
+
15549
+ if (this._eventsCount === 0) return names;
15550
+
15551
+ for (name in (events = this._events)) {
15552
+ if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
15553
+ }
15554
+
15555
+ if (Object.getOwnPropertySymbols) {
15556
+ return names.concat(Object.getOwnPropertySymbols(events));
15557
+ }
15558
+
15559
+ return names;
15560
+ };
15561
+
15562
+ /**
15563
+ * Return the listeners registered for a given event.
15564
+ *
15565
+ * @param {(String|Symbol)} event The event name.
15566
+ * @returns {Array} The registered listeners.
15567
+ * @public
15568
+ */
15569
+ EventEmitter.prototype.listeners = function listeners(event) {
15570
+ var evt = prefix ? prefix + event : event
15571
+ , handlers = this._events[evt];
15572
+
15573
+ if (!handlers) return [];
15574
+ if (handlers.fn) return [handlers.fn];
15575
+
15576
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
15577
+ ee[i] = handlers[i].fn;
15578
+ }
15579
+
15580
+ return ee;
15581
+ };
15582
+
15583
+ /**
15584
+ * Return the number of listeners listening to a given event.
15585
+ *
15586
+ * @param {(String|Symbol)} event The event name.
15587
+ * @returns {Number} The number of listeners.
15588
+ * @public
15589
+ */
15590
+ EventEmitter.prototype.listenerCount = function listenerCount(event) {
15591
+ var evt = prefix ? prefix + event : event
15592
+ , listeners = this._events[evt];
15593
+
15594
+ if (!listeners) return 0;
15595
+ if (listeners.fn) return 1;
15596
+ return listeners.length;
15597
+ };
15598
+
15599
+ /**
15600
+ * Calls each of the listeners registered for a given event.
15601
+ *
15602
+ * @param {(String|Symbol)} event The event name.
15603
+ * @returns {Boolean} `true` if the event had listeners, else `false`.
15604
+ * @public
15605
+ */
15606
+ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
15607
+ var evt = prefix ? prefix + event : event;
15608
+
15609
+ if (!this._events[evt]) return false;
15610
+
15611
+ var listeners = this._events[evt]
15612
+ , len = arguments.length
15613
+ , args
15614
+ , i;
15615
+
15616
+ if (listeners.fn) {
15617
+ if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
15618
+
15619
+ switch (len) {
15620
+ case 1: return listeners.fn.call(listeners.context), true;
15621
+ case 2: return listeners.fn.call(listeners.context, a1), true;
15622
+ case 3: return listeners.fn.call(listeners.context, a1, a2), true;
15623
+ case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
15624
+ case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
15625
+ case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
15626
+ }
15627
+
15628
+ for (i = 1, args = new Array(len -1); i < len; i++) {
15629
+ args[i - 1] = arguments[i];
15630
+ }
15631
+
15632
+ listeners.fn.apply(listeners.context, args);
15633
+ } else {
15634
+ var length = listeners.length
15635
+ , j;
15636
+
15637
+ for (i = 0; i < length; i++) {
15638
+ if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
15639
+
15640
+ switch (len) {
15641
+ case 1: listeners[i].fn.call(listeners[i].context); break;
15642
+ case 2: listeners[i].fn.call(listeners[i].context, a1); break;
15643
+ case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
15644
+ case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
15645
+ default:
15646
+ if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
15647
+ args[j - 1] = arguments[j];
15648
+ }
15649
+
15650
+ listeners[i].fn.apply(listeners[i].context, args);
15651
+ }
15652
+ }
15653
+ }
15654
+
15655
+ return true;
15656
+ };
15657
+
15658
+ /**
15659
+ * Add a listener for a given event.
15660
+ *
15661
+ * @param {(String|Symbol)} event The event name.
15662
+ * @param {Function} fn The listener function.
15663
+ * @param {*} [context=this] The context to invoke the listener with.
15664
+ * @returns {EventEmitter} `this`.
15665
+ * @public
15666
+ */
15667
+ EventEmitter.prototype.on = function on(event, fn, context) {
15668
+ return addListener(this, event, fn, context, false);
15669
+ };
15670
+
15671
+ /**
15672
+ * Add a one-time listener for a given event.
15673
+ *
15674
+ * @param {(String|Symbol)} event The event name.
15675
+ * @param {Function} fn The listener function.
15676
+ * @param {*} [context=this] The context to invoke the listener with.
15677
+ * @returns {EventEmitter} `this`.
15678
+ * @public
15679
+ */
15680
+ EventEmitter.prototype.once = function once(event, fn, context) {
15681
+ return addListener(this, event, fn, context, true);
15682
+ };
15683
+
15684
+ /**
15685
+ * Remove the listeners of a given event.
15686
+ *
15687
+ * @param {(String|Symbol)} event The event name.
15688
+ * @param {Function} fn Only remove the listeners that match this function.
15689
+ * @param {*} context Only remove the listeners that have this context.
15690
+ * @param {Boolean} once Only remove one-time listeners.
15691
+ * @returns {EventEmitter} `this`.
15692
+ * @public
15693
+ */
15694
+ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
15695
+ var evt = prefix ? prefix + event : event;
15696
+
15697
+ if (!this._events[evt]) return this;
15698
+ if (!fn) {
15699
+ clearEvent(this, evt);
15700
+ return this;
15701
+ }
15702
+
15703
+ var listeners = this._events[evt];
15704
+
15705
+ if (listeners.fn) {
15706
+ if (
15707
+ listeners.fn === fn &&
15708
+ (!once || listeners.once) &&
15709
+ (!context || listeners.context === context)
15710
+ ) {
15711
+ clearEvent(this, evt);
15712
+ }
15713
+ } else {
15714
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
15715
+ if (
15716
+ listeners[i].fn !== fn ||
15717
+ (once && !listeners[i].once) ||
15718
+ (context && listeners[i].context !== context)
15719
+ ) {
15720
+ events.push(listeners[i]);
15721
+ }
15722
+ }
15723
+
15724
+ //
15725
+ // Reset the array, or remove it completely if we have no more listeners.
15726
+ //
15727
+ if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
15728
+ else clearEvent(this, evt);
15729
+ }
15730
+
15731
+ return this;
15732
+ };
15733
+
15734
+ /**
15735
+ * Remove all listeners, or those of the specified event.
15736
+ *
15737
+ * @param {(String|Symbol)} [event] The event name.
15738
+ * @returns {EventEmitter} `this`.
15739
+ * @public
15740
+ */
15741
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
15742
+ var evt;
15743
+
15744
+ if (event) {
15745
+ evt = prefix ? prefix + event : event;
15746
+ if (this._events[evt]) clearEvent(this, evt);
15747
+ } else {
15748
+ this._events = new Events();
15749
+ this._eventsCount = 0;
15750
+ }
15751
+
15752
+ return this;
15753
+ };
15754
+
15755
+ //
15756
+ // Alias methods names because people roll like that.
15757
+ //
15758
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
15759
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
15760
+
15761
+ //
15762
+ // Expose the prefix.
15763
+ //
15764
+ EventEmitter.prefixed = prefix;
15765
+
15766
+ //
15767
+ // Allow `EventEmitter` to be imported as module namespace.
15768
+ //
15769
+ EventEmitter.EventEmitter = EventEmitter;
15770
+
15771
+ //
15772
+ // Expose the module.
15773
+ //
15774
+ if (true) {
15775
+ module.exports = EventEmitter;
15776
+ }
15777
+
15778
+
15436
15779
  /***/ }),
15437
15780
 
15438
15781
  /***/ 1681:
@@ -24027,7 +24370,11 @@ __nccwpck_require__.d(__webpack_exports__, {
24027
24370
  TB: () => (/* reexport */ protocol)
24028
24371
  });
24029
24372
 
24373
+ ;// CONCATENATED MODULE: ./packages/core/utils/env.ts
24374
+ const env = typeof process === "undefined" ? {} : process.env;
24375
+
24030
24376
  ;// CONCATENATED MODULE: ./packages/core/utils/compatibility.ts
24377
+
24031
24378
  var GpVersion;
24032
24379
  (function (GpVersion) {
24033
24380
  GpVersion["V0_6_7"] = "0.6.7";
@@ -24047,7 +24394,6 @@ const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
24047
24394
  * Since we are currently at 0.7.1 not 0.7.2, we set our default version accordingly.
24048
24395
  */
24049
24396
  const DEFAULT_VERSION = GpVersion.V0_7_1;
24050
- const env = typeof process === "undefined" ? {} : process.env;
24051
24397
  let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
24052
24398
  let CURRENT_SUITE = parseCurrentSuite(env.TEST_SUITE) ?? DEFAULT_SUITE;
24053
24399
  function parseCurrentVersion(env) {
@@ -24240,7 +24586,7 @@ function lazyInspect(obj) {
24240
24586
  }
24241
24587
 
24242
24588
  ;// CONCATENATED MODULE: ./packages/core/utils/dev.ts
24243
- const dev_env = typeof process === "undefined" ? {} : process.env;
24589
+
24244
24590
  /**
24245
24591
  * The function will produce relative path resolver that is adjusted
24246
24592
  * for package location within the workspace.
@@ -24258,7 +24604,7 @@ const dev_env = typeof process === "undefined" ? {} : process.env;
24258
24604
  * NOTE: the translation happens only for development build! When
24259
24605
  * we build a single library from our project, we no longer mangle the paths.
24260
24606
  */
24261
- const workspacePathFix = dev_env.NODE_ENV === "development"
24607
+ const workspacePathFix = env.NODE_ENV === "development"
24262
24608
  ? (workspacePath) => (p) => {
24263
24609
  if (p.startsWith("/")) {
24264
24610
  return p;
@@ -26239,7 +26585,7 @@ const TYPICAL_SEQUENCE_LENGTH = 64;
26239
26585
  * For the size hint for encoding typical dictionaries.
26240
26586
  * TODO [ToDr] [opti] This value should be updated when we run some real-data bechmarks.
26241
26587
  */
26242
- const descriptors_TYPICAL_DICTIONARY_LENGTH = 32;
26588
+ const TYPICAL_DICTIONARY_LENGTH = 32;
26243
26589
  /**
26244
26590
  * Convert a descriptor for regular array into readonly one.
26245
26591
  *
@@ -26265,213 +26611,209 @@ function exactHint(bytes) {
26265
26611
  isExact: true,
26266
26612
  };
26267
26613
  }
26268
- /** Descriptors for data types that can be read/written from/to codec. */
26269
- var descriptors_codec;
26270
- (function (codec) {
26271
- /** Fixed-length bytes sequence. */
26272
- codec.bytes = (() => {
26273
- const cache = new Map();
26274
- return (len) => {
26275
- let ret = cache.get(len);
26276
- if (ret === undefined) {
26277
- ret = descriptor_Descriptor.new(`Bytes<${len}>`, exactHint(len), (e, v) => e.bytes(v), (d) => d.bytes(len), (s) => s.bytes(len));
26278
- cache.set(len, ret);
26279
- }
26280
- return ret;
26281
- };
26282
- })();
26283
- /** Zero-size `void` value. */
26284
- codec.nothing = descriptor_Descriptor.new("void", { bytes: 0, isExact: true }, (_e, _v) => { }, (_d) => { }, (_s) => { });
26285
- /** Variable-length U32. */
26286
- codec.varU32 = descriptor_Descriptor.new("var_u32", { bytes: 4, isExact: false }, (e, v) => e.varU32(v), (d) => d.varU32(), (d) => d.varU32());
26287
- /** Variable-length U64. */
26288
- codec.varU64 = descriptor_Descriptor.new("var_u64", { bytes: 8, isExact: false }, (e, v) => e.varU64(v), (d) => d.varU64(), (d) => d.varU64());
26289
- /** Unsigned 64-bit number. */
26290
- codec.u64 = descriptor_Descriptor.withView("u64", exactHint(8), (e, v) => e.i64(v), (d) => d.u64(), (d) => d.u64(), codec.bytes(8));
26291
- /** Unsigned 32-bit number. */
26292
- codec.u32 = descriptor_Descriptor.withView("u32", exactHint(4), (e, v) => e.i32(v), (d) => d.u32(), (d) => d.u32(), codec.bytes(4));
26293
- /** Unsigned 24-bit number. */
26294
- codec.u24 = descriptor_Descriptor.withView("u24", exactHint(3), (e, v) => e.i24(v), (d) => d.u24(), (d) => d.u24(), codec.bytes(3));
26295
- /** Unsigned 16-bit number. */
26296
- codec.u16 = descriptor_Descriptor.withView("u16", exactHint(2), (e, v) => e.i16(v), (d) => d.u16(), (d) => d.u16(), codec.bytes(2));
26297
- /** Unsigned 8-bit number. */
26298
- codec.u8 = descriptor_Descriptor.new("u8", exactHint(1), (e, v) => e.i8(v), (d) => d.u8(), (d) => d.u8());
26299
- /** Signed 64-bit number. */
26300
- codec.i64 = descriptor_Descriptor.withView("u64", exactHint(8), (e, v) => e.i64(v), (d) => d.i64(), (s) => s.u64(), codec.bytes(8));
26301
- /** Signed 32-bit number. */
26302
- codec.i32 = descriptor_Descriptor.withView("i32", exactHint(4), (e, v) => e.i32(v), (d) => d.i32(), (s) => s.u32(), codec.bytes(4));
26303
- /** Signed 24-bit number. */
26304
- codec.i24 = descriptor_Descriptor.withView("i24", exactHint(3), (e, v) => e.i24(v), (d) => d.i24(), (s) => s.u24(), codec.bytes(3));
26305
- /** Signed 16-bit number. */
26306
- codec.i16 = descriptor_Descriptor.withView("i16", exactHint(2), (e, v) => e.i16(v), (d) => d.i16(), (s) => s.u16(), codec.bytes(2));
26307
- /** Signed 8-bit number. */
26308
- codec.i8 = descriptor_Descriptor.new("i8", exactHint(1), (e, v) => e.i8(v), (d) => d.i8(), (s) => s.u8());
26309
- /** 1-byte boolean value. */
26310
- codec.bool = descriptor_Descriptor.new("bool", exactHint(1), (e, v) => e.bool(v), (d) => d.bool(), (s) => s.bool());
26311
- /** Variable-length bytes blob. */
26312
- codec.blob = descriptor_Descriptor.new("BytesBlob", { bytes: TYPICAL_SEQUENCE_LENGTH, isExact: false }, (e, v) => e.bytesBlob(v), (d) => d.bytesBlob(), (s) => s.bytesBlob());
26313
- /** String encoded as variable-length bytes blob. */
26314
- codec.string = descriptor_Descriptor.withView("string", { bytes: TYPICAL_SEQUENCE_LENGTH, isExact: false }, (e, v) => e.bytesBlob(bytes_BytesBlob.blobFrom(new TextEncoder().encode(v))), (d) => new TextDecoder("utf8", { fatal: true }).decode(d.bytesBlob().raw), (s) => s.bytesBlob(), codec.blob);
26315
- /** Variable-length bit vector. */
26316
- codec.bitVecVarLen = descriptor_Descriptor.new("BitVec[?]", { bytes: TYPICAL_SEQUENCE_LENGTH >>> 3, isExact: false }, (e, v) => e.bitVecVarLen(v), (d) => d.bitVecVarLen(), (s) => s.bitVecVarLen());
26317
- /** Fixed-length bit vector. */
26318
- codec.bitVecFixLen = (bitLen) => descriptor_Descriptor.new(`BitVec[${bitLen}]`, exactHint(bitLen >>> 3), (e, v) => e.bitVecFixLen(v), (d) => d.bitVecFixLen(bitLen), (s) => s.bitVecFixLen(bitLen));
26319
- /** Optionality wrapper for given type. */
26320
- codec.optional = (type) => {
26321
- const self = descriptor_Descriptor.new(`Optional<${type.name}>`, addSizeHints({ bytes: 1, isExact: false }, type.sizeHint), (e, v) => e.optional(type, v), (d) => d.optional(type), (s) => s.optional(type));
26322
- if (hasUniqueView(type)) {
26323
- return descriptor_Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.optional(type.View));
26324
- }
26325
- return self;
26326
- };
26327
- /** Variable-length sequence of given type. */
26328
- codec.sequenceVarLen = (type, options = {
26329
- minLength: 0,
26330
- maxLength: 2 ** 32 - 1,
26331
- }) => {
26332
- const name = `Sequence<${type.name}>[?]`;
26333
- const typicalLength = options.typicalLength ?? TYPICAL_SEQUENCE_LENGTH;
26334
- return descriptor_Descriptor.withView(name, { bytes: typicalLength * type.sizeHint.bytes, isExact: false }, (e, v) => {
26335
- validateLength(options, v.length, name);
26336
- e.sequenceVarLen(type, v);
26337
- }, (d) => {
26338
- const len = d.varU32();
26339
- validateLength(options, len, name);
26340
- return d.sequenceFixLen(type, len);
26341
- }, (s) => {
26342
- const len = s.decoder.varU32();
26343
- validateLength(options, len, name);
26344
- return s.sequenceFixLen(type, len);
26345
- }, sequenceViewVarLen(type, options));
26346
- };
26347
- /** Fixed-length sequence of given type. */
26348
- codec.sequenceFixLen = (type, len) => descriptor_Descriptor.withView(`Sequence<${type.name}>[${len}]`, { bytes: len * type.sizeHint.bytes, isExact: type.sizeHint.isExact }, (e, v) => e.sequenceFixLen(type, v), (d) => d.sequenceFixLen(type, len), (s) => s.sequenceFixLen(type, len), sequenceViewFixLen(type, { fixedLength: len }));
26349
- /** Small dictionary codec. */
26350
- codec.dictionary = (key, value, { sortKeys, fixedLength, }) => {
26351
- const self = descriptor_Descriptor.new(`Dictionary<${key.name}, ${value.name}>[${fixedLength ?? "?"}]`, {
26352
- bytes: fixedLength !== undefined
26353
- ? fixedLength * addSizeHints(key.sizeHint, value.sizeHint).bytes
26354
- : descriptors_TYPICAL_DICTIONARY_LENGTH * (addSizeHints(key.sizeHint, value.sizeHint).bytes ?? 0),
26355
- isExact: fixedLength !== undefined ? key.sizeHint.isExact && value.sizeHint.isExact : false,
26356
- }, (e, v) => {
26357
- const data = Array.from(v.entries());
26358
- data.sort((a, b) => sortKeys(a[0], b[0]));
26359
- // length prefix
26360
- if (fixedLength === undefined || fixedLength === 0) {
26361
- e.varU32(numbers_tryAsU32(data.length));
26362
- }
26363
- for (const [k, v] of data) {
26364
- key.encode(e, k);
26365
- value.encode(e, v);
26366
- }
26367
- }, (d) => {
26368
- const map = new Map();
26369
- const len = fixedLength ?? d.varU32();
26370
- let prevKey = null;
26371
- for (let i = 0; i < len; i += 1) {
26372
- const k = key.decode(d);
26373
- const v = value.decode(d);
26374
- if (map.has(k)) {
26375
- throw new Error(`Duplicate item in the dictionary encoding: "${k}"!`);
26376
- }
26377
- if (prevKey !== null && sortKeys(prevKey, k) >= 0) {
26378
- throw new Error(`The keys in dictionary encoding are not sorted "${prevKey}" >= "${k}"!`);
26379
- }
26380
- map.set(k, v);
26381
- prevKey = k;
26382
- }
26383
- return map;
26384
- }, (s) => {
26385
- const len = fixedLength ?? s.decoder.varU32();
26386
- s.sequenceFixLen(key, len);
26387
- s.sequenceFixLen(value, len);
26388
- });
26389
- if (hasUniqueView(value)) {
26390
- return descriptor_Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.dictionary(key, value.View, { sortKeys, fixedLength }));
26614
+ /** Fixed-length bytes sequence. */
26615
+ const bytes = (() => {
26616
+ const cache = new Map();
26617
+ return (len) => {
26618
+ let ret = cache.get(len);
26619
+ if (ret === undefined) {
26620
+ ret = descriptor_Descriptor.new(`Bytes<${len}>`, exactHint(len), (e, v) => e.bytes(v), (d) => d.bytes(len), (s) => s.bytes(len));
26621
+ cache.set(len, ret);
26391
26622
  }
26392
- return self;
26623
+ return ret;
26393
26624
  };
26394
- /** Encoding of pair of two values. */
26395
- codec.pair = (a, b) => {
26396
- const self = descriptor_Descriptor.new(`Pair<${a.name}, ${b.name}>`, addSizeHints(a.sizeHint, b.sizeHint), (e, elem) => {
26397
- a.encode(e, elem[0]);
26398
- b.encode(e, elem[1]);
26399
- }, (d) => {
26400
- const aValue = a.decode(d);
26401
- const bValue = b.decode(d);
26402
- return [aValue, bValue];
26403
- }, (s) => {
26404
- a.skip(s);
26405
- b.skip(s);
26406
- });
26407
- if (hasUniqueView(a) && hasUniqueView(b)) {
26408
- return descriptor_Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.pair(a.View, b.View));
26625
+ })();
26626
+ /** Zero-size `void` value. */
26627
+ const nothing = descriptor_Descriptor.new("void", { bytes: 0, isExact: true }, (_e, _v) => { }, (_d) => { }, (_s) => { });
26628
+ /** Variable-length U32. */
26629
+ const varU32 = descriptor_Descriptor.new("var_u32", { bytes: 4, isExact: false }, (e, v) => e.varU32(v), (d) => d.varU32(), (d) => d.varU32());
26630
+ /** Variable-length U64. */
26631
+ const varU64 = descriptor_Descriptor.new("var_u64", { bytes: 8, isExact: false }, (e, v) => e.varU64(v), (d) => d.varU64(), (d) => d.varU64());
26632
+ /** Unsigned 64-bit number. */
26633
+ const u64 = descriptor_Descriptor.withView("u64", exactHint(8), (e, v) => e.i64(v), (d) => d.u64(), (d) => d.u64(), bytes(8));
26634
+ /** Unsigned 32-bit number. */
26635
+ const u32 = descriptor_Descriptor.withView("u32", exactHint(4), (e, v) => e.i32(v), (d) => d.u32(), (d) => d.u32(), bytes(4));
26636
+ /** Unsigned 24-bit number. */
26637
+ const u24 = descriptor_Descriptor.withView("u24", exactHint(3), (e, v) => e.i24(v), (d) => d.u24(), (d) => d.u24(), bytes(3));
26638
+ /** Unsigned 16-bit number. */
26639
+ const u16 = descriptor_Descriptor.withView("u16", exactHint(2), (e, v) => e.i16(v), (d) => d.u16(), (d) => d.u16(), bytes(2));
26640
+ /** Unsigned 8-bit number. */
26641
+ const u8 = descriptor_Descriptor.new("u8", exactHint(1), (e, v) => e.i8(v), (d) => d.u8(), (d) => d.u8());
26642
+ /** Signed 64-bit number. */
26643
+ const i64 = descriptor_Descriptor.withView("i64", exactHint(8), (e, v) => e.i64(v), (d) => d.i64(), (s) => s.u64(), bytes(8));
26644
+ /** Signed 32-bit number. */
26645
+ const i32 = descriptor_Descriptor.withView("i32", exactHint(4), (e, v) => e.i32(v), (d) => d.i32(), (s) => s.u32(), bytes(4));
26646
+ /** Signed 24-bit number. */
26647
+ const i24 = descriptor_Descriptor.withView("i24", exactHint(3), (e, v) => e.i24(v), (d) => d.i24(), (s) => s.u24(), bytes(3));
26648
+ /** Signed 16-bit number. */
26649
+ const i16 = descriptor_Descriptor.withView("i16", exactHint(2), (e, v) => e.i16(v), (d) => d.i16(), (s) => s.u16(), bytes(2));
26650
+ /** Signed 8-bit number. */
26651
+ const i8 = descriptor_Descriptor.new("i8", exactHint(1), (e, v) => e.i8(v), (d) => d.i8(), (s) => s.u8());
26652
+ /** 1-byte boolean value. */
26653
+ const bool = descriptor_Descriptor.new("bool", exactHint(1), (e, v) => e.bool(v), (d) => d.bool(), (s) => s.bool());
26654
+ /** Variable-length bytes blob. */
26655
+ const blob = descriptor_Descriptor.new("BytesBlob", { bytes: TYPICAL_SEQUENCE_LENGTH, isExact: false }, (e, v) => e.bytesBlob(v), (d) => d.bytesBlob(), (s) => s.bytesBlob());
26656
+ /** String encoded as variable-length bytes blob. */
26657
+ const string = descriptor_Descriptor.withView("string", { bytes: TYPICAL_SEQUENCE_LENGTH, isExact: false }, (e, v) => e.bytesBlob(bytes_BytesBlob.blobFrom(new TextEncoder().encode(v))), (d) => new TextDecoder("utf8", { fatal: true }).decode(d.bytesBlob().raw), (s) => s.bytesBlob(), blob);
26658
+ /** Variable-length bit vector. */
26659
+ const bitVecVarLen = descriptor_Descriptor.new("BitVec[?]", { bytes: TYPICAL_SEQUENCE_LENGTH >>> 3, isExact: false }, (e, v) => e.bitVecVarLen(v), (d) => d.bitVecVarLen(), (s) => s.bitVecVarLen());
26660
+ /** Fixed-length bit vector. */
26661
+ const bitVecFixLen = (bitLen) => descriptor_Descriptor.new(`BitVec[${bitLen}]`, exactHint(bitLen >>> 3), (e, v) => e.bitVecFixLen(v), (d) => d.bitVecFixLen(bitLen), (s) => s.bitVecFixLen(bitLen));
26662
+ /** Optionality wrapper for given type. */
26663
+ const optional = (type) => {
26664
+ const self = descriptor_Descriptor.new(`Optional<${type.name}>`, addSizeHints({ bytes: 1, isExact: false }, type.sizeHint), (e, v) => e.optional(type, v), (d) => d.optional(type), (s) => s.optional(type));
26665
+ if (hasUniqueView(type)) {
26666
+ return descriptor_Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, optional(type.View));
26667
+ }
26668
+ return self;
26669
+ };
26670
+ /** Variable-length sequence of given type. */
26671
+ const sequenceVarLen = (type, options = {
26672
+ minLength: 0,
26673
+ maxLength: 2 ** 32 - 1,
26674
+ }) => {
26675
+ const name = `Sequence<${type.name}>[?]`;
26676
+ const typicalLength = options.typicalLength ?? TYPICAL_SEQUENCE_LENGTH;
26677
+ return descriptor_Descriptor.withView(name, { bytes: typicalLength * type.sizeHint.bytes, isExact: false }, (e, v) => {
26678
+ validateLength(options, v.length, name);
26679
+ e.sequenceVarLen(type, v);
26680
+ }, (d) => {
26681
+ const len = d.varU32();
26682
+ validateLength(options, len, name);
26683
+ return d.sequenceFixLen(type, len);
26684
+ }, (s) => {
26685
+ const len = s.decoder.varU32();
26686
+ validateLength(options, len, name);
26687
+ return s.sequenceFixLen(type, len);
26688
+ }, sequenceViewVarLen(type, options));
26689
+ };
26690
+ /** Fixed-length sequence of given type. */
26691
+ const sequenceFixLen = (type, len) => descriptor_Descriptor.withView(`Sequence<${type.name}>[${len}]`, { bytes: len * type.sizeHint.bytes, isExact: type.sizeHint.isExact }, (e, v) => e.sequenceFixLen(type, v), (d) => d.sequenceFixLen(type, len), (s) => s.sequenceFixLen(type, len), sequenceViewFixLen(type, { fixedLength: len }));
26692
+ /** Small dictionary codec. */
26693
+ const dictionary = (key, value, { sortKeys, fixedLength, }) => {
26694
+ const self = descriptor_Descriptor.new(`Dictionary<${key.name}, ${value.name}>[${fixedLength ?? "?"}]`, {
26695
+ bytes: fixedLength !== undefined
26696
+ ? fixedLength * addSizeHints(key.sizeHint, value.sizeHint).bytes
26697
+ : TYPICAL_DICTIONARY_LENGTH * (addSizeHints(key.sizeHint, value.sizeHint).bytes ?? 0),
26698
+ isExact: fixedLength !== undefined ? key.sizeHint.isExact && value.sizeHint.isExact : false,
26699
+ }, (e, v) => {
26700
+ const data = Array.from(v.entries());
26701
+ data.sort((a, b) => sortKeys(a[0], b[0]));
26702
+ // length prefix
26703
+ if (fixedLength === undefined) {
26704
+ e.varU32(numbers_tryAsU32(data.length));
26705
+ }
26706
+ for (const [k, v] of data) {
26707
+ key.encode(e, k);
26708
+ value.encode(e, v);
26409
26709
  }
26410
- return self;
26411
- };
26412
- /** Custom encoding / decoding logic. */
26413
- codec.custom = ({ name, sizeHint = { bytes: 0, isExact: false }, }, encode, decode, skip) => descriptor_Descriptor.new(name, sizeHint, encode, decode, skip);
26414
- /** Choose a descriptor depending on the encoding/decoding context. */
26415
- codec.select = ({ name, sizeHint, }, chooser) => {
26416
- const Self = chooser(null);
26417
- return descriptor_Descriptor.withView(name, sizeHint, (e, x) => chooser(e.getContext()).encode(e, x), (d) => chooser(d.getContext()).decode(d), (s) => chooser(s.decoder.getContext()).skip(s), hasUniqueView(Self)
26418
- ? codec.select({
26419
- name: Self.View.name,
26420
- sizeHint: Self.View.sizeHint,
26421
- }, (ctx) => chooser(ctx).View)
26422
- : Self.View);
26423
- };
26424
- /**
26425
- * A descriptor for a more complex POJO.
26426
- *
26427
- * This descriptor is very similar to `Class`, but it DOES NOT maintain the
26428
- * prototype chain of the resulting object - we only care about the shape of
26429
- * the object here.
26430
- */
26431
- codec.object = (descriptors, name = "object", create = (o) => o) => {
26432
- return codec.Class({ name, create }, descriptors);
26433
- };
26434
- /**
26435
- * A descriptor for a more complex class type.
26436
- *
26437
- * The resulting descriptor is able to encode & decode all of the public fields of
26438
- * the class, given the map of descriptors for each one of them.
26439
- *
26440
- * The resulting decoded object will be an instance of given `Class` unlike simpler,
26441
- * shape-based `object` method.
26442
- */
26443
- codec.Class = (Class, descriptors) => {
26444
- // Calculate a size hint for this class.
26445
- let sizeHint = exactHint(0);
26446
- forEachDescriptor(descriptors, (_k, val) => {
26447
- sizeHint = addSizeHints(sizeHint, val.sizeHint);
26448
- });
26449
- const skipper = (s) => {
26450
- // optimized case for fixed size complex values.
26451
- if (sizeHint.isExact) {
26452
- return s.decoder.skip(sizeHint.bytes);
26710
+ }, (d) => {
26711
+ const map = new Map();
26712
+ const len = fixedLength ?? d.varU32();
26713
+ let prevKey = null;
26714
+ for (let i = 0; i < len; i += 1) {
26715
+ const k = key.decode(d);
26716
+ const v = value.decode(d);
26717
+ if (map.has(k)) {
26718
+ throw new Error(`Duplicate item in the dictionary encoding: "${k}"!`);
26453
26719
  }
26454
- forEachDescriptor(descriptors, (_key, descriptor) => {
26455
- descriptor.skip(s);
26456
- });
26457
- };
26458
- const view = objectView(Class, descriptors, sizeHint, skipper);
26459
- // and create the descriptor for the entire class.
26460
- return descriptor_Descriptor.withView(Class.name, sizeHint, (e, t) => {
26461
- forEachDescriptor(descriptors, (key, descriptor) => {
26462
- const value = t[key];
26463
- descriptor.encode(e, value);
26464
- });
26465
- }, (d) => {
26466
- const constructorParams = {};
26467
- forEachDescriptor(descriptors, (key, descriptor) => {
26468
- const value = descriptor.decode(d);
26469
- constructorParams[key] = value;
26470
- });
26471
- return Class.create(constructorParams);
26472
- }, skipper, view);
26720
+ if (prevKey !== null && sortKeys(prevKey, k) >= 0) {
26721
+ throw new Error(`The keys in dictionary encoding are not sorted "${prevKey}" >= "${k}"!`);
26722
+ }
26723
+ map.set(k, v);
26724
+ prevKey = k;
26725
+ }
26726
+ return map;
26727
+ }, (s) => {
26728
+ const len = fixedLength ?? s.decoder.varU32();
26729
+ s.sequenceFixLen(key, len);
26730
+ s.sequenceFixLen(value, len);
26731
+ });
26732
+ if (hasUniqueView(value)) {
26733
+ return descriptor_Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, dictionary(key, value.View, { sortKeys, fixedLength }));
26734
+ }
26735
+ return self;
26736
+ };
26737
+ /** Encoding of pair of two values. */
26738
+ const pair = (a, b) => {
26739
+ const self = descriptor_Descriptor.new(`Pair<${a.name}, ${b.name}>`, addSizeHints(a.sizeHint, b.sizeHint), (e, elem) => {
26740
+ a.encode(e, elem[0]);
26741
+ b.encode(e, elem[1]);
26742
+ }, (d) => {
26743
+ const aValue = a.decode(d);
26744
+ const bValue = b.decode(d);
26745
+ return [aValue, bValue];
26746
+ }, (s) => {
26747
+ a.skip(s);
26748
+ b.skip(s);
26749
+ });
26750
+ if (hasUniqueView(a) && hasUniqueView(b)) {
26751
+ return descriptor_Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, pair(a.View, b.View));
26752
+ }
26753
+ return self;
26754
+ };
26755
+ /** Custom encoding / decoding logic. */
26756
+ const custom = ({ name, sizeHint = { bytes: 0, isExact: false }, }, encode, decode, skip) => descriptor_Descriptor.new(name, sizeHint, encode, decode, skip);
26757
+ /** Choose a descriptor depending on the encoding/decoding context. */
26758
+ const descriptors_select = ({ name, sizeHint, }, chooser) => {
26759
+ const Self = chooser(null);
26760
+ return descriptor_Descriptor.withView(name, sizeHint, (e, x) => chooser(e.getContext()).encode(e, x), (d) => chooser(d.getContext()).decode(d), (s) => chooser(s.decoder.getContext()).skip(s), hasUniqueView(Self)
26761
+ ? descriptors_select({
26762
+ name: Self.View.name,
26763
+ sizeHint: Self.View.sizeHint,
26764
+ }, (ctx) => chooser(ctx).View)
26765
+ : Self.View);
26766
+ };
26767
+ /**
26768
+ * A descriptor for a more complex POJO.
26769
+ *
26770
+ * This descriptor is very similar to `Class`, but it DOES NOT maintain the
26771
+ * prototype chain of the resulting object - we only care about the shape of
26772
+ * the object here.
26773
+ */
26774
+ const object = (descriptors, name = "object", create = (o) => o) => {
26775
+ return Class({ name, create }, descriptors);
26776
+ };
26777
+ /**
26778
+ * A descriptor for a more complex class type.
26779
+ *
26780
+ * The resulting descriptor is able to encode & decode all of the public fields of
26781
+ * the class, given the map of descriptors for each one of them.
26782
+ *
26783
+ * The resulting decoded object will be an instance of given `Class` unlike simpler,
26784
+ * shape-based `object` method.
26785
+ */
26786
+ const Class = (Class, descriptors) => {
26787
+ // Calculate a size hint for this class.
26788
+ let sizeHint = exactHint(0);
26789
+ forEachDescriptor(descriptors, (_k, val) => {
26790
+ sizeHint = addSizeHints(sizeHint, val.sizeHint);
26791
+ });
26792
+ const skipper = (s) => {
26793
+ // optimized case for fixed size complex values.
26794
+ if (sizeHint.isExact) {
26795
+ return s.decoder.skip(sizeHint.bytes);
26796
+ }
26797
+ forEachDescriptor(descriptors, (_key, descriptor) => {
26798
+ descriptor.skip(s);
26799
+ });
26473
26800
  };
26474
- })(descriptors_codec || (descriptors_codec = {}));
26801
+ const view = objectView(Class, descriptors, sizeHint, skipper);
26802
+ // and create the descriptor for the entire class.
26803
+ return descriptor_Descriptor.withView(Class.name, sizeHint, (e, t) => {
26804
+ forEachDescriptor(descriptors, (key, descriptor) => {
26805
+ const value = t[key];
26806
+ descriptor.encode(e, value);
26807
+ });
26808
+ }, (d) => {
26809
+ const constructorParams = {};
26810
+ forEachDescriptor(descriptors, (key, descriptor) => {
26811
+ const value = descriptor.decode(d);
26812
+ constructorParams[key] = value;
26813
+ });
26814
+ return Class.create(constructorParams);
26815
+ }, skipper, view);
26816
+ };
26475
26817
  /** Typesafe iteration of every descriptor in the record object. */
26476
26818
  function forEachDescriptor(descriptors, f) {
26477
26819
  for (const key in descriptors) {
@@ -27978,9 +28320,438 @@ class ArrayView {
27978
28320
  }
27979
28321
  }
27980
28322
 
28323
+ ;// CONCATENATED MODULE: ./packages/core/collections/blob-dictionary.ts
28324
+
28325
+
28326
+ /** A map which uses byte blobs as keys */
28327
+ class BlobDictionary extends WithDebug {
28328
+ mapNodeThreshold;
28329
+ /**
28330
+ * The root node of the dictionary.
28331
+ *
28332
+ * This is the main internal data structure that organizes entries
28333
+ * in a tree-like fashion (array-based nodes up to `mapNodeThreshold`,
28334
+ * map-based nodes beyond it). All insertions, updates, and deletions
28335
+ * operate through this structure.
28336
+ */
28337
+ root = Node.withList();
28338
+ /**
28339
+ * Auxiliary map that stores references to the original keys and their values.
28340
+ *
28341
+ * - Overriding a value in the main structure does not replace the original key reference.
28342
+ * - Used for efficient iteration over `keys()`, `values()`, `entries()`, and computing `size`.
28343
+ */
28344
+ keyvals = new Map();
28345
+ /**
28346
+ * Protected constructor used internally by `BlobDictionary.new`
28347
+ * and `BlobDictionary.fromEntries`.
28348
+ *
28349
+ * This enforces controlled instantiation — users should create instances
28350
+ * through the provided static factory methods instead of calling the
28351
+ * constructor directly.
28352
+ *
28353
+ * @param mapNodeThreshold - The threshold that determines when the dictionary
28354
+ * switches from using an array-based (`ListChildren`) node to a map-based (`MapChildren`) node for storing entries.
28355
+ */
28356
+ constructor(mapNodeThreshold) {
28357
+ super();
28358
+ this.mapNodeThreshold = mapNodeThreshold;
28359
+ }
28360
+ /**
28361
+ * Returns the number of entries in the dictionary.
28362
+ *
28363
+ * The count is derived from the auxiliary `keyvals` map, which stores
28364
+ * all original key references and their associated values. This ensures
28365
+ * that the `size` reflects the actual number of entries, independent of
28366
+ * internal overrides in the main `root` structure.
28367
+ *
28368
+ * @returns The total number of entries in the dictionary.
28369
+ */
28370
+ get size() {
28371
+ return this.keyvals.size;
28372
+ }
28373
+ [TEST_COMPARE_USING]() {
28374
+ const vals = Array.from(this);
28375
+ vals.sort((a, b) => a[0].compare(b[0]).value);
28376
+ return vals;
28377
+ }
28378
+ /**
28379
+ * Creates an empty `BlobDictionary`.
28380
+ *
28381
+ * @param mapNodeThreshold - The threshold that determines when the dictionary
28382
+ * switches from using an array-based (`ListChildren`) node to a map-based (`MapChildren`) node for storing entries.
28383
+ * Defaults to `0`.
28384
+ *
28385
+ * @returns A new, empty `BlobDictionary` instance.
28386
+ */
28387
+ static new(mapNodeThreshold = 0) {
28388
+ return new BlobDictionary(mapNodeThreshold);
28389
+ }
28390
+ /**
28391
+ * Creates a new `BlobDictionary` initialized with the given entries.
28392
+ *
28393
+ * @param entries - An array of `[key, value]` pairs used to populate the dictionary.
28394
+ * @param mapNodeThreshold - The threshold that determines when the dictionary
28395
+ * switches from using an array-based (`ListChildren`) node to a map-based (`MapChildren`) node for storing entries.
28396
+ * Defaults to `0`.
28397
+ *
28398
+ * @returns A new `BlobDictionary` containing the provided entries.
28399
+ */
28400
+ static fromEntries(entries, mapNodeThreshold) {
28401
+ const dict = BlobDictionary.new(mapNodeThreshold);
28402
+ for (const [key, value] of entries) {
28403
+ dict.set(key, value);
28404
+ }
28405
+ return dict;
28406
+ }
28407
+ /**
28408
+ * Internal helper that inserts, updates or deletes an entry in the dictionary.
28409
+ *
28410
+ * Behaviour details:
28411
+ * - Passing `undefined` as `value` indicates a deletion. (E.g. `delete` uses `internalSet(key, undefined)`.)
28412
+ * - When an add (new entry) or a delete actually changes the structure, the method returns the affected leaf node.
28413
+ * - When the call only overrides an existing value (no structural add/delete), the method returns `null`.
28414
+ *
28415
+ * This method is intended for internal use by the dictionary implementation and allows `undefined` as a
28416
+ * sentinel value to signal removals.
28417
+ *
28418
+ * @param key - The key to insert, update or remove.
28419
+ * @param value - The value to associate with the key, or `undefined` to remove the key.
28420
+ * @returns The leaf node created or removed on add/delete, or `null` if the operation only overwrote an existing value.
28421
+ */
28422
+ internalSet(key, value) {
28423
+ let node = this.root;
28424
+ const keyChunkGenerator = key.chunks(CHUNK_SIZE);
28425
+ let depth = 0;
28426
+ for (;;) {
28427
+ const maybeKeyChunk = keyChunkGenerator.next().value;
28428
+ if (maybeKeyChunk === undefined) {
28429
+ if (value === undefined) {
28430
+ return node.remove(key);
28431
+ }
28432
+ return node.set(key, value);
28433
+ }
28434
+ const keyChunk = opaque_asOpaqueType(maybeKeyChunk);
28435
+ if (node.children instanceof ListChildren) {
28436
+ const subkey = bytes_BytesBlob.blobFrom(key.raw.subarray(CHUNK_SIZE * depth));
28437
+ const leaf = value !== undefined ? node.children.insert(subkey, { key, value }) : node.children.remove(subkey);
28438
+ if (subkey.length > CHUNK_SIZE && node.children.children.length > this.mapNodeThreshold) {
28439
+ node.convertListChildrenToMap();
28440
+ }
28441
+ return leaf;
28442
+ }
28443
+ depth += 1;
28444
+ const children = node.children;
28445
+ if (children instanceof ListChildren) {
28446
+ throw new Error("We handle list node earlier. If we fall through, we know it's for the `Map` case.");
28447
+ }
28448
+ if (children instanceof MapChildren) {
28449
+ const maybeNode = children.getChild(keyChunk);
28450
+ if (maybeNode !== undefined) {
28451
+ // simply go one level deeper
28452
+ node = maybeNode;
28453
+ }
28454
+ else {
28455
+ // we are trying to remove an item, but it does not exist
28456
+ if (value === undefined) {
28457
+ return null;
28458
+ }
28459
+ // no more child nodes, we insert a new one.
28460
+ const newNode = Node.withList();
28461
+ children.setChild(keyChunk, newNode);
28462
+ node = newNode;
28463
+ }
28464
+ continue;
28465
+ }
28466
+ assertNever(children);
28467
+ }
28468
+ }
28469
+ /**
28470
+ * Adds a new entry to the dictionary or updates the value of an existing key.
28471
+ *
28472
+ * If an entry with the given key already exists, its value is replaced
28473
+ * with the new one.
28474
+ *
28475
+ * @param key - The key to add or update in the dictionary.
28476
+ * @param value - The value to associate with the specified key.
28477
+ * @returns Nothing (`void`).
28478
+ */
28479
+ set(key, value) {
28480
+ const leaf = this.internalSet(key, value);
28481
+ if (leaf !== null) {
28482
+ this.keyvals.set(leaf.key, leaf);
28483
+ }
28484
+ }
28485
+ /**
28486
+ * Retrieves the value associated with the given key from the dictionary.
28487
+ *
28488
+ * If the key does not exist, this method returns `undefined`.
28489
+ *
28490
+ * @param key - The key whose associated value should be retrieved.
28491
+ * @returns The value associated with the specified key, or `undefined` if the key is not present.
28492
+ */
28493
+ get(key) {
28494
+ let node = this.root;
28495
+ const pathChunksGenerator = key.chunks(CHUNK_SIZE);
28496
+ let depth = 0;
28497
+ while (node !== undefined) {
28498
+ const maybePathChunk = pathChunksGenerator.next().value;
28499
+ if (node.children instanceof ListChildren) {
28500
+ const subkey = bytes_BytesBlob.blobFrom(key.raw.subarray(depth * CHUNK_SIZE));
28501
+ const child = node.children.find(subkey);
28502
+ if (child !== null) {
28503
+ return child.value;
28504
+ }
28505
+ }
28506
+ if (maybePathChunk === undefined) {
28507
+ return node.getLeaf()?.value;
28508
+ }
28509
+ if (node.children instanceof MapChildren) {
28510
+ const pathChunk = opaque_asOpaqueType(maybePathChunk);
28511
+ node = node.children.getChild(pathChunk);
28512
+ depth += 1;
28513
+ }
28514
+ }
28515
+ return undefined;
28516
+ }
28517
+ /**
28518
+ * Checks whether the dictionary contains an entry for the given key.
28519
+ *
28520
+ * ⚠️ **Note:** Avoid using `has(...)` together with `get(...)` in a pattern like this:
28521
+ *
28522
+ * ```ts
28523
+ * if (dict.has(key)) {
28524
+ * const value = dict.get(key);
28525
+ * ...
28526
+ * }
28527
+ * ```
28528
+ *
28529
+ * This approach performs two lookups for the same key.
28530
+ *
28531
+ * Instead, prefer the following pattern, which retrieves the value once:
28532
+ *
28533
+ * ```ts
28534
+ * const value = dict.get(key);
28535
+ * if (value !== undefined) {
28536
+ * ...
28537
+ * }
28538
+ * ```
28539
+ *
28540
+ * @param key - The key to check for.
28541
+ * @returns `true` if the dictionary contains an entry for the given key, otherwise `false`.
28542
+ */
28543
+ has(key) {
28544
+ return this.get(key) !== undefined;
28545
+ }
28546
+ /**
28547
+ * Removes an entry with the specified key from the dictionary.
28548
+ *
28549
+ * Internally, this calls {@link internalSet} with `undefined` to mark the entry as deleted.
28550
+ *
28551
+ * @param key - The key of the entry to remove.
28552
+ * @returns `true` if an entry was removed (i.e. the key existed), otherwise `false`.
28553
+ */
28554
+ delete(key) {
28555
+ const leaf = this.internalSet(key, undefined);
28556
+ if (leaf !== null) {
28557
+ this.keyvals.delete(leaf.key);
28558
+ return true;
28559
+ }
28560
+ return false;
28561
+ }
28562
+ /**
28563
+ * Returns an iterator over the keys in the dictionary.
28564
+ *
28565
+ * The iterator yields each key in insertion order.
28566
+ *
28567
+ * @returns An iterator over all keys in the dictionary.
28568
+ */
28569
+ keys() {
28570
+ return this.keyvals.keys();
28571
+ }
28572
+ /**
28573
+ * Returns an iterator over the values in the dictionary.
28574
+ *
28575
+ * The iterator yields each value in insertion order.
28576
+ *
28577
+ * @returns An iterator over all values in the dictionary.
28578
+ */
28579
+ *values() {
28580
+ for (const leaf of this.keyvals.values()) {
28581
+ yield leaf.value;
28582
+ }
28583
+ }
28584
+ /**
28585
+ * Returns an iterator over the `[key, value]` pairs in the dictionary.
28586
+ *
28587
+ * The iterator yields entries in insertion order.
28588
+ *
28589
+ * @returns An iterator over `[key, value]` tuples for each entry in the dictionary.
28590
+ */
28591
+ *entries() {
28592
+ for (const leaf of this.keyvals.values()) {
28593
+ yield [leaf.key, leaf.value];
28594
+ }
28595
+ }
28596
+ /**
28597
+ * Default iterator for the dictionary.
28598
+ *
28599
+ * Equivalent to calling {@link entries}.
28600
+ * Enables iteration with `for...of`:
28601
+ *
28602
+ * ```ts
28603
+ * for (const [key, value] of dict) {
28604
+ * ...
28605
+ * }
28606
+ * ```
28607
+ *
28608
+ * @returns An iterator over `[key, value]` pairs.
28609
+ */
28610
+ [Symbol.iterator]() {
28611
+ return this.entries();
28612
+ }
28613
+ /**
28614
+ * Creates a new sorted array of values, ordered by their corresponding keys.
28615
+ *
28616
+ * Iterates over all entries in the dictionary and sorts them according
28617
+ * to the provided comparator function applied to the keys.
28618
+ *
28619
+ * @param comparator - A comparator function that can compare two keys.
28620
+ *
28621
+ * @returns A new array containing all values from the dictionary,
28622
+ * sorted according to their keys.
28623
+ */
28624
+ toSortedArray(comparator) {
28625
+ const vals = Array.from(this);
28626
+ vals.sort((a, b) => comparator(a[0], b[0]).value);
28627
+ return vals.map((x) => x[1]);
28628
+ }
28629
+ }
28630
+ const CHUNK_SIZE = 6;
28631
+ /**
28632
+ * A function to transform a bytes chunk (up to 6 bytes into U48 number)
28633
+ *
28634
+ * Note that it uses 3 additional bits to store length(`value * 8 + len;`),
28635
+ * It is needed to distinguish shorter chunks that have 0s at the end, for example: [1, 2] and [1, 2, 0]
28636
+ * */
28637
+ function bytesAsU48(bytes) {
28638
+ const len = bytes.length;
28639
+ debug_check `${len <= CHUNK_SIZE} Length has to be <= ${CHUNK_SIZE}, got: ${len}`;
28640
+ let value = bytes[3] | (bytes[2] << 8) | (bytes[1] << 16) | (bytes[0] << 24);
28641
+ for (let i = 4; i < bytes.length; i++) {
28642
+ value = value * 256 + bytes[i];
28643
+ }
28644
+ return value * 8 + len;
28645
+ }
28646
+ class Node {
28647
+ leaf;
28648
+ children;
28649
+ convertListChildrenToMap() {
28650
+ if (!(this.children instanceof ListChildren)) {
28651
+ return;
28652
+ }
28653
+ this.children = MapChildren.fromListNode(this.children);
28654
+ }
28655
+ static withList() {
28656
+ return new Node(undefined, ListChildren.new());
28657
+ }
28658
+ static withMap() {
28659
+ return new Node(undefined, MapChildren.new());
28660
+ }
28661
+ constructor(leaf, children) {
28662
+ this.leaf = leaf;
28663
+ this.children = children;
28664
+ }
28665
+ getLeaf() {
28666
+ return this.leaf;
28667
+ }
28668
+ remove(_key) {
28669
+ if (this.leaf === undefined) {
28670
+ return null;
28671
+ }
28672
+ const removedLeaf = this.leaf;
28673
+ this.leaf = undefined;
28674
+ return removedLeaf;
28675
+ }
28676
+ set(key, value) {
28677
+ if (this.leaf === undefined) {
28678
+ this.leaf = { key, value };
28679
+ return this.leaf;
28680
+ }
28681
+ this.leaf.value = value;
28682
+ return null;
28683
+ }
28684
+ }
28685
+ class ListChildren {
28686
+ children = [];
28687
+ constructor() { }
28688
+ find(key) {
28689
+ const result = this.children.find((item) => item[0].isEqualTo(key));
28690
+ if (result !== undefined) {
28691
+ return result[1];
28692
+ }
28693
+ return null;
28694
+ }
28695
+ remove(key) {
28696
+ const existingIndex = this.children.findIndex((item) => item[0].isEqualTo(key));
28697
+ if (existingIndex >= 0) {
28698
+ const ret = this.children.splice(existingIndex, 1);
28699
+ return ret[0][1];
28700
+ }
28701
+ return null;
28702
+ }
28703
+ insert(key, leaf) {
28704
+ const existingIndex = this.children.findIndex((item) => item[0].isEqualTo(key));
28705
+ if (existingIndex >= 0) {
28706
+ const existing = this.children[existingIndex];
28707
+ existing[1].value = leaf.value;
28708
+ return null;
28709
+ }
28710
+ this.children.push([key, leaf]);
28711
+ return leaf;
28712
+ }
28713
+ static new() {
28714
+ return new ListChildren();
28715
+ }
28716
+ }
28717
+ class MapChildren {
28718
+ children = new Map();
28719
+ constructor() { }
28720
+ static new() {
28721
+ return new MapChildren();
28722
+ }
28723
+ static fromListNode(node) {
28724
+ const mapNode = new MapChildren();
28725
+ for (const [key, leaf] of node.children) {
28726
+ const currentKeyChunk = opaque_asOpaqueType(bytes_BytesBlob.blobFrom(key.raw.subarray(0, CHUNK_SIZE)));
28727
+ const subKey = bytes_BytesBlob.blobFrom(key.raw.subarray(CHUNK_SIZE));
28728
+ let child = mapNode.getChild(currentKeyChunk);
28729
+ if (child === undefined) {
28730
+ child = Node.withList();
28731
+ mapNode.setChild(currentKeyChunk, child);
28732
+ }
28733
+ const children = child.children;
28734
+ children.insert(subKey, leaf);
28735
+ }
28736
+ return mapNode;
28737
+ }
28738
+ getChild(keyChunk) {
28739
+ const chunkAsNumber = bytesAsU48(keyChunk.raw);
28740
+ return this.children.get(chunkAsNumber);
28741
+ }
28742
+ setChild(keyChunk, node) {
28743
+ const chunkAsNumber = bytesAsU48(keyChunk.raw);
28744
+ this.children.set(chunkAsNumber, node);
28745
+ }
28746
+ }
28747
+
27981
28748
  ;// CONCATENATED MODULE: ./packages/core/collections/hash-dictionary.ts
27982
- /** A map which uses hashes as keys. */
27983
- class hash_dictionary_HashDictionary {
28749
+ /**
28750
+ * A map which uses hashes as keys.
28751
+ *
28752
+ * @deprecated
28753
+ * */
28754
+ class StringHashDictionary {
27984
28755
  // TODO [ToDr] [crit] We can't use `TrieHash` directly in the map,
27985
28756
  // because of the way it's being compared. Hence having `string` here.
27986
28757
  // This has to be benchmarked and re-written to a custom map most likely.
@@ -28046,6 +28817,17 @@ class hash_dictionary_HashDictionary {
28046
28817
  }
28047
28818
  }
28048
28819
 
28820
+ /**
28821
+ * A value that indicates when `BlobDictionary` transforms Array nodes into Map nodes.
28822
+ * In practice, it doesn't matter much because, in real life, arrays in this structure usually have a length close to 1.
28823
+ */
28824
+ const BLOB_DICTIONARY_THRESHOLD = 5;
28825
+ class hash_dictionary_HashDictionary extends BlobDictionary {
28826
+ constructor() {
28827
+ super(BLOB_DICTIONARY_THRESHOLD);
28828
+ }
28829
+ }
28830
+
28049
28831
  ;// CONCATENATED MODULE: ./packages/core/collections/hash-set.ts
28050
28832
 
28051
28833
  /** A set specialized for storing hashes. */
@@ -28510,6 +29292,18 @@ class SortedSet extends (/* unused pure expression or super */ null && (SortedAr
28510
29292
 
28511
29293
 
28512
29294
 
29295
+ function getTruncatedKey(key) {
29296
+ // Always return exactly TRUNCATED_HASH_SIZE bytes.
29297
+ if (key.length === TRUNCATED_HASH_SIZE) {
29298
+ return key;
29299
+ }
29300
+ return bytes_Bytes.fromBlob(key.raw.subarray(0, TRUNCATED_HASH_SIZE), TRUNCATED_HASH_SIZE);
29301
+ }
29302
+ /**
29303
+ * A value that indicates when `BlobDictionary` transforms Array nodes into Map nodes.
29304
+ * In practice, it doesn't matter much because, in real life, arrays in this structure usually have a length close to 1.
29305
+ */
29306
+ const truncated_hash_dictionary_BLOB_DICTIONARY_THRESHOLD = 5;
28513
29307
  /**
28514
29308
  * A collection of hash-based keys (likely `StateKey`s) which ignores
28515
29309
  * differences on the last byte.
@@ -28522,48 +29316,37 @@ class TruncatedHashDictionary {
28522
29316
  * Each key will be copied and have the last byte replace with a 0.
28523
29317
  */
28524
29318
  static fromEntries(entries) {
28525
- /** Copy key bytes of an entry and replace the last one with 0. */
28526
- const mapped = Array.from(entries).map(([key, value]) => {
28527
- const newKey = bytes_Bytes.zero(hash_HASH_SIZE).asOpaque();
28528
- newKey.raw.set(key.raw.subarray(0, TRUNCATED_HASH_SIZE));
28529
- return [newKey, value];
28530
- });
28531
- return new TruncatedHashDictionary(hash_dictionary_HashDictionary.fromEntries(mapped));
29319
+ return new TruncatedHashDictionary(BlobDictionary.fromEntries(Array.from(entries).map(([key, value]) => [getTruncatedKey(key), value]), truncated_hash_dictionary_BLOB_DICTIONARY_THRESHOLD));
28532
29320
  }
28533
- /** A truncated key which we re-use to query the dictionary. */
28534
- truncatedKey = bytes_Bytes.zero(hash_HASH_SIZE).asOpaque();
28535
29321
  constructor(dict) {
28536
29322
  this.dict = dict;
28537
29323
  }
28538
29324
  [TEST_COMPARE_USING]() {
28539
- return this.dict;
29325
+ return Array.from(this.dict);
28540
29326
  }
28541
29327
  /** Return number of items in the dictionary. */
28542
29328
  get size() {
28543
29329
  return this.dict.size;
28544
29330
  }
28545
29331
  /** Retrieve a value that matches the key on `TRUNCATED_HASH_SIZE`. */
28546
- get(fullKey) {
28547
- this.truncatedKey.raw.set(fullKey.raw.subarray(0, TRUNCATED_HASH_SIZE));
28548
- return this.dict.get(this.truncatedKey);
29332
+ get(key) {
29333
+ const truncatedKey = getTruncatedKey(key);
29334
+ return this.dict.get(truncatedKey);
28549
29335
  }
28550
29336
  /** Return true if the key is present in the dictionary */
28551
- has(fullKey) {
28552
- this.truncatedKey.raw.set(fullKey.raw.subarray(0, TRUNCATED_HASH_SIZE));
28553
- return this.dict.has(this.truncatedKey);
29337
+ has(key) {
29338
+ const truncatedKey = getTruncatedKey(key);
29339
+ return this.dict.has(truncatedKey);
28554
29340
  }
28555
29341
  /** Set or update a value that matches the key on `TRUNCATED_HASH_SIZE`. */
28556
- set(fullKey, value) {
28557
- // NOTE we can't use the the shared key here, since the collection will
28558
- // store the key for us, hence the copy.
28559
- const key = bytes_Bytes.zero(hash_HASH_SIZE);
28560
- key.raw.set(fullKey.raw.subarray(0, TRUNCATED_HASH_SIZE));
28561
- this.dict.set(key.asOpaque(), value);
29342
+ set(key, value) {
29343
+ const truncatedKey = getTruncatedKey(key);
29344
+ this.dict.set(truncatedKey, value);
28562
29345
  }
28563
29346
  /** Remove a value that matches the key on `TRUNCATED_HASH_SIZE`. */
28564
- delete(fullKey) {
28565
- this.truncatedKey.raw.set(fullKey.raw.subarray(0, TRUNCATED_HASH_SIZE));
28566
- this.dict.delete(this.truncatedKey);
29347
+ delete(key) {
29348
+ const truncatedKey = getTruncatedKey(key);
29349
+ this.dict.delete(truncatedKey);
28567
29350
  }
28568
29351
  /** Iterator over values of the dictionary. */
28569
29352
  values() {
@@ -28571,9 +29354,7 @@ class TruncatedHashDictionary {
28571
29354
  }
28572
29355
  /** Iterator over entries of the dictionary (with truncated keys) */
28573
29356
  *entries() {
28574
- for (const [key, value] of this.dict.entries()) {
28575
- yield [bytes_Bytes.fromBlob(key.raw.subarray(0, TRUNCATED_HASH_SIZE), TRUNCATED_HASH_SIZE).asOpaque(), value];
28576
- }
29357
+ yield* this.dict.entries();
28577
29358
  }
28578
29359
  [Symbol.iterator]() {
28579
29360
  return this.entries();
@@ -28590,6 +29371,7 @@ class TruncatedHashDictionary {
28590
29371
 
28591
29372
 
28592
29373
 
29374
+
28593
29375
  ;// CONCATENATED MODULE: ./packages/jam/config/chain-spec.ts
28594
29376
 
28595
29377
 
@@ -28774,7 +29556,7 @@ var PvmBackend;
28774
29556
 
28775
29557
 
28776
29558
 
28777
- ;// CONCATENATED MODULE: ./packages/jam/block/codec.ts
29559
+ ;// CONCATENATED MODULE: ./packages/jam/block/codec-utils.ts
28778
29560
 
28779
29561
 
28780
29562
 
@@ -28789,7 +29571,7 @@ function codecWithContext(chooser) {
28789
29571
  const defaultContext = fullChainSpec;
28790
29572
  const { name, sizeHint } = chooser(defaultContext);
28791
29573
  const cache = new Map();
28792
- return descriptors_codec.select({
29574
+ return descriptors_select({
28793
29575
  name,
28794
29576
  sizeHint: { bytes: sizeHint.bytes, isExact: false },
28795
29577
  }, (context) => {
@@ -28816,9 +29598,9 @@ function codecWithContext(chooser) {
28816
29598
  /** Codec for a known-size array with length validation. */
28817
29599
  const codecKnownSizeArray = (val, options, _id) => {
28818
29600
  if ("fixedLength" in options) {
28819
- return readonlyArray(descriptors_codec.sequenceFixLen(val, options.fixedLength)).convert(seeThrough, sized_array_asKnownSize);
29601
+ return readonlyArray(sequenceFixLen(val, options.fixedLength)).convert(seeThrough, sized_array_asKnownSize);
28820
29602
  }
28821
- return readonlyArray(descriptors_codec.sequenceVarLen(val, options)).convert(seeThrough, sized_array_asKnownSize);
29603
+ return readonlyArray(sequenceVarLen(val, options)).convert(seeThrough, sized_array_asKnownSize);
28822
29604
  };
28823
29605
  /** Codec for a fixed-size array with length validation. */
28824
29606
  const codecFixedSizeArray = (val, len) => {
@@ -28836,7 +29618,7 @@ const codecFixedSizeArray = (val, len) => {
28836
29618
  });
28837
29619
  };
28838
29620
  /** Codec for a hash-dictionary. */
28839
- const codecHashDictionary = (value, extractKey, { typicalLength = TYPICAL_DICTIONARY_LENGTH, compare = (a, b) => extractKey(a).compare(extractKey(b)), } = {}) => {
29621
+ const codecHashDictionary = (value, extractKey, { typicalLength = codec.TYPICAL_DICTIONARY_LENGTH, compare = (a, b) => extractKey(a).compare(extractKey(b)), } = {}) => {
28840
29622
  return Descriptor.new(`HashDictionary<${value.name}>[?]`, {
28841
29623
  bytes: typicalLength * value.sizeHint.bytes,
28842
29624
  isExact: false,
@@ -28888,13 +29670,13 @@ class assurances_AvailabilityAssurance extends WithDebug {
28888
29670
  bitfield;
28889
29671
  validatorIndex;
28890
29672
  signature;
28891
- static Codec = descriptors_codec.Class(assurances_AvailabilityAssurance, {
28892
- anchor: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29673
+ static Codec = Class(assurances_AvailabilityAssurance, {
29674
+ anchor: bytes(hash_HASH_SIZE).asOpaque(),
28893
29675
  bitfield: codecWithContext((context) => {
28894
- return descriptors_codec.bitVecFixLen(context.coresCount);
29676
+ return bitVecFixLen(context.coresCount);
28895
29677
  }),
28896
- validatorIndex: descriptors_codec.u16.asOpaque(),
28897
- signature: descriptors_codec.bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
29678
+ validatorIndex: u16.asOpaque(),
29679
+ signature: bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
28898
29680
  });
28899
29681
  static create({ anchor, bitfield, validatorIndex, signature }) {
28900
29682
  return new assurances_AvailabilityAssurance(anchor, bitfield, validatorIndex, signature);
@@ -29186,10 +29968,10 @@ function tryAsTicketAttempt(x) {
29186
29968
  class SignedTicket extends WithDebug {
29187
29969
  attempt;
29188
29970
  signature;
29189
- static Codec = descriptors_codec.Class(SignedTicket, {
29971
+ static Codec = Class(SignedTicket, {
29190
29972
  // TODO [ToDr] we should verify that attempt is either 0|1|2.
29191
- attempt: descriptors_codec.u8.asOpaque(),
29192
- signature: descriptors_codec.bytes(BANDERSNATCH_PROOF_BYTES).asOpaque(),
29973
+ attempt: u8.asOpaque(),
29974
+ signature: bytes(BANDERSNATCH_PROOF_BYTES).asOpaque(),
29193
29975
  });
29194
29976
  static create({ attempt, signature }) {
29195
29977
  return new SignedTicket(attempt, signature);
@@ -29208,10 +29990,10 @@ class SignedTicket extends WithDebug {
29208
29990
  class Ticket extends WithDebug {
29209
29991
  id;
29210
29992
  attempt;
29211
- static Codec = descriptors_codec.Class(Ticket, {
29212
- id: descriptors_codec.bytes(hash_HASH_SIZE),
29993
+ static Codec = Class(Ticket, {
29994
+ id: bytes(hash_HASH_SIZE),
29213
29995
  // TODO [ToDr] we should verify that attempt is either 0|1|2.
29214
- attempt: descriptors_codec.u8.asOpaque(),
29996
+ attempt: u8.asOpaque(),
29215
29997
  });
29216
29998
  static create({ id, attempt }) {
29217
29999
  return new Ticket(id, attempt);
@@ -29357,11 +30139,11 @@ class Fault extends WithDebug {
29357
30139
  wasConsideredValid;
29358
30140
  key;
29359
30141
  signature;
29360
- static Codec = descriptors_codec.Class(Fault, {
29361
- workReportHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29362
- wasConsideredValid: descriptors_codec.bool,
29363
- key: descriptors_codec.bytes(ED25519_KEY_BYTES).asOpaque(),
29364
- signature: descriptors_codec.bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
30142
+ static Codec = Class(Fault, {
30143
+ workReportHash: bytes(hash_HASH_SIZE).asOpaque(),
30144
+ wasConsideredValid: bool,
30145
+ key: bytes(ED25519_KEY_BYTES).asOpaque(),
30146
+ signature: bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
29365
30147
  });
29366
30148
  static create({ workReportHash, wasConsideredValid, key, signature }) {
29367
30149
  return new Fault(workReportHash, wasConsideredValid, key, signature);
@@ -29389,10 +30171,10 @@ class Culprit extends WithDebug {
29389
30171
  workReportHash;
29390
30172
  key;
29391
30173
  signature;
29392
- static Codec = descriptors_codec.Class(Culprit, {
29393
- workReportHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29394
- key: descriptors_codec.bytes(ED25519_KEY_BYTES).asOpaque(),
29395
- signature: descriptors_codec.bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
30174
+ static Codec = Class(Culprit, {
30175
+ workReportHash: bytes(hash_HASH_SIZE).asOpaque(),
30176
+ key: bytes(ED25519_KEY_BYTES).asOpaque(),
30177
+ signature: bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
29396
30178
  });
29397
30179
  static create({ workReportHash, key, signature }) {
29398
30180
  return new Culprit(workReportHash, key, signature);
@@ -29417,10 +30199,10 @@ class Judgement extends WithDebug {
29417
30199
  isWorkReportValid;
29418
30200
  index;
29419
30201
  signature;
29420
- static Codec = descriptors_codec.Class(Judgement, {
29421
- isWorkReportValid: descriptors_codec.bool,
29422
- index: descriptors_codec.u16.asOpaque(),
29423
- signature: descriptors_codec.bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
30202
+ static Codec = Class(Judgement, {
30203
+ isWorkReportValid: bool,
30204
+ index: u16.asOpaque(),
30205
+ signature: bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
29424
30206
  });
29425
30207
  static create({ isWorkReportValid, index, signature }) {
29426
30208
  return new Judgement(isWorkReportValid, index, signature);
@@ -29449,11 +30231,12 @@ class Verdict extends WithDebug {
29449
30231
  workReportHash;
29450
30232
  votesEpoch;
29451
30233
  votes;
29452
- static Codec = descriptors_codec.Class(Verdict, {
29453
- workReportHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29454
- votesEpoch: descriptors_codec.u32.asOpaque(),
30234
+ static Codec = Class(Verdict, {
30235
+ workReportHash: bytes(hash_HASH_SIZE).asOpaque(),
30236
+ votesEpoch: u32.asOpaque(),
29455
30237
  votes: codecWithContext((context) => {
29456
- return readonlyArray(descriptors_codec.sequenceFixLen(Judgement.Codec, context.validatorsSuperMajority)).convert(seeThrough, sized_array_asKnownSize);
30238
+ return readonlyArray(sequenceFixLen(Judgement.Codec, context.validatorsSuperMajority))
30239
+ .convert(seeThrough, sized_array_asKnownSize);
29457
30240
  }),
29458
30241
  });
29459
30242
  static create({ workReportHash, votesEpoch, votes }) {
@@ -29494,10 +30277,10 @@ class DisputesExtrinsic extends WithDebug {
29494
30277
  verdicts;
29495
30278
  culprits;
29496
30279
  faults;
29497
- static Codec = descriptors_codec.Class(DisputesExtrinsic, {
29498
- verdicts: descriptors_codec.sequenceVarLen(Verdict.Codec),
29499
- culprits: descriptors_codec.sequenceVarLen(Culprit.Codec),
29500
- faults: descriptors_codec.sequenceVarLen(Fault.Codec),
30280
+ static Codec = Class(DisputesExtrinsic, {
30281
+ verdicts: sequenceVarLen(Verdict.Codec),
30282
+ culprits: sequenceVarLen(Culprit.Codec),
30283
+ faults: sequenceVarLen(Fault.Codec),
29501
30284
  });
29502
30285
  static create({ verdicts, culprits, faults }) {
29503
30286
  return new DisputesExtrinsic(verdicts, culprits, faults);
@@ -29543,9 +30326,9 @@ class DisputesExtrinsic extends WithDebug {
29543
30326
  class WorkPackageInfo extends WithDebug {
29544
30327
  workPackageHash;
29545
30328
  segmentTreeRoot;
29546
- static Codec = descriptors_codec.Class(WorkPackageInfo, {
29547
- workPackageHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29548
- segmentTreeRoot: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30329
+ static Codec = Class(WorkPackageInfo, {
30330
+ workPackageHash: bytes(hash_HASH_SIZE).asOpaque(),
30331
+ segmentTreeRoot: bytes(hash_HASH_SIZE).asOpaque(),
29549
30332
  });
29550
30333
  constructor(
29551
30334
  /** Hash of the described work package. */
@@ -29573,13 +30356,13 @@ class RefineContext extends WithDebug {
29573
30356
  lookupAnchor;
29574
30357
  lookupAnchorSlot;
29575
30358
  prerequisites;
29576
- static Codec = descriptors_codec.Class(RefineContext, {
29577
- anchor: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29578
- stateRoot: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29579
- beefyRoot: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29580
- lookupAnchor: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29581
- lookupAnchorSlot: descriptors_codec.u32.asOpaque(),
29582
- prerequisites: descriptors_codec.sequenceVarLen(descriptors_codec.bytes(hash_HASH_SIZE).asOpaque()),
30359
+ static Codec = Class(RefineContext, {
30360
+ anchor: bytes(hash_HASH_SIZE).asOpaque(),
30361
+ stateRoot: bytes(hash_HASH_SIZE).asOpaque(),
30362
+ beefyRoot: bytes(hash_HASH_SIZE).asOpaque(),
30363
+ lookupAnchor: bytes(hash_HASH_SIZE).asOpaque(),
30364
+ lookupAnchorSlot: u32.asOpaque(),
30365
+ prerequisites: sequenceVarLen(bytes(hash_HASH_SIZE).asOpaque()),
29583
30366
  });
29584
30367
  static create({ anchor, stateRoot, beefyRoot, lookupAnchor, lookupAnchorSlot, prerequisites, }) {
29585
30368
  return new RefineContext(anchor, stateRoot, beefyRoot, lookupAnchor, lookupAnchorSlot, prerequisites);
@@ -29636,9 +30419,9 @@ const tryAsSegmentIndex = (v) => asOpaqueType(tryAsU16(v));
29636
30419
  class ImportSpec extends WithDebug {
29637
30420
  treeRoot;
29638
30421
  index;
29639
- static Codec = descriptors_codec.Class(ImportSpec, {
29640
- treeRoot: descriptors_codec.bytes(hash_HASH_SIZE),
29641
- index: descriptors_codec.u16.asOpaque(),
30422
+ static Codec = Class(ImportSpec, {
30423
+ treeRoot: bytes(hash_HASH_SIZE),
30424
+ index: u16.asOpaque(),
29642
30425
  });
29643
30426
  static create({ treeRoot, index }) {
29644
30427
  return new ImportSpec(treeRoot, index);
@@ -29660,9 +30443,9 @@ class ImportSpec extends WithDebug {
29660
30443
  class WorkItemExtrinsicSpec extends WithDebug {
29661
30444
  hash;
29662
30445
  len;
29663
- static Codec = descriptors_codec.Class(WorkItemExtrinsicSpec, {
29664
- hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29665
- len: descriptors_codec.u32,
30446
+ static Codec = Class(WorkItemExtrinsicSpec, {
30447
+ hash: bytes(hash_HASH_SIZE).asOpaque(),
30448
+ len: u32,
29666
30449
  });
29667
30450
  static create({ hash, len }) {
29668
30451
  return new WorkItemExtrinsicSpec(hash, len);
@@ -29723,33 +30506,33 @@ class WorkItem extends WithDebug {
29723
30506
  extrinsic;
29724
30507
  exportCount;
29725
30508
  static Codec = Compatibility.isGreaterOrEqual(GpVersion.V0_7_0)
29726
- ? descriptors_codec.Class(WorkItem, {
29727
- service: descriptors_codec.u32.asOpaque(),
29728
- codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29729
- refineGasLimit: descriptors_codec.u64.asOpaque(),
29730
- accumulateGasLimit: descriptors_codec.u64.asOpaque(),
29731
- exportCount: descriptors_codec.u16,
29732
- payload: descriptors_codec.blob,
30509
+ ? Class(WorkItem, {
30510
+ service: u32.asOpaque(),
30511
+ codeHash: bytes(hash_HASH_SIZE).asOpaque(),
30512
+ refineGasLimit: u64.asOpaque(),
30513
+ accumulateGasLimit: u64.asOpaque(),
30514
+ exportCount: u16,
30515
+ payload: blob,
29733
30516
  importSegments: codecKnownSizeArray(ImportSpec.Codec, {
29734
30517
  minLength: 0,
29735
30518
  maxLength: MAX_NUMBER_OF_SEGMENTS,
29736
30519
  typicalLength: MAX_NUMBER_OF_SEGMENTS,
29737
30520
  }),
29738
- extrinsic: descriptors_codec.sequenceVarLen(WorkItemExtrinsicSpec.Codec),
30521
+ extrinsic: sequenceVarLen(WorkItemExtrinsicSpec.Codec),
29739
30522
  })
29740
- : descriptors_codec.Class(WorkItem, {
29741
- service: descriptors_codec.u32.asOpaque(),
29742
- codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29743
- payload: descriptors_codec.blob,
29744
- refineGasLimit: descriptors_codec.u64.asOpaque(),
29745
- accumulateGasLimit: descriptors_codec.u64.asOpaque(),
30523
+ : Class(WorkItem, {
30524
+ service: u32.asOpaque(),
30525
+ codeHash: bytes(hash_HASH_SIZE).asOpaque(),
30526
+ payload: blob,
30527
+ refineGasLimit: u64.asOpaque(),
30528
+ accumulateGasLimit: u64.asOpaque(),
29746
30529
  importSegments: codecKnownSizeArray(ImportSpec.Codec, {
29747
30530
  minLength: 0,
29748
30531
  maxLength: MAX_NUMBER_OF_SEGMENTS,
29749
30532
  typicalLength: MAX_NUMBER_OF_SEGMENTS,
29750
30533
  }),
29751
- extrinsic: descriptors_codec.sequenceVarLen(WorkItemExtrinsicSpec.Codec),
29752
- exportCount: descriptors_codec.u16,
30534
+ extrinsic: sequenceVarLen(WorkItemExtrinsicSpec.Codec),
30535
+ exportCount: u16,
29753
30536
  });
29754
30537
  static create({ service, codeHash, payload, refineGasLimit, accumulateGasLimit, importSegments, extrinsic, exportCount, }) {
29755
30538
  return new WorkItem(service, codeHash, payload, refineGasLimit, accumulateGasLimit, importSegments, extrinsic, exportCount);
@@ -29823,21 +30606,21 @@ class WorkPackage extends WithDebug {
29823
30606
  context;
29824
30607
  items;
29825
30608
  static Codec = Compatibility.isGreaterOrEqual(GpVersion.V0_7_0)
29826
- ? descriptors_codec.Class(WorkPackage, {
29827
- authCodeHost: descriptors_codec.u32.asOpaque(),
29828
- authCodeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30609
+ ? Class(WorkPackage, {
30610
+ authCodeHost: u32.asOpaque(),
30611
+ authCodeHash: bytes(hash_HASH_SIZE).asOpaque(),
29829
30612
  context: RefineContext.Codec,
29830
- authorization: descriptors_codec.blob,
29831
- parametrization: descriptors_codec.blob,
29832
- items: descriptors_codec.sequenceVarLen(WorkItem.Codec).convert((x) => x, (items) => sized_array_FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
30613
+ authorization: blob,
30614
+ parametrization: blob,
30615
+ items: sequenceVarLen(WorkItem.Codec).convert((x) => x, (items) => sized_array_FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
29833
30616
  })
29834
- : descriptors_codec.Class(WorkPackage, {
29835
- authorization: descriptors_codec.blob,
29836
- authCodeHost: descriptors_codec.u32.asOpaque(),
29837
- authCodeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29838
- parametrization: descriptors_codec.blob,
30617
+ : Class(WorkPackage, {
30618
+ authorization: blob,
30619
+ authCodeHost: u32.asOpaque(),
30620
+ authCodeHash: bytes(hash_HASH_SIZE).asOpaque(),
30621
+ parametrization: blob,
29839
30622
  context: RefineContext.Codec,
29840
- items: descriptors_codec.sequenceVarLen(WorkItem.Codec).convert((x) => x, (items) => sized_array_FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
30623
+ items: sequenceVarLen(WorkItem.Codec).convert((x) => x, (items) => sized_array_FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
29841
30624
  });
29842
30625
  static create({ authorization, authCodeHost, authCodeHash, parametrization, context, items, }) {
29843
30626
  return new WorkPackage(authorization, authCodeHost, authCodeHash, parametrization, context, items);
@@ -29897,7 +30680,7 @@ var WorkExecResultKind;
29897
30680
  class WorkExecResult extends WithDebug {
29898
30681
  kind;
29899
30682
  okBlob;
29900
- static Codec = descriptors_codec.custom({
30683
+ static Codec = custom({
29901
30684
  name: "WorkExecResult",
29902
30685
  sizeHint: { bytes: 1, isExact: false },
29903
30686
  }, (e, x) => {
@@ -29944,12 +30727,12 @@ class WorkRefineLoad extends WithDebug {
29944
30727
  extrinsicCount;
29945
30728
  extrinsicSize;
29946
30729
  exportedSegments;
29947
- static Codec = descriptors_codec.Class(WorkRefineLoad, {
29948
- gasUsed: descriptors_codec.varU64.asOpaque(),
29949
- importedSegments: descriptors_codec.varU32,
29950
- extrinsicCount: descriptors_codec.varU32,
29951
- extrinsicSize: descriptors_codec.varU32,
29952
- exportedSegments: descriptors_codec.varU32,
30730
+ static Codec = Class(WorkRefineLoad, {
30731
+ gasUsed: varU64.asOpaque(),
30732
+ importedSegments: varU32,
30733
+ extrinsicCount: varU32,
30734
+ extrinsicSize: varU32,
30735
+ exportedSegments: varU32,
29953
30736
  });
29954
30737
  static create({ gasUsed, importedSegments, extrinsicCount, extrinsicSize, exportedSegments, }) {
29955
30738
  return new WorkRefineLoad(gasUsed, importedSegments, extrinsicCount, extrinsicSize, exportedSegments);
@@ -29985,11 +30768,11 @@ class WorkResult {
29985
30768
  gas;
29986
30769
  result;
29987
30770
  load;
29988
- static Codec = descriptors_codec.Class(WorkResult, {
29989
- serviceId: descriptors_codec.u32.asOpaque(),
29990
- codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
29991
- payloadHash: descriptors_codec.bytes(hash_HASH_SIZE),
29992
- gas: descriptors_codec.u64.asOpaque(),
30771
+ static Codec = Class(WorkResult, {
30772
+ serviceId: u32.asOpaque(),
30773
+ codeHash: bytes(hash_HASH_SIZE).asOpaque(),
30774
+ payloadHash: bytes(hash_HASH_SIZE),
30775
+ gas: u64.asOpaque(),
29993
30776
  result: WorkExecResult.Codec,
29994
30777
  load: WorkRefineLoad.Codec,
29995
30778
  });
@@ -30056,12 +30839,12 @@ class WorkPackageSpec extends WithDebug {
30056
30839
  erasureRoot;
30057
30840
  exportsRoot;
30058
30841
  exportsCount;
30059
- static Codec = descriptors_codec.Class(WorkPackageSpec, {
30060
- hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30061
- length: descriptors_codec.u32,
30062
- erasureRoot: descriptors_codec.bytes(hash_HASH_SIZE),
30063
- exportsRoot: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30064
- exportsCount: descriptors_codec.u16,
30842
+ static Codec = Class(WorkPackageSpec, {
30843
+ hash: bytes(hash_HASH_SIZE).asOpaque(),
30844
+ length: u32,
30845
+ erasureRoot: bytes(hash_HASH_SIZE),
30846
+ exportsRoot: bytes(hash_HASH_SIZE).asOpaque(),
30847
+ exportsCount: u16,
30065
30848
  });
30066
30849
  static create({ hash, length, erasureRoot, exportsRoot, exportsCount }) {
30067
30850
  return new WorkPackageSpec(hash, length, erasureRoot, exportsRoot, exportsCount);
@@ -30133,35 +30916,35 @@ class WorkReportNoCodec extends WithDebug {
30133
30916
  this.authorizationGasUsed = authorizationGasUsed;
30134
30917
  }
30135
30918
  }
30136
- const WorkReportCodec = descriptors_codec.Class(WorkReportNoCodec, {
30919
+ const WorkReportCodec = Class(WorkReportNoCodec, {
30137
30920
  workPackageSpec: WorkPackageSpec.Codec,
30138
30921
  context: RefineContext.Codec,
30139
- coreIndex: descriptors_codec.varU32.convert((o) => numbers_tryAsU32(o), (i) => {
30922
+ coreIndex: varU32.convert((o) => numbers_tryAsU32(o), (i) => {
30140
30923
  if (!isU16(i)) {
30141
30924
  throw new Error(`Core index exceeds U16: ${i}`);
30142
30925
  }
30143
30926
  return tryAsCoreIndex(i);
30144
30927
  }),
30145
- authorizerHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30146
- authorizationGasUsed: descriptors_codec.varU64.asOpaque(),
30147
- authorizationOutput: descriptors_codec.blob,
30148
- segmentRootLookup: readonlyArray(descriptors_codec.sequenceVarLen(WorkPackageInfo.Codec)),
30149
- results: descriptors_codec.sequenceVarLen(WorkResult.Codec).convert((x) => x, (items) => sized_array_FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
30928
+ authorizerHash: bytes(hash_HASH_SIZE).asOpaque(),
30929
+ authorizationGasUsed: varU64.asOpaque(),
30930
+ authorizationOutput: blob,
30931
+ segmentRootLookup: readonlyArray(sequenceVarLen(WorkPackageInfo.Codec)),
30932
+ results: sequenceVarLen(WorkResult.Codec).convert((x) => x, (items) => sized_array_FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
30150
30933
  });
30151
- const WorkReportCodecPre070 = descriptors_codec.Class(WorkReportNoCodec, {
30934
+ const WorkReportCodecPre070 = Class(WorkReportNoCodec, {
30152
30935
  workPackageSpec: WorkPackageSpec.Codec,
30153
30936
  context: RefineContext.Codec,
30154
- coreIndex: descriptors_codec.varU32.convert((o) => numbers_tryAsU32(o), (i) => {
30937
+ coreIndex: varU32.convert((o) => numbers_tryAsU32(o), (i) => {
30155
30938
  if (!isU16(i)) {
30156
30939
  throw new Error(`Core index exceeds U16: ${i}`);
30157
30940
  }
30158
30941
  return tryAsCoreIndex(i);
30159
30942
  }),
30160
- authorizerHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30161
- authorizationOutput: descriptors_codec.blob,
30162
- segmentRootLookup: readonlyArray(descriptors_codec.sequenceVarLen(WorkPackageInfo.Codec)),
30163
- results: descriptors_codec.sequenceVarLen(WorkResult.Codec).convert((x) => x, (items) => sized_array_FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
30164
- authorizationGasUsed: descriptors_codec.varU64.asOpaque(),
30943
+ authorizerHash: bytes(hash_HASH_SIZE).asOpaque(),
30944
+ authorizationOutput: blob,
30945
+ segmentRootLookup: readonlyArray(sequenceVarLen(WorkPackageInfo.Codec)),
30946
+ results: sequenceVarLen(WorkResult.Codec).convert((x) => x, (items) => sized_array_FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
30947
+ authorizationGasUsed: varU64.asOpaque(),
30165
30948
  });
30166
30949
  class WorkReport extends WorkReportNoCodec {
30167
30950
  static Codec = Compatibility.isGreaterOrEqual(GpVersion.V0_7_0)
@@ -30180,9 +30963,9 @@ const REQUIRED_CREDENTIALS_RANGE = [2, 3];
30180
30963
  class Credential extends WithDebug {
30181
30964
  validatorIndex;
30182
30965
  signature;
30183
- static Codec = descriptors_codec.Class(Credential, {
30184
- validatorIndex: descriptors_codec.u16.asOpaque(),
30185
- signature: descriptors_codec.bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
30966
+ static Codec = Class(Credential, {
30967
+ validatorIndex: u16.asOpaque(),
30968
+ signature: bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
30186
30969
  });
30187
30970
  static create({ validatorIndex, signature }) {
30188
30971
  return new Credential(validatorIndex, signature);
@@ -30206,9 +30989,9 @@ class ReportGuarantee extends WithDebug {
30206
30989
  report;
30207
30990
  slot;
30208
30991
  credentials;
30209
- static Codec = descriptors_codec.Class(ReportGuarantee, {
30992
+ static Codec = Class(ReportGuarantee, {
30210
30993
  report: WorkReport.Codec,
30211
- slot: descriptors_codec.u32.asOpaque(),
30994
+ slot: u32.asOpaque(),
30212
30995
  credentials: codecKnownSizeArray(Credential.Codec, {
30213
30996
  minLength: REQUIRED_CREDENTIALS_RANGE[0],
30214
30997
  maxLength: REQUIRED_CREDENTIALS_RANGE[1],
@@ -30260,9 +31043,9 @@ const guaranteesExtrinsicCodec = codecWithContext((context) => codecKnownSizeArr
30260
31043
  class ValidatorKeys extends WithDebug {
30261
31044
  bandersnatch;
30262
31045
  ed25519;
30263
- static Codec = descriptors_codec.Class(ValidatorKeys, {
30264
- bandersnatch: descriptors_codec.bytes(BANDERSNATCH_KEY_BYTES).asOpaque(),
30265
- ed25519: descriptors_codec.bytes(ED25519_KEY_BYTES).asOpaque(),
31046
+ static Codec = Class(ValidatorKeys, {
31047
+ bandersnatch: bytes(BANDERSNATCH_KEY_BYTES).asOpaque(),
31048
+ ed25519: bytes(ED25519_KEY_BYTES).asOpaque(),
30266
31049
  });
30267
31050
  static create({ bandersnatch, ed25519 }) {
30268
31051
  return new ValidatorKeys(bandersnatch, ed25519);
@@ -30279,7 +31062,7 @@ class ValidatorKeys extends WithDebug {
30279
31062
  }
30280
31063
  class TicketsMarker extends WithDebug {
30281
31064
  tickets;
30282
- static Codec = descriptors_codec.Class(TicketsMarker, {
31065
+ static Codec = Class(TicketsMarker, {
30283
31066
  tickets: codecPerEpochBlock(Ticket.Codec),
30284
31067
  });
30285
31068
  static create({ tickets }) {
@@ -30301,9 +31084,9 @@ class EpochMarker extends WithDebug {
30301
31084
  entropy;
30302
31085
  ticketsEntropy;
30303
31086
  validators;
30304
- static Codec = descriptors_codec.Class(EpochMarker, {
30305
- entropy: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30306
- ticketsEntropy: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
31087
+ static Codec = Class(EpochMarker, {
31088
+ entropy: bytes(hash_HASH_SIZE).asOpaque(),
31089
+ ticketsEntropy: bytes(hash_HASH_SIZE).asOpaque(),
30307
31090
  validators: codecPerValidator(ValidatorKeys.Codec),
30308
31091
  });
30309
31092
  static create({ entropy, ticketsEntropy, validators }) {
@@ -30338,16 +31121,16 @@ const encodeUnsealedHeader = (view) => {
30338
31121
  * Codec descriptor with pre 0.7.0 encoding order
30339
31122
  */
30340
31123
  const legacyDescriptor = {
30341
- parentHeaderHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30342
- priorStateRoot: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30343
- extrinsicHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30344
- timeSlotIndex: descriptors_codec.u32.asOpaque(),
30345
- epochMarker: descriptors_codec.optional(EpochMarker.Codec),
30346
- ticketsMarker: descriptors_codec.optional(TicketsMarker.Codec),
30347
- offendersMarker: descriptors_codec.sequenceVarLen(descriptors_codec.bytes(ED25519_KEY_BYTES).asOpaque()),
30348
- bandersnatchBlockAuthorIndex: descriptors_codec.u16.asOpaque(),
30349
- entropySource: descriptors_codec.bytes(bandersnatch_BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
30350
- seal: descriptors_codec.bytes(bandersnatch_BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
31124
+ parentHeaderHash: bytes(hash_HASH_SIZE).asOpaque(),
31125
+ priorStateRoot: bytes(hash_HASH_SIZE).asOpaque(),
31126
+ extrinsicHash: bytes(hash_HASH_SIZE).asOpaque(),
31127
+ timeSlotIndex: u32.asOpaque(),
31128
+ epochMarker: optional(EpochMarker.Codec),
31129
+ ticketsMarker: optional(TicketsMarker.Codec),
31130
+ offendersMarker: sequenceVarLen(bytes(ED25519_KEY_BYTES).asOpaque()),
31131
+ bandersnatchBlockAuthorIndex: u16.asOpaque(),
31132
+ entropySource: bytes(bandersnatch_BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
31133
+ seal: bytes(bandersnatch_BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
30351
31134
  };
30352
31135
  /**
30353
31136
  * The header of the JAM block.
@@ -30355,19 +31138,19 @@ const legacyDescriptor = {
30355
31138
  * https://graypaper.fluffylabs.dev/#/579bd12/0c66000c7200
30356
31139
  */
30357
31140
  class header_Header extends WithDebug {
30358
- static Codec = descriptors_codec.Class(header_Header, Compatibility.isLessThan(GpVersion.V0_7_0)
31141
+ static Codec = Class(header_Header, Compatibility.isLessThan(GpVersion.V0_7_0)
30359
31142
  ? legacyDescriptor
30360
31143
  : {
30361
- parentHeaderHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30362
- priorStateRoot: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30363
- extrinsicHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
30364
- timeSlotIndex: descriptors_codec.u32.asOpaque(),
30365
- epochMarker: descriptors_codec.optional(EpochMarker.Codec),
30366
- ticketsMarker: descriptors_codec.optional(TicketsMarker.Codec),
30367
- bandersnatchBlockAuthorIndex: descriptors_codec.u16.asOpaque(),
30368
- entropySource: descriptors_codec.bytes(bandersnatch_BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
30369
- offendersMarker: descriptors_codec.sequenceVarLen(descriptors_codec.bytes(ED25519_KEY_BYTES).asOpaque()),
30370
- seal: descriptors_codec.bytes(bandersnatch_BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
31144
+ parentHeaderHash: bytes(hash_HASH_SIZE).asOpaque(),
31145
+ priorStateRoot: bytes(hash_HASH_SIZE).asOpaque(),
31146
+ extrinsicHash: bytes(hash_HASH_SIZE).asOpaque(),
31147
+ timeSlotIndex: u32.asOpaque(),
31148
+ epochMarker: optional(EpochMarker.Codec),
31149
+ ticketsMarker: optional(TicketsMarker.Codec),
31150
+ bandersnatchBlockAuthorIndex: u16.asOpaque(),
31151
+ entropySource: bytes(bandersnatch_BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
31152
+ offendersMarker: sequenceVarLen(bytes(ED25519_KEY_BYTES).asOpaque()),
31153
+ seal: bytes(bandersnatch_BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
30371
31154
  });
30372
31155
  static create(h) {
30373
31156
  return Object.assign(header_Header.empty(), h);
@@ -30422,8 +31205,8 @@ class header_Header extends WithDebug {
30422
31205
  * `DescriptorRecord` or `CodecRecord` for some reason.
30423
31206
  */
30424
31207
  class HeaderViewWithHash extends WithHash {
30425
- static Codec = descriptors_codec.Class(HeaderViewWithHash, {
30426
- hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
31208
+ static Codec = Class(HeaderViewWithHash, {
31209
+ hash: bytes(hash_HASH_SIZE).asOpaque(),
30427
31210
  data: header_Header.Codec.View,
30428
31211
  });
30429
31212
  static create({ hash, data }) {
@@ -30444,9 +31227,9 @@ const headerViewWithHashCodec = HeaderViewWithHash.Codec;
30444
31227
  class Preimage extends WithDebug {
30445
31228
  requester;
30446
31229
  blob;
30447
- static Codec = descriptors_codec.Class(Preimage, {
30448
- requester: descriptors_codec.u32.asOpaque(),
30449
- blob: descriptors_codec.blob,
31230
+ static Codec = Class(Preimage, {
31231
+ requester: u32.asOpaque(),
31232
+ blob: blob,
30450
31233
  });
30451
31234
  static create({ requester, blob }) {
30452
31235
  return new Preimage(requester, blob);
@@ -30461,7 +31244,7 @@ class Preimage extends WithDebug {
30461
31244
  this.blob = blob;
30462
31245
  }
30463
31246
  }
30464
- const preimagesExtrinsicCodec = descriptors_codec.sequenceVarLen(Preimage.Codec);
31247
+ const preimagesExtrinsicCodec = sequenceVarLen(Preimage.Codec);
30465
31248
 
30466
31249
  ;// CONCATENATED MODULE: ./packages/jam/block/block.ts
30467
31250
 
@@ -30487,7 +31270,7 @@ class block_Extrinsic extends WithDebug {
30487
31270
  guarantees;
30488
31271
  assurances;
30489
31272
  disputes;
30490
- static Codec = descriptors_codec.Class(block_Extrinsic, {
31273
+ static Codec = Class(block_Extrinsic, {
30491
31274
  tickets: ticketsExtrinsicCodec,
30492
31275
  preimages: preimagesExtrinsicCodec,
30493
31276
  guarantees: guaranteesExtrinsicCodec,
@@ -30540,7 +31323,7 @@ class block_Extrinsic extends WithDebug {
30540
31323
  class block_Block extends WithDebug {
30541
31324
  header;
30542
31325
  extrinsic;
30543
- static Codec = descriptors_codec.Class(block_Block, {
31326
+ static Codec = Class(block_Block, {
30544
31327
  header: header_Header.Codec,
30545
31328
  extrinsic: block_Extrinsic.Codec,
30546
31329
  });
@@ -33079,9 +33862,9 @@ class BlockRequest extends WithDebug {
33079
33862
  headerHash;
33080
33863
  direction;
33081
33864
  maxBlocks;
33082
- static Codec = descriptors_codec.Class(BlockRequest, {
33083
- headerHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
33084
- direction: descriptors_codec.u8.convert((i) => tryAsU8(i), (i) => {
33865
+ static Codec = Class(BlockRequest, {
33866
+ headerHash: bytes(hash_HASH_SIZE).asOpaque(),
33867
+ direction: u8.convert((i) => tryAsU8(i), (i) => {
33085
33868
  switch (i) {
33086
33869
  case Direction.AscExcl:
33087
33870
  return Direction.AscExcl;
@@ -33091,7 +33874,7 @@ class BlockRequest extends WithDebug {
33091
33874
  throw new Error(`Invalid 'Direction' value: ${i}`);
33092
33875
  }
33093
33876
  }),
33094
- maxBlocks: descriptors_codec.u32,
33877
+ maxBlocks: u32,
33095
33878
  });
33096
33879
  static create({ headerHash, direction, maxBlocks }) {
33097
33880
  return new BlockRequest(headerHash, direction, maxBlocks);
@@ -33116,7 +33899,7 @@ class ServerHandler {
33116
33899
  const request = decoder_Decoder.decodeObject(BlockRequest.Codec, message);
33117
33900
  ce_128_block_request_logger.log `[${sender.streamId}] Client has requested: ${request}`;
33118
33901
  const blocks = this.getBlockSequence(sender.streamId, request.headerHash, request.direction, request.maxBlocks);
33119
- sender.bufferAndSend(encoder_Encoder.encodeObject(descriptors_codec.sequenceFixLen(block_Block.Codec.View, blocks.length), blocks, this.chainSpec));
33902
+ sender.bufferAndSend(encoder_Encoder.encodeObject(sequenceFixLen(block_Block.Codec.View, blocks.length), blocks, this.chainSpec));
33120
33903
  sender.close();
33121
33904
  }
33122
33905
  onClose() { }
@@ -33439,13 +34222,13 @@ class LeafNode {
33439
34222
  */
33440
34223
  const ce_129_state_request_STREAM_KIND = tryAsStreamKind(129);
33441
34224
  const ce_129_state_request_TRIE_NODE_BYTES = 64;
33442
- const trieNodeCodec = descriptors_codec.bytes(ce_129_state_request_TRIE_NODE_BYTES).convert((i) => bytes_Bytes.fromBlob(i.raw, ce_129_state_request_TRIE_NODE_BYTES), (i) => new TrieNode(i.raw));
34225
+ const trieNodeCodec = bytes(ce_129_state_request_TRIE_NODE_BYTES).convert((i) => bytes_Bytes.fromBlob(i.raw, ce_129_state_request_TRIE_NODE_BYTES), (i) => new TrieNode(i.raw));
33443
34226
  class KeyValuePair extends WithDebug {
33444
34227
  key;
33445
34228
  value;
33446
- static Codec = descriptors_codec.Class(KeyValuePair, {
33447
- key: descriptors_codec.bytes(TRUNCATED_KEY_BYTES),
33448
- value: descriptors_codec.blob,
34229
+ static Codec = Class(KeyValuePair, {
34230
+ key: bytes(TRUNCATED_KEY_BYTES),
34231
+ value: blob,
33449
34232
  });
33450
34233
  static create({ key, value }) {
33451
34234
  return new KeyValuePair(key, value);
@@ -33458,8 +34241,8 @@ class KeyValuePair extends WithDebug {
33458
34241
  }
33459
34242
  class StateResponse extends WithDebug {
33460
34243
  keyValuePairs;
33461
- static Codec = descriptors_codec.Class(StateResponse, {
33462
- keyValuePairs: descriptors_codec.sequenceVarLen(KeyValuePair.Codec),
34244
+ static Codec = Class(StateResponse, {
34245
+ keyValuePairs: sequenceVarLen(KeyValuePair.Codec),
33463
34246
  });
33464
34247
  static create({ keyValuePairs }) {
33465
34248
  return new StateResponse(keyValuePairs);
@@ -33474,11 +34257,11 @@ class StateRequest extends WithDebug {
33474
34257
  startKey;
33475
34258
  endKey;
33476
34259
  maximumSize;
33477
- static Codec = descriptors_codec.Class(StateRequest, {
33478
- headerHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
33479
- startKey: descriptors_codec.bytes(TRUNCATED_KEY_BYTES),
33480
- endKey: descriptors_codec.bytes(TRUNCATED_KEY_BYTES),
33481
- maximumSize: descriptors_codec.u32,
34260
+ static Codec = Class(StateRequest, {
34261
+ headerHash: bytes(hash_HASH_SIZE).asOpaque(),
34262
+ startKey: bytes(TRUNCATED_KEY_BYTES),
34263
+ endKey: bytes(TRUNCATED_KEY_BYTES),
34264
+ maximumSize: u32,
33482
34265
  });
33483
34266
  static create({ headerHash, startKey, endKey, maximumSize }) {
33484
34267
  return new StateRequest(headerHash, startKey, endKey, maximumSize);
@@ -33562,8 +34345,8 @@ const STREAM_KIND_PROXY_TO_ALL = tryAsStreamKind(132);
33562
34345
  class TicketDistributionRequest extends WithDebug {
33563
34346
  epochIndex;
33564
34347
  ticket;
33565
- static Codec = descriptors_codec.Class(TicketDistributionRequest, {
33566
- epochIndex: descriptors_codec.u32.asOpaque(),
34348
+ static Codec = Class(TicketDistributionRequest, {
34349
+ epochIndex: u32.asOpaque(),
33567
34350
  ticket: SignedTicket.Codec,
33568
34351
  });
33569
34352
  static create({ epochIndex, ticket }) {
@@ -33626,8 +34409,8 @@ const ce_133_work_package_submission_STREAM_KIND = tryAsStreamKind(133);
33626
34409
  class CoreWorkPackage extends WithDebug {
33627
34410
  coreIndex;
33628
34411
  workPackage;
33629
- static Codec = descriptors_codec.Class(CoreWorkPackage, {
33630
- coreIndex: descriptors_codec.u16.asOpaque(),
34412
+ static Codec = Class(CoreWorkPackage, {
34413
+ coreIndex: u16.asOpaque(),
33631
34414
  workPackage: WorkPackage.Codec,
33632
34415
  });
33633
34416
  static create({ coreIndex, workPackage }) {
@@ -33693,14 +34476,14 @@ class ce_133_work_package_submission_ClientHandler {
33693
34476
 
33694
34477
 
33695
34478
 
33696
- const WorkPackageBundleCodec = descriptors_codec.blob;
34479
+ const WorkPackageBundleCodec = blob;
33697
34480
  const ce_134_work_package_sharing_STREAM_KIND = tryAsStreamKind(134);
33698
34481
  class WorkPackageSharingRequest extends WithDebug {
33699
34482
  coreIndex;
33700
34483
  segmentsRootMappings;
33701
- static Codec = descriptors_codec.Class(WorkPackageSharingRequest, {
33702
- coreIndex: descriptors_codec.u16.asOpaque(),
33703
- segmentsRootMappings: descriptors_codec.sequenceVarLen(WorkPackageInfo.Codec),
34484
+ static Codec = Class(WorkPackageSharingRequest, {
34485
+ coreIndex: u16.asOpaque(),
34486
+ segmentsRootMappings: sequenceVarLen(WorkPackageInfo.Codec),
33704
34487
  });
33705
34488
  static create({ coreIndex, segmentsRootMappings }) {
33706
34489
  return new WorkPackageSharingRequest(coreIndex, segmentsRootMappings);
@@ -33714,9 +34497,9 @@ class WorkPackageSharingRequest extends WithDebug {
33714
34497
  class WorkPackageSharingResponse extends WithDebug {
33715
34498
  workReportHash;
33716
34499
  signature;
33717
- static Codec = descriptors_codec.Class(WorkPackageSharingResponse, {
33718
- workReportHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
33719
- signature: descriptors_codec.bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
34500
+ static Codec = Class(WorkPackageSharingResponse, {
34501
+ workReportHash: bytes(hash_HASH_SIZE).asOpaque(),
34502
+ signature: bytes(ED25519_SIGNATURE_BYTES).asOpaque(),
33720
34503
  });
33721
34504
  static create({ workReportHash, signature }) {
33722
34505
  return new WorkPackageSharingResponse(workReportHash, signature);
@@ -33814,9 +34597,9 @@ class GuaranteedWorkReport extends WithDebug {
33814
34597
  report;
33815
34598
  slot;
33816
34599
  signatures;
33817
- static Codec = descriptors_codec.Class(GuaranteedWorkReport, {
34600
+ static Codec = Class(GuaranteedWorkReport, {
33818
34601
  report: WorkReport.Codec,
33819
- slot: descriptors_codec.u32.asOpaque(),
34602
+ slot: u32.asOpaque(),
33820
34603
  signatures: codecWithContext((context) => {
33821
34604
  return codecKnownSizeArray(Credential.Codec, {
33822
34605
  minLength: 0,
@@ -33888,9 +34671,9 @@ const up_0_block_announcement_STREAM_KIND = tryAsStreamKind(0);
33888
34671
  class HashAndSlot extends WithDebug {
33889
34672
  hash;
33890
34673
  slot;
33891
- static Codec = descriptors_codec.Class(HashAndSlot, {
33892
- hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
33893
- slot: descriptors_codec.u32.asOpaque(),
34674
+ static Codec = Class(HashAndSlot, {
34675
+ hash: bytes(hash_HASH_SIZE).asOpaque(),
34676
+ slot: u32.asOpaque(),
33894
34677
  });
33895
34678
  static create({ hash, slot }) {
33896
34679
  return new HashAndSlot(hash, slot);
@@ -33907,9 +34690,9 @@ class HashAndSlot extends WithDebug {
33907
34690
  class Handshake {
33908
34691
  final;
33909
34692
  leafs;
33910
- static Codec = descriptors_codec.Class(Handshake, {
34693
+ static Codec = Class(Handshake, {
33911
34694
  final: HashAndSlot.Codec,
33912
- leafs: descriptors_codec.sequenceVarLen(HashAndSlot.Codec),
34695
+ leafs: sequenceVarLen(HashAndSlot.Codec),
33913
34696
  });
33914
34697
  static create({ final, leafs }) {
33915
34698
  return new Handshake(final, leafs);
@@ -33930,7 +34713,7 @@ class Handshake {
33930
34713
  class Announcement extends WithDebug {
33931
34714
  header;
33932
34715
  final;
33933
- static Codec = descriptors_codec.Class(Announcement, {
34716
+ static Codec = Class(Announcement, {
33934
34717
  header: header_Header.Codec,
33935
34718
  final: HashAndSlot.Codec,
33936
34719
  });
@@ -34416,12 +35199,9 @@ async function main(config, comms) {
34416
35199
  main_logger.info `🛜 Network worker finished. Closing channel.`;
34417
35200
  }
34418
35201
 
34419
- ;// CONCATENATED MODULE: external "node:worker_threads"
34420
- const external_node_worker_threads_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:worker_threads");
34421
35202
  ;// CONCATENATED MODULE: ./packages/workers/api/channel.ts
34422
35203
 
34423
35204
 
34424
-
34425
35205
  const channel_logger = Logger.new(import.meta.filename, "workers");
34426
35206
  /**
34427
35207
  * Wraps a protocol definition and a communication port into a properly
@@ -34488,10 +35268,10 @@ class channel_Channel {
34488
35268
  // listen to request incoming to worker
34489
35269
  this.port.on(key, val.request, async ({ responseId, data }) => {
34490
35270
  try {
34491
- console.log(`[${threadId}] handling ${key}. Responseid: ${responseId}`);
35271
+ console.log(`[${this.port.threadId}] handling ${key}. Responseid: ${responseId}`);
34492
35272
  // handle them
34493
35273
  const response = await handler(data);
34494
- console.log(`[${threadId}] sending response: ${responseId}`);
35274
+ console.log(`[${this.port.threadId}] sending response: ${responseId}`);
34495
35275
  // and send response back on dedicated event
34496
35276
  this.port.postMessage(responseId, val.response, {
34497
35277
  responseId,
@@ -34509,14 +35289,14 @@ class channel_Channel {
34509
35289
  return (data) => {
34510
35290
  this.nextResponseId++;
34511
35291
  const responseId = `${key}:${this.nextResponseId}`;
34512
- console.log(`[${threadId}] will wait for ${key}`);
35292
+ console.log(`[${this.port.threadId}] will wait for ${key}`);
34513
35293
  return new Promise((resolve, reject) => {
34514
35294
  this.pendingPromises.add(reject);
34515
35295
  // attach response listener first
34516
35296
  this.port.once(responseId, val.response, (msg) => {
34517
35297
  // we got response, so will resolve
34518
35298
  this.pendingPromises.delete(reject);
34519
- console.log(`[${threadId}] got ${key}`);
35299
+ console.log(`[${this.port.threadId}] got ${key}`);
34520
35300
  resolve(msg.data);
34521
35301
  });
34522
35302
  // send message to the port
@@ -34541,6 +35321,14 @@ function isMessageCodecs(val) {
34541
35321
  return val !== null && typeof val === "object" && "request" in val && "response" in val;
34542
35322
  }
34543
35323
 
35324
+ // EXTERNAL MODULE: ./node_modules/eventemitter3/index.js
35325
+ var eventemitter3 = __nccwpck_require__(952);
35326
+ ;// CONCATENATED MODULE: ./node_modules/eventemitter3/index.mjs
35327
+
35328
+
35329
+
35330
+ /* harmony default export */ const node_modules_eventemitter3 = ((/* unused pure expression or super */ null && (EventEmitter)));
35331
+
34544
35332
  ;// CONCATENATED MODULE: ./packages/workers/api/port.ts
34545
35333
 
34546
35334
  /**
@@ -34551,6 +35339,7 @@ function isMessageCodecs(val) {
34551
35339
  */
34552
35340
  class port_DirectPort {
34553
35341
  events;
35342
+ threadId = 0;
34554
35343
  /** Create a pair of symmetrical inter-connected ports. */
34555
35344
  static pair() {
34556
35345
  const events = new EventEmitter();
@@ -34628,12 +35417,12 @@ class NetworkingConfig extends WithDebug {
34628
35417
  host;
34629
35418
  port;
34630
35419
  bootnodes;
34631
- static Codec = descriptors_codec.Class(NetworkingConfig, {
34632
- genesisHeaderHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
34633
- key: descriptors_codec.bytes(ED25519_PRIV_KEY_BYTES).asOpaque(),
34634
- host: descriptors_codec.string,
34635
- port: descriptors_codec.u16,
34636
- bootnodes: descriptors_codec.sequenceVarLen(descriptors_codec.string),
35420
+ static Codec = Class(NetworkingConfig, {
35421
+ genesisHeaderHash: bytes(hash_HASH_SIZE).asOpaque(),
35422
+ key: bytes(ED25519_PRIV_KEY_BYTES).asOpaque(),
35423
+ host: string,
35424
+ port: u16,
35425
+ bootnodes: sequenceVarLen(string),
34637
35426
  });
34638
35427
  static create({ genesisHeaderHash, key, host, port, bootnodes }) {
34639
35428
  return new NetworkingConfig(genesisHeaderHash, key, host, port, bootnodes);
@@ -34661,17 +35450,17 @@ const protocol = createProtocol("net", {
34661
35450
  toWorker: {
34662
35451
  newHeader: {
34663
35452
  request: headerViewWithHashCodec,
34664
- response: descriptors_codec.nothing,
35453
+ response: nothing,
34665
35454
  },
34666
35455
  finish: {
34667
- request: descriptors_codec.nothing,
34668
- response: descriptors_codec.nothing,
35456
+ request: nothing,
35457
+ response: nothing,
34669
35458
  },
34670
35459
  },
34671
35460
  fromWorker: {
34672
35461
  blocks: {
34673
- request: descriptors_codec.sequenceVarLen(block_Block.Codec.View),
34674
- response: descriptors_codec.nothing,
35462
+ request: sequenceVarLen(block_Block.Codec.View),
35463
+ response: nothing,
34675
35464
  },
34676
35465
  },
34677
35466
  });