@typeberry/lib 0.1.3-c2321fb → 0.1.3-ca63b35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/index.cjs +314 -213
  2. package/index.d.ts +380 -238
  3. package/index.js +314 -213
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -35,7 +35,9 @@ declare function parseCurrentVersion(env?: string): GpVersion | undefined {
35
35
  }
36
36
 
37
37
  declare function parseCurrentSuite(env?: string): TestSuite | undefined {
38
- if (env === undefined) return undefined;
38
+ if (env === undefined) {
39
+ return undefined;
40
+ }
39
41
  switch (env) {
40
42
  case TestSuite.W3F_DAVXY:
41
43
  case TestSuite.JAMDUNA:
@@ -587,8 +589,12 @@ declare function deepEqual<T>(
587
589
  const aKey = `${a.key}`;
588
590
  const bKey = `${b.key}`;
589
591
 
590
- if (aKey < bKey) return -1;
591
- if (bKey < aKey) return 1;
592
+ if (aKey < bKey) {
593
+ return -1;
594
+ }
595
+ if (bKey < aKey) {
596
+ return 1;
597
+ }
592
598
  return 0;
593
599
  });
594
600
  };
@@ -3476,6 +3482,53 @@ declare namespace index$q {
3476
3482
  export type { index$q_ClassConstructor as ClassConstructor, index$q_Codec as Codec, index$q_CodecRecord as CodecRecord, index$q_Decode as Decode, index$q_DescribedBy as DescribedBy, index$q_DescriptorRecord as DescriptorRecord, index$q_Encode as Encode, index$q_LengthRange as LengthRange, index$q_OptionalRecord as OptionalRecord, Options$1 as Options, index$q_PropertyKeys as PropertyKeys, index$q_SimpleDescriptorRecord as SimpleDescriptorRecord, index$q_SizeHint as SizeHint, index$q_ViewOf as ViewOf };
3477
3483
  }
3478
3484
 
3485
+ /**
3486
+ * A utility class providing a readonly view over a portion of an array without copying it.
3487
+ */
3488
+ declare class ArrayView<T> implements Iterable<T> {
3489
+ private readonly source: T[];
3490
+ public readonly length: number;
3491
+
3492
+ private constructor(
3493
+ source: T[],
3494
+ private readonly start: number,
3495
+ private readonly end: number,
3496
+ ) {
3497
+ this.source = source;
3498
+ this.length = end - start;
3499
+ }
3500
+
3501
+ static from<T>(source: T[], start = 0, end = source.length): ArrayView<T> {
3502
+ check`
3503
+ ${start >= 0 && end <= source.length && start <= end}
3504
+ Invalid start (${start})/end (${end}) for ArrayView
3505
+ `;
3506
+ return new ArrayView(source, start, end);
3507
+ }
3508
+
3509
+ get(i: number): T {
3510
+ check`
3511
+ ${i >= 0 && i < this.length}
3512
+ Index out of bounds: ${i} < ${this.length}
3513
+ `;
3514
+ return this.source[this.start + i];
3515
+ }
3516
+
3517
+ subview(from: number, to: number = this.length): ArrayView<T> {
3518
+ return ArrayView.from(this.source, this.start + from, this.start + to);
3519
+ }
3520
+
3521
+ toArray(): T[] {
3522
+ return this.source.slice(this.start, this.end);
3523
+ }
3524
+
3525
+ *[Symbol.iterator](): Iterator<T> {
3526
+ for (let i = this.start; i < this.end; i++) {
3527
+ yield this.source[i];
3528
+ }
3529
+ }
3530
+ }
3531
+
3479
3532
  type ITypedArray = Uint8Array | Uint16Array | Uint32Array;
3480
3533
  type IDataType = string | Buffer | ITypedArray;
3481
3534
 
@@ -4440,6 +4493,8 @@ declare class TruncatedHashDictionary<T extends OpaqueHash, V> {
4440
4493
  }
4441
4494
  }
4442
4495
 
4496
+ type index$o_ArrayView<T> = ArrayView<T>;
4497
+ declare const index$o_ArrayView: typeof ArrayView;
4443
4498
  type index$o_FixedSizeArray<T, N extends number> = FixedSizeArray<T, N>;
4444
4499
  declare const index$o_FixedSizeArray: typeof FixedSizeArray;
4445
4500
  type index$o_HashDictionary<K extends OpaqueHash, V> = HashDictionary<K, V>;
@@ -4467,7 +4522,7 @@ type index$o_TruncatedHashDictionary<T extends OpaqueHash, V> = TruncatedHashDic
4467
4522
  declare const index$o_TruncatedHashDictionary: typeof TruncatedHashDictionary;
4468
4523
  declare const index$o_asKnownSize: typeof asKnownSize;
4469
4524
  declare namespace index$o {
4470
- export { index$o_FixedSizeArray as FixedSizeArray, index$o_HashDictionary as HashDictionary, index$o_HashSet as HashSet, index$o_MultiMap as MultiMap, index$o_SortedArray as SortedArray, index$o_SortedSet as SortedSet, index$o_TruncatedHashDictionary as TruncatedHashDictionary, index$o_asKnownSize as asKnownSize };
4525
+ export { index$o_ArrayView as ArrayView, index$o_FixedSizeArray as FixedSizeArray, index$o_HashDictionary as HashDictionary, index$o_HashSet as HashSet, index$o_MultiMap as MultiMap, index$o_SortedArray as SortedArray, index$o_SortedSet as SortedSet, index$o_TruncatedHashDictionary as TruncatedHashDictionary, index$o_asKnownSize as asKnownSize };
4471
4526
  export type { index$o_HashWithZeroedBit as HashWithZeroedBit, index$o_ImmutableHashDictionary as ImmutableHashDictionary, index$o_ImmutableHashSet as ImmutableHashSet, index$o_ImmutableSortedArray as ImmutableSortedArray, index$o_ImmutableSortedSet as ImmutableSortedSet, index$o_KeyMapper as KeyMapper, index$o_KeyMappers as KeyMappers, index$o_KnownSize as KnownSize, index$o_KnownSizeArray as KnownSizeArray, index$o_KnownSizeId as KnownSizeId, index$o_NestedMaps as NestedMaps };
4472
4527
  }
4473
4528
 
@@ -9190,8 +9245,6 @@ declare function hashComparator<V extends OpaqueHash>(a: V, b: V) {
9190
9245
  return a.compare(b);
9191
9246
  }
9192
9247
 
9193
- // TODO [ToDr] Not sure where these should live yet :(
9194
-
9195
9248
  /**
9196
9249
  * `J`: The maximum sum of dependency items in a work-report.
9197
9250
  *
@@ -9245,6 +9298,215 @@ declare class NotYetAccumulatedReport extends WithDebug {
9245
9298
  }
9246
9299
  }
9247
9300
 
9301
+ /**
9302
+ * `B_S`: The basic minimum balance which all services require.
9303
+ *
9304
+ * https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
9305
+ */
9306
+ declare const BASE_SERVICE_BALANCE = 100n;
9307
+ /**
9308
+ * `B_I`: The additional minimum balance required per item of elective service state.
9309
+ *
9310
+ * https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
9311
+ */
9312
+ declare const ELECTIVE_ITEM_BALANCE = 10n;
9313
+ /**
9314
+ * `B_L`: The additional minimum balance required per octet of elective service state.
9315
+ *
9316
+ * https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
9317
+ */
9318
+ declare const ELECTIVE_BYTE_BALANCE = 1n;
9319
+
9320
+ declare const zeroSizeHint: SizeHint = {
9321
+ bytes: 0,
9322
+ isExact: true,
9323
+ };
9324
+
9325
+ /** 0-byte read, return given default value */
9326
+ declare const ignoreValueWithDefault = <T>(defaultValue: T) =>
9327
+ Descriptor.new<T>(
9328
+ "ignoreValue",
9329
+ zeroSizeHint,
9330
+ (_e, _v) => {},
9331
+ (_d) => defaultValue,
9332
+ (_s) => {},
9333
+ );
9334
+
9335
+ /** Encode and decode object with leading version number. */
9336
+ declare const codecWithVersion = <T>(val: Descriptor<T>): Descriptor<T> =>
9337
+ Descriptor.new<T>(
9338
+ "withVersion",
9339
+ {
9340
+ bytes: val.sizeHint.bytes + 8,
9341
+ isExact: false,
9342
+ },
9343
+ (e, v) => {
9344
+ e.varU64(0n);
9345
+ val.encode(e, v);
9346
+ },
9347
+ (d) => {
9348
+ const version = d.varU64();
9349
+ if (version !== 0n) {
9350
+ throw new Error("Non-zero version is not supported!");
9351
+ }
9352
+ return val.decode(d);
9353
+ },
9354
+ (s) => {
9355
+ s.varU64();
9356
+ val.skip(s);
9357
+ },
9358
+ );
9359
+
9360
+ /**
9361
+ * Service account details.
9362
+ *
9363
+ * https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
9364
+ */
9365
+ declare class ServiceAccountInfo extends WithDebug {
9366
+ static Codec = codec.Class(ServiceAccountInfo, {
9367
+ codeHash: codec.bytes(HASH_SIZE).asOpaque<CodeHash>(),
9368
+ balance: codec.u64,
9369
+ accumulateMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
9370
+ onTransferMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
9371
+ storageUtilisationBytes: codec.u64,
9372
+ gratisStorage: codec.u64,
9373
+ storageUtilisationCount: codec.u32,
9374
+ created: codec.u32.convert((x) => x, tryAsTimeSlot),
9375
+ lastAccumulation: codec.u32.convert((x) => x, tryAsTimeSlot),
9376
+ parentService: codec.u32.convert((x) => x, tryAsServiceId),
9377
+ });
9378
+
9379
+ static create(a: CodecRecord<ServiceAccountInfo>) {
9380
+ return new ServiceAccountInfo(
9381
+ a.codeHash,
9382
+ a.balance,
9383
+ a.accumulateMinGas,
9384
+ a.onTransferMinGas,
9385
+ a.storageUtilisationBytes,
9386
+ a.gratisStorage,
9387
+ a.storageUtilisationCount,
9388
+ a.created,
9389
+ a.lastAccumulation,
9390
+ a.parentService,
9391
+ );
9392
+ }
9393
+
9394
+ /**
9395
+ * `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
9396
+ * https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
9397
+ */
9398
+ static calculateThresholdBalance(items: U32, bytes: U64, gratisStorage: U64): U64 {
9399
+ const storageCost =
9400
+ BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
9401
+
9402
+ if (storageCost < 0n) {
9403
+ return tryAsU64(0);
9404
+ }
9405
+
9406
+ if (storageCost >= 2n ** 64n) {
9407
+ return tryAsU64(2n ** 64n - 1n);
9408
+ }
9409
+
9410
+ return tryAsU64(storageCost);
9411
+ }
9412
+
9413
+ private constructor(
9414
+ /** `a_c`: Hash of the service code. */
9415
+ public readonly codeHash: CodeHash,
9416
+ /** `a_b`: Current account balance. */
9417
+ public readonly balance: U64,
9418
+ /** `a_g`: Minimal gas required to execute Accumulate entrypoint. */
9419
+ public readonly accumulateMinGas: ServiceGas,
9420
+ /** `a_m`: Minimal gas required to execute On Transfer entrypoint. */
9421
+ public readonly onTransferMinGas: ServiceGas,
9422
+ /** `a_o`: Total number of octets in storage. */
9423
+ public readonly storageUtilisationBytes: U64,
9424
+ /** `a_f`: Cost-free storage. Decreases both storage item count and total byte size. */
9425
+ public readonly gratisStorage: U64,
9426
+ /** `a_i`: Number of items in storage. */
9427
+ public readonly storageUtilisationCount: U32,
9428
+ /** `a_r`: Creation account time slot. */
9429
+ public readonly created: TimeSlot,
9430
+ /** `a_a`: Most recent accumulation time slot. */
9431
+ public readonly lastAccumulation: TimeSlot,
9432
+ /** `a_p`: Parent service ID. */
9433
+ public readonly parentService: ServiceId,
9434
+ ) {
9435
+ super();
9436
+ }
9437
+ }
9438
+
9439
+ declare class PreimageItem extends WithDebug {
9440
+ static Codec = codec.Class(PreimageItem, {
9441
+ hash: codec.bytes(HASH_SIZE).asOpaque<PreimageHash>(),
9442
+ blob: codec.blob,
9443
+ });
9444
+
9445
+ static create({ hash, blob }: CodecRecord<PreimageItem>) {
9446
+ return new PreimageItem(hash, blob);
9447
+ }
9448
+
9449
+ private constructor(
9450
+ readonly hash: PreimageHash,
9451
+ readonly blob: BytesBlob,
9452
+ ) {
9453
+ super();
9454
+ }
9455
+ }
9456
+
9457
+ type StorageKey = Opaque<BytesBlob, "storage key">;
9458
+
9459
+ declare class StorageItem extends WithDebug {
9460
+ static Codec = codec.Class(StorageItem, {
9461
+ key: codec.blob.convert(
9462
+ (i) => i,
9463
+ (o) => asOpaqueType(o),
9464
+ ),
9465
+ value: codec.blob,
9466
+ });
9467
+
9468
+ static create({ key, value }: CodecRecord<StorageItem>) {
9469
+ return new StorageItem(key, value);
9470
+ }
9471
+
9472
+ private constructor(
9473
+ readonly key: StorageKey,
9474
+ readonly value: BytesBlob,
9475
+ ) {
9476
+ super();
9477
+ }
9478
+ }
9479
+
9480
+ declare const MAX_LOOKUP_HISTORY_SLOTS = 3;
9481
+ type LookupHistorySlots = KnownSizeArray<TimeSlot, `0-${typeof MAX_LOOKUP_HISTORY_SLOTS} timeslots`>;
9482
+ declare function tryAsLookupHistorySlots(items: readonly TimeSlot[]): LookupHistorySlots {
9483
+ const knownSize = asKnownSize(items) as LookupHistorySlots;
9484
+ if (knownSize.length > MAX_LOOKUP_HISTORY_SLOTS) {
9485
+ throw new Error(`Lookup history items must contain 0-${MAX_LOOKUP_HISTORY_SLOTS} timeslots.`);
9486
+ }
9487
+ return knownSize;
9488
+ }
9489
+
9490
+ /** https://graypaper.fluffylabs.dev/#/5f542d7/115400115800 */
9491
+ declare class LookupHistoryItem {
9492
+ constructor(
9493
+ public readonly hash: PreimageHash,
9494
+ public readonly length: U32,
9495
+ /**
9496
+ * Preimage availability history as a sequence of time slots.
9497
+ * See PreimageStatus and the following GP fragment for more details.
9498
+ * https://graypaper.fluffylabs.dev/#/5f542d7/11780011a500 */
9499
+ public readonly slots: LookupHistorySlots,
9500
+ ) {}
9501
+
9502
+ static isRequested(item: LookupHistoryItem | LookupHistorySlots): boolean {
9503
+ if ("slots" in item) {
9504
+ return item.slots.length === 0;
9505
+ }
9506
+ return item.length === 0;
9507
+ }
9508
+ }
9509
+
9248
9510
  /** Dictionary entry of services that auto-accumulate every block. */
9249
9511
  declare class AutoAccumulate {
9250
9512
  static Codec = codec.Class(AutoAccumulate, {
@@ -9265,33 +9527,42 @@ declare class AutoAccumulate {
9265
9527
  }
9266
9528
 
9267
9529
  /**
9268
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/11da0111da01?v=0.6.7
9530
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/114402114402?v=0.7.2
9269
9531
  */
9270
9532
  declare class PrivilegedServices {
9533
+ /** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bbd023bcb02?v=0.7.2 */
9271
9534
  static Codec = codec.Class(PrivilegedServices, {
9272
9535
  manager: codec.u32.asOpaque<ServiceId>(),
9273
- authManager: codecPerCore(codec.u32.asOpaque<ServiceId>()),
9274
- validatorsManager: codec.u32.asOpaque<ServiceId>(),
9536
+ assigners: codecPerCore(codec.u32.asOpaque<ServiceId>()),
9537
+ delegator: codec.u32.asOpaque<ServiceId>(),
9538
+ registrar: Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
9539
+ ? codec.u32.asOpaque<ServiceId>()
9540
+ : ignoreValueWithDefault(tryAsServiceId(2 ** 32 - 1)),
9275
9541
  autoAccumulateServices: readonlyArray(codec.sequenceVarLen(AutoAccumulate.Codec)),
9276
9542
  });
9277
9543
 
9278
- static create({ manager, authManager, validatorsManager, autoAccumulateServices }: CodecRecord<PrivilegedServices>) {
9279
- return new PrivilegedServices(manager, authManager, validatorsManager, autoAccumulateServices);
9544
+ static create(a: CodecRecord<PrivilegedServices>) {
9545
+ return new PrivilegedServices(a.manager, a.delegator, a.registrar, a.assigners, a.autoAccumulateServices);
9280
9546
  }
9281
9547
 
9282
9548
  private constructor(
9283
9549
  /**
9284
- * `chi_m`: The first, χm, is the index of the manager service which is
9285
- * the service able to effect an alteration of χ from block to block,
9550
+ * `χ_M`: Manages alteration of χ from block to block,
9286
9551
  * as well as bestow services with storage deposit credits.
9287
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/11a40111a801?v=0.6.7
9552
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/111502111902?v=0.7.2
9288
9553
  */
9289
9554
  readonly manager: ServiceId,
9290
- /** `chi_a`: Manages authorization queue one for each core. */
9291
- readonly authManager: PerCore<ServiceId>,
9292
- /** `chi_v`: Managers validator keys. */
9293
- readonly validatorsManager: ServiceId,
9294
- /** `chi_g`: Dictionary of services that auto-accumulate every block with their gas limit. */
9555
+ /** `χ_V`: Managers validator keys. */
9556
+ readonly delegator: ServiceId,
9557
+ /**
9558
+ * `χ_R`: Manages the creation of services in protected range.
9559
+ *
9560
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/111b02111d02?v=0.7.2
9561
+ */
9562
+ readonly registrar: ServiceId,
9563
+ /** `χ_A`: Manages authorization queue one for each core. */
9564
+ readonly assigners: PerCore<ServiceId>,
9565
+ /** `χ_Z`: Dictionary of services that auto-accumulate every block with their gas limit. */
9295
9566
  readonly autoAccumulateServices: readonly AutoAccumulate[],
9296
9567
  ) {}
9297
9568
  }
@@ -9740,190 +10011,6 @@ declare class SafroleData {
9740
10011
  ) {}
9741
10012
  }
9742
10013
 
9743
- /**
9744
- * `B_S`: The basic minimum balance which all services require.
9745
- *
9746
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
9747
- */
9748
- declare const BASE_SERVICE_BALANCE = 100n;
9749
- /**
9750
- * `B_I`: The additional minimum balance required per item of elective service state.
9751
- *
9752
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
9753
- */
9754
- declare const ELECTIVE_ITEM_BALANCE = 10n;
9755
- /**
9756
- * `B_L`: The additional minimum balance required per octet of elective service state.
9757
- *
9758
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
9759
- */
9760
- declare const ELECTIVE_BYTE_BALANCE = 1n;
9761
-
9762
- declare const zeroSizeHint: SizeHint = {
9763
- bytes: 0,
9764
- isExact: true,
9765
- };
9766
-
9767
- /** 0-byte read, return given default value */
9768
- declare const ignoreValueWithDefault = <T>(defaultValue: T) =>
9769
- Descriptor.new<T>(
9770
- "ignoreValue",
9771
- zeroSizeHint,
9772
- (_e, _v) => {},
9773
- (_d) => defaultValue,
9774
- (_s) => {},
9775
- );
9776
-
9777
- /**
9778
- * Service account details.
9779
- *
9780
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
9781
- */
9782
- declare class ServiceAccountInfo extends WithDebug {
9783
- static Codec = codec.Class(ServiceAccountInfo, {
9784
- codeHash: codec.bytes(HASH_SIZE).asOpaque<CodeHash>(),
9785
- balance: codec.u64,
9786
- accumulateMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
9787
- onTransferMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
9788
- storageUtilisationBytes: codec.u64,
9789
- gratisStorage: codec.u64,
9790
- storageUtilisationCount: codec.u32,
9791
- created: codec.u32.convert((x) => x, tryAsTimeSlot),
9792
- lastAccumulation: codec.u32.convert((x) => x, tryAsTimeSlot),
9793
- parentService: codec.u32.convert((x) => x, tryAsServiceId),
9794
- });
9795
-
9796
- static create(a: CodecRecord<ServiceAccountInfo>) {
9797
- return new ServiceAccountInfo(
9798
- a.codeHash,
9799
- a.balance,
9800
- a.accumulateMinGas,
9801
- a.onTransferMinGas,
9802
- a.storageUtilisationBytes,
9803
- a.gratisStorage,
9804
- a.storageUtilisationCount,
9805
- a.created,
9806
- a.lastAccumulation,
9807
- a.parentService,
9808
- );
9809
- }
9810
-
9811
- /**
9812
- * `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
9813
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
9814
- */
9815
- static calculateThresholdBalance(items: U32, bytes: U64, gratisStorage: U64): U64 {
9816
- const storageCost =
9817
- BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
9818
-
9819
- if (storageCost < 0n) {
9820
- return tryAsU64(0);
9821
- }
9822
-
9823
- if (storageCost >= 2n ** 64n) {
9824
- return tryAsU64(2n ** 64n - 1n);
9825
- }
9826
-
9827
- return tryAsU64(storageCost);
9828
- }
9829
-
9830
- private constructor(
9831
- /** `a_c`: Hash of the service code. */
9832
- public readonly codeHash: CodeHash,
9833
- /** `a_b`: Current account balance. */
9834
- public readonly balance: U64,
9835
- /** `a_g`: Minimal gas required to execute Accumulate entrypoint. */
9836
- public readonly accumulateMinGas: ServiceGas,
9837
- /** `a_m`: Minimal gas required to execute On Transfer entrypoint. */
9838
- public readonly onTransferMinGas: ServiceGas,
9839
- /** `a_o`: Total number of octets in storage. */
9840
- public readonly storageUtilisationBytes: U64,
9841
- /** `a_f`: Cost-free storage. Decreases both storage item count and total byte size. */
9842
- public readonly gratisStorage: U64,
9843
- /** `a_i`: Number of items in storage. */
9844
- public readonly storageUtilisationCount: U32,
9845
- /** `a_r`: Creation account time slot. */
9846
- public readonly created: TimeSlot,
9847
- /** `a_a`: Most recent accumulation time slot. */
9848
- public readonly lastAccumulation: TimeSlot,
9849
- /** `a_p`: Parent service ID. */
9850
- public readonly parentService: ServiceId,
9851
- ) {
9852
- super();
9853
- }
9854
- }
9855
-
9856
- declare class PreimageItem extends WithDebug {
9857
- static Codec = codec.Class(PreimageItem, {
9858
- hash: codec.bytes(HASH_SIZE).asOpaque<PreimageHash>(),
9859
- blob: codec.blob,
9860
- });
9861
-
9862
- static create({ hash, blob }: CodecRecord<PreimageItem>) {
9863
- return new PreimageItem(hash, blob);
9864
- }
9865
-
9866
- private constructor(
9867
- readonly hash: PreimageHash,
9868
- readonly blob: BytesBlob,
9869
- ) {
9870
- super();
9871
- }
9872
- }
9873
-
9874
- type StorageKey = Opaque<BytesBlob, "storage key">;
9875
-
9876
- declare class StorageItem extends WithDebug {
9877
- static Codec = codec.Class(StorageItem, {
9878
- key: codec.blob.convert(
9879
- (i) => i,
9880
- (o) => asOpaqueType(o),
9881
- ),
9882
- value: codec.blob,
9883
- });
9884
-
9885
- static create({ key, value }: CodecRecord<StorageItem>) {
9886
- return new StorageItem(key, value);
9887
- }
9888
-
9889
- private constructor(
9890
- readonly key: StorageKey,
9891
- readonly value: BytesBlob,
9892
- ) {
9893
- super();
9894
- }
9895
- }
9896
-
9897
- declare const MAX_LOOKUP_HISTORY_SLOTS = 3;
9898
- type LookupHistorySlots = KnownSizeArray<TimeSlot, `0-${typeof MAX_LOOKUP_HISTORY_SLOTS} timeslots`>;
9899
- declare function tryAsLookupHistorySlots(items: readonly TimeSlot[]): LookupHistorySlots {
9900
- const knownSize = asKnownSize(items) as LookupHistorySlots;
9901
- if (knownSize.length > MAX_LOOKUP_HISTORY_SLOTS) {
9902
- throw new Error(`Lookup history items must contain 0-${MAX_LOOKUP_HISTORY_SLOTS} timeslots.`);
9903
- }
9904
- return knownSize;
9905
- }
9906
-
9907
- /** https://graypaper.fluffylabs.dev/#/5f542d7/115400115800 */
9908
- declare class LookupHistoryItem {
9909
- constructor(
9910
- public readonly hash: PreimageHash,
9911
- public readonly length: U32,
9912
- /**
9913
- * Preimage availability history as a sequence of time slots.
9914
- * See PreimageStatus and the following GP fragment for more details.
9915
- * https://graypaper.fluffylabs.dev/#/5f542d7/11780011a500 */
9916
- public readonly slots: LookupHistorySlots,
9917
- ) {}
9918
-
9919
- static isRequested(item: LookupHistoryItem | LookupHistorySlots): boolean {
9920
- if ("slots" in item) {
9921
- return item.slots.length === 0;
9922
- }
9923
- return item.length === 0;
9924
- }
9925
- }
9926
-
9927
10014
  declare const codecServiceId: Descriptor<ServiceId> =
9928
10015
  Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_7)
9929
10016
  ? codec.u32.asOpaque<ServiceId>()
@@ -11098,8 +11185,9 @@ declare class InMemoryState extends WithDebug implements State, EnumerableState
11098
11185
  epochRoot: Bytes.zero(BANDERSNATCH_RING_ROOT_BYTES).asOpaque(),
11099
11186
  privilegedServices: PrivilegedServices.create({
11100
11187
  manager: tryAsServiceId(0),
11101
- authManager: tryAsPerCore(new Array(spec.coresCount).fill(tryAsServiceId(0)), spec),
11102
- validatorsManager: tryAsServiceId(0),
11188
+ assigners: tryAsPerCore(new Array(spec.coresCount).fill(tryAsServiceId(0)), spec),
11189
+ delegator: tryAsServiceId(0),
11190
+ registrar: tryAsServiceId(MAX_VALUE),
11103
11191
  autoAccumulateServices: [],
11104
11192
  }),
11105
11193
  accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
@@ -11233,6 +11321,7 @@ declare const index$e_codecPerCore: typeof codecPerCore;
11233
11321
  declare const index$e_codecServiceId: typeof codecServiceId;
11234
11322
  declare const index$e_codecVarGas: typeof codecVarGas;
11235
11323
  declare const index$e_codecVarU16: typeof codecVarU16;
11324
+ declare const index$e_codecWithVersion: typeof codecWithVersion;
11236
11325
  declare const index$e_hashComparator: typeof hashComparator;
11237
11326
  declare const index$e_ignoreValueWithDefault: typeof ignoreValueWithDefault;
11238
11327
  declare const index$e_serviceDataCodec: typeof serviceDataCodec;
@@ -11243,7 +11332,7 @@ declare const index$e_tryAsPerCore: typeof tryAsPerCore;
11243
11332
  declare const index$e_workReportsSortedSetCodec: typeof workReportsSortedSetCodec;
11244
11333
  declare const index$e_zeroSizeHint: typeof zeroSizeHint;
11245
11334
  declare namespace index$e {
11246
- export { index$e_AccumulationOutput as AccumulationOutput, index$e_AutoAccumulate as AutoAccumulate, index$e_AvailabilityAssignment as AvailabilityAssignment, index$e_BASE_SERVICE_BALANCE as BASE_SERVICE_BALANCE, index$e_BlockState as BlockState, index$e_CoreStatistics as CoreStatistics, index$e_DisputesRecords as DisputesRecords, index$e_ELECTIVE_BYTE_BALANCE as ELECTIVE_BYTE_BALANCE, index$e_ELECTIVE_ITEM_BALANCE as ELECTIVE_ITEM_BALANCE, index$e_InMemoryService as InMemoryService, index$e_InMemoryState as InMemoryState, index$e_LookupHistoryItem as LookupHistoryItem, index$e_MAX_LOOKUP_HISTORY_SLOTS as MAX_LOOKUP_HISTORY_SLOTS, index$e_PreimageItem as PreimageItem, index$e_PrivilegedServices as PrivilegedServices, index$e_RecentBlocks as RecentBlocks, index$e_RecentBlocksHistory as RecentBlocksHistory, index$e_SafroleData as SafroleData, index$e_SafroleSealingKeysData as SafroleSealingKeysData, index$e_SafroleSealingKeysKind as SafroleSealingKeysKind, index$e_ServiceAccountInfo as ServiceAccountInfo, index$e_ServiceStatistics as ServiceStatistics, index$e_StatisticsData as StatisticsData, index$e_StorageItem as StorageItem, index$e_UpdateError as UpdateError, index$e_UpdatePreimage as UpdatePreimage, index$e_UpdatePreimageKind as UpdatePreimageKind, index$e_UpdateService as UpdateService, index$e_UpdateServiceKind as UpdateServiceKind, index$e_UpdateStorage as UpdateStorage, index$e_UpdateStorageKind as UpdateStorageKind, index$e_ValidatorData as ValidatorData, index$e_ValidatorStatistics as ValidatorStatistics, index$e_accumulationOutputComparator as accumulationOutputComparator, index$e_codecBandersnatchKey as codecBandersnatchKey, index$e_codecPerCore as codecPerCore, index$e_codecServiceId as codecServiceId, index$e_codecVarGas as codecVarGas, index$e_codecVarU16 as codecVarU16, index$e_hashComparator as hashComparator, index$e_ignoreValueWithDefault as ignoreValueWithDefault, index$e_serviceDataCodec as serviceDataCodec, index$e_serviceEntriesCodec as serviceEntriesCodec, index$e_sortedSetCodec as sortedSetCodec, index$e_tryAsLookupHistorySlots as tryAsLookupHistorySlots, index$e_tryAsPerCore as tryAsPerCore, index$e_workReportsSortedSetCodec as workReportsSortedSetCodec, index$e_zeroSizeHint as zeroSizeHint };
11335
+ export { index$e_AccumulationOutput as AccumulationOutput, index$e_AutoAccumulate as AutoAccumulate, index$e_AvailabilityAssignment as AvailabilityAssignment, index$e_BASE_SERVICE_BALANCE as BASE_SERVICE_BALANCE, index$e_BlockState as BlockState, index$e_CoreStatistics as CoreStatistics, index$e_DisputesRecords as DisputesRecords, index$e_ELECTIVE_BYTE_BALANCE as ELECTIVE_BYTE_BALANCE, index$e_ELECTIVE_ITEM_BALANCE as ELECTIVE_ITEM_BALANCE, index$e_InMemoryService as InMemoryService, index$e_InMemoryState as InMemoryState, index$e_LookupHistoryItem as LookupHistoryItem, index$e_MAX_LOOKUP_HISTORY_SLOTS as MAX_LOOKUP_HISTORY_SLOTS, index$e_PreimageItem as PreimageItem, index$e_PrivilegedServices as PrivilegedServices, index$e_RecentBlocks as RecentBlocks, index$e_RecentBlocksHistory as RecentBlocksHistory, index$e_SafroleData as SafroleData, index$e_SafroleSealingKeysData as SafroleSealingKeysData, index$e_SafroleSealingKeysKind as SafroleSealingKeysKind, index$e_ServiceAccountInfo as ServiceAccountInfo, index$e_ServiceStatistics as ServiceStatistics, index$e_StatisticsData as StatisticsData, index$e_StorageItem as StorageItem, index$e_UpdateError as UpdateError, index$e_UpdatePreimage as UpdatePreimage, index$e_UpdatePreimageKind as UpdatePreimageKind, index$e_UpdateService as UpdateService, index$e_UpdateServiceKind as UpdateServiceKind, index$e_UpdateStorage as UpdateStorage, index$e_UpdateStorageKind as UpdateStorageKind, index$e_ValidatorData as ValidatorData, index$e_ValidatorStatistics as ValidatorStatistics, index$e_accumulationOutputComparator as accumulationOutputComparator, index$e_codecBandersnatchKey as codecBandersnatchKey, index$e_codecPerCore as codecPerCore, index$e_codecServiceId as codecServiceId, index$e_codecVarGas as codecVarGas, index$e_codecVarU16 as codecVarU16, index$e_codecWithVersion as codecWithVersion, index$e_hashComparator as hashComparator, index$e_ignoreValueWithDefault as ignoreValueWithDefault, index$e_serviceDataCodec as serviceDataCodec, index$e_serviceEntriesCodec as serviceEntriesCodec, index$e_sortedSetCodec as sortedSetCodec, index$e_tryAsLookupHistorySlots as tryAsLookupHistorySlots, index$e_tryAsPerCore as tryAsPerCore, index$e_workReportsSortedSetCodec as workReportsSortedSetCodec, index$e_zeroSizeHint as zeroSizeHint };
11247
11336
  export type { index$e_BlocksState as BlocksState, index$e_ENTROPY_ENTRIES as ENTROPY_ENTRIES, index$e_EnumerableState as EnumerableState, index$e_FieldNames as FieldNames, index$e_InMemoryStateFields as InMemoryStateFields, index$e_LookupHistorySlots as LookupHistorySlots, index$e_MAX_RECENT_HISTORY as MAX_RECENT_HISTORY, index$e_PerCore as PerCore, index$e_SafroleSealingKeys as SafroleSealingKeys, index$e_Service as Service, index$e_ServiceData as ServiceData, index$e_ServiceEntries as ServiceEntries, index$e_ServicesUpdate as ServicesUpdate, index$e_State as State, index$e_StorageKey as StorageKey, index$e_VALIDATOR_META_BYTES as VALIDATOR_META_BYTES };
11248
11337
  }
11249
11338
 
@@ -11533,7 +11622,9 @@ declare namespace serialize {
11533
11622
  /** C(255, s): https://graypaper.fluffylabs.dev/#/85129da/383103383103?v=0.6.3 */
11534
11623
  export const serviceData = (serviceId: ServiceId) => ({
11535
11624
  key: stateKeys.serviceInfo(serviceId),
11536
- Codec: ServiceAccountInfo.Codec,
11625
+ Codec: Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
11626
+ ? codecWithVersion(ServiceAccountInfo.Codec)
11627
+ : ServiceAccountInfo.Codec,
11537
11628
  });
11538
11629
 
11539
11630
  /** https://graypaper.fluffylabs.dev/#/85129da/384803384803?v=0.6.3 */
@@ -13601,6 +13692,8 @@ declare enum NewServiceError {
13601
13692
  InsufficientFunds = 0,
13602
13693
  /** Service is not privileged to set gratis storage. */
13603
13694
  UnprivilegedService = 1,
13695
+ /** Registrar attempting to create a service with already existing id. */
13696
+ RegistrarServiceIdAlreadyTaken = 2,
13604
13697
  }
13605
13698
 
13606
13699
  declare enum UpdatePrivilegesError {
@@ -13666,14 +13759,18 @@ interface PartialState {
13666
13759
  ): Result$2<OK, TransferError>;
13667
13760
 
13668
13761
  /**
13669
- * Create a new service with given codeHash, length, gas, allowance and gratisStorage.
13762
+ * Create a new service with given codeHash, length, gas, allowance, gratisStorage and wantedServiceId.
13670
13763
  *
13671
- * Returns a newly assigned id of that service.
13672
- * https://graypaper.fluffylabs.dev/#/7e6ff6a/2f4c022f4c02?v=0.6.7
13764
+ * Returns a newly assigned id
13765
+ * or `wantedServiceId` if it's lower than `S`
13766
+ * and parent of that service is `Registrar`.
13767
+ *
13768
+ * https://graypaper.fluffylabs.dev/#/ab2cdbd/2fa9042fc304?v=0.7.2
13673
13769
  *
13674
13770
  * An error can be returned in case the account does not
13675
13771
  * have the required balance
13676
- * or tries to set gratis storage without being privileged.
13772
+ * or tries to set gratis storage without being `Manager`
13773
+ * or `Registrar` tries to set service id thats already taken.
13677
13774
  */
13678
13775
  newService(
13679
13776
  codeHash: CodeHash,
@@ -13681,6 +13778,7 @@ interface PartialState {
13681
13778
  gas: ServiceGas,
13682
13779
  allowance: ServiceGas,
13683
13780
  gratisStorage: U64,
13781
+ wantedServiceId: U64,
13684
13782
  ): Result$2<ServiceId, NewServiceError>;
13685
13783
 
13686
13784
  /** Upgrade code of currently running service. */
@@ -13702,7 +13800,7 @@ interface PartialState {
13702
13800
  updateAuthorizationQueue(
13703
13801
  coreIndex: CoreIndex,
13704
13802
  authQueue: FixedSizeArray<Blake2bHash, AUTHORIZATION_QUEUE_SIZE>,
13705
- authManager: ServiceId | null,
13803
+ assigners: ServiceId | null,
13706
13804
  ): Result$2<OK, UpdatePrivilegesError>;
13707
13805
 
13708
13806
  /**
@@ -13711,14 +13809,16 @@ interface PartialState {
13711
13809
  * `m`: manager service (can change privileged services)
13712
13810
  * `a`: manages authorization queue
13713
13811
  * `v`: manages validator keys
13714
- * `g`: collection of serviceId -> gas that auto-accumulate every block
13812
+ * `r`: manages create new services in protected id range.
13813
+ * `z`: collection of serviceId -> gas that auto-accumulate every block
13715
13814
  *
13716
13815
  */
13717
13816
  updatePrivilegedServices(
13718
13817
  m: ServiceId | null,
13719
13818
  a: PerCore<ServiceId>,
13720
13819
  v: ServiceId | null,
13721
- g: [ServiceId, ServiceGas][],
13820
+ r: ServiceId | null,
13821
+ z: [ServiceId, ServiceGas][],
13722
13822
  ): Result$2<OK, UpdatePrivilegesError>;
13723
13823
 
13724
13824
  /** Yield accumulation trie result hash. */
@@ -17687,7 +17787,7 @@ declare class AccumulationStateUpdate {
17687
17787
  if (from.privilegedServices !== null) {
17688
17788
  update.privilegedServices = PrivilegedServices.create({
17689
17789
  ...from.privilegedServices,
17690
- authManager: asKnownSize([...from.privilegedServices.authManager]),
17790
+ assigners: asKnownSize([...from.privilegedServices.assigners]),
17691
17791
  });
17692
17792
  }
17693
17793
  return update;
@@ -17958,7 +18058,7 @@ declare const HostCallResult = {
17958
18058
  OOB: tryAsU64(0xffff_ffff_ffff_fffdn), // 2**64 - 3
17959
18059
  /** Index unknown. */
17960
18060
  WHO: tryAsU64(0xffff_ffff_ffff_fffcn), // 2**64 - 4
17961
- /** Storage full. */
18061
+ /** Storage full or resource already allocated. */
17962
18062
  FULL: tryAsU64(0xffff_ffff_ffff_fffbn), // 2**64 - 5
17963
18063
  /** Core index unknown. */
17964
18064
  CORE: tryAsU64(0xffff_ffff_ffff_fffan), // 2**64 - 6
@@ -17966,7 +18066,7 @@ declare const HostCallResult = {
17966
18066
  CASH: tryAsU64(0xffff_ffff_ffff_fff9n), // 2**64 - 7
17967
18067
  /** Gas limit too low. */
17968
18068
  LOW: tryAsU64(0xffff_ffff_ffff_fff8n), // 2**64 - 8
17969
- /** The item is already solicited or cannot be forgotten. */
18069
+ /** The item is already solicited, cannot be forgotten or the operation is invalid due to privilege level. */
17970
18070
  HUH: tryAsU64(0xffff_ffff_ffff_fff7n), // 2**64 - 9
17971
18071
  /** The return value indicating general success. */
17972
18072
  OK: tryAsU64(0n),
@@ -18871,6 +18971,7 @@ declare namespace index$2 {
18871
18971
  declare class JsonServiceInfo {
18872
18972
  static fromJson = json.object<JsonServiceInfo, ServiceAccountInfo>(
18873
18973
  {
18974
+ ...(Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? { version: "number" } : {}),
18874
18975
  code_hash: fromJson.bytes32(),
18875
18976
  balance: json.fromNumber((x) => tryAsU64(x)),
18876
18977
  min_item_gas: json.fromNumber((x) => tryAsServiceGas(x)),
@@ -18909,6 +19010,7 @@ declare class JsonServiceInfo {
18909
19010
  },
18910
19011
  );
18911
19012
 
19013
+ version?: number;
18912
19014
  code_hash!: CodeHash;
18913
19015
  balance!: U64;
18914
19016
  min_item_gas!: ServiceGas;
@@ -18955,6 +19057,19 @@ declare const lookupMetaFromJson = json.object<JsonLookupMeta, LookupHistoryItem
18955
19057
  ({ key, value }) => new LookupHistoryItem(key.hash, key.length, value),
18956
19058
  );
18957
19059
 
19060
+ declare const preimageStatusFromJson = json.object<JsonPreimageStatus, LookupHistoryItem>(
19061
+ {
19062
+ hash: fromJson.bytes32(),
19063
+ status: json.array("number"),
19064
+ },
19065
+ ({ hash, status }) => new LookupHistoryItem(hash, tryAsU32(0), status),
19066
+ );
19067
+
19068
+ type JsonPreimageStatus = {
19069
+ hash: PreimageHash;
19070
+ status: LookupHistorySlots;
19071
+ };
19072
+
18958
19073
  type JsonLookupMeta = {
18959
19074
  key: {
18960
19075
  hash: PreimageHash;
@@ -18967,21 +19082,34 @@ declare class JsonService {
18967
19082
  static fromJson = json.object<JsonService, InMemoryService>(
18968
19083
  {
18969
19084
  id: "number",
18970
- data: {
18971
- service: JsonServiceInfo.fromJson,
18972
- preimages: json.optional(json.array(JsonPreimageItem.fromJson)),
18973
- storage: json.optional(json.array(JsonStorageItem.fromJson)),
18974
- lookup_meta: json.optional(json.array(lookupMetaFromJson)),
18975
- },
19085
+ data: Compatibility.isLessThan(GpVersion.V0_7_1)
19086
+ ? {
19087
+ service: JsonServiceInfo.fromJson,
19088
+ preimages: json.optional(json.array(JsonPreimageItem.fromJson)),
19089
+ storage: json.optional(json.array(JsonStorageItem.fromJson)),
19090
+ lookup_meta: json.optional(json.array(lookupMetaFromJson)),
19091
+ }
19092
+ : {
19093
+ service: JsonServiceInfo.fromJson,
19094
+ storage: json.optional(json.array(JsonStorageItem.fromJson)),
19095
+ preimages_blob: json.optional(json.array(JsonPreimageItem.fromJson)),
19096
+ preimages_status: json.optional(json.array(preimageStatusFromJson)),
19097
+ },
18976
19098
  },
18977
19099
  ({ id, data }) => {
19100
+ const preimages = HashDictionary.fromEntries(
19101
+ (data.preimages ?? data.preimages_blob ?? []).map((x) => [x.hash, x]),
19102
+ );
19103
+
18978
19104
  const lookupHistory = HashDictionary.new<PreimageHash, LookupHistoryItem[]>();
18979
- for (const item of data.lookup_meta ?? []) {
19105
+
19106
+ for (const item of data.lookup_meta ?? data.preimages_status ?? []) {
18980
19107
  const data = lookupHistory.get(item.hash) ?? [];
18981
- data.push(item);
19108
+ const length = tryAsU32(preimages.get(item.hash)?.blob.length ?? item.length);
19109
+ data.push(new LookupHistoryItem(item.hash, length, item.slots));
18982
19110
  lookupHistory.set(item.hash, data);
18983
19111
  }
18984
- const preimages = HashDictionary.fromEntries((data.preimages ?? []).map((x) => [x.hash, x]));
19112
+
18985
19113
  const storage = new Map<string, StorageItem>();
18986
19114
 
18987
19115
  const entries = (data.storage ?? []).map(({ key, value }) => {
@@ -19008,6 +19136,8 @@ declare class JsonService {
19008
19136
  preimages?: JsonPreimageItem[];
19009
19137
  storage?: JsonStorageItem[];
19010
19138
  lookup_meta?: LookupHistoryItem[];
19139
+ preimages_blob?: JsonPreimageItem[];
19140
+ preimages_status?: LookupHistoryItem[];
19011
19141
  };
19012
19142
  }
19013
19143
 
@@ -19238,8 +19368,12 @@ declare class JsonServiceStatistics {
19238
19368
  extrinsic_count: "number",
19239
19369
  accumulate_count: "number",
19240
19370
  accumulate_gas_used: json.fromNumber(tryAsServiceGas),
19241
- on_transfers_count: "number",
19242
- on_transfers_gas_used: json.fromNumber(tryAsServiceGas),
19371
+ ...(Compatibility.isLessThan(GpVersion.V0_7_1)
19372
+ ? {
19373
+ on_transfers_count: "number",
19374
+ on_transfers_gas_used: json.fromNumber(tryAsServiceGas),
19375
+ }
19376
+ : {}),
19243
19377
  },
19244
19378
  ({
19245
19379
  provided_count,
@@ -19266,8 +19400,8 @@ declare class JsonServiceStatistics {
19266
19400
  extrinsicCount: extrinsic_count,
19267
19401
  accumulateCount: accumulate_count,
19268
19402
  accumulateGasUsed: accumulate_gas_used,
19269
- onTransfersCount: on_transfers_count,
19270
- onTransfersGasUsed: on_transfers_gas_used,
19403
+ onTransfersCount: on_transfers_count ?? tryAsU32(0),
19404
+ onTransfersGasUsed: on_transfers_gas_used ?? tryAsServiceGas(0),
19271
19405
  });
19272
19406
  },
19273
19407
  );
@@ -19282,8 +19416,8 @@ declare class JsonServiceStatistics {
19282
19416
  extrinsic_count!: U16;
19283
19417
  accumulate_count!: U32;
19284
19418
  accumulate_gas_used!: ServiceGas;
19285
- on_transfers_count!: U32;
19286
- on_transfers_gas_used!: ServiceGas;
19419
+ on_transfers_count?: U32;
19420
+ on_transfers_gas_used?: ServiceGas;
19287
19421
  }
19288
19422
 
19289
19423
  type ServiceStatisticsEntry = {
@@ -19355,8 +19489,9 @@ type JsonStateDump = {
19355
19489
  tau: State["timeslot"];
19356
19490
  chi: {
19357
19491
  chi_m: PrivilegedServices["manager"];
19358
- chi_a: PrivilegedServices["authManager"];
19359
- chi_v: PrivilegedServices["validatorsManager"];
19492
+ chi_a: PrivilegedServices["assigners"];
19493
+ chi_v: PrivilegedServices["delegator"];
19494
+ chi_r?: PrivilegedServices["registrar"];
19360
19495
  chi_g: PrivilegedServices["autoAccumulateServices"] | null;
19361
19496
  };
19362
19497
  pi: JsonStatisticsData;
@@ -19389,6 +19524,7 @@ declare const fullStateDumpFromJson = (spec: ChainSpec) =>
19389
19524
  chi_m: "number",
19390
19525
  chi_a: json.array("number"),
19391
19526
  chi_v: "number",
19527
+ chi_r: json.optional("number"),
19392
19528
  chi_g: json.nullable(
19393
19529
  json.array({
19394
19530
  service: "number",
@@ -19421,6 +19557,9 @@ declare const fullStateDumpFromJson = (spec: ChainSpec) =>
19421
19557
  theta,
19422
19558
  accounts,
19423
19559
  }): InMemoryState => {
19560
+ if (Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) && chi.chi_r === undefined) {
19561
+ throw new Error("Registrar is required in Privileges GP ^0.7.1");
19562
+ }
19424
19563
  return InMemoryState.create({
19425
19564
  authPools: tryAsPerCore(
19426
19565
  alpha.map((perCore) => {
@@ -19454,8 +19593,9 @@ declare const fullStateDumpFromJson = (spec: ChainSpec) =>
19454
19593
  timeslot: tau,
19455
19594
  privilegedServices: PrivilegedServices.create({
19456
19595
  manager: chi.chi_m,
19457
- authManager: chi.chi_a,
19458
- validatorsManager: chi.chi_v,
19596
+ assigners: chi.chi_a,
19597
+ delegator: chi.chi_v,
19598
+ registrar: chi.chi_r ?? tryAsServiceId(2 ** 32 - 1),
19459
19599
  autoAccumulateServices: chi.chi_g ?? [],
19460
19600
  }),
19461
19601
  statistics: JsonStatisticsData.toStatisticsData(spec, pi),
@@ -19478,6 +19618,7 @@ declare const index$1_JsonDisputesRecords: typeof JsonDisputesRecords;
19478
19618
  type index$1_JsonLookupMeta = JsonLookupMeta;
19479
19619
  type index$1_JsonPreimageItem = JsonPreimageItem;
19480
19620
  declare const index$1_JsonPreimageItem: typeof JsonPreimageItem;
19621
+ type index$1_JsonPreimageStatus = JsonPreimageStatus;
19481
19622
  type index$1_JsonRecentBlockState = JsonRecentBlockState;
19482
19623
  type index$1_JsonRecentBlocks = JsonRecentBlocks;
19483
19624
  type index$1_JsonReportedWorkPackageInfo = JsonReportedWorkPackageInfo;
@@ -19502,6 +19643,7 @@ declare const index$1_disputesRecordsFromJson: typeof disputesRecordsFromJson;
19502
19643
  declare const index$1_fullStateDumpFromJson: typeof fullStateDumpFromJson;
19503
19644
  declare const index$1_lookupMetaFromJson: typeof lookupMetaFromJson;
19504
19645
  declare const index$1_notYetAccumulatedFromJson: typeof notYetAccumulatedFromJson;
19646
+ declare const index$1_preimageStatusFromJson: typeof preimageStatusFromJson;
19505
19647
  declare const index$1_recentBlockStateFromJson: typeof recentBlockStateFromJson;
19506
19648
  declare const index$1_recentBlocksHistoryFromJson: typeof recentBlocksHistoryFromJson;
19507
19649
  declare const index$1_reportedWorkPackageFromJson: typeof reportedWorkPackageFromJson;
@@ -19509,8 +19651,8 @@ declare const index$1_serviceStatisticsEntryFromJson: typeof serviceStatisticsEn
19509
19651
  declare const index$1_ticketFromJson: typeof ticketFromJson;
19510
19652
  declare const index$1_validatorDataFromJson: typeof validatorDataFromJson;
19511
19653
  declare namespace index$1 {
19512
- export { index$1_JsonCoreStatistics as JsonCoreStatistics, index$1_JsonDisputesRecords as JsonDisputesRecords, index$1_JsonPreimageItem as JsonPreimageItem, index$1_JsonService as JsonService, index$1_JsonServiceInfo as JsonServiceInfo, index$1_JsonServiceStatistics as JsonServiceStatistics, index$1_JsonStatisticsData as JsonStatisticsData, index$1_JsonStorageItem as JsonStorageItem, index$1_JsonValidatorStatistics as JsonValidatorStatistics, index$1_TicketsOrKeys as TicketsOrKeys, index$1_availabilityAssignmentFromJson as availabilityAssignmentFromJson, index$1_disputesRecordsFromJson as disputesRecordsFromJson, index$1_fullStateDumpFromJson as fullStateDumpFromJson, index$1_lookupMetaFromJson as lookupMetaFromJson, index$1_notYetAccumulatedFromJson as notYetAccumulatedFromJson, index$1_recentBlockStateFromJson as recentBlockStateFromJson, index$1_recentBlocksHistoryFromJson as recentBlocksHistoryFromJson, index$1_reportedWorkPackageFromJson as reportedWorkPackageFromJson, index$1_serviceStatisticsEntryFromJson as serviceStatisticsEntryFromJson, index$1_ticketFromJson as ticketFromJson, index$1_validatorDataFromJson as validatorDataFromJson };
19513
- export type { index$1_JsonAvailabilityAssignment as JsonAvailabilityAssignment, index$1_JsonLookupMeta as JsonLookupMeta, index$1_JsonRecentBlockState as JsonRecentBlockState, index$1_JsonRecentBlocks as JsonRecentBlocks, index$1_JsonReportedWorkPackageInfo as JsonReportedWorkPackageInfo, index$1_JsonStateDump as JsonStateDump, index$1_ServiceStatisticsEntry as ServiceStatisticsEntry };
19654
+ export { index$1_JsonCoreStatistics as JsonCoreStatistics, index$1_JsonDisputesRecords as JsonDisputesRecords, index$1_JsonPreimageItem as JsonPreimageItem, index$1_JsonService as JsonService, index$1_JsonServiceInfo as JsonServiceInfo, index$1_JsonServiceStatistics as JsonServiceStatistics, index$1_JsonStatisticsData as JsonStatisticsData, index$1_JsonStorageItem as JsonStorageItem, index$1_JsonValidatorStatistics as JsonValidatorStatistics, index$1_TicketsOrKeys as TicketsOrKeys, index$1_availabilityAssignmentFromJson as availabilityAssignmentFromJson, index$1_disputesRecordsFromJson as disputesRecordsFromJson, index$1_fullStateDumpFromJson as fullStateDumpFromJson, index$1_lookupMetaFromJson as lookupMetaFromJson, index$1_notYetAccumulatedFromJson as notYetAccumulatedFromJson, index$1_preimageStatusFromJson as preimageStatusFromJson, index$1_recentBlockStateFromJson as recentBlockStateFromJson, index$1_recentBlocksHistoryFromJson as recentBlocksHistoryFromJson, index$1_reportedWorkPackageFromJson as reportedWorkPackageFromJson, index$1_serviceStatisticsEntryFromJson as serviceStatisticsEntryFromJson, index$1_ticketFromJson as ticketFromJson, index$1_validatorDataFromJson as validatorDataFromJson };
19655
+ export type { index$1_JsonAvailabilityAssignment as JsonAvailabilityAssignment, index$1_JsonLookupMeta as JsonLookupMeta, index$1_JsonPreimageStatus as JsonPreimageStatus, index$1_JsonRecentBlockState as JsonRecentBlockState, index$1_JsonRecentBlocks as JsonRecentBlocks, index$1_JsonReportedWorkPackageInfo as JsonReportedWorkPackageInfo, index$1_JsonStateDump as JsonStateDump, index$1_ServiceStatisticsEntry as ServiceStatisticsEntry };
19514
19656
  }
19515
19657
 
19516
19658
  /** Helper function to create most used hashes in the block */