@typeberry/jam 0.1.3-b635981 → 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 +285 -252
- package/bootstrap-generator.mjs.map +1 -1
- package/bootstrap-importer.mjs +432 -327
- package/bootstrap-importer.mjs.map +1 -1
- package/bootstrap-network.mjs +287 -253
- package/bootstrap-network.mjs.map +1 -1
- package/index.js +434 -328
- package/index.js.map +1 -1
- package/package.json +1 -1
package/bootstrap-generator.mjs
CHANGED
|
@@ -2899,8 +2899,9 @@ function parseCurrentVersion(env) {
|
|
|
2899
2899
|
}
|
|
2900
2900
|
}
|
|
2901
2901
|
function parseCurrentSuite(env) {
|
|
2902
|
-
if (env === undefined)
|
|
2902
|
+
if (env === undefined) {
|
|
2903
2903
|
return undefined;
|
|
2904
|
+
}
|
|
2904
2905
|
switch (env) {
|
|
2905
2906
|
case TestSuite.W3F_DAVXY:
|
|
2906
2907
|
case TestSuite.JAMDUNA:
|
|
@@ -3331,10 +3332,12 @@ function deepEqual(actual, expected, { context = [], errorsCollector, ignore = [
|
|
|
3331
3332
|
.sort((a, b) => {
|
|
3332
3333
|
const aKey = `${a.key}`;
|
|
3333
3334
|
const bKey = `${b.key}`;
|
|
3334
|
-
if (aKey < bKey)
|
|
3335
|
+
if (aKey < bKey) {
|
|
3335
3336
|
return -1;
|
|
3336
|
-
|
|
3337
|
+
}
|
|
3338
|
+
if (bKey < aKey) {
|
|
3337
3339
|
return 1;
|
|
3340
|
+
}
|
|
3338
3341
|
return 0;
|
|
3339
3342
|
});
|
|
3340
3343
|
};
|
|
@@ -4346,7 +4349,7 @@ class Skipper {
|
|
|
4346
4349
|
*
|
|
4347
4350
|
* Descriptors can be composed to form more complex typings.
|
|
4348
4351
|
*/
|
|
4349
|
-
class
|
|
4352
|
+
class Descriptor {
|
|
4350
4353
|
name;
|
|
4351
4354
|
sizeHint;
|
|
4352
4355
|
encode;
|
|
@@ -4356,11 +4359,11 @@ class descriptor_Descriptor {
|
|
|
4356
4359
|
View;
|
|
4357
4360
|
/** New descriptor with specialized `View`. */
|
|
4358
4361
|
static withView(name, sizeHint, encode, decode, skip, view) {
|
|
4359
|
-
return new
|
|
4362
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, view);
|
|
4360
4363
|
}
|
|
4361
4364
|
/** Create a new descriptor without a specialized `View`. */
|
|
4362
4365
|
static new(name, sizeHint, encode, decode, skip) {
|
|
4363
|
-
return new
|
|
4366
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, null);
|
|
4364
4367
|
}
|
|
4365
4368
|
constructor(
|
|
4366
4369
|
/** Descriptive name of the coded data. */
|
|
@@ -4397,7 +4400,7 @@ class descriptor_Descriptor {
|
|
|
4397
4400
|
}
|
|
4398
4401
|
/** Return a new descriptor that converts data into some other type. */
|
|
4399
4402
|
convert(input, output) {
|
|
4400
|
-
return new
|
|
4403
|
+
return new Descriptor(this.name, this.sizeHint, (e, elem) => this.encode(e, input(elem)), (d) => output(this.decode(d)), this.skip, this.View);
|
|
4401
4404
|
}
|
|
4402
4405
|
/** Safely cast the descriptor value to a opaque type. */
|
|
4403
4406
|
asOpaque() {
|
|
@@ -5095,51 +5098,51 @@ var descriptors_codec;
|
|
|
5095
5098
|
return (len) => {
|
|
5096
5099
|
let ret = cache.get(len);
|
|
5097
5100
|
if (ret === undefined) {
|
|
5098
|
-
ret =
|
|
5101
|
+
ret = Descriptor.new(`Bytes<${len}>`, exactHint(len), (e, v) => e.bytes(v), (d) => d.bytes(len), (s) => s.bytes(len));
|
|
5099
5102
|
cache.set(len, ret);
|
|
5100
5103
|
}
|
|
5101
5104
|
return ret;
|
|
5102
5105
|
};
|
|
5103
5106
|
})();
|
|
5104
5107
|
/** Variable-length U32. */
|
|
5105
|
-
codec.varU32 =
|
|
5108
|
+
codec.varU32 = Descriptor.new("var_u32", { bytes: 4, isExact: false }, (e, v) => e.varU32(v), (d) => d.varU32(), (d) => d.varU32());
|
|
5106
5109
|
/** Variable-length U64. */
|
|
5107
|
-
codec.varU64 =
|
|
5110
|
+
codec.varU64 = Descriptor.new("var_u64", { bytes: 8, isExact: false }, (e, v) => e.varU64(v), (d) => d.varU64(), (d) => d.varU64());
|
|
5108
5111
|
/** Unsigned 64-bit number. */
|
|
5109
|
-
codec.u64 =
|
|
5112
|
+
codec.u64 = Descriptor.withView("u64", exactHint(8), (e, v) => e.i64(v), (d) => d.u64(), (d) => d.u64(), codec.bytes(8));
|
|
5110
5113
|
/** Unsigned 32-bit number. */
|
|
5111
|
-
codec.u32 =
|
|
5114
|
+
codec.u32 = Descriptor.withView("u32", exactHint(4), (e, v) => e.i32(v), (d) => d.u32(), (d) => d.u32(), codec.bytes(4));
|
|
5112
5115
|
/** Unsigned 24-bit number. */
|
|
5113
|
-
codec.u24 =
|
|
5116
|
+
codec.u24 = Descriptor.withView("u24", exactHint(3), (e, v) => e.i24(v), (d) => d.u24(), (d) => d.u24(), codec.bytes(3));
|
|
5114
5117
|
/** Unsigned 16-bit number. */
|
|
5115
|
-
codec.u16 =
|
|
5118
|
+
codec.u16 = Descriptor.withView("u16", exactHint(2), (e, v) => e.i16(v), (d) => d.u16(), (d) => d.u16(), codec.bytes(2));
|
|
5116
5119
|
/** Unsigned 8-bit number. */
|
|
5117
|
-
codec.u8 =
|
|
5120
|
+
codec.u8 = Descriptor.new("u8", exactHint(1), (e, v) => e.i8(v), (d) => d.u8(), (d) => d.u8());
|
|
5118
5121
|
/** Signed 64-bit number. */
|
|
5119
|
-
codec.i64 =
|
|
5122
|
+
codec.i64 = Descriptor.withView("u64", exactHint(8), (e, v) => e.i64(v), (d) => d.i64(), (s) => s.u64(), codec.bytes(8));
|
|
5120
5123
|
/** Signed 32-bit number. */
|
|
5121
|
-
codec.i32 =
|
|
5124
|
+
codec.i32 = Descriptor.withView("i32", exactHint(4), (e, v) => e.i32(v), (d) => d.i32(), (s) => s.u32(), codec.bytes(4));
|
|
5122
5125
|
/** Signed 24-bit number. */
|
|
5123
|
-
codec.i24 =
|
|
5126
|
+
codec.i24 = Descriptor.withView("i24", exactHint(3), (e, v) => e.i24(v), (d) => d.i24(), (s) => s.u24(), codec.bytes(3));
|
|
5124
5127
|
/** Signed 16-bit number. */
|
|
5125
|
-
codec.i16 =
|
|
5128
|
+
codec.i16 = Descriptor.withView("i16", exactHint(2), (e, v) => e.i16(v), (d) => d.i16(), (s) => s.u16(), codec.bytes(2));
|
|
5126
5129
|
/** Signed 8-bit number. */
|
|
5127
|
-
codec.i8 =
|
|
5130
|
+
codec.i8 = Descriptor.new("i8", exactHint(1), (e, v) => e.i8(v), (d) => d.i8(), (s) => s.u8());
|
|
5128
5131
|
/** 1-byte boolean value. */
|
|
5129
|
-
codec.bool =
|
|
5132
|
+
codec.bool = Descriptor.new("bool", exactHint(1), (e, v) => e.bool(v), (d) => d.bool(), (s) => s.bool());
|
|
5130
5133
|
/** Variable-length bytes blob. */
|
|
5131
|
-
codec.blob =
|
|
5134
|
+
codec.blob = Descriptor.new("BytesBlob", { bytes: TYPICAL_SEQUENCE_LENGTH, isExact: false }, (e, v) => e.bytesBlob(v), (d) => d.bytesBlob(), (s) => s.bytesBlob());
|
|
5132
5135
|
/** String encoded as variable-length bytes blob. */
|
|
5133
|
-
codec.string =
|
|
5136
|
+
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);
|
|
5134
5137
|
/** Variable-length bit vector. */
|
|
5135
|
-
codec.bitVecVarLen =
|
|
5138
|
+
codec.bitVecVarLen = Descriptor.new("BitVec[?]", { bytes: TYPICAL_SEQUENCE_LENGTH >>> 3, isExact: false }, (e, v) => e.bitVecVarLen(v), (d) => d.bitVecVarLen(), (s) => s.bitVecVarLen());
|
|
5136
5139
|
/** Fixed-length bit vector. */
|
|
5137
|
-
codec.bitVecFixLen = (bitLen) =>
|
|
5140
|
+
codec.bitVecFixLen = (bitLen) => Descriptor.new(`BitVec[${bitLen}]`, exactHint(bitLen >>> 3), (e, v) => e.bitVecFixLen(v), (d) => d.bitVecFixLen(bitLen), (s) => s.bitVecFixLen(bitLen));
|
|
5138
5141
|
/** Optionality wrapper for given type. */
|
|
5139
5142
|
codec.optional = (type) => {
|
|
5140
|
-
const self =
|
|
5143
|
+
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));
|
|
5141
5144
|
if (hasUniqueView(type)) {
|
|
5142
|
-
return
|
|
5145
|
+
return Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.optional(type.View));
|
|
5143
5146
|
}
|
|
5144
5147
|
return self;
|
|
5145
5148
|
};
|
|
@@ -5150,7 +5153,7 @@ var descriptors_codec;
|
|
|
5150
5153
|
}) => {
|
|
5151
5154
|
const name = `Sequence<${type.name}>[?]`;
|
|
5152
5155
|
const typicalLength = options.typicalLength ?? TYPICAL_SEQUENCE_LENGTH;
|
|
5153
|
-
return
|
|
5156
|
+
return Descriptor.withView(name, { bytes: typicalLength * type.sizeHint.bytes, isExact: false }, (e, v) => {
|
|
5154
5157
|
validateLength(options, v.length, name);
|
|
5155
5158
|
e.sequenceVarLen(type, v);
|
|
5156
5159
|
}, (d) => {
|
|
@@ -5164,10 +5167,10 @@ var descriptors_codec;
|
|
|
5164
5167
|
}, sequenceViewVarLen(type, options));
|
|
5165
5168
|
};
|
|
5166
5169
|
/** Fixed-length sequence of given type. */
|
|
5167
|
-
codec.sequenceFixLen = (type, len) =>
|
|
5170
|
+
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 }));
|
|
5168
5171
|
/** Small dictionary codec. */
|
|
5169
5172
|
codec.dictionary = (key, value, { sortKeys, fixedLength, }) => {
|
|
5170
|
-
const self =
|
|
5173
|
+
const self = Descriptor.new(`Dictionary<${key.name}, ${value.name}>[${fixedLength ?? "?"}]`, {
|
|
5171
5174
|
bytes: fixedLength !== undefined
|
|
5172
5175
|
? fixedLength * addSizeHints(key.sizeHint, value.sizeHint).bytes
|
|
5173
5176
|
: TYPICAL_DICTIONARY_LENGTH * (addSizeHints(key.sizeHint, value.sizeHint).bytes ?? 0),
|
|
@@ -5206,13 +5209,13 @@ var descriptors_codec;
|
|
|
5206
5209
|
s.sequenceFixLen(value, len);
|
|
5207
5210
|
});
|
|
5208
5211
|
if (hasUniqueView(value)) {
|
|
5209
|
-
return
|
|
5212
|
+
return Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.dictionary(key, value.View, { sortKeys, fixedLength }));
|
|
5210
5213
|
}
|
|
5211
5214
|
return self;
|
|
5212
5215
|
};
|
|
5213
5216
|
/** Encoding of pair of two values. */
|
|
5214
5217
|
codec.pair = (a, b) => {
|
|
5215
|
-
const self =
|
|
5218
|
+
const self = Descriptor.new(`Pair<${a.name}, ${b.name}>`, addSizeHints(a.sizeHint, b.sizeHint), (e, elem) => {
|
|
5216
5219
|
a.encode(e, elem[0]);
|
|
5217
5220
|
b.encode(e, elem[1]);
|
|
5218
5221
|
}, (d) => {
|
|
@@ -5224,14 +5227,14 @@ var descriptors_codec;
|
|
|
5224
5227
|
b.skip(s);
|
|
5225
5228
|
});
|
|
5226
5229
|
if (hasUniqueView(a) && hasUniqueView(b)) {
|
|
5227
|
-
return
|
|
5230
|
+
return Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.pair(a.View, b.View));
|
|
5228
5231
|
}
|
|
5229
5232
|
return self;
|
|
5230
5233
|
};
|
|
5231
5234
|
/** Custom encoding / decoding logic. */
|
|
5232
|
-
codec.custom = ({ name, sizeHint = { bytes: 0, isExact: false }, }, encode, decode, skip) =>
|
|
5235
|
+
codec.custom = ({ name, sizeHint = { bytes: 0, isExact: false }, }, encode, decode, skip) => Descriptor.new(name, sizeHint, encode, decode, skip);
|
|
5233
5236
|
/** Choose a descriptor depending on the encoding/decoding context. */
|
|
5234
|
-
codec.select = ({ name, sizeHint, }, chooser) =>
|
|
5237
|
+
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);
|
|
5235
5238
|
/**
|
|
5236
5239
|
* A descriptor for a more complex POJO.
|
|
5237
5240
|
*
|
|
@@ -5268,7 +5271,7 @@ var descriptors_codec;
|
|
|
5268
5271
|
};
|
|
5269
5272
|
const view = objectView(Class, descriptors, sizeHint, skipper);
|
|
5270
5273
|
// and create the descriptor for the entire class.
|
|
5271
|
-
return
|
|
5274
|
+
return Descriptor.withView(Class.name, sizeHint, (e, t) => {
|
|
5272
5275
|
forEachDescriptor(descriptors, (key, descriptor) => {
|
|
5273
5276
|
const value = t[key];
|
|
5274
5277
|
descriptor.encode(e, value);
|
|
@@ -5319,7 +5322,7 @@ function objectView(Class, descriptors, sizeHint, skipper) {
|
|
|
5319
5322
|
});
|
|
5320
5323
|
}
|
|
5321
5324
|
});
|
|
5322
|
-
return
|
|
5325
|
+
return Descriptor.new(`View<${Class.name}>`, sizeHint, (e, t) => {
|
|
5323
5326
|
const encoded = t.encoded();
|
|
5324
5327
|
e.bytes(bytes_Bytes.fromBlob(encoded.raw, encoded.length));
|
|
5325
5328
|
}, (d) => {
|
|
@@ -5338,7 +5341,7 @@ function sequenceViewVarLen(type, options) {
|
|
|
5338
5341
|
validateLength(options, length, name);
|
|
5339
5342
|
return s.sequenceFixLen(type, length);
|
|
5340
5343
|
};
|
|
5341
|
-
return
|
|
5344
|
+
return Descriptor.new(name, sizeHint, (e, t) => {
|
|
5342
5345
|
validateLength(options, t.length, name);
|
|
5343
5346
|
const encoded = t.encoded();
|
|
5344
5347
|
e.bytes(bytes_Bytes.fromBlob(encoded.raw, encoded.length));
|
|
@@ -5354,7 +5357,7 @@ function sequenceViewFixLen(type, { fixedLength }) {
|
|
|
5354
5357
|
const skipper = (s) => s.sequenceFixLen(type, fixedLength);
|
|
5355
5358
|
const view = type.name !== type.View.name ? `, ${type.View.name}` : "";
|
|
5356
5359
|
const name = `SeqView<${type.name}${view}>[${fixedLength}]`;
|
|
5357
|
-
return
|
|
5360
|
+
return Descriptor.new(name, sizeHint, (e, t) => {
|
|
5358
5361
|
const encoded = t.encoded();
|
|
5359
5362
|
e.bytes(bytes_Bytes.fromBlob(encoded.raw, encoded.length));
|
|
5360
5363
|
}, (d) => {
|
|
@@ -7202,7 +7205,7 @@ const codecFixedSizeArray = (val, len) => {
|
|
|
7202
7205
|
};
|
|
7203
7206
|
/** Codec for a hash-dictionary. */
|
|
7204
7207
|
const codecHashDictionary = (value, extractKey, { typicalLength = TYPICAL_DICTIONARY_LENGTH, compare = (a, b) => extractKey(a).compare(extractKey(b)), } = {}) => {
|
|
7205
|
-
return
|
|
7208
|
+
return Descriptor.new(`HashDictionary<${value.name}>[?]`, {
|
|
7206
7209
|
bytes: typicalLength * value.sizeHint.bytes,
|
|
7207
7210
|
isExact: false,
|
|
7208
7211
|
}, (e, v) => {
|
|
@@ -9169,6 +9172,13 @@ const W_T = 128;
|
|
|
9169
9172
|
/** `W_M`: The maximum number of exports in a work-package. */
|
|
9170
9173
|
const W_X = 3_072;
|
|
9171
9174
|
// TODO [ToDr] Not sure where these should live yet :(
|
|
9175
|
+
/**
|
|
9176
|
+
* `S`: The minimum public service index.
|
|
9177
|
+
* Services of indices below these may only be created by the Registrar.
|
|
9178
|
+
*
|
|
9179
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/447a00447a00?v=0.7.2
|
|
9180
|
+
*/
|
|
9181
|
+
const MIN_PUBLIC_SERVICE_INDEX = (/* unused pure expression or super */ null && (2 ** 16));
|
|
9172
9182
|
/**
|
|
9173
9183
|
* `J`: The maximum sum of dependency items in a work-report.
|
|
9174
9184
|
*
|
|
@@ -9180,9 +9190,209 @@ const AUTHORIZATION_QUEUE_SIZE = Q;
|
|
|
9180
9190
|
/** `O`: Maximal authorization pool size. */
|
|
9181
9191
|
const MAX_AUTH_POOL_SIZE = O;
|
|
9182
9192
|
|
|
9193
|
+
;// CONCATENATED MODULE: ./packages/core/pvm-interpreter/ops/math-consts.ts
|
|
9194
|
+
const MAX_VALUE = 4294967295;
|
|
9195
|
+
const math_consts_MAX_VALUE_U64 = (/* unused pure expression or super */ null && (2n ** 63n));
|
|
9196
|
+
const MIN_VALUE = (/* unused pure expression or super */ null && (-(2 ** 31)));
|
|
9197
|
+
const MAX_SHIFT_U32 = 32;
|
|
9198
|
+
const MAX_SHIFT_U64 = 64n;
|
|
9199
|
+
|
|
9200
|
+
;// CONCATENATED MODULE: ./packages/jam/state/service.ts
|
|
9201
|
+
|
|
9202
|
+
|
|
9203
|
+
|
|
9204
|
+
|
|
9205
|
+
|
|
9206
|
+
|
|
9207
|
+
/**
|
|
9208
|
+
* `B_S`: The basic minimum balance which all services require.
|
|
9209
|
+
*
|
|
9210
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
|
|
9211
|
+
*/
|
|
9212
|
+
const BASE_SERVICE_BALANCE = 100n;
|
|
9213
|
+
/**
|
|
9214
|
+
* `B_I`: The additional minimum balance required per item of elective service state.
|
|
9215
|
+
*
|
|
9216
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
|
|
9217
|
+
*/
|
|
9218
|
+
const ELECTIVE_ITEM_BALANCE = 10n;
|
|
9219
|
+
/**
|
|
9220
|
+
* `B_L`: The additional minimum balance required per octet of elective service state.
|
|
9221
|
+
*
|
|
9222
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
|
|
9223
|
+
*/
|
|
9224
|
+
const ELECTIVE_BYTE_BALANCE = 1n;
|
|
9225
|
+
const zeroSizeHint = {
|
|
9226
|
+
bytes: 0,
|
|
9227
|
+
isExact: true,
|
|
9228
|
+
};
|
|
9229
|
+
/** 0-byte read, return given default value */
|
|
9230
|
+
const ignoreValueWithDefault = (defaultValue) => Descriptor.new("ignoreValue", zeroSizeHint, (_e, _v) => { }, (_d) => defaultValue, (_s) => { });
|
|
9231
|
+
/** Encode and decode object with leading version number. */
|
|
9232
|
+
const codecWithVersion = (val) => Descriptor.new("withVersion", {
|
|
9233
|
+
bytes: val.sizeHint.bytes + 8,
|
|
9234
|
+
isExact: false,
|
|
9235
|
+
}, (e, v) => {
|
|
9236
|
+
e.varU64(0n);
|
|
9237
|
+
val.encode(e, v);
|
|
9238
|
+
}, (d) => {
|
|
9239
|
+
const version = d.varU64();
|
|
9240
|
+
if (version !== 0n) {
|
|
9241
|
+
throw new Error("Non-zero version is not supported!");
|
|
9242
|
+
}
|
|
9243
|
+
return val.decode(d);
|
|
9244
|
+
}, (s) => {
|
|
9245
|
+
s.varU64();
|
|
9246
|
+
val.skip(s);
|
|
9247
|
+
});
|
|
9248
|
+
/**
|
|
9249
|
+
* Service account details.
|
|
9250
|
+
*
|
|
9251
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
|
|
9252
|
+
*/
|
|
9253
|
+
class ServiceAccountInfo extends WithDebug {
|
|
9254
|
+
codeHash;
|
|
9255
|
+
balance;
|
|
9256
|
+
accumulateMinGas;
|
|
9257
|
+
onTransferMinGas;
|
|
9258
|
+
storageUtilisationBytes;
|
|
9259
|
+
gratisStorage;
|
|
9260
|
+
storageUtilisationCount;
|
|
9261
|
+
created;
|
|
9262
|
+
lastAccumulation;
|
|
9263
|
+
parentService;
|
|
9264
|
+
static Codec = descriptors_codec.Class(ServiceAccountInfo, {
|
|
9265
|
+
codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
9266
|
+
balance: descriptors_codec.u64,
|
|
9267
|
+
accumulateMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
9268
|
+
onTransferMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
9269
|
+
storageUtilisationBytes: descriptors_codec.u64,
|
|
9270
|
+
gratisStorage: descriptors_codec.u64,
|
|
9271
|
+
storageUtilisationCount: descriptors_codec.u32,
|
|
9272
|
+
created: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
9273
|
+
lastAccumulation: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
9274
|
+
parentService: descriptors_codec.u32.convert((x) => x, tryAsServiceId),
|
|
9275
|
+
});
|
|
9276
|
+
static create(a) {
|
|
9277
|
+
return new ServiceAccountInfo(a.codeHash, a.balance, a.accumulateMinGas, a.onTransferMinGas, a.storageUtilisationBytes, a.gratisStorage, a.storageUtilisationCount, a.created, a.lastAccumulation, a.parentService);
|
|
9278
|
+
}
|
|
9279
|
+
/**
|
|
9280
|
+
* `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
|
|
9281
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
|
|
9282
|
+
*/
|
|
9283
|
+
static calculateThresholdBalance(items, bytes, gratisStorage) {
|
|
9284
|
+
const storageCost = BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
|
|
9285
|
+
if (storageCost < 0n) {
|
|
9286
|
+
return tryAsU64(0);
|
|
9287
|
+
}
|
|
9288
|
+
if (storageCost >= 2n ** 64n) {
|
|
9289
|
+
return tryAsU64(2n ** 64n - 1n);
|
|
9290
|
+
}
|
|
9291
|
+
return tryAsU64(storageCost);
|
|
9292
|
+
}
|
|
9293
|
+
constructor(
|
|
9294
|
+
/** `a_c`: Hash of the service code. */
|
|
9295
|
+
codeHash,
|
|
9296
|
+
/** `a_b`: Current account balance. */
|
|
9297
|
+
balance,
|
|
9298
|
+
/** `a_g`: Minimal gas required to execute Accumulate entrypoint. */
|
|
9299
|
+
accumulateMinGas,
|
|
9300
|
+
/** `a_m`: Minimal gas required to execute On Transfer entrypoint. */
|
|
9301
|
+
onTransferMinGas,
|
|
9302
|
+
/** `a_o`: Total number of octets in storage. */
|
|
9303
|
+
storageUtilisationBytes,
|
|
9304
|
+
/** `a_f`: Cost-free storage. Decreases both storage item count and total byte size. */
|
|
9305
|
+
gratisStorage,
|
|
9306
|
+
/** `a_i`: Number of items in storage. */
|
|
9307
|
+
storageUtilisationCount,
|
|
9308
|
+
/** `a_r`: Creation account time slot. */
|
|
9309
|
+
created,
|
|
9310
|
+
/** `a_a`: Most recent accumulation time slot. */
|
|
9311
|
+
lastAccumulation,
|
|
9312
|
+
/** `a_p`: Parent service ID. */
|
|
9313
|
+
parentService) {
|
|
9314
|
+
super();
|
|
9315
|
+
this.codeHash = codeHash;
|
|
9316
|
+
this.balance = balance;
|
|
9317
|
+
this.accumulateMinGas = accumulateMinGas;
|
|
9318
|
+
this.onTransferMinGas = onTransferMinGas;
|
|
9319
|
+
this.storageUtilisationBytes = storageUtilisationBytes;
|
|
9320
|
+
this.gratisStorage = gratisStorage;
|
|
9321
|
+
this.storageUtilisationCount = storageUtilisationCount;
|
|
9322
|
+
this.created = created;
|
|
9323
|
+
this.lastAccumulation = lastAccumulation;
|
|
9324
|
+
this.parentService = parentService;
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9327
|
+
class service_PreimageItem extends WithDebug {
|
|
9328
|
+
hash;
|
|
9329
|
+
blob;
|
|
9330
|
+
static Codec = descriptors_codec.Class(service_PreimageItem, {
|
|
9331
|
+
hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
9332
|
+
blob: descriptors_codec.blob,
|
|
9333
|
+
});
|
|
9334
|
+
static create({ hash, blob }) {
|
|
9335
|
+
return new service_PreimageItem(hash, blob);
|
|
9336
|
+
}
|
|
9337
|
+
constructor(hash, blob) {
|
|
9338
|
+
super();
|
|
9339
|
+
this.hash = hash;
|
|
9340
|
+
this.blob = blob;
|
|
9341
|
+
}
|
|
9342
|
+
}
|
|
9343
|
+
class StorageItem extends WithDebug {
|
|
9344
|
+
key;
|
|
9345
|
+
value;
|
|
9346
|
+
static Codec = descriptors_codec.Class(StorageItem, {
|
|
9347
|
+
key: descriptors_codec.blob.convert((i) => i, (o) => opaque_asOpaqueType(o)),
|
|
9348
|
+
value: descriptors_codec.blob,
|
|
9349
|
+
});
|
|
9350
|
+
static create({ key, value }) {
|
|
9351
|
+
return new StorageItem(key, value);
|
|
9352
|
+
}
|
|
9353
|
+
constructor(key, value) {
|
|
9354
|
+
super();
|
|
9355
|
+
this.key = key;
|
|
9356
|
+
this.value = value;
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9359
|
+
const MAX_LOOKUP_HISTORY_SLOTS = 3;
|
|
9360
|
+
function tryAsLookupHistorySlots(items) {
|
|
9361
|
+
const knownSize = sized_array_asKnownSize(items);
|
|
9362
|
+
if (knownSize.length > MAX_LOOKUP_HISTORY_SLOTS) {
|
|
9363
|
+
throw new Error(`Lookup history items must contain 0-${MAX_LOOKUP_HISTORY_SLOTS} timeslots.`);
|
|
9364
|
+
}
|
|
9365
|
+
return knownSize;
|
|
9366
|
+
}
|
|
9367
|
+
/** https://graypaper.fluffylabs.dev/#/5f542d7/115400115800 */
|
|
9368
|
+
class service_LookupHistoryItem {
|
|
9369
|
+
hash;
|
|
9370
|
+
length;
|
|
9371
|
+
slots;
|
|
9372
|
+
constructor(hash, length,
|
|
9373
|
+
/**
|
|
9374
|
+
* Preimage availability history as a sequence of time slots.
|
|
9375
|
+
* See PreimageStatus and the following GP fragment for more details.
|
|
9376
|
+
* https://graypaper.fluffylabs.dev/#/5f542d7/11780011a500 */
|
|
9377
|
+
slots) {
|
|
9378
|
+
this.hash = hash;
|
|
9379
|
+
this.length = length;
|
|
9380
|
+
this.slots = slots;
|
|
9381
|
+
}
|
|
9382
|
+
static isRequested(item) {
|
|
9383
|
+
if ("slots" in item) {
|
|
9384
|
+
return item.slots.length === 0;
|
|
9385
|
+
}
|
|
9386
|
+
return item.length === 0;
|
|
9387
|
+
}
|
|
9388
|
+
}
|
|
9389
|
+
|
|
9183
9390
|
;// CONCATENATED MODULE: ./packages/jam/state/privileged-services.ts
|
|
9184
9391
|
|
|
9185
9392
|
|
|
9393
|
+
|
|
9394
|
+
|
|
9395
|
+
|
|
9186
9396
|
/** Dictionary entry of services that auto-accumulate every block. */
|
|
9187
9397
|
class AutoAccumulate {
|
|
9188
9398
|
service;
|
|
@@ -9204,39 +9414,50 @@ class AutoAccumulate {
|
|
|
9204
9414
|
}
|
|
9205
9415
|
}
|
|
9206
9416
|
/**
|
|
9207
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
9417
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/114402114402?v=0.7.2
|
|
9208
9418
|
*/
|
|
9209
9419
|
class PrivilegedServices {
|
|
9210
9420
|
manager;
|
|
9211
|
-
|
|
9212
|
-
|
|
9421
|
+
delegator;
|
|
9422
|
+
registrar;
|
|
9423
|
+
assigners;
|
|
9213
9424
|
autoAccumulateServices;
|
|
9425
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bbd023bcb02?v=0.7.2 */
|
|
9214
9426
|
static Codec = descriptors_codec.Class(PrivilegedServices, {
|
|
9215
9427
|
manager: descriptors_codec.u32.asOpaque(),
|
|
9216
|
-
|
|
9217
|
-
|
|
9428
|
+
assigners: codecPerCore(descriptors_codec.u32.asOpaque()),
|
|
9429
|
+
delegator: descriptors_codec.u32.asOpaque(),
|
|
9430
|
+
registrar: Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
9431
|
+
? descriptors_codec.u32.asOpaque()
|
|
9432
|
+
: ignoreValueWithDefault(tryAsServiceId(2 ** 32 - 1)),
|
|
9218
9433
|
autoAccumulateServices: readonlyArray(descriptors_codec.sequenceVarLen(AutoAccumulate.Codec)),
|
|
9219
9434
|
});
|
|
9220
|
-
static create(
|
|
9221
|
-
return new PrivilegedServices(manager,
|
|
9435
|
+
static create(a) {
|
|
9436
|
+
return new PrivilegedServices(a.manager, a.delegator, a.registrar, a.assigners, a.autoAccumulateServices);
|
|
9222
9437
|
}
|
|
9223
9438
|
constructor(
|
|
9224
9439
|
/**
|
|
9225
|
-
*
|
|
9226
|
-
* the service able to effect an alteration of χ from block to block,
|
|
9440
|
+
* `χ_M`: Manages alteration of χ from block to block,
|
|
9227
9441
|
* as well as bestow services with storage deposit credits.
|
|
9228
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
9442
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/111502111902?v=0.7.2
|
|
9229
9443
|
*/
|
|
9230
9444
|
manager,
|
|
9231
|
-
/**
|
|
9232
|
-
|
|
9233
|
-
/**
|
|
9234
|
-
|
|
9235
|
-
|
|
9445
|
+
/** `χ_V`: Managers validator keys. */
|
|
9446
|
+
delegator,
|
|
9447
|
+
/**
|
|
9448
|
+
* `χ_R`: Manages the creation of services in protected range.
|
|
9449
|
+
*
|
|
9450
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/111b02111d02?v=0.7.2
|
|
9451
|
+
*/
|
|
9452
|
+
registrar,
|
|
9453
|
+
/** `χ_A`: Manages authorization queue one for each core. */
|
|
9454
|
+
assigners,
|
|
9455
|
+
/** `χ_Z`: Dictionary of services that auto-accumulate every block with their gas limit. */
|
|
9236
9456
|
autoAccumulateServices) {
|
|
9237
9457
|
this.manager = manager;
|
|
9238
|
-
this.
|
|
9239
|
-
this.
|
|
9458
|
+
this.delegator = delegator;
|
|
9459
|
+
this.registrar = registrar;
|
|
9460
|
+
this.assigners = assigners;
|
|
9240
9461
|
this.autoAccumulateServices = autoAccumulateServices;
|
|
9241
9462
|
}
|
|
9242
9463
|
}
|
|
@@ -9324,7 +9545,7 @@ class RecentBlocks extends WithDebug {
|
|
|
9324
9545
|
*/
|
|
9325
9546
|
class RecentBlocksHistory extends WithDebug {
|
|
9326
9547
|
current;
|
|
9327
|
-
static Codec =
|
|
9548
|
+
static Codec = Descriptor.new("RecentBlocksHistory", RecentBlocks.Codec.sizeHint, (encoder, value) => RecentBlocks.Codec.encode(encoder, value.asCurrent()), (decoder) => {
|
|
9328
9549
|
const recentBlocks = RecentBlocks.Codec.decode(decoder);
|
|
9329
9550
|
return RecentBlocksHistory.create(recentBlocks);
|
|
9330
9551
|
}, (skip) => {
|
|
@@ -9521,196 +9742,6 @@ class SafroleData {
|
|
|
9521
9742
|
}
|
|
9522
9743
|
}
|
|
9523
9744
|
|
|
9524
|
-
;// CONCATENATED MODULE: ./packages/jam/state/service.ts
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
/**
|
|
9532
|
-
* `B_S`: The basic minimum balance which all services require.
|
|
9533
|
-
*
|
|
9534
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
|
|
9535
|
-
*/
|
|
9536
|
-
const BASE_SERVICE_BALANCE = 100n;
|
|
9537
|
-
/**
|
|
9538
|
-
* `B_I`: The additional minimum balance required per item of elective service state.
|
|
9539
|
-
*
|
|
9540
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
|
|
9541
|
-
*/
|
|
9542
|
-
const ELECTIVE_ITEM_BALANCE = 10n;
|
|
9543
|
-
/**
|
|
9544
|
-
* `B_L`: The additional minimum balance required per octet of elective service state.
|
|
9545
|
-
*
|
|
9546
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
|
|
9547
|
-
*/
|
|
9548
|
-
const ELECTIVE_BYTE_BALANCE = 1n;
|
|
9549
|
-
const zeroSizeHint = {
|
|
9550
|
-
bytes: 0,
|
|
9551
|
-
isExact: true,
|
|
9552
|
-
};
|
|
9553
|
-
/** 0-byte read, return given default value */
|
|
9554
|
-
const ignoreValueWithDefault = (defaultValue) => Descriptor.new("ignoreValue", zeroSizeHint, (_e, _v) => { }, (_d) => defaultValue, (_s) => { });
|
|
9555
|
-
/** Encode and decode object with leading version number. */
|
|
9556
|
-
const codecWithVersion = (val) => descriptor_Descriptor.new("withVersion", {
|
|
9557
|
-
bytes: val.sizeHint.bytes + 8,
|
|
9558
|
-
isExact: false,
|
|
9559
|
-
}, (e, v) => {
|
|
9560
|
-
e.varU64(0n);
|
|
9561
|
-
val.encode(e, v);
|
|
9562
|
-
}, (d) => {
|
|
9563
|
-
const version = d.varU64();
|
|
9564
|
-
if (version !== 0n) {
|
|
9565
|
-
throw new Error("Non-zero version is not supported!");
|
|
9566
|
-
}
|
|
9567
|
-
return val.decode(d);
|
|
9568
|
-
}, (s) => {
|
|
9569
|
-
s.varU64();
|
|
9570
|
-
val.skip(s);
|
|
9571
|
-
});
|
|
9572
|
-
/**
|
|
9573
|
-
* Service account details.
|
|
9574
|
-
*
|
|
9575
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
|
|
9576
|
-
*/
|
|
9577
|
-
class ServiceAccountInfo extends WithDebug {
|
|
9578
|
-
codeHash;
|
|
9579
|
-
balance;
|
|
9580
|
-
accumulateMinGas;
|
|
9581
|
-
onTransferMinGas;
|
|
9582
|
-
storageUtilisationBytes;
|
|
9583
|
-
gratisStorage;
|
|
9584
|
-
storageUtilisationCount;
|
|
9585
|
-
created;
|
|
9586
|
-
lastAccumulation;
|
|
9587
|
-
parentService;
|
|
9588
|
-
static Codec = descriptors_codec.Class(ServiceAccountInfo, {
|
|
9589
|
-
codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
9590
|
-
balance: descriptors_codec.u64,
|
|
9591
|
-
accumulateMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
9592
|
-
onTransferMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
9593
|
-
storageUtilisationBytes: descriptors_codec.u64,
|
|
9594
|
-
gratisStorage: descriptors_codec.u64,
|
|
9595
|
-
storageUtilisationCount: descriptors_codec.u32,
|
|
9596
|
-
created: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
9597
|
-
lastAccumulation: descriptors_codec.u32.convert((x) => x, common_tryAsTimeSlot),
|
|
9598
|
-
parentService: descriptors_codec.u32.convert((x) => x, tryAsServiceId),
|
|
9599
|
-
});
|
|
9600
|
-
static create(a) {
|
|
9601
|
-
return new ServiceAccountInfo(a.codeHash, a.balance, a.accumulateMinGas, a.onTransferMinGas, a.storageUtilisationBytes, a.gratisStorage, a.storageUtilisationCount, a.created, a.lastAccumulation, a.parentService);
|
|
9602
|
-
}
|
|
9603
|
-
/**
|
|
9604
|
-
* `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
|
|
9605
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
|
|
9606
|
-
*/
|
|
9607
|
-
static calculateThresholdBalance(items, bytes, gratisStorage) {
|
|
9608
|
-
const storageCost = BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
|
|
9609
|
-
if (storageCost < 0n) {
|
|
9610
|
-
return tryAsU64(0);
|
|
9611
|
-
}
|
|
9612
|
-
if (storageCost >= 2n ** 64n) {
|
|
9613
|
-
return tryAsU64(2n ** 64n - 1n);
|
|
9614
|
-
}
|
|
9615
|
-
return tryAsU64(storageCost);
|
|
9616
|
-
}
|
|
9617
|
-
constructor(
|
|
9618
|
-
/** `a_c`: Hash of the service code. */
|
|
9619
|
-
codeHash,
|
|
9620
|
-
/** `a_b`: Current account balance. */
|
|
9621
|
-
balance,
|
|
9622
|
-
/** `a_g`: Minimal gas required to execute Accumulate entrypoint. */
|
|
9623
|
-
accumulateMinGas,
|
|
9624
|
-
/** `a_m`: Minimal gas required to execute On Transfer entrypoint. */
|
|
9625
|
-
onTransferMinGas,
|
|
9626
|
-
/** `a_o`: Total number of octets in storage. */
|
|
9627
|
-
storageUtilisationBytes,
|
|
9628
|
-
/** `a_f`: Cost-free storage. Decreases both storage item count and total byte size. */
|
|
9629
|
-
gratisStorage,
|
|
9630
|
-
/** `a_i`: Number of items in storage. */
|
|
9631
|
-
storageUtilisationCount,
|
|
9632
|
-
/** `a_r`: Creation account time slot. */
|
|
9633
|
-
created,
|
|
9634
|
-
/** `a_a`: Most recent accumulation time slot. */
|
|
9635
|
-
lastAccumulation,
|
|
9636
|
-
/** `a_p`: Parent service ID. */
|
|
9637
|
-
parentService) {
|
|
9638
|
-
super();
|
|
9639
|
-
this.codeHash = codeHash;
|
|
9640
|
-
this.balance = balance;
|
|
9641
|
-
this.accumulateMinGas = accumulateMinGas;
|
|
9642
|
-
this.onTransferMinGas = onTransferMinGas;
|
|
9643
|
-
this.storageUtilisationBytes = storageUtilisationBytes;
|
|
9644
|
-
this.gratisStorage = gratisStorage;
|
|
9645
|
-
this.storageUtilisationCount = storageUtilisationCount;
|
|
9646
|
-
this.created = created;
|
|
9647
|
-
this.lastAccumulation = lastAccumulation;
|
|
9648
|
-
this.parentService = parentService;
|
|
9649
|
-
}
|
|
9650
|
-
}
|
|
9651
|
-
class service_PreimageItem extends WithDebug {
|
|
9652
|
-
hash;
|
|
9653
|
-
blob;
|
|
9654
|
-
static Codec = descriptors_codec.Class(service_PreimageItem, {
|
|
9655
|
-
hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
9656
|
-
blob: descriptors_codec.blob,
|
|
9657
|
-
});
|
|
9658
|
-
static create({ hash, blob }) {
|
|
9659
|
-
return new service_PreimageItem(hash, blob);
|
|
9660
|
-
}
|
|
9661
|
-
constructor(hash, blob) {
|
|
9662
|
-
super();
|
|
9663
|
-
this.hash = hash;
|
|
9664
|
-
this.blob = blob;
|
|
9665
|
-
}
|
|
9666
|
-
}
|
|
9667
|
-
class StorageItem extends WithDebug {
|
|
9668
|
-
key;
|
|
9669
|
-
value;
|
|
9670
|
-
static Codec = descriptors_codec.Class(StorageItem, {
|
|
9671
|
-
key: descriptors_codec.blob.convert((i) => i, (o) => opaque_asOpaqueType(o)),
|
|
9672
|
-
value: descriptors_codec.blob,
|
|
9673
|
-
});
|
|
9674
|
-
static create({ key, value }) {
|
|
9675
|
-
return new StorageItem(key, value);
|
|
9676
|
-
}
|
|
9677
|
-
constructor(key, value) {
|
|
9678
|
-
super();
|
|
9679
|
-
this.key = key;
|
|
9680
|
-
this.value = value;
|
|
9681
|
-
}
|
|
9682
|
-
}
|
|
9683
|
-
const MAX_LOOKUP_HISTORY_SLOTS = 3;
|
|
9684
|
-
function tryAsLookupHistorySlots(items) {
|
|
9685
|
-
const knownSize = sized_array_asKnownSize(items);
|
|
9686
|
-
if (knownSize.length > MAX_LOOKUP_HISTORY_SLOTS) {
|
|
9687
|
-
throw new Error(`Lookup history items must contain 0-${MAX_LOOKUP_HISTORY_SLOTS} timeslots.`);
|
|
9688
|
-
}
|
|
9689
|
-
return knownSize;
|
|
9690
|
-
}
|
|
9691
|
-
/** https://graypaper.fluffylabs.dev/#/5f542d7/115400115800 */
|
|
9692
|
-
class service_LookupHistoryItem {
|
|
9693
|
-
hash;
|
|
9694
|
-
length;
|
|
9695
|
-
slots;
|
|
9696
|
-
constructor(hash, length,
|
|
9697
|
-
/**
|
|
9698
|
-
* Preimage availability history as a sequence of time slots.
|
|
9699
|
-
* See PreimageStatus and the following GP fragment for more details.
|
|
9700
|
-
* https://graypaper.fluffylabs.dev/#/5f542d7/11780011a500 */
|
|
9701
|
-
slots) {
|
|
9702
|
-
this.hash = hash;
|
|
9703
|
-
this.length = length;
|
|
9704
|
-
this.slots = slots;
|
|
9705
|
-
}
|
|
9706
|
-
static isRequested(item) {
|
|
9707
|
-
if ("slots" in item) {
|
|
9708
|
-
return item.slots.length === 0;
|
|
9709
|
-
}
|
|
9710
|
-
return item.length === 0;
|
|
9711
|
-
}
|
|
9712
|
-
}
|
|
9713
|
-
|
|
9714
9745
|
;// CONCATENATED MODULE: ./packages/jam/state/state.ts
|
|
9715
9746
|
/**
|
|
9716
9747
|
* In addition to the entropy accumulator η_0, we retain
|
|
@@ -10147,6 +10178,7 @@ class StatisticsData {
|
|
|
10147
10178
|
|
|
10148
10179
|
|
|
10149
10180
|
|
|
10181
|
+
|
|
10150
10182
|
|
|
10151
10183
|
|
|
10152
10184
|
var in_memory_state_UpdateError;
|
|
@@ -10550,8 +10582,9 @@ class InMemoryState extends WithDebug {
|
|
|
10550
10582
|
epochRoot: bytes_Bytes.zero(BANDERSNATCH_RING_ROOT_BYTES).asOpaque(),
|
|
10551
10583
|
privilegedServices: PrivilegedServices.create({
|
|
10552
10584
|
manager: tryAsServiceId(0),
|
|
10553
|
-
|
|
10554
|
-
|
|
10585
|
+
assigners: tryAsPerCore(new Array(spec.coresCount).fill(tryAsServiceId(0)), spec),
|
|
10586
|
+
delegator: tryAsServiceId(0),
|
|
10587
|
+
registrar: tryAsServiceId(MAX_VALUE),
|
|
10555
10588
|
autoAccumulateServices: [],
|
|
10556
10589
|
}),
|
|
10557
10590
|
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
|
|
@@ -10787,7 +10820,7 @@ var serialize;
|
|
|
10787
10820
|
* determine the boundary of the bytes, so it can only be used
|
|
10788
10821
|
* as the last element of the codec and can't be used in sequences!
|
|
10789
10822
|
*/
|
|
10790
|
-
const dumpCodec =
|
|
10823
|
+
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()));
|
|
10791
10824
|
|
|
10792
10825
|
;// CONCATENATED MODULE: ./packages/jam/state-merkleization/serialized-state.ts
|
|
10793
10826
|
|
|
@@ -12098,7 +12131,7 @@ const codecMap = (value, extractKey, { typicalLength = TYPICAL_DICTIONARY_LENGTH
|
|
|
12098
12131
|
}
|
|
12099
12132
|
return Ordering.Equal;
|
|
12100
12133
|
}, } = {}) => {
|
|
12101
|
-
return
|
|
12134
|
+
return Descriptor.new(`Map<${value.name}>[?]`, {
|
|
12102
12135
|
bytes: typicalLength * value.sizeHint.bytes,
|
|
12103
12136
|
isExact: false,
|
|
12104
12137
|
}, (e, v) => {
|