@typeberry/jam 0.1.3-8fd7637 → 0.1.3-b0374a8
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 +285 -252
- package/bootstrap-generator.mjs.map +1 -1
- package/bootstrap-importer.mjs +414 -326
- package/bootstrap-importer.mjs.map +1 -1
- package/bootstrap-network.mjs +287 -253
- package/bootstrap-network.mjs.map +1 -1
- package/index.js +416 -327
- 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) => {
|
|
@@ -28818,7 +28821,7 @@ const codecFixedSizeArray = (val, len) => {
|
|
|
28818
28821
|
};
|
|
28819
28822
|
/** Codec for a hash-dictionary. */
|
|
28820
28823
|
const codecHashDictionary = (value, extractKey, { typicalLength = TYPICAL_DICTIONARY_LENGTH, compare = (a, b) => extractKey(a).compare(extractKey(b)), } = {}) => {
|
|
28821
|
-
return
|
|
28824
|
+
return Descriptor.new(`HashDictionary<${value.name}>[?]`, {
|
|
28822
28825
|
bytes: typicalLength * value.sizeHint.bytes,
|
|
28823
28826
|
isExact: false,
|
|
28824
28827
|
}, (e, v) => {
|
|
@@ -31880,6 +31883,13 @@ const W_T = 128;
|
|
|
31880
31883
|
/** `W_M`: The maximum number of exports in a work-package. */
|
|
31881
31884
|
const W_X = 3_072;
|
|
31882
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));
|
|
31883
31893
|
/**
|
|
31884
31894
|
* `J`: The maximum sum of dependency items in a work-report.
|
|
31885
31895
|
*
|
|
@@ -31891,9 +31901,209 @@ const AUTHORIZATION_QUEUE_SIZE = Q;
|
|
|
31891
31901
|
/** `O`: Maximal authorization pool size. */
|
|
31892
31902
|
const MAX_AUTH_POOL_SIZE = O;
|
|
31893
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
|
+
|
|
31894
32101
|
;// CONCATENATED MODULE: ./packages/jam/state/privileged-services.ts
|
|
31895
32102
|
|
|
31896
32103
|
|
|
32104
|
+
|
|
32105
|
+
|
|
32106
|
+
|
|
31897
32107
|
/** Dictionary entry of services that auto-accumulate every block. */
|
|
31898
32108
|
class AutoAccumulate {
|
|
31899
32109
|
service;
|
|
@@ -31915,39 +32125,50 @@ class AutoAccumulate {
|
|
|
31915
32125
|
}
|
|
31916
32126
|
}
|
|
31917
32127
|
/**
|
|
31918
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
32128
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/114402114402?v=0.7.2
|
|
31919
32129
|
*/
|
|
31920
32130
|
class PrivilegedServices {
|
|
31921
32131
|
manager;
|
|
31922
|
-
|
|
31923
|
-
|
|
32132
|
+
delegator;
|
|
32133
|
+
registrar;
|
|
32134
|
+
assigners;
|
|
31924
32135
|
autoAccumulateServices;
|
|
32136
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bbd023bcb02?v=0.7.2 */
|
|
31925
32137
|
static Codec = descriptors_codec.Class(PrivilegedServices, {
|
|
31926
32138
|
manager: descriptors_codec.u32.asOpaque(),
|
|
31927
|
-
|
|
31928
|
-
|
|
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)),
|
|
31929
32144
|
autoAccumulateServices: readonlyArray(descriptors_codec.sequenceVarLen(AutoAccumulate.Codec)),
|
|
31930
32145
|
});
|
|
31931
|
-
static create(
|
|
31932
|
-
return new PrivilegedServices(manager,
|
|
32146
|
+
static create(a) {
|
|
32147
|
+
return new PrivilegedServices(a.manager, a.delegator, a.registrar, a.assigners, a.autoAccumulateServices);
|
|
31933
32148
|
}
|
|
31934
32149
|
constructor(
|
|
31935
32150
|
/**
|
|
31936
|
-
*
|
|
31937
|
-
* the service able to effect an alteration of χ from block to block,
|
|
32151
|
+
* `χ_M`: Manages alteration of χ from block to block,
|
|
31938
32152
|
* as well as bestow services with storage deposit credits.
|
|
31939
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
32153
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/111502111902?v=0.7.2
|
|
31940
32154
|
*/
|
|
31941
32155
|
manager,
|
|
31942
|
-
/**
|
|
31943
|
-
|
|
31944
|
-
/**
|
|
31945
|
-
|
|
31946
|
-
|
|
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. */
|
|
31947
32167
|
autoAccumulateServices) {
|
|
31948
32168
|
this.manager = manager;
|
|
31949
|
-
this.
|
|
31950
|
-
this.
|
|
32169
|
+
this.delegator = delegator;
|
|
32170
|
+
this.registrar = registrar;
|
|
32171
|
+
this.assigners = assigners;
|
|
31951
32172
|
this.autoAccumulateServices = autoAccumulateServices;
|
|
31952
32173
|
}
|
|
31953
32174
|
}
|
|
@@ -32035,7 +32256,7 @@ class RecentBlocks extends WithDebug {
|
|
|
32035
32256
|
*/
|
|
32036
32257
|
class RecentBlocksHistory extends WithDebug {
|
|
32037
32258
|
current;
|
|
32038
|
-
static Codec =
|
|
32259
|
+
static Codec = Descriptor.new("RecentBlocksHistory", RecentBlocks.Codec.sizeHint, (encoder, value) => RecentBlocks.Codec.encode(encoder, value.asCurrent()), (decoder) => {
|
|
32039
32260
|
const recentBlocks = RecentBlocks.Codec.decode(decoder);
|
|
32040
32261
|
return RecentBlocksHistory.create(recentBlocks);
|
|
32041
32262
|
}, (skip) => {
|
|
@@ -32232,196 +32453,6 @@ class safrole_data_SafroleData {
|
|
|
32232
32453
|
}
|
|
32233
32454
|
}
|
|
32234
32455
|
|
|
32235
|
-
;// CONCATENATED MODULE: ./packages/jam/state/service.ts
|
|
32236
|
-
|
|
32237
|
-
|
|
32238
|
-
|
|
32239
|
-
|
|
32240
|
-
|
|
32241
|
-
|
|
32242
|
-
/**
|
|
32243
|
-
* `B_S`: The basic minimum balance which all services require.
|
|
32244
|
-
*
|
|
32245
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
|
|
32246
|
-
*/
|
|
32247
|
-
const BASE_SERVICE_BALANCE = 100n;
|
|
32248
|
-
/**
|
|
32249
|
-
* `B_I`: The additional minimum balance required per item of elective service state.
|
|
32250
|
-
*
|
|
32251
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
|
|
32252
|
-
*/
|
|
32253
|
-
const ELECTIVE_ITEM_BALANCE = 10n;
|
|
32254
|
-
/**
|
|
32255
|
-
* `B_L`: The additional minimum balance required per octet of elective service state.
|
|
32256
|
-
*
|
|
32257
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
|
|
32258
|
-
*/
|
|
32259
|
-
const ELECTIVE_BYTE_BALANCE = 1n;
|
|
32260
|
-
const zeroSizeHint = {
|
|
32261
|
-
bytes: 0,
|
|
32262
|
-
isExact: true,
|
|
32263
|
-
};
|
|
32264
|
-
/** 0-byte read, return given default value */
|
|
32265
|
-
const ignoreValueWithDefault = (defaultValue) => Descriptor.new("ignoreValue", zeroSizeHint, (_e, _v) => { }, (_d) => defaultValue, (_s) => { });
|
|
32266
|
-
/** Encode and decode object with leading version number. */
|
|
32267
|
-
const codecWithVersion = (val) => descriptor_Descriptor.new("withVersion", {
|
|
32268
|
-
bytes: val.sizeHint.bytes + 8,
|
|
32269
|
-
isExact: false,
|
|
32270
|
-
}, (e, v) => {
|
|
32271
|
-
e.varU64(0n);
|
|
32272
|
-
val.encode(e, v);
|
|
32273
|
-
}, (d) => {
|
|
32274
|
-
const version = d.varU64();
|
|
32275
|
-
if (version !== 0n) {
|
|
32276
|
-
throw new Error("Non-zero version is not supported!");
|
|
32277
|
-
}
|
|
32278
|
-
return val.decode(d);
|
|
32279
|
-
}, (s) => {
|
|
32280
|
-
s.varU64();
|
|
32281
|
-
val.skip(s);
|
|
32282
|
-
});
|
|
32283
|
-
/**
|
|
32284
|
-
* Service account details.
|
|
32285
|
-
*
|
|
32286
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
|
|
32287
|
-
*/
|
|
32288
|
-
class ServiceAccountInfo extends WithDebug {
|
|
32289
|
-
codeHash;
|
|
32290
|
-
balance;
|
|
32291
|
-
accumulateMinGas;
|
|
32292
|
-
onTransferMinGas;
|
|
32293
|
-
storageUtilisationBytes;
|
|
32294
|
-
gratisStorage;
|
|
32295
|
-
storageUtilisationCount;
|
|
32296
|
-
created;
|
|
32297
|
-
lastAccumulation;
|
|
32298
|
-
parentService;
|
|
32299
|
-
static Codec = descriptors_codec.Class(ServiceAccountInfo, {
|
|
32300
|
-
codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
32301
|
-
balance: descriptors_codec.u64,
|
|
32302
|
-
accumulateMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
32303
|
-
onTransferMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
32304
|
-
storageUtilisationBytes: descriptors_codec.u64,
|
|
32305
|
-
gratisStorage: descriptors_codec.u64,
|
|
32306
|
-
storageUtilisationCount: descriptors_codec.u32,
|
|
32307
|
-
created: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
32308
|
-
lastAccumulation: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
32309
|
-
parentService: descriptors_codec.u32.convert((x) => x, tryAsServiceId),
|
|
32310
|
-
});
|
|
32311
|
-
static create(a) {
|
|
32312
|
-
return new ServiceAccountInfo(a.codeHash, a.balance, a.accumulateMinGas, a.onTransferMinGas, a.storageUtilisationBytes, a.gratisStorage, a.storageUtilisationCount, a.created, a.lastAccumulation, a.parentService);
|
|
32313
|
-
}
|
|
32314
|
-
/**
|
|
32315
|
-
* `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
|
|
32316
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
|
|
32317
|
-
*/
|
|
32318
|
-
static calculateThresholdBalance(items, bytes, gratisStorage) {
|
|
32319
|
-
const storageCost = BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
|
|
32320
|
-
if (storageCost < 0n) {
|
|
32321
|
-
return tryAsU64(0);
|
|
32322
|
-
}
|
|
32323
|
-
if (storageCost >= 2n ** 64n) {
|
|
32324
|
-
return tryAsU64(2n ** 64n - 1n);
|
|
32325
|
-
}
|
|
32326
|
-
return tryAsU64(storageCost);
|
|
32327
|
-
}
|
|
32328
|
-
constructor(
|
|
32329
|
-
/** `a_c`: Hash of the service code. */
|
|
32330
|
-
codeHash,
|
|
32331
|
-
/** `a_b`: Current account balance. */
|
|
32332
|
-
balance,
|
|
32333
|
-
/** `a_g`: Minimal gas required to execute Accumulate entrypoint. */
|
|
32334
|
-
accumulateMinGas,
|
|
32335
|
-
/** `a_m`: Minimal gas required to execute On Transfer entrypoint. */
|
|
32336
|
-
onTransferMinGas,
|
|
32337
|
-
/** `a_o`: Total number of octets in storage. */
|
|
32338
|
-
storageUtilisationBytes,
|
|
32339
|
-
/** `a_f`: Cost-free storage. Decreases both storage item count and total byte size. */
|
|
32340
|
-
gratisStorage,
|
|
32341
|
-
/** `a_i`: Number of items in storage. */
|
|
32342
|
-
storageUtilisationCount,
|
|
32343
|
-
/** `a_r`: Creation account time slot. */
|
|
32344
|
-
created,
|
|
32345
|
-
/** `a_a`: Most recent accumulation time slot. */
|
|
32346
|
-
lastAccumulation,
|
|
32347
|
-
/** `a_p`: Parent service ID. */
|
|
32348
|
-
parentService) {
|
|
32349
|
-
super();
|
|
32350
|
-
this.codeHash = codeHash;
|
|
32351
|
-
this.balance = balance;
|
|
32352
|
-
this.accumulateMinGas = accumulateMinGas;
|
|
32353
|
-
this.onTransferMinGas = onTransferMinGas;
|
|
32354
|
-
this.storageUtilisationBytes = storageUtilisationBytes;
|
|
32355
|
-
this.gratisStorage = gratisStorage;
|
|
32356
|
-
this.storageUtilisationCount = storageUtilisationCount;
|
|
32357
|
-
this.created = created;
|
|
32358
|
-
this.lastAccumulation = lastAccumulation;
|
|
32359
|
-
this.parentService = parentService;
|
|
32360
|
-
}
|
|
32361
|
-
}
|
|
32362
|
-
class PreimageItem extends WithDebug {
|
|
32363
|
-
hash;
|
|
32364
|
-
blob;
|
|
32365
|
-
static Codec = descriptors_codec.Class(PreimageItem, {
|
|
32366
|
-
hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
32367
|
-
blob: descriptors_codec.blob,
|
|
32368
|
-
});
|
|
32369
|
-
static create({ hash, blob }) {
|
|
32370
|
-
return new PreimageItem(hash, blob);
|
|
32371
|
-
}
|
|
32372
|
-
constructor(hash, blob) {
|
|
32373
|
-
super();
|
|
32374
|
-
this.hash = hash;
|
|
32375
|
-
this.blob = blob;
|
|
32376
|
-
}
|
|
32377
|
-
}
|
|
32378
|
-
class StorageItem extends WithDebug {
|
|
32379
|
-
key;
|
|
32380
|
-
value;
|
|
32381
|
-
static Codec = descriptors_codec.Class(StorageItem, {
|
|
32382
|
-
key: descriptors_codec.blob.convert((i) => i, (o) => opaque_asOpaqueType(o)),
|
|
32383
|
-
value: descriptors_codec.blob,
|
|
32384
|
-
});
|
|
32385
|
-
static create({ key, value }) {
|
|
32386
|
-
return new StorageItem(key, value);
|
|
32387
|
-
}
|
|
32388
|
-
constructor(key, value) {
|
|
32389
|
-
super();
|
|
32390
|
-
this.key = key;
|
|
32391
|
-
this.value = value;
|
|
32392
|
-
}
|
|
32393
|
-
}
|
|
32394
|
-
const MAX_LOOKUP_HISTORY_SLOTS = 3;
|
|
32395
|
-
function service_tryAsLookupHistorySlots(items) {
|
|
32396
|
-
const knownSize = sized_array_asKnownSize(items);
|
|
32397
|
-
if (knownSize.length > MAX_LOOKUP_HISTORY_SLOTS) {
|
|
32398
|
-
throw new Error(`Lookup history items must contain 0-${MAX_LOOKUP_HISTORY_SLOTS} timeslots.`);
|
|
32399
|
-
}
|
|
32400
|
-
return knownSize;
|
|
32401
|
-
}
|
|
32402
|
-
/** https://graypaper.fluffylabs.dev/#/5f542d7/115400115800 */
|
|
32403
|
-
class LookupHistoryItem {
|
|
32404
|
-
hash;
|
|
32405
|
-
length;
|
|
32406
|
-
slots;
|
|
32407
|
-
constructor(hash, length,
|
|
32408
|
-
/**
|
|
32409
|
-
* Preimage availability history as a sequence of time slots.
|
|
32410
|
-
* See PreimageStatus and the following GP fragment for more details.
|
|
32411
|
-
* https://graypaper.fluffylabs.dev/#/5f542d7/11780011a500 */
|
|
32412
|
-
slots) {
|
|
32413
|
-
this.hash = hash;
|
|
32414
|
-
this.length = length;
|
|
32415
|
-
this.slots = slots;
|
|
32416
|
-
}
|
|
32417
|
-
static isRequested(item) {
|
|
32418
|
-
if ("slots" in item) {
|
|
32419
|
-
return item.slots.length === 0;
|
|
32420
|
-
}
|
|
32421
|
-
return item.length === 0;
|
|
32422
|
-
}
|
|
32423
|
-
}
|
|
32424
|
-
|
|
32425
32456
|
;// CONCATENATED MODULE: ./packages/jam/state/state.ts
|
|
32426
32457
|
/**
|
|
32427
32458
|
* In addition to the entropy accumulator η_0, we retain
|
|
@@ -32858,6 +32889,7 @@ class StatisticsData {
|
|
|
32858
32889
|
|
|
32859
32890
|
|
|
32860
32891
|
|
|
32892
|
+
|
|
32861
32893
|
|
|
32862
32894
|
|
|
32863
32895
|
var in_memory_state_UpdateError;
|
|
@@ -33261,8 +33293,9 @@ class InMemoryState extends WithDebug {
|
|
|
33261
33293
|
epochRoot: bytes_Bytes.zero(BANDERSNATCH_RING_ROOT_BYTES).asOpaque(),
|
|
33262
33294
|
privilegedServices: PrivilegedServices.create({
|
|
33263
33295
|
manager: tryAsServiceId(0),
|
|
33264
|
-
|
|
33265
|
-
|
|
33296
|
+
assigners: tryAsPerCore(new Array(spec.coresCount).fill(tryAsServiceId(0)), spec),
|
|
33297
|
+
delegator: tryAsServiceId(0),
|
|
33298
|
+
registrar: tryAsServiceId(MAX_VALUE),
|
|
33266
33299
|
autoAccumulateServices: [],
|
|
33267
33300
|
}),
|
|
33268
33301
|
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
|
|
@@ -33498,7 +33531,7 @@ var serialize_serialize;
|
|
|
33498
33531
|
* determine the boundary of the bytes, so it can only be used
|
|
33499
33532
|
* as the last element of the codec and can't be used in sequences!
|
|
33500
33533
|
*/
|
|
33501
|
-
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()));
|
|
33502
33535
|
|
|
33503
33536
|
;// CONCATENATED MODULE: ./packages/jam/state-merkleization/serialized-state.ts
|
|
33504
33537
|
|
|
@@ -34809,7 +34842,7 @@ const codecMap = (value, extractKey, { typicalLength = TYPICAL_DICTIONARY_LENGTH
|
|
|
34809
34842
|
}
|
|
34810
34843
|
return Ordering.Equal;
|
|
34811
34844
|
}, } = {}) => {
|
|
34812
|
-
return
|
|
34845
|
+
return Descriptor.new(`Map<${value.name}>[?]`, {
|
|
34813
34846
|
bytes: typicalLength * value.sizeHint.bytes,
|
|
34814
34847
|
isExact: false,
|
|
34815
34848
|
}, (e, v) => {
|
|
@@ -37563,8 +37596,9 @@ class ce_129_state_request_Handler {
|
|
|
37563
37596
|
onStreamMessage(sender, message) {
|
|
37564
37597
|
if (this.isServer) {
|
|
37565
37598
|
ce_129_state_request_logger.info `[${sender.streamId}][server]: Received request.`;
|
|
37566
|
-
if (this.getBoundaryNodes === undefined || this.getKeyValuePairs === undefined)
|
|
37599
|
+
if (this.getBoundaryNodes === undefined || this.getKeyValuePairs === undefined) {
|
|
37567
37600
|
return;
|
|
37601
|
+
}
|
|
37568
37602
|
const request = Decoder.decodeObject(StateRequest.Codec, message);
|
|
37569
37603
|
const boundaryNodes = this.getBoundaryNodes(request.headerHash, request.startKey, request.endKey);
|
|
37570
37604
|
const keyValuePairs = this.getKeyValuePairs(request.headerHash, request.startKey, request.endKey);
|