@typeberry/jam 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.
- package/bootstrap-generator.mjs +333 -236
- package/bootstrap-generator.mjs.map +1 -1
- package/bootstrap-importer.mjs +794 -474
- package/bootstrap-importer.mjs.map +1 -1
- package/bootstrap-network.mjs +335 -237
- package/bootstrap-network.mjs.map +1 -1
- package/index.js +793 -472
- package/index.js.map +1 -1
- package/package.json +1 -1
package/bootstrap-network.mjs
CHANGED
|
@@ -24062,8 +24062,9 @@ function parseCurrentVersion(env) {
|
|
|
24062
24062
|
}
|
|
24063
24063
|
}
|
|
24064
24064
|
function parseCurrentSuite(env) {
|
|
24065
|
-
if (env === undefined)
|
|
24065
|
+
if (env === undefined) {
|
|
24066
24066
|
return undefined;
|
|
24067
|
+
}
|
|
24067
24068
|
switch (env) {
|
|
24068
24069
|
case TestSuite.W3F_DAVXY:
|
|
24069
24070
|
case TestSuite.JAMDUNA:
|
|
@@ -24494,10 +24495,12 @@ function deepEqual(actual, expected, { context = [], errorsCollector, ignore = [
|
|
|
24494
24495
|
.sort((a, b) => {
|
|
24495
24496
|
const aKey = `${a.key}`;
|
|
24496
24497
|
const bKey = `${b.key}`;
|
|
24497
|
-
if (aKey < bKey)
|
|
24498
|
+
if (aKey < bKey) {
|
|
24498
24499
|
return -1;
|
|
24499
|
-
|
|
24500
|
+
}
|
|
24501
|
+
if (bKey < aKey) {
|
|
24500
24502
|
return 1;
|
|
24503
|
+
}
|
|
24501
24504
|
return 0;
|
|
24502
24505
|
});
|
|
24503
24506
|
};
|
|
@@ -25509,7 +25512,7 @@ class Skipper {
|
|
|
25509
25512
|
*
|
|
25510
25513
|
* Descriptors can be composed to form more complex typings.
|
|
25511
25514
|
*/
|
|
25512
|
-
class
|
|
25515
|
+
class Descriptor {
|
|
25513
25516
|
name;
|
|
25514
25517
|
sizeHint;
|
|
25515
25518
|
encode;
|
|
@@ -25519,11 +25522,11 @@ class descriptor_Descriptor {
|
|
|
25519
25522
|
View;
|
|
25520
25523
|
/** New descriptor with specialized `View`. */
|
|
25521
25524
|
static withView(name, sizeHint, encode, decode, skip, view) {
|
|
25522
|
-
return new
|
|
25525
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, view);
|
|
25523
25526
|
}
|
|
25524
25527
|
/** Create a new descriptor without a specialized `View`. */
|
|
25525
25528
|
static new(name, sizeHint, encode, decode, skip) {
|
|
25526
|
-
return new
|
|
25529
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, null);
|
|
25527
25530
|
}
|
|
25528
25531
|
constructor(
|
|
25529
25532
|
/** Descriptive name of the coded data. */
|
|
@@ -25560,7 +25563,7 @@ class descriptor_Descriptor {
|
|
|
25560
25563
|
}
|
|
25561
25564
|
/** Return a new descriptor that converts data into some other type. */
|
|
25562
25565
|
convert(input, output) {
|
|
25563
|
-
return new
|
|
25566
|
+
return new Descriptor(this.name, this.sizeHint, (e, elem) => this.encode(e, input(elem)), (d) => output(this.decode(d)), this.skip, this.View);
|
|
25564
25567
|
}
|
|
25565
25568
|
/** Safely cast the descriptor value to a opaque type. */
|
|
25566
25569
|
asOpaque() {
|
|
@@ -26258,51 +26261,51 @@ var descriptors_codec;
|
|
|
26258
26261
|
return (len) => {
|
|
26259
26262
|
let ret = cache.get(len);
|
|
26260
26263
|
if (ret === undefined) {
|
|
26261
|
-
ret =
|
|
26264
|
+
ret = Descriptor.new(`Bytes<${len}>`, exactHint(len), (e, v) => e.bytes(v), (d) => d.bytes(len), (s) => s.bytes(len));
|
|
26262
26265
|
cache.set(len, ret);
|
|
26263
26266
|
}
|
|
26264
26267
|
return ret;
|
|
26265
26268
|
};
|
|
26266
26269
|
})();
|
|
26267
26270
|
/** Variable-length U32. */
|
|
26268
|
-
codec.varU32 =
|
|
26271
|
+
codec.varU32 = Descriptor.new("var_u32", { bytes: 4, isExact: false }, (e, v) => e.varU32(v), (d) => d.varU32(), (d) => d.varU32());
|
|
26269
26272
|
/** Variable-length U64. */
|
|
26270
|
-
codec.varU64 =
|
|
26273
|
+
codec.varU64 = Descriptor.new("var_u64", { bytes: 8, isExact: false }, (e, v) => e.varU64(v), (d) => d.varU64(), (d) => d.varU64());
|
|
26271
26274
|
/** Unsigned 64-bit number. */
|
|
26272
|
-
codec.u64 =
|
|
26275
|
+
codec.u64 = Descriptor.withView("u64", exactHint(8), (e, v) => e.i64(v), (d) => d.u64(), (d) => d.u64(), codec.bytes(8));
|
|
26273
26276
|
/** Unsigned 32-bit number. */
|
|
26274
|
-
codec.u32 =
|
|
26277
|
+
codec.u32 = Descriptor.withView("u32", exactHint(4), (e, v) => e.i32(v), (d) => d.u32(), (d) => d.u32(), codec.bytes(4));
|
|
26275
26278
|
/** Unsigned 24-bit number. */
|
|
26276
|
-
codec.u24 =
|
|
26279
|
+
codec.u24 = Descriptor.withView("u24", exactHint(3), (e, v) => e.i24(v), (d) => d.u24(), (d) => d.u24(), codec.bytes(3));
|
|
26277
26280
|
/** Unsigned 16-bit number. */
|
|
26278
|
-
codec.u16 =
|
|
26281
|
+
codec.u16 = Descriptor.withView("u16", exactHint(2), (e, v) => e.i16(v), (d) => d.u16(), (d) => d.u16(), codec.bytes(2));
|
|
26279
26282
|
/** Unsigned 8-bit number. */
|
|
26280
|
-
codec.u8 =
|
|
26283
|
+
codec.u8 = Descriptor.new("u8", exactHint(1), (e, v) => e.i8(v), (d) => d.u8(), (d) => d.u8());
|
|
26281
26284
|
/** Signed 64-bit number. */
|
|
26282
|
-
codec.i64 =
|
|
26285
|
+
codec.i64 = Descriptor.withView("u64", exactHint(8), (e, v) => e.i64(v), (d) => d.i64(), (s) => s.u64(), codec.bytes(8));
|
|
26283
26286
|
/** Signed 32-bit number. */
|
|
26284
|
-
codec.i32 =
|
|
26287
|
+
codec.i32 = Descriptor.withView("i32", exactHint(4), (e, v) => e.i32(v), (d) => d.i32(), (s) => s.u32(), codec.bytes(4));
|
|
26285
26288
|
/** Signed 24-bit number. */
|
|
26286
|
-
codec.i24 =
|
|
26289
|
+
codec.i24 = Descriptor.withView("i24", exactHint(3), (e, v) => e.i24(v), (d) => d.i24(), (s) => s.u24(), codec.bytes(3));
|
|
26287
26290
|
/** Signed 16-bit number. */
|
|
26288
|
-
codec.i16 =
|
|
26291
|
+
codec.i16 = Descriptor.withView("i16", exactHint(2), (e, v) => e.i16(v), (d) => d.i16(), (s) => s.u16(), codec.bytes(2));
|
|
26289
26292
|
/** Signed 8-bit number. */
|
|
26290
|
-
codec.i8 =
|
|
26293
|
+
codec.i8 = Descriptor.new("i8", exactHint(1), (e, v) => e.i8(v), (d) => d.i8(), (s) => s.u8());
|
|
26291
26294
|
/** 1-byte boolean value. */
|
|
26292
|
-
codec.bool =
|
|
26295
|
+
codec.bool = Descriptor.new("bool", exactHint(1), (e, v) => e.bool(v), (d) => d.bool(), (s) => s.bool());
|
|
26293
26296
|
/** Variable-length bytes blob. */
|
|
26294
|
-
codec.blob =
|
|
26297
|
+
codec.blob = Descriptor.new("BytesBlob", { bytes: TYPICAL_SEQUENCE_LENGTH, isExact: false }, (e, v) => e.bytesBlob(v), (d) => d.bytesBlob(), (s) => s.bytesBlob());
|
|
26295
26298
|
/** String encoded as variable-length bytes blob. */
|
|
26296
|
-
codec.string =
|
|
26299
|
+
codec.string = 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);
|
|
26297
26300
|
/** Variable-length bit vector. */
|
|
26298
|
-
codec.bitVecVarLen =
|
|
26301
|
+
codec.bitVecVarLen = Descriptor.new("BitVec[?]", { bytes: TYPICAL_SEQUENCE_LENGTH >>> 3, isExact: false }, (e, v) => e.bitVecVarLen(v), (d) => d.bitVecVarLen(), (s) => s.bitVecVarLen());
|
|
26299
26302
|
/** Fixed-length bit vector. */
|
|
26300
|
-
codec.bitVecFixLen = (bitLen) =>
|
|
26303
|
+
codec.bitVecFixLen = (bitLen) => Descriptor.new(`BitVec[${bitLen}]`, exactHint(bitLen >>> 3), (e, v) => e.bitVecFixLen(v), (d) => d.bitVecFixLen(bitLen), (s) => s.bitVecFixLen(bitLen));
|
|
26301
26304
|
/** Optionality wrapper for given type. */
|
|
26302
26305
|
codec.optional = (type) => {
|
|
26303
|
-
const self =
|
|
26306
|
+
const self = 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));
|
|
26304
26307
|
if (hasUniqueView(type)) {
|
|
26305
|
-
return
|
|
26308
|
+
return Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.optional(type.View));
|
|
26306
26309
|
}
|
|
26307
26310
|
return self;
|
|
26308
26311
|
};
|
|
@@ -26313,7 +26316,7 @@ var descriptors_codec;
|
|
|
26313
26316
|
}) => {
|
|
26314
26317
|
const name = `Sequence<${type.name}>[?]`;
|
|
26315
26318
|
const typicalLength = options.typicalLength ?? TYPICAL_SEQUENCE_LENGTH;
|
|
26316
|
-
return
|
|
26319
|
+
return Descriptor.withView(name, { bytes: typicalLength * type.sizeHint.bytes, isExact: false }, (e, v) => {
|
|
26317
26320
|
validateLength(options, v.length, name);
|
|
26318
26321
|
e.sequenceVarLen(type, v);
|
|
26319
26322
|
}, (d) => {
|
|
@@ -26327,10 +26330,10 @@ var descriptors_codec;
|
|
|
26327
26330
|
}, sequenceViewVarLen(type, options));
|
|
26328
26331
|
};
|
|
26329
26332
|
/** Fixed-length sequence of given type. */
|
|
26330
|
-
codec.sequenceFixLen = (type, len) =>
|
|
26333
|
+
codec.sequenceFixLen = (type, len) => 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 }));
|
|
26331
26334
|
/** Small dictionary codec. */
|
|
26332
26335
|
codec.dictionary = (key, value, { sortKeys, fixedLength, }) => {
|
|
26333
|
-
const self =
|
|
26336
|
+
const self = Descriptor.new(`Dictionary<${key.name}, ${value.name}>[${fixedLength ?? "?"}]`, {
|
|
26334
26337
|
bytes: fixedLength !== undefined
|
|
26335
26338
|
? fixedLength * addSizeHints(key.sizeHint, value.sizeHint).bytes
|
|
26336
26339
|
: TYPICAL_DICTIONARY_LENGTH * (addSizeHints(key.sizeHint, value.sizeHint).bytes ?? 0),
|
|
@@ -26369,13 +26372,13 @@ var descriptors_codec;
|
|
|
26369
26372
|
s.sequenceFixLen(value, len);
|
|
26370
26373
|
});
|
|
26371
26374
|
if (hasUniqueView(value)) {
|
|
26372
|
-
return
|
|
26375
|
+
return Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.dictionary(key, value.View, { sortKeys, fixedLength }));
|
|
26373
26376
|
}
|
|
26374
26377
|
return self;
|
|
26375
26378
|
};
|
|
26376
26379
|
/** Encoding of pair of two values. */
|
|
26377
26380
|
codec.pair = (a, b) => {
|
|
26378
|
-
const self =
|
|
26381
|
+
const self = Descriptor.new(`Pair<${a.name}, ${b.name}>`, addSizeHints(a.sizeHint, b.sizeHint), (e, elem) => {
|
|
26379
26382
|
a.encode(e, elem[0]);
|
|
26380
26383
|
b.encode(e, elem[1]);
|
|
26381
26384
|
}, (d) => {
|
|
@@ -26387,14 +26390,14 @@ var descriptors_codec;
|
|
|
26387
26390
|
b.skip(s);
|
|
26388
26391
|
});
|
|
26389
26392
|
if (hasUniqueView(a) && hasUniqueView(b)) {
|
|
26390
|
-
return
|
|
26393
|
+
return Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.pair(a.View, b.View));
|
|
26391
26394
|
}
|
|
26392
26395
|
return self;
|
|
26393
26396
|
};
|
|
26394
26397
|
/** Custom encoding / decoding logic. */
|
|
26395
|
-
codec.custom = ({ name, sizeHint = { bytes: 0, isExact: false }, }, encode, decode, skip) =>
|
|
26398
|
+
codec.custom = ({ name, sizeHint = { bytes: 0, isExact: false }, }, encode, decode, skip) => Descriptor.new(name, sizeHint, encode, decode, skip);
|
|
26396
26399
|
/** Choose a descriptor depending on the encoding/decoding context. */
|
|
26397
|
-
codec.select = ({ name, sizeHint, }, chooser) =>
|
|
26400
|
+
codec.select = ({ name, sizeHint, }, chooser) => 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), chooser(null).View);
|
|
26398
26401
|
/**
|
|
26399
26402
|
* A descriptor for a more complex POJO.
|
|
26400
26403
|
*
|
|
@@ -26431,7 +26434,7 @@ var descriptors_codec;
|
|
|
26431
26434
|
};
|
|
26432
26435
|
const view = objectView(Class, descriptors, sizeHint, skipper);
|
|
26433
26436
|
// and create the descriptor for the entire class.
|
|
26434
|
-
return
|
|
26437
|
+
return Descriptor.withView(Class.name, sizeHint, (e, t) => {
|
|
26435
26438
|
forEachDescriptor(descriptors, (key, descriptor) => {
|
|
26436
26439
|
const value = t[key];
|
|
26437
26440
|
descriptor.encode(e, value);
|
|
@@ -26482,7 +26485,7 @@ function objectView(Class, descriptors, sizeHint, skipper) {
|
|
|
26482
26485
|
});
|
|
26483
26486
|
}
|
|
26484
26487
|
});
|
|
26485
|
-
return
|
|
26488
|
+
return Descriptor.new(`View<${Class.name}>`, sizeHint, (e, t) => {
|
|
26486
26489
|
const encoded = t.encoded();
|
|
26487
26490
|
e.bytes(bytes_Bytes.fromBlob(encoded.raw, encoded.length));
|
|
26488
26491
|
}, (d) => {
|
|
@@ -26501,7 +26504,7 @@ function sequenceViewVarLen(type, options) {
|
|
|
26501
26504
|
validateLength(options, length, name);
|
|
26502
26505
|
return s.sequenceFixLen(type, length);
|
|
26503
26506
|
};
|
|
26504
|
-
return
|
|
26507
|
+
return Descriptor.new(name, sizeHint, (e, t) => {
|
|
26505
26508
|
validateLength(options, t.length, name);
|
|
26506
26509
|
const encoded = t.encoded();
|
|
26507
26510
|
e.bytes(bytes_Bytes.fromBlob(encoded.raw, encoded.length));
|
|
@@ -26517,7 +26520,7 @@ function sequenceViewFixLen(type, { fixedLength }) {
|
|
|
26517
26520
|
const skipper = (s) => s.sequenceFixLen(type, fixedLength);
|
|
26518
26521
|
const view = type.name !== type.View.name ? `, ${type.View.name}` : "";
|
|
26519
26522
|
const name = `SeqView<${type.name}${view}>[${fixedLength}]`;
|
|
26520
|
-
return
|
|
26523
|
+
return Descriptor.new(name, sizeHint, (e, t) => {
|
|
26521
26524
|
const encoded = t.encoded();
|
|
26522
26525
|
e.bytes(bytes_Bytes.fromBlob(encoded.raw, encoded.length));
|
|
26523
26526
|
}, (d) => {
|
|
@@ -27906,6 +27909,49 @@ function keccak_hashBlobs(hasher, blobs) {
|
|
|
27906
27909
|
|
|
27907
27910
|
|
|
27908
27911
|
|
|
27912
|
+
;// CONCATENATED MODULE: ./packages/core/collections/array-view.ts
|
|
27913
|
+
|
|
27914
|
+
/**
|
|
27915
|
+
* A utility class providing a readonly view over a portion of an array without copying it.
|
|
27916
|
+
*/
|
|
27917
|
+
class ArrayView {
|
|
27918
|
+
start;
|
|
27919
|
+
end;
|
|
27920
|
+
source;
|
|
27921
|
+
length;
|
|
27922
|
+
constructor(source, start, end) {
|
|
27923
|
+
this.start = start;
|
|
27924
|
+
this.end = end;
|
|
27925
|
+
this.source = source;
|
|
27926
|
+
this.length = end - start;
|
|
27927
|
+
}
|
|
27928
|
+
static from(source, start = 0, end = source.length) {
|
|
27929
|
+
debug_check `
|
|
27930
|
+
${start >= 0 && end <= source.length && start <= end}
|
|
27931
|
+
Invalid start (${start})/end (${end}) for ArrayView
|
|
27932
|
+
`;
|
|
27933
|
+
return new ArrayView(source, start, end);
|
|
27934
|
+
}
|
|
27935
|
+
get(i) {
|
|
27936
|
+
debug_check `
|
|
27937
|
+
${i >= 0 && i < this.length}
|
|
27938
|
+
Index out of bounds: ${i} < ${this.length}
|
|
27939
|
+
`;
|
|
27940
|
+
return this.source[this.start + i];
|
|
27941
|
+
}
|
|
27942
|
+
subview(from, to = this.length) {
|
|
27943
|
+
return ArrayView.from(this.source, this.start + from, this.start + to);
|
|
27944
|
+
}
|
|
27945
|
+
toArray() {
|
|
27946
|
+
return this.source.slice(this.start, this.end);
|
|
27947
|
+
}
|
|
27948
|
+
*[Symbol.iterator]() {
|
|
27949
|
+
for (let i = this.start; i < this.end; i++) {
|
|
27950
|
+
yield this.source[i];
|
|
27951
|
+
}
|
|
27952
|
+
}
|
|
27953
|
+
}
|
|
27954
|
+
|
|
27909
27955
|
;// CONCATENATED MODULE: ./packages/core/collections/hash-dictionary.ts
|
|
27910
27956
|
/** A map which uses hashes as keys. */
|
|
27911
27957
|
class hash_dictionary_HashDictionary {
|
|
@@ -28517,6 +28563,7 @@ class truncated_hash_dictionary_TruncatedHashDictionary {
|
|
|
28517
28563
|
|
|
28518
28564
|
|
|
28519
28565
|
|
|
28566
|
+
|
|
28520
28567
|
;// CONCATENATED MODULE: ./packages/jam/config/chain-spec.ts
|
|
28521
28568
|
|
|
28522
28569
|
|
|
@@ -28774,7 +28821,7 @@ const codecFixedSizeArray = (val, len) => {
|
|
|
28774
28821
|
};
|
|
28775
28822
|
/** Codec for a hash-dictionary. */
|
|
28776
28823
|
const codecHashDictionary = (value, extractKey, { typicalLength = TYPICAL_DICTIONARY_LENGTH, compare = (a, b) => extractKey(a).compare(extractKey(b)), } = {}) => {
|
|
28777
|
-
return
|
|
28824
|
+
return Descriptor.new(`HashDictionary<${value.name}>[?]`, {
|
|
28778
28825
|
bytes: typicalLength * value.sizeHint.bytes,
|
|
28779
28826
|
isExact: false,
|
|
28780
28827
|
}, (e, v) => {
|
|
@@ -31836,6 +31883,13 @@ const W_T = 128;
|
|
|
31836
31883
|
/** `W_M`: The maximum number of exports in a work-package. */
|
|
31837
31884
|
const W_X = 3_072;
|
|
31838
31885
|
// TODO [ToDr] Not sure where these should live yet :(
|
|
31886
|
+
/**
|
|
31887
|
+
* `S`: The minimum public service index.
|
|
31888
|
+
* Services of indices below these may only be created by the Registrar.
|
|
31889
|
+
*
|
|
31890
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/447a00447a00?v=0.7.2
|
|
31891
|
+
*/
|
|
31892
|
+
const MIN_PUBLIC_SERVICE_INDEX = (/* unused pure expression or super */ null && (2 ** 16));
|
|
31839
31893
|
/**
|
|
31840
31894
|
* `J`: The maximum sum of dependency items in a work-report.
|
|
31841
31895
|
*
|
|
@@ -31847,9 +31901,209 @@ const AUTHORIZATION_QUEUE_SIZE = Q;
|
|
|
31847
31901
|
/** `O`: Maximal authorization pool size. */
|
|
31848
31902
|
const MAX_AUTH_POOL_SIZE = O;
|
|
31849
31903
|
|
|
31904
|
+
;// CONCATENATED MODULE: ./packages/core/pvm-interpreter/ops/math-consts.ts
|
|
31905
|
+
const MAX_VALUE = 4294967295;
|
|
31906
|
+
const math_consts_MAX_VALUE_U64 = (/* unused pure expression or super */ null && (2n ** 63n));
|
|
31907
|
+
const MIN_VALUE = (/* unused pure expression or super */ null && (-(2 ** 31)));
|
|
31908
|
+
const MAX_SHIFT_U32 = 32;
|
|
31909
|
+
const MAX_SHIFT_U64 = 64n;
|
|
31910
|
+
|
|
31911
|
+
;// CONCATENATED MODULE: ./packages/jam/state/service.ts
|
|
31912
|
+
|
|
31913
|
+
|
|
31914
|
+
|
|
31915
|
+
|
|
31916
|
+
|
|
31917
|
+
|
|
31918
|
+
/**
|
|
31919
|
+
* `B_S`: The basic minimum balance which all services require.
|
|
31920
|
+
*
|
|
31921
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
|
|
31922
|
+
*/
|
|
31923
|
+
const BASE_SERVICE_BALANCE = 100n;
|
|
31924
|
+
/**
|
|
31925
|
+
* `B_I`: The additional minimum balance required per item of elective service state.
|
|
31926
|
+
*
|
|
31927
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
|
|
31928
|
+
*/
|
|
31929
|
+
const ELECTIVE_ITEM_BALANCE = 10n;
|
|
31930
|
+
/**
|
|
31931
|
+
* `B_L`: The additional minimum balance required per octet of elective service state.
|
|
31932
|
+
*
|
|
31933
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
|
|
31934
|
+
*/
|
|
31935
|
+
const ELECTIVE_BYTE_BALANCE = 1n;
|
|
31936
|
+
const zeroSizeHint = {
|
|
31937
|
+
bytes: 0,
|
|
31938
|
+
isExact: true,
|
|
31939
|
+
};
|
|
31940
|
+
/** 0-byte read, return given default value */
|
|
31941
|
+
const ignoreValueWithDefault = (defaultValue) => Descriptor.new("ignoreValue", zeroSizeHint, (_e, _v) => { }, (_d) => defaultValue, (_s) => { });
|
|
31942
|
+
/** Encode and decode object with leading version number. */
|
|
31943
|
+
const codecWithVersion = (val) => Descriptor.new("withVersion", {
|
|
31944
|
+
bytes: val.sizeHint.bytes + 8,
|
|
31945
|
+
isExact: false,
|
|
31946
|
+
}, (e, v) => {
|
|
31947
|
+
e.varU64(0n);
|
|
31948
|
+
val.encode(e, v);
|
|
31949
|
+
}, (d) => {
|
|
31950
|
+
const version = d.varU64();
|
|
31951
|
+
if (version !== 0n) {
|
|
31952
|
+
throw new Error("Non-zero version is not supported!");
|
|
31953
|
+
}
|
|
31954
|
+
return val.decode(d);
|
|
31955
|
+
}, (s) => {
|
|
31956
|
+
s.varU64();
|
|
31957
|
+
val.skip(s);
|
|
31958
|
+
});
|
|
31959
|
+
/**
|
|
31960
|
+
* Service account details.
|
|
31961
|
+
*
|
|
31962
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
|
|
31963
|
+
*/
|
|
31964
|
+
class ServiceAccountInfo extends WithDebug {
|
|
31965
|
+
codeHash;
|
|
31966
|
+
balance;
|
|
31967
|
+
accumulateMinGas;
|
|
31968
|
+
onTransferMinGas;
|
|
31969
|
+
storageUtilisationBytes;
|
|
31970
|
+
gratisStorage;
|
|
31971
|
+
storageUtilisationCount;
|
|
31972
|
+
created;
|
|
31973
|
+
lastAccumulation;
|
|
31974
|
+
parentService;
|
|
31975
|
+
static Codec = descriptors_codec.Class(ServiceAccountInfo, {
|
|
31976
|
+
codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
31977
|
+
balance: descriptors_codec.u64,
|
|
31978
|
+
accumulateMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
31979
|
+
onTransferMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
31980
|
+
storageUtilisationBytes: descriptors_codec.u64,
|
|
31981
|
+
gratisStorage: descriptors_codec.u64,
|
|
31982
|
+
storageUtilisationCount: descriptors_codec.u32,
|
|
31983
|
+
created: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
31984
|
+
lastAccumulation: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
31985
|
+
parentService: descriptors_codec.u32.convert((x) => x, tryAsServiceId),
|
|
31986
|
+
});
|
|
31987
|
+
static create(a) {
|
|
31988
|
+
return new ServiceAccountInfo(a.codeHash, a.balance, a.accumulateMinGas, a.onTransferMinGas, a.storageUtilisationBytes, a.gratisStorage, a.storageUtilisationCount, a.created, a.lastAccumulation, a.parentService);
|
|
31989
|
+
}
|
|
31990
|
+
/**
|
|
31991
|
+
* `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
|
|
31992
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
|
|
31993
|
+
*/
|
|
31994
|
+
static calculateThresholdBalance(items, bytes, gratisStorage) {
|
|
31995
|
+
const storageCost = BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
|
|
31996
|
+
if (storageCost < 0n) {
|
|
31997
|
+
return tryAsU64(0);
|
|
31998
|
+
}
|
|
31999
|
+
if (storageCost >= 2n ** 64n) {
|
|
32000
|
+
return tryAsU64(2n ** 64n - 1n);
|
|
32001
|
+
}
|
|
32002
|
+
return tryAsU64(storageCost);
|
|
32003
|
+
}
|
|
32004
|
+
constructor(
|
|
32005
|
+
/** `a_c`: Hash of the service code. */
|
|
32006
|
+
codeHash,
|
|
32007
|
+
/** `a_b`: Current account balance. */
|
|
32008
|
+
balance,
|
|
32009
|
+
/** `a_g`: Minimal gas required to execute Accumulate entrypoint. */
|
|
32010
|
+
accumulateMinGas,
|
|
32011
|
+
/** `a_m`: Minimal gas required to execute On Transfer entrypoint. */
|
|
32012
|
+
onTransferMinGas,
|
|
32013
|
+
/** `a_o`: Total number of octets in storage. */
|
|
32014
|
+
storageUtilisationBytes,
|
|
32015
|
+
/** `a_f`: Cost-free storage. Decreases both storage item count and total byte size. */
|
|
32016
|
+
gratisStorage,
|
|
32017
|
+
/** `a_i`: Number of items in storage. */
|
|
32018
|
+
storageUtilisationCount,
|
|
32019
|
+
/** `a_r`: Creation account time slot. */
|
|
32020
|
+
created,
|
|
32021
|
+
/** `a_a`: Most recent accumulation time slot. */
|
|
32022
|
+
lastAccumulation,
|
|
32023
|
+
/** `a_p`: Parent service ID. */
|
|
32024
|
+
parentService) {
|
|
32025
|
+
super();
|
|
32026
|
+
this.codeHash = codeHash;
|
|
32027
|
+
this.balance = balance;
|
|
32028
|
+
this.accumulateMinGas = accumulateMinGas;
|
|
32029
|
+
this.onTransferMinGas = onTransferMinGas;
|
|
32030
|
+
this.storageUtilisationBytes = storageUtilisationBytes;
|
|
32031
|
+
this.gratisStorage = gratisStorage;
|
|
32032
|
+
this.storageUtilisationCount = storageUtilisationCount;
|
|
32033
|
+
this.created = created;
|
|
32034
|
+
this.lastAccumulation = lastAccumulation;
|
|
32035
|
+
this.parentService = parentService;
|
|
32036
|
+
}
|
|
32037
|
+
}
|
|
32038
|
+
class PreimageItem extends WithDebug {
|
|
32039
|
+
hash;
|
|
32040
|
+
blob;
|
|
32041
|
+
static Codec = descriptors_codec.Class(PreimageItem, {
|
|
32042
|
+
hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
32043
|
+
blob: descriptors_codec.blob,
|
|
32044
|
+
});
|
|
32045
|
+
static create({ hash, blob }) {
|
|
32046
|
+
return new PreimageItem(hash, blob);
|
|
32047
|
+
}
|
|
32048
|
+
constructor(hash, blob) {
|
|
32049
|
+
super();
|
|
32050
|
+
this.hash = hash;
|
|
32051
|
+
this.blob = blob;
|
|
32052
|
+
}
|
|
32053
|
+
}
|
|
32054
|
+
class StorageItem extends WithDebug {
|
|
32055
|
+
key;
|
|
32056
|
+
value;
|
|
32057
|
+
static Codec = descriptors_codec.Class(StorageItem, {
|
|
32058
|
+
key: descriptors_codec.blob.convert((i) => i, (o) => opaque_asOpaqueType(o)),
|
|
32059
|
+
value: descriptors_codec.blob,
|
|
32060
|
+
});
|
|
32061
|
+
static create({ key, value }) {
|
|
32062
|
+
return new StorageItem(key, value);
|
|
32063
|
+
}
|
|
32064
|
+
constructor(key, value) {
|
|
32065
|
+
super();
|
|
32066
|
+
this.key = key;
|
|
32067
|
+
this.value = value;
|
|
32068
|
+
}
|
|
32069
|
+
}
|
|
32070
|
+
const MAX_LOOKUP_HISTORY_SLOTS = 3;
|
|
32071
|
+
function service_tryAsLookupHistorySlots(items) {
|
|
32072
|
+
const knownSize = sized_array_asKnownSize(items);
|
|
32073
|
+
if (knownSize.length > MAX_LOOKUP_HISTORY_SLOTS) {
|
|
32074
|
+
throw new Error(`Lookup history items must contain 0-${MAX_LOOKUP_HISTORY_SLOTS} timeslots.`);
|
|
32075
|
+
}
|
|
32076
|
+
return knownSize;
|
|
32077
|
+
}
|
|
32078
|
+
/** https://graypaper.fluffylabs.dev/#/5f542d7/115400115800 */
|
|
32079
|
+
class LookupHistoryItem {
|
|
32080
|
+
hash;
|
|
32081
|
+
length;
|
|
32082
|
+
slots;
|
|
32083
|
+
constructor(hash, length,
|
|
32084
|
+
/**
|
|
32085
|
+
* Preimage availability history as a sequence of time slots.
|
|
32086
|
+
* See PreimageStatus and the following GP fragment for more details.
|
|
32087
|
+
* https://graypaper.fluffylabs.dev/#/5f542d7/11780011a500 */
|
|
32088
|
+
slots) {
|
|
32089
|
+
this.hash = hash;
|
|
32090
|
+
this.length = length;
|
|
32091
|
+
this.slots = slots;
|
|
32092
|
+
}
|
|
32093
|
+
static isRequested(item) {
|
|
32094
|
+
if ("slots" in item) {
|
|
32095
|
+
return item.slots.length === 0;
|
|
32096
|
+
}
|
|
32097
|
+
return item.length === 0;
|
|
32098
|
+
}
|
|
32099
|
+
}
|
|
32100
|
+
|
|
31850
32101
|
;// CONCATENATED MODULE: ./packages/jam/state/privileged-services.ts
|
|
31851
32102
|
|
|
31852
32103
|
|
|
32104
|
+
|
|
32105
|
+
|
|
32106
|
+
|
|
31853
32107
|
/** Dictionary entry of services that auto-accumulate every block. */
|
|
31854
32108
|
class AutoAccumulate {
|
|
31855
32109
|
service;
|
|
@@ -31871,39 +32125,50 @@ class AutoAccumulate {
|
|
|
31871
32125
|
}
|
|
31872
32126
|
}
|
|
31873
32127
|
/**
|
|
31874
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
32128
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/114402114402?v=0.7.2
|
|
31875
32129
|
*/
|
|
31876
32130
|
class PrivilegedServices {
|
|
31877
32131
|
manager;
|
|
31878
|
-
|
|
31879
|
-
|
|
32132
|
+
delegator;
|
|
32133
|
+
registrar;
|
|
32134
|
+
assigners;
|
|
31880
32135
|
autoAccumulateServices;
|
|
32136
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bbd023bcb02?v=0.7.2 */
|
|
31881
32137
|
static Codec = descriptors_codec.Class(PrivilegedServices, {
|
|
31882
32138
|
manager: descriptors_codec.u32.asOpaque(),
|
|
31883
|
-
|
|
31884
|
-
|
|
32139
|
+
assigners: codecPerCore(descriptors_codec.u32.asOpaque()),
|
|
32140
|
+
delegator: descriptors_codec.u32.asOpaque(),
|
|
32141
|
+
registrar: compatibility_Compatibility.isGreaterOrEqual(compatibility_GpVersion.V0_7_1)
|
|
32142
|
+
? descriptors_codec.u32.asOpaque()
|
|
32143
|
+
: ignoreValueWithDefault(tryAsServiceId(2 ** 32 - 1)),
|
|
31885
32144
|
autoAccumulateServices: readonlyArray(descriptors_codec.sequenceVarLen(AutoAccumulate.Codec)),
|
|
31886
32145
|
});
|
|
31887
|
-
static create(
|
|
31888
|
-
return new PrivilegedServices(manager,
|
|
32146
|
+
static create(a) {
|
|
32147
|
+
return new PrivilegedServices(a.manager, a.delegator, a.registrar, a.assigners, a.autoAccumulateServices);
|
|
31889
32148
|
}
|
|
31890
32149
|
constructor(
|
|
31891
32150
|
/**
|
|
31892
|
-
*
|
|
31893
|
-
* the service able to effect an alteration of χ from block to block,
|
|
32151
|
+
* `χ_M`: Manages alteration of χ from block to block,
|
|
31894
32152
|
* as well as bestow services with storage deposit credits.
|
|
31895
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
32153
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/111502111902?v=0.7.2
|
|
31896
32154
|
*/
|
|
31897
32155
|
manager,
|
|
31898
|
-
/**
|
|
31899
|
-
|
|
31900
|
-
/**
|
|
31901
|
-
|
|
31902
|
-
|
|
32156
|
+
/** `χ_V`: Managers validator keys. */
|
|
32157
|
+
delegator,
|
|
32158
|
+
/**
|
|
32159
|
+
* `χ_R`: Manages the creation of services in protected range.
|
|
32160
|
+
*
|
|
32161
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/111b02111d02?v=0.7.2
|
|
32162
|
+
*/
|
|
32163
|
+
registrar,
|
|
32164
|
+
/** `χ_A`: Manages authorization queue one for each core. */
|
|
32165
|
+
assigners,
|
|
32166
|
+
/** `χ_Z`: Dictionary of services that auto-accumulate every block with their gas limit. */
|
|
31903
32167
|
autoAccumulateServices) {
|
|
31904
32168
|
this.manager = manager;
|
|
31905
|
-
this.
|
|
31906
|
-
this.
|
|
32169
|
+
this.delegator = delegator;
|
|
32170
|
+
this.registrar = registrar;
|
|
32171
|
+
this.assigners = assigners;
|
|
31907
32172
|
this.autoAccumulateServices = autoAccumulateServices;
|
|
31908
32173
|
}
|
|
31909
32174
|
}
|
|
@@ -31991,7 +32256,7 @@ class RecentBlocks extends WithDebug {
|
|
|
31991
32256
|
*/
|
|
31992
32257
|
class RecentBlocksHistory extends WithDebug {
|
|
31993
32258
|
current;
|
|
31994
|
-
static Codec =
|
|
32259
|
+
static Codec = Descriptor.new("RecentBlocksHistory", RecentBlocks.Codec.sizeHint, (encoder, value) => RecentBlocks.Codec.encode(encoder, value.asCurrent()), (decoder) => {
|
|
31995
32260
|
const recentBlocks = RecentBlocks.Codec.decode(decoder);
|
|
31996
32261
|
return RecentBlocksHistory.create(recentBlocks);
|
|
31997
32262
|
}, (skip) => {
|
|
@@ -32188,179 +32453,6 @@ class safrole_data_SafroleData {
|
|
|
32188
32453
|
}
|
|
32189
32454
|
}
|
|
32190
32455
|
|
|
32191
|
-
;// CONCATENATED MODULE: ./packages/jam/state/service.ts
|
|
32192
|
-
|
|
32193
|
-
|
|
32194
|
-
|
|
32195
|
-
|
|
32196
|
-
|
|
32197
|
-
|
|
32198
|
-
/**
|
|
32199
|
-
* `B_S`: The basic minimum balance which all services require.
|
|
32200
|
-
*
|
|
32201
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
|
|
32202
|
-
*/
|
|
32203
|
-
const BASE_SERVICE_BALANCE = 100n;
|
|
32204
|
-
/**
|
|
32205
|
-
* `B_I`: The additional minimum balance required per item of elective service state.
|
|
32206
|
-
*
|
|
32207
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
|
|
32208
|
-
*/
|
|
32209
|
-
const ELECTIVE_ITEM_BALANCE = 10n;
|
|
32210
|
-
/**
|
|
32211
|
-
* `B_L`: The additional minimum balance required per octet of elective service state.
|
|
32212
|
-
*
|
|
32213
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
|
|
32214
|
-
*/
|
|
32215
|
-
const ELECTIVE_BYTE_BALANCE = 1n;
|
|
32216
|
-
const zeroSizeHint = {
|
|
32217
|
-
bytes: 0,
|
|
32218
|
-
isExact: true,
|
|
32219
|
-
};
|
|
32220
|
-
/** 0-byte read, return given default value */
|
|
32221
|
-
const ignoreValueWithDefault = (defaultValue) => Descriptor.new("ignoreValue", zeroSizeHint, (_e, _v) => { }, (_d) => defaultValue, (_s) => { });
|
|
32222
|
-
/**
|
|
32223
|
-
* Service account details.
|
|
32224
|
-
*
|
|
32225
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
|
|
32226
|
-
*/
|
|
32227
|
-
class ServiceAccountInfo extends WithDebug {
|
|
32228
|
-
codeHash;
|
|
32229
|
-
balance;
|
|
32230
|
-
accumulateMinGas;
|
|
32231
|
-
onTransferMinGas;
|
|
32232
|
-
storageUtilisationBytes;
|
|
32233
|
-
gratisStorage;
|
|
32234
|
-
storageUtilisationCount;
|
|
32235
|
-
created;
|
|
32236
|
-
lastAccumulation;
|
|
32237
|
-
parentService;
|
|
32238
|
-
static Codec = descriptors_codec.Class(ServiceAccountInfo, {
|
|
32239
|
-
codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
32240
|
-
balance: descriptors_codec.u64,
|
|
32241
|
-
accumulateMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
32242
|
-
onTransferMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
32243
|
-
storageUtilisationBytes: descriptors_codec.u64,
|
|
32244
|
-
gratisStorage: descriptors_codec.u64,
|
|
32245
|
-
storageUtilisationCount: descriptors_codec.u32,
|
|
32246
|
-
created: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
32247
|
-
lastAccumulation: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
32248
|
-
parentService: descriptors_codec.u32.convert((x) => x, tryAsServiceId),
|
|
32249
|
-
});
|
|
32250
|
-
static create(a) {
|
|
32251
|
-
return new ServiceAccountInfo(a.codeHash, a.balance, a.accumulateMinGas, a.onTransferMinGas, a.storageUtilisationBytes, a.gratisStorage, a.storageUtilisationCount, a.created, a.lastAccumulation, a.parentService);
|
|
32252
|
-
}
|
|
32253
|
-
/**
|
|
32254
|
-
* `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
|
|
32255
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
|
|
32256
|
-
*/
|
|
32257
|
-
static calculateThresholdBalance(items, bytes, gratisStorage) {
|
|
32258
|
-
const storageCost = BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
|
|
32259
|
-
if (storageCost < 0n) {
|
|
32260
|
-
return tryAsU64(0);
|
|
32261
|
-
}
|
|
32262
|
-
if (storageCost >= 2n ** 64n) {
|
|
32263
|
-
return tryAsU64(2n ** 64n - 1n);
|
|
32264
|
-
}
|
|
32265
|
-
return tryAsU64(storageCost);
|
|
32266
|
-
}
|
|
32267
|
-
constructor(
|
|
32268
|
-
/** `a_c`: Hash of the service code. */
|
|
32269
|
-
codeHash,
|
|
32270
|
-
/** `a_b`: Current account balance. */
|
|
32271
|
-
balance,
|
|
32272
|
-
/** `a_g`: Minimal gas required to execute Accumulate entrypoint. */
|
|
32273
|
-
accumulateMinGas,
|
|
32274
|
-
/** `a_m`: Minimal gas required to execute On Transfer entrypoint. */
|
|
32275
|
-
onTransferMinGas,
|
|
32276
|
-
/** `a_o`: Total number of octets in storage. */
|
|
32277
|
-
storageUtilisationBytes,
|
|
32278
|
-
/** `a_f`: Cost-free storage. Decreases both storage item count and total byte size. */
|
|
32279
|
-
gratisStorage,
|
|
32280
|
-
/** `a_i`: Number of items in storage. */
|
|
32281
|
-
storageUtilisationCount,
|
|
32282
|
-
/** `a_r`: Creation account time slot. */
|
|
32283
|
-
created,
|
|
32284
|
-
/** `a_a`: Most recent accumulation time slot. */
|
|
32285
|
-
lastAccumulation,
|
|
32286
|
-
/** `a_p`: Parent service ID. */
|
|
32287
|
-
parentService) {
|
|
32288
|
-
super();
|
|
32289
|
-
this.codeHash = codeHash;
|
|
32290
|
-
this.balance = balance;
|
|
32291
|
-
this.accumulateMinGas = accumulateMinGas;
|
|
32292
|
-
this.onTransferMinGas = onTransferMinGas;
|
|
32293
|
-
this.storageUtilisationBytes = storageUtilisationBytes;
|
|
32294
|
-
this.gratisStorage = gratisStorage;
|
|
32295
|
-
this.storageUtilisationCount = storageUtilisationCount;
|
|
32296
|
-
this.created = created;
|
|
32297
|
-
this.lastAccumulation = lastAccumulation;
|
|
32298
|
-
this.parentService = parentService;
|
|
32299
|
-
}
|
|
32300
|
-
}
|
|
32301
|
-
class PreimageItem extends WithDebug {
|
|
32302
|
-
hash;
|
|
32303
|
-
blob;
|
|
32304
|
-
static Codec = descriptors_codec.Class(PreimageItem, {
|
|
32305
|
-
hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
32306
|
-
blob: descriptors_codec.blob,
|
|
32307
|
-
});
|
|
32308
|
-
static create({ hash, blob }) {
|
|
32309
|
-
return new PreimageItem(hash, blob);
|
|
32310
|
-
}
|
|
32311
|
-
constructor(hash, blob) {
|
|
32312
|
-
super();
|
|
32313
|
-
this.hash = hash;
|
|
32314
|
-
this.blob = blob;
|
|
32315
|
-
}
|
|
32316
|
-
}
|
|
32317
|
-
class StorageItem extends WithDebug {
|
|
32318
|
-
key;
|
|
32319
|
-
value;
|
|
32320
|
-
static Codec = descriptors_codec.Class(StorageItem, {
|
|
32321
|
-
key: descriptors_codec.blob.convert((i) => i, (o) => opaque_asOpaqueType(o)),
|
|
32322
|
-
value: descriptors_codec.blob,
|
|
32323
|
-
});
|
|
32324
|
-
static create({ key, value }) {
|
|
32325
|
-
return new StorageItem(key, value);
|
|
32326
|
-
}
|
|
32327
|
-
constructor(key, value) {
|
|
32328
|
-
super();
|
|
32329
|
-
this.key = key;
|
|
32330
|
-
this.value = value;
|
|
32331
|
-
}
|
|
32332
|
-
}
|
|
32333
|
-
const MAX_LOOKUP_HISTORY_SLOTS = 3;
|
|
32334
|
-
function service_tryAsLookupHistorySlots(items) {
|
|
32335
|
-
const knownSize = sized_array_asKnownSize(items);
|
|
32336
|
-
if (knownSize.length > MAX_LOOKUP_HISTORY_SLOTS) {
|
|
32337
|
-
throw new Error(`Lookup history items must contain 0-${MAX_LOOKUP_HISTORY_SLOTS} timeslots.`);
|
|
32338
|
-
}
|
|
32339
|
-
return knownSize;
|
|
32340
|
-
}
|
|
32341
|
-
/** https://graypaper.fluffylabs.dev/#/5f542d7/115400115800 */
|
|
32342
|
-
class LookupHistoryItem {
|
|
32343
|
-
hash;
|
|
32344
|
-
length;
|
|
32345
|
-
slots;
|
|
32346
|
-
constructor(hash, length,
|
|
32347
|
-
/**
|
|
32348
|
-
* Preimage availability history as a sequence of time slots.
|
|
32349
|
-
* See PreimageStatus and the following GP fragment for more details.
|
|
32350
|
-
* https://graypaper.fluffylabs.dev/#/5f542d7/11780011a500 */
|
|
32351
|
-
slots) {
|
|
32352
|
-
this.hash = hash;
|
|
32353
|
-
this.length = length;
|
|
32354
|
-
this.slots = slots;
|
|
32355
|
-
}
|
|
32356
|
-
static isRequested(item) {
|
|
32357
|
-
if ("slots" in item) {
|
|
32358
|
-
return item.slots.length === 0;
|
|
32359
|
-
}
|
|
32360
|
-
return item.length === 0;
|
|
32361
|
-
}
|
|
32362
|
-
}
|
|
32363
|
-
|
|
32364
32456
|
;// CONCATENATED MODULE: ./packages/jam/state/state.ts
|
|
32365
32457
|
/**
|
|
32366
32458
|
* In addition to the entropy accumulator η_0, we retain
|
|
@@ -32797,6 +32889,7 @@ class StatisticsData {
|
|
|
32797
32889
|
|
|
32798
32890
|
|
|
32799
32891
|
|
|
32892
|
+
|
|
32800
32893
|
|
|
32801
32894
|
|
|
32802
32895
|
var in_memory_state_UpdateError;
|
|
@@ -33200,8 +33293,9 @@ class InMemoryState extends WithDebug {
|
|
|
33200
33293
|
epochRoot: bytes_Bytes.zero(BANDERSNATCH_RING_ROOT_BYTES).asOpaque(),
|
|
33201
33294
|
privilegedServices: PrivilegedServices.create({
|
|
33202
33295
|
manager: tryAsServiceId(0),
|
|
33203
|
-
|
|
33204
|
-
|
|
33296
|
+
assigners: tryAsPerCore(new Array(spec.coresCount).fill(tryAsServiceId(0)), spec),
|
|
33297
|
+
delegator: tryAsServiceId(0),
|
|
33298
|
+
registrar: tryAsServiceId(MAX_VALUE),
|
|
33205
33299
|
autoAccumulateServices: [],
|
|
33206
33300
|
}),
|
|
33207
33301
|
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
|
|
@@ -33295,6 +33389,7 @@ class NotYetAccumulatedReport extends WithDebug {
|
|
|
33295
33389
|
|
|
33296
33390
|
|
|
33297
33391
|
|
|
33392
|
+
|
|
33298
33393
|
/** Serialization for particular state entries. */
|
|
33299
33394
|
var serialize_serialize;
|
|
33300
33395
|
(function (serialize) {
|
|
@@ -33409,7 +33504,9 @@ var serialize_serialize;
|
|
|
33409
33504
|
/** C(255, s): https://graypaper.fluffylabs.dev/#/85129da/383103383103?v=0.6.3 */
|
|
33410
33505
|
serialize.serviceData = (serviceId) => ({
|
|
33411
33506
|
key: stateKeys.serviceInfo(serviceId),
|
|
33412
|
-
Codec:
|
|
33507
|
+
Codec: compatibility_Compatibility.isGreaterOrEqual(compatibility_GpVersion.V0_7_1)
|
|
33508
|
+
? codecWithVersion(ServiceAccountInfo.Codec)
|
|
33509
|
+
: ServiceAccountInfo.Codec,
|
|
33413
33510
|
});
|
|
33414
33511
|
/** https://graypaper.fluffylabs.dev/#/85129da/384803384803?v=0.6.3 */
|
|
33415
33512
|
serialize.serviceStorage = (blake2b, serviceId, key) => ({
|
|
@@ -33434,7 +33531,7 @@ var serialize_serialize;
|
|
|
33434
33531
|
* determine the boundary of the bytes, so it can only be used
|
|
33435
33532
|
* as the last element of the codec and can't be used in sequences!
|
|
33436
33533
|
*/
|
|
33437
|
-
const dumpCodec =
|
|
33534
|
+
const dumpCodec = Descriptor.new("Dump", { bytes: 64, isExact: false }, (e, v) => e.bytes(bytes_Bytes.fromBlob(v.raw, v.raw.length)), (d) => bytes_BytesBlob.blobFrom(d.bytes(d.source.length - d.bytesRead()).raw), (s) => s.bytes(s.decoder.source.length - s.decoder.bytesRead()));
|
|
33438
33535
|
|
|
33439
33536
|
;// CONCATENATED MODULE: ./packages/jam/state-merkleization/serialized-state.ts
|
|
33440
33537
|
|
|
@@ -34745,7 +34842,7 @@ const codecMap = (value, extractKey, { typicalLength = TYPICAL_DICTIONARY_LENGTH
|
|
|
34745
34842
|
}
|
|
34746
34843
|
return Ordering.Equal;
|
|
34747
34844
|
}, } = {}) => {
|
|
34748
|
-
return
|
|
34845
|
+
return Descriptor.new(`Map<${value.name}>[?]`, {
|
|
34749
34846
|
bytes: typicalLength * value.sizeHint.bytes,
|
|
34750
34847
|
isExact: false,
|
|
34751
34848
|
}, (e, v) => {
|
|
@@ -37499,8 +37596,9 @@ class ce_129_state_request_Handler {
|
|
|
37499
37596
|
onStreamMessage(sender, message) {
|
|
37500
37597
|
if (this.isServer) {
|
|
37501
37598
|
ce_129_state_request_logger.info `[${sender.streamId}][server]: Received request.`;
|
|
37502
|
-
if (this.getBoundaryNodes === undefined || this.getKeyValuePairs === undefined)
|
|
37599
|
+
if (this.getBoundaryNodes === undefined || this.getKeyValuePairs === undefined) {
|
|
37503
37600
|
return;
|
|
37601
|
+
}
|
|
37504
37602
|
const request = Decoder.decodeObject(StateRequest.Codec, message);
|
|
37505
37603
|
const boundaryNodes = this.getBoundaryNodes(request.headerHash, request.startKey, request.endKey);
|
|
37506
37604
|
const keyValuePairs = this.getKeyValuePairs(request.headerHash, request.startKey, request.endKey);
|