@typeberry/lib 0.1.2 → 0.1.3-6edad4a
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/index.cjs +565 -89
- package/index.d.ts +1233 -656
- package/index.js +546 -71
- package/package.json +1 -1
- package/bin/lib/index.d.ts +0 -29
- package/configs/index.d.ts +0 -76
package/index.js
CHANGED
|
@@ -560,7 +560,7 @@ function isResult(x) {
|
|
|
560
560
|
* as an afterthought.
|
|
561
561
|
*/
|
|
562
562
|
|
|
563
|
-
var index$
|
|
563
|
+
var index$u = /*#__PURE__*/Object.freeze({
|
|
564
564
|
__proto__: null,
|
|
565
565
|
get CURRENT_SUITE () { return CURRENT_SUITE; },
|
|
566
566
|
get CURRENT_VERSION () { return CURRENT_VERSION; },
|
|
@@ -714,7 +714,7 @@ class Ordering {
|
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
|
|
717
|
-
var index$
|
|
717
|
+
var index$t = /*#__PURE__*/Object.freeze({
|
|
718
718
|
__proto__: null,
|
|
719
719
|
Ordering: Ordering
|
|
720
720
|
});
|
|
@@ -965,7 +965,7 @@ function u8ArraySameLengthEqual(self, other) {
|
|
|
965
965
|
}
|
|
966
966
|
const bytesBlobComparator = (a, b) => a.compare(b);
|
|
967
967
|
|
|
968
|
-
var index$
|
|
968
|
+
var index$s = /*#__PURE__*/Object.freeze({
|
|
969
969
|
__proto__: null,
|
|
970
970
|
BitVec: BitVec,
|
|
971
971
|
Bytes: Bytes,
|
|
@@ -1067,7 +1067,7 @@ const minU64 = (a, ...values) => values.reduce((min, value) => (value > min ? mi
|
|
|
1067
1067
|
/** Get the biggest value between U64 a and values given as input parameters. */
|
|
1068
1068
|
const maxU64 = (a, ...values) => values.reduce((max, value) => (value < max ? max : value), a);
|
|
1069
1069
|
|
|
1070
|
-
var index$
|
|
1070
|
+
var index$r = /*#__PURE__*/Object.freeze({
|
|
1071
1071
|
__proto__: null,
|
|
1072
1072
|
isU16: isU16,
|
|
1073
1073
|
isU32: isU32,
|
|
@@ -1944,13 +1944,15 @@ function validateLength(range, length, context) {
|
|
|
1944
1944
|
|
|
1945
1945
|
/** A caching wrapper for either object or sequence item. */
|
|
1946
1946
|
class ViewField {
|
|
1947
|
+
name;
|
|
1947
1948
|
getView;
|
|
1948
1949
|
getValue;
|
|
1949
1950
|
getEncoded;
|
|
1950
1951
|
cachedValue;
|
|
1951
1952
|
cachedView;
|
|
1952
1953
|
cachedBlob;
|
|
1953
|
-
constructor(getView, getValue, getEncoded) {
|
|
1954
|
+
constructor(name, getView, getValue, getEncoded) {
|
|
1955
|
+
this.name = name;
|
|
1954
1956
|
this.getView = getView;
|
|
1955
1957
|
this.getValue = getValue;
|
|
1956
1958
|
this.getEncoded = getEncoded;
|
|
@@ -1976,6 +1978,9 @@ class ViewField {
|
|
|
1976
1978
|
}
|
|
1977
1979
|
return this.cachedBlob;
|
|
1978
1980
|
}
|
|
1981
|
+
toString() {
|
|
1982
|
+
return `ViewField<${this.name}>`;
|
|
1983
|
+
}
|
|
1979
1984
|
}
|
|
1980
1985
|
/**
|
|
1981
1986
|
* A base class for all the lazy views.
|
|
@@ -2050,7 +2055,7 @@ class ObjectView {
|
|
|
2050
2055
|
const fieldDecoder = skipper.decoder.clone();
|
|
2051
2056
|
const field = this.descriptorsKeys[i];
|
|
2052
2057
|
const type = this.descriptors[field];
|
|
2053
|
-
lastItem = new ViewField(() => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
|
|
2058
|
+
lastItem = new ViewField(`${this.toString()}.${String(field)}`, () => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
|
|
2054
2059
|
// skip the field
|
|
2055
2060
|
type.skip(skipper);
|
|
2056
2061
|
// cache data
|
|
@@ -2062,6 +2067,9 @@ class ObjectView {
|
|
|
2062
2067
|
}
|
|
2063
2068
|
return lastItem;
|
|
2064
2069
|
}
|
|
2070
|
+
toString() {
|
|
2071
|
+
return `View<${this.materializedConstructor.name}>(cache: ${this.cache.size})`;
|
|
2072
|
+
}
|
|
2065
2073
|
}
|
|
2066
2074
|
/**
|
|
2067
2075
|
* A lazy-evaluated decoder of a sequence.
|
|
@@ -2150,7 +2158,7 @@ class SequenceView {
|
|
|
2150
2158
|
// create new cached prop
|
|
2151
2159
|
const fieldDecoder = skipper.decoder.clone();
|
|
2152
2160
|
const type = this.descriptor;
|
|
2153
|
-
lastItem = new ViewField(() => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
|
|
2161
|
+
lastItem = new ViewField(`${this.toString()}[${index}]`, () => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
|
|
2154
2162
|
// skip the field
|
|
2155
2163
|
type.skip(skipper);
|
|
2156
2164
|
// cache data
|
|
@@ -2162,6 +2170,9 @@ class SequenceView {
|
|
|
2162
2170
|
}
|
|
2163
2171
|
return lastItem;
|
|
2164
2172
|
}
|
|
2173
|
+
toString() {
|
|
2174
|
+
return `SequenceView<${this.descriptor.name}>(cache: ${this.cache.size})`;
|
|
2175
|
+
}
|
|
2165
2176
|
}
|
|
2166
2177
|
|
|
2167
2178
|
/**
|
|
@@ -2477,7 +2488,7 @@ function sequenceViewFixLen(type, { fixedLength }) {
|
|
|
2477
2488
|
}, skipper);
|
|
2478
2489
|
}
|
|
2479
2490
|
|
|
2480
|
-
var index$
|
|
2491
|
+
var index$q = /*#__PURE__*/Object.freeze({
|
|
2481
2492
|
__proto__: null,
|
|
2482
2493
|
Decoder: Decoder,
|
|
2483
2494
|
Descriptor: Descriptor,
|
|
@@ -4916,7 +4927,7 @@ var keccak = /*#__PURE__*/Object.freeze({
|
|
|
4916
4927
|
hashBlobs: hashBlobs
|
|
4917
4928
|
});
|
|
4918
4929
|
|
|
4919
|
-
var index$
|
|
4930
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
4920
4931
|
__proto__: null,
|
|
4921
4932
|
HASH_SIZE: HASH_SIZE,
|
|
4922
4933
|
PageAllocator: PageAllocator,
|
|
@@ -4982,7 +4993,7 @@ var keyDerivation = /*#__PURE__*/Object.freeze({
|
|
|
4982
4993
|
trivialSeed: trivialSeed
|
|
4983
4994
|
});
|
|
4984
4995
|
|
|
4985
|
-
var index$
|
|
4996
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
4986
4997
|
__proto__: null,
|
|
4987
4998
|
BANDERSNATCH_KEY_BYTES: BANDERSNATCH_KEY_BYTES,
|
|
4988
4999
|
BANDERSNATCH_PROOF_BYTES: BANDERSNATCH_PROOF_BYTES,
|
|
@@ -5586,7 +5597,7 @@ class TruncatedHashDictionary {
|
|
|
5586
5597
|
}
|
|
5587
5598
|
}
|
|
5588
5599
|
|
|
5589
|
-
var index$
|
|
5600
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
5590
5601
|
__proto__: null,
|
|
5591
5602
|
FixedSizeArray: FixedSizeArray,
|
|
5592
5603
|
HashDictionary: HashDictionary,
|
|
@@ -5781,7 +5792,7 @@ class Bootnode {
|
|
|
5781
5792
|
}
|
|
5782
5793
|
}
|
|
5783
5794
|
|
|
5784
|
-
var index$
|
|
5795
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
5785
5796
|
__proto__: null,
|
|
5786
5797
|
Bootnode: Bootnode,
|
|
5787
5798
|
ChainSpec: ChainSpec,
|
|
@@ -5954,6 +5965,40 @@ var assurances = /*#__PURE__*/Object.freeze({
|
|
|
5954
5965
|
assurancesExtrinsicCodec: assurancesExtrinsicCodec
|
|
5955
5966
|
});
|
|
5956
5967
|
|
|
5968
|
+
/** Attempt to convert a number into `TimeSlot`. */
|
|
5969
|
+
const tryAsTimeSlot = (v) => asOpaqueType(tryAsU32(v));
|
|
5970
|
+
/** Attempt to convert a number into `ValidatorIndex`. */
|
|
5971
|
+
const tryAsValidatorIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
5972
|
+
/** Attempt to convert a number into `ServiceId`. */
|
|
5973
|
+
const tryAsServiceId = (v) => asOpaqueType(tryAsU32(v));
|
|
5974
|
+
const tryAsServiceGas = (v) => asOpaqueType(tryAsU64(v));
|
|
5975
|
+
/** Attempt to convert a number into `CoreIndex`. */
|
|
5976
|
+
const tryAsCoreIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
5977
|
+
/** Attempt to convert a number into `Epoch`. */
|
|
5978
|
+
const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
|
|
5979
|
+
function tryAsPerValidator(array, spec) {
|
|
5980
|
+
check `
|
|
5981
|
+
${array.length === spec.validatorsCount}
|
|
5982
|
+
Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
|
|
5983
|
+
`;
|
|
5984
|
+
return asKnownSize(array);
|
|
5985
|
+
}
|
|
5986
|
+
const codecPerValidator = (val) => codecWithContext((context) => {
|
|
5987
|
+
return codecKnownSizeArray(val, {
|
|
5988
|
+
fixedLength: context.validatorsCount,
|
|
5989
|
+
});
|
|
5990
|
+
});
|
|
5991
|
+
function tryAsPerEpochBlock(array, spec) {
|
|
5992
|
+
check `
|
|
5993
|
+
${array.length === spec.epochLength}
|
|
5994
|
+
Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
|
|
5995
|
+
`;
|
|
5996
|
+
return asKnownSize(array);
|
|
5997
|
+
}
|
|
5998
|
+
const codecPerEpochBlock = (val) => codecWithContext((context) => {
|
|
5999
|
+
return codecKnownSizeArray(val, { fixedLength: context.epochLength });
|
|
6000
|
+
});
|
|
6001
|
+
|
|
5957
6002
|
/**
|
|
5958
6003
|
* Proof of signing a contradictory [`Judgement`] of a work report.
|
|
5959
6004
|
*/
|
|
@@ -6145,40 +6190,6 @@ var disputes = /*#__PURE__*/Object.freeze({
|
|
|
6145
6190
|
Verdict: Verdict
|
|
6146
6191
|
});
|
|
6147
6192
|
|
|
6148
|
-
/** Attempt to convert a number into `TimeSlot`. */
|
|
6149
|
-
const tryAsTimeSlot = (v) => asOpaqueType(tryAsU32(v));
|
|
6150
|
-
/** Attempt to convert a number into `ValidatorIndex`. */
|
|
6151
|
-
const tryAsValidatorIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
6152
|
-
/** Attempt to convert a number into `ServiceId`. */
|
|
6153
|
-
const tryAsServiceId = (v) => asOpaqueType(tryAsU32(v));
|
|
6154
|
-
const tryAsServiceGas = (v) => asOpaqueType(tryAsU64(v));
|
|
6155
|
-
/** Attempt to convert a number into `CoreIndex`. */
|
|
6156
|
-
const tryAsCoreIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
6157
|
-
/** Attempt to convert a number into `Epoch`. */
|
|
6158
|
-
const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
|
|
6159
|
-
function tryAsPerValidator(array, spec) {
|
|
6160
|
-
check `
|
|
6161
|
-
${array.length === spec.validatorsCount}
|
|
6162
|
-
Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
|
|
6163
|
-
`;
|
|
6164
|
-
return asKnownSize(array);
|
|
6165
|
-
}
|
|
6166
|
-
const codecPerValidator = (val) => codecWithContext((context) => {
|
|
6167
|
-
return codecKnownSizeArray(val, {
|
|
6168
|
-
fixedLength: context.validatorsCount,
|
|
6169
|
-
});
|
|
6170
|
-
});
|
|
6171
|
-
function tryAsPerEpochBlock(array, spec) {
|
|
6172
|
-
check `
|
|
6173
|
-
${array.length === spec.epochLength}
|
|
6174
|
-
Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
|
|
6175
|
-
`;
|
|
6176
|
-
return asKnownSize(array);
|
|
6177
|
-
}
|
|
6178
|
-
const codecPerEpochBlock = (val) => codecWithContext((context) => {
|
|
6179
|
-
return codecKnownSizeArray(val, { fixedLength: context.epochLength });
|
|
6180
|
-
});
|
|
6181
|
-
|
|
6182
6193
|
/**
|
|
6183
6194
|
* Mapping between work package hash and root hash of it's exports.
|
|
6184
6195
|
*
|
|
@@ -7257,8 +7268,26 @@ class Block extends WithDebug {
|
|
|
7257
7268
|
this.extrinsic = extrinsic;
|
|
7258
7269
|
}
|
|
7259
7270
|
}
|
|
7271
|
+
function emptyBlock(slot = tryAsTimeSlot(0)) {
|
|
7272
|
+
const header = Header.empty();
|
|
7273
|
+
header.timeSlotIndex = slot;
|
|
7274
|
+
return Block.create({
|
|
7275
|
+
header,
|
|
7276
|
+
extrinsic: Extrinsic.create({
|
|
7277
|
+
tickets: asKnownSize([]),
|
|
7278
|
+
preimages: [],
|
|
7279
|
+
assurances: asKnownSize([]),
|
|
7280
|
+
guarantees: asKnownSize([]),
|
|
7281
|
+
disputes: {
|
|
7282
|
+
verdicts: [],
|
|
7283
|
+
culprits: [],
|
|
7284
|
+
faults: [],
|
|
7285
|
+
},
|
|
7286
|
+
}),
|
|
7287
|
+
});
|
|
7288
|
+
}
|
|
7260
7289
|
|
|
7261
|
-
var index$
|
|
7290
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
7262
7291
|
__proto__: null,
|
|
7263
7292
|
Block: Block,
|
|
7264
7293
|
EpochMarker: EpochMarker,
|
|
@@ -7273,6 +7302,7 @@ var index$j = /*#__PURE__*/Object.freeze({
|
|
|
7273
7302
|
codecPerValidator: codecPerValidator,
|
|
7274
7303
|
codecUtils: codec,
|
|
7275
7304
|
disputes: disputes,
|
|
7305
|
+
emptyBlock: emptyBlock,
|
|
7276
7306
|
encodeUnsealedHeader: encodeUnsealedHeader,
|
|
7277
7307
|
guarantees: guarantees,
|
|
7278
7308
|
headerViewWithHashCodec: headerViewWithHashCodec,
|
|
@@ -7513,7 +7543,7 @@ var json;
|
|
|
7513
7543
|
json.object = object;
|
|
7514
7544
|
})(json || (json = {}));
|
|
7515
7545
|
|
|
7516
|
-
var index$
|
|
7546
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
7517
7547
|
__proto__: null,
|
|
7518
7548
|
get json () { return json; },
|
|
7519
7549
|
parseFromJson: parseFromJson
|
|
@@ -7783,7 +7813,7 @@ const blockFromJson = (spec) => json.object({
|
|
|
7783
7813
|
extrinsic: getExtrinsicFromJson(spec),
|
|
7784
7814
|
}, ({ header, extrinsic }) => Block.create({ header, extrinsic }));
|
|
7785
7815
|
|
|
7786
|
-
var index$
|
|
7816
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
7787
7817
|
__proto__: null,
|
|
7788
7818
|
blockFromJson: blockFromJson,
|
|
7789
7819
|
disputesExtrinsicFromJson: disputesExtrinsicFromJson,
|
|
@@ -8049,8 +8079,8 @@ function print(level, levelAndName, strings, data) {
|
|
|
8049
8079
|
return;
|
|
8050
8080
|
}
|
|
8051
8081
|
const lvlText = Level[level].padEnd(5);
|
|
8052
|
-
const val = strings.map((v, idx) => `${v}${data[idx]}`);
|
|
8053
|
-
const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
|
|
8082
|
+
const val = strings.map((v, idx) => `${v}${idx < data.length ? data[idx] : ""}`);
|
|
8083
|
+
const msg = `${lvlText} [${levelAndName[1]}] ${val.join("")}`;
|
|
8054
8084
|
if (level === Level.WARN) {
|
|
8055
8085
|
console.warn(msg);
|
|
8056
8086
|
}
|
|
@@ -8281,7 +8311,7 @@ class Logger {
|
|
|
8281
8311
|
}
|
|
8282
8312
|
}
|
|
8283
8313
|
|
|
8284
|
-
var index$
|
|
8314
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
8285
8315
|
__proto__: null,
|
|
8286
8316
|
get Level () { return Level; },
|
|
8287
8317
|
Logger: Logger,
|
|
@@ -8304,7 +8334,7 @@ class AuthorshipOptions {
|
|
|
8304
8334
|
}
|
|
8305
8335
|
}
|
|
8306
8336
|
|
|
8307
|
-
const logger$
|
|
8337
|
+
const logger$5 = Logger.new(import.meta.filename, "config");
|
|
8308
8338
|
/** Development config. Will accept unsealed blocks for now. */
|
|
8309
8339
|
const DEV_CONFIG = "dev";
|
|
8310
8340
|
/** Default config file. */
|
|
@@ -8363,15 +8393,15 @@ class NodeConfiguration {
|
|
|
8363
8393
|
}
|
|
8364
8394
|
function loadConfig(configPath) {
|
|
8365
8395
|
if (configPath === DEFAULT_CONFIG) {
|
|
8366
|
-
logger$
|
|
8396
|
+
logger$5.log `🔧 Loading DEFAULT config`;
|
|
8367
8397
|
return parseFromJson(configs.default, NodeConfiguration.fromJson);
|
|
8368
8398
|
}
|
|
8369
8399
|
if (configPath === DEV_CONFIG) {
|
|
8370
|
-
logger$
|
|
8400
|
+
logger$5.log `🔧 Loading DEV config`;
|
|
8371
8401
|
return parseFromJson(configs.dev, NodeConfiguration.fromJson);
|
|
8372
8402
|
}
|
|
8373
8403
|
try {
|
|
8374
|
-
logger$
|
|
8404
|
+
logger$5.log `🔧 Loading config from ${configPath}`;
|
|
8375
8405
|
const configFile = fs.readFileSync(configPath, "utf8");
|
|
8376
8406
|
const parsed = JSON.parse(configFile);
|
|
8377
8407
|
return parseFromJson(parsed, NodeConfiguration.fromJson);
|
|
@@ -8381,7 +8411,7 @@ function loadConfig(configPath) {
|
|
|
8381
8411
|
}
|
|
8382
8412
|
}
|
|
8383
8413
|
|
|
8384
|
-
var index$
|
|
8414
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
8385
8415
|
__proto__: null,
|
|
8386
8416
|
DEFAULT_CONFIG: DEFAULT_CONFIG,
|
|
8387
8417
|
DEV_CONFIG: DEV_CONFIG,
|
|
@@ -10047,7 +10077,7 @@ const serviceDataCodec = codec$1.dictionary(codec$1.u32.asOpaque(), serviceEntri
|
|
|
10047
10077
|
sortKeys: (a, b) => a - b,
|
|
10048
10078
|
});
|
|
10049
10079
|
|
|
10050
|
-
var index$
|
|
10080
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
10051
10081
|
__proto__: null,
|
|
10052
10082
|
AccumulationOutput: AccumulationOutput,
|
|
10053
10083
|
AutoAccumulate: AutoAccumulate,
|
|
@@ -11057,7 +11087,7 @@ const bitLookup = [
|
|
|
11057
11087
|
[0b00000000, 8],
|
|
11058
11088
|
];
|
|
11059
11089
|
|
|
11060
|
-
var index$
|
|
11090
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
11061
11091
|
__proto__: null,
|
|
11062
11092
|
BranchNode: BranchNode,
|
|
11063
11093
|
InMemoryTrie: InMemoryTrie,
|
|
@@ -11403,7 +11433,7 @@ function loadState(spec, entries) {
|
|
|
11403
11433
|
* hashmap of `key -> value` entries.
|
|
11404
11434
|
*/
|
|
11405
11435
|
|
|
11406
|
-
var index$
|
|
11436
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
11407
11437
|
__proto__: null,
|
|
11408
11438
|
SerializedService: SerializedService,
|
|
11409
11439
|
SerializedState: SerializedState,
|
|
@@ -11689,7 +11719,7 @@ class InMemoryStates {
|
|
|
11689
11719
|
}
|
|
11690
11720
|
}
|
|
11691
11721
|
|
|
11692
|
-
var index$
|
|
11722
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
11693
11723
|
__proto__: null,
|
|
11694
11724
|
InMemoryBlocks: InMemoryBlocks,
|
|
11695
11725
|
InMemoryStates: InMemoryStates,
|
|
@@ -12051,7 +12081,7 @@ const initEc = async () => {
|
|
|
12051
12081
|
await init.reedSolomon();
|
|
12052
12082
|
};
|
|
12053
12083
|
|
|
12054
|
-
var index$
|
|
12084
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
12055
12085
|
__proto__: null,
|
|
12056
12086
|
N_CHUNKS_REDUNDANCY: N_CHUNKS_REDUNDANCY,
|
|
12057
12087
|
N_CHUNKS_REQUIRED: N_CHUNKS_REQUIRED,
|
|
@@ -12075,6 +12105,439 @@ var index$a = /*#__PURE__*/Object.freeze({
|
|
|
12075
12105
|
unzip: unzip
|
|
12076
12106
|
});
|
|
12077
12107
|
|
|
12108
|
+
/**
|
|
12109
|
+
* Version ::= SEQUENCE {
|
|
12110
|
+
* major INTEGER (0..255),
|
|
12111
|
+
* minor INTEGER (0..255),
|
|
12112
|
+
* patch INTEGER (0..255)
|
|
12113
|
+
* }
|
|
12114
|
+
*/
|
|
12115
|
+
class Version extends WithDebug {
|
|
12116
|
+
major;
|
|
12117
|
+
minor;
|
|
12118
|
+
patch;
|
|
12119
|
+
static Codec = codec$1.Class(Version, {
|
|
12120
|
+
major: codec$1.u8,
|
|
12121
|
+
minor: codec$1.u8,
|
|
12122
|
+
patch: codec$1.u8,
|
|
12123
|
+
});
|
|
12124
|
+
static tryFromString(str) {
|
|
12125
|
+
const parse = (v) => tryAsU8(Number(v));
|
|
12126
|
+
try {
|
|
12127
|
+
const [major, minor, patch] = str.trim().split(".").map(parse);
|
|
12128
|
+
return Version.create({
|
|
12129
|
+
major,
|
|
12130
|
+
minor,
|
|
12131
|
+
patch,
|
|
12132
|
+
});
|
|
12133
|
+
}
|
|
12134
|
+
catch (e) {
|
|
12135
|
+
throw new Error(`Unable to parse ${str} as Version: ${e}`);
|
|
12136
|
+
}
|
|
12137
|
+
}
|
|
12138
|
+
static create({ major, minor, patch }) {
|
|
12139
|
+
return new Version(major, minor, patch);
|
|
12140
|
+
}
|
|
12141
|
+
constructor(major, minor, patch) {
|
|
12142
|
+
super();
|
|
12143
|
+
this.major = major;
|
|
12144
|
+
this.minor = minor;
|
|
12145
|
+
this.patch = patch;
|
|
12146
|
+
}
|
|
12147
|
+
}
|
|
12148
|
+
/**
|
|
12149
|
+
* Fuzzer Protocol V1
|
|
12150
|
+
* Reference: https://github.com/davxy/jam-conformance/blob/main/fuzz-proto/fuzz.asn
|
|
12151
|
+
*/
|
|
12152
|
+
// Feature bit constants
|
|
12153
|
+
var Features;
|
|
12154
|
+
(function (Features) {
|
|
12155
|
+
Features[Features["Ancestry"] = 1] = "Ancestry";
|
|
12156
|
+
Features[Features["Fork"] = 2] = "Fork";
|
|
12157
|
+
Features[Features["Reserved"] = 2147483648] = "Reserved";
|
|
12158
|
+
})(Features || (Features = {}));
|
|
12159
|
+
/**
|
|
12160
|
+
* PeerInfo ::= SEQUENCE {
|
|
12161
|
+
* fuzz-version U8,
|
|
12162
|
+
* features Features,
|
|
12163
|
+
* jam-version Version,
|
|
12164
|
+
* app-version Version,
|
|
12165
|
+
* name UTF8String
|
|
12166
|
+
* }
|
|
12167
|
+
*/
|
|
12168
|
+
class PeerInfo extends WithDebug {
|
|
12169
|
+
fuzzVersion;
|
|
12170
|
+
features;
|
|
12171
|
+
jamVersion;
|
|
12172
|
+
appVersion;
|
|
12173
|
+
name;
|
|
12174
|
+
static Codec = codec$1.Class(PeerInfo, {
|
|
12175
|
+
fuzzVersion: codec$1.u8,
|
|
12176
|
+
features: codec$1.u32,
|
|
12177
|
+
jamVersion: Version.Codec,
|
|
12178
|
+
appVersion: Version.Codec,
|
|
12179
|
+
name: codec$1.string,
|
|
12180
|
+
});
|
|
12181
|
+
static create({ fuzzVersion, features, appVersion, jamVersion, name }) {
|
|
12182
|
+
return new PeerInfo(fuzzVersion, features, jamVersion, appVersion, name);
|
|
12183
|
+
}
|
|
12184
|
+
constructor(fuzzVersion, features, jamVersion, appVersion, name) {
|
|
12185
|
+
super();
|
|
12186
|
+
this.fuzzVersion = fuzzVersion;
|
|
12187
|
+
this.features = features;
|
|
12188
|
+
this.jamVersion = jamVersion;
|
|
12189
|
+
this.appVersion = appVersion;
|
|
12190
|
+
this.name = name;
|
|
12191
|
+
}
|
|
12192
|
+
}
|
|
12193
|
+
/**
|
|
12194
|
+
* AncestryItem ::= SEQUENCE {
|
|
12195
|
+
* slot TimeSlot,
|
|
12196
|
+
* header-hash HeaderHash
|
|
12197
|
+
* }
|
|
12198
|
+
*/
|
|
12199
|
+
class AncestryItem extends WithDebug {
|
|
12200
|
+
slot;
|
|
12201
|
+
headerHash;
|
|
12202
|
+
static Codec = codec$1.Class(AncestryItem, {
|
|
12203
|
+
slot: codec$1.u32.asOpaque(),
|
|
12204
|
+
headerHash: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
12205
|
+
});
|
|
12206
|
+
static create({ slot, headerHash }) {
|
|
12207
|
+
return new AncestryItem(slot, headerHash);
|
|
12208
|
+
}
|
|
12209
|
+
constructor(slot, headerHash) {
|
|
12210
|
+
super();
|
|
12211
|
+
this.slot = slot;
|
|
12212
|
+
this.headerHash = headerHash;
|
|
12213
|
+
}
|
|
12214
|
+
}
|
|
12215
|
+
/**
|
|
12216
|
+
* KeyValue ::= SEQUENCE {
|
|
12217
|
+
* key TrieKey,
|
|
12218
|
+
* value OCTET STRING
|
|
12219
|
+
* }
|
|
12220
|
+
*/
|
|
12221
|
+
class KeyValue extends WithDebug {
|
|
12222
|
+
key;
|
|
12223
|
+
value;
|
|
12224
|
+
static Codec = codec$1.Class(KeyValue, {
|
|
12225
|
+
key: codec$1.bytes(TRUNCATED_HASH_SIZE),
|
|
12226
|
+
value: codec$1.blob,
|
|
12227
|
+
});
|
|
12228
|
+
static create({ key, value }) {
|
|
12229
|
+
return new KeyValue(key, value);
|
|
12230
|
+
}
|
|
12231
|
+
constructor(key, value) {
|
|
12232
|
+
super();
|
|
12233
|
+
this.key = key;
|
|
12234
|
+
this.value = value;
|
|
12235
|
+
}
|
|
12236
|
+
}
|
|
12237
|
+
/** State ::= SEQUENCE OF KeyValue */
|
|
12238
|
+
const stateCodec = codec$1.sequenceVarLen(KeyValue.Codec);
|
|
12239
|
+
/**
|
|
12240
|
+
* Ancestry ::= SEQUENCE (SIZE(0..24)) OF AncestryItem
|
|
12241
|
+
* Empty when `feature-ancestry` is not supported by both parties
|
|
12242
|
+
*/
|
|
12243
|
+
const ancestryCodec = codec$1.sequenceVarLen(AncestryItem.Codec, {
|
|
12244
|
+
minLength: 0,
|
|
12245
|
+
maxLength: 24,
|
|
12246
|
+
});
|
|
12247
|
+
/**
|
|
12248
|
+
* Initialize ::= SEQUENCE {
|
|
12249
|
+
* header Header,
|
|
12250
|
+
* keyvals State,
|
|
12251
|
+
* ancestry Ancestry
|
|
12252
|
+
* }
|
|
12253
|
+
*/
|
|
12254
|
+
class Initialize extends WithDebug {
|
|
12255
|
+
header;
|
|
12256
|
+
keyvals;
|
|
12257
|
+
ancestry;
|
|
12258
|
+
static Codec = codec$1.Class(Initialize, {
|
|
12259
|
+
header: Header.Codec,
|
|
12260
|
+
keyvals: stateCodec,
|
|
12261
|
+
ancestry: ancestryCodec,
|
|
12262
|
+
});
|
|
12263
|
+
static create({ header, keyvals, ancestry }) {
|
|
12264
|
+
return new Initialize(header, keyvals, ancestry);
|
|
12265
|
+
}
|
|
12266
|
+
constructor(header, keyvals, ancestry) {
|
|
12267
|
+
super();
|
|
12268
|
+
this.header = header;
|
|
12269
|
+
this.keyvals = keyvals;
|
|
12270
|
+
this.ancestry = ancestry;
|
|
12271
|
+
}
|
|
12272
|
+
}
|
|
12273
|
+
/** GetState ::= HeaderHash */
|
|
12274
|
+
const getStateCodec = codec$1.bytes(HASH_SIZE).asOpaque();
|
|
12275
|
+
/** StateRoot ::= StateRootHash */
|
|
12276
|
+
const stateRootCodec = codec$1.bytes(HASH_SIZE).asOpaque();
|
|
12277
|
+
/** Error ::= UTF8String */
|
|
12278
|
+
class ErrorMessage extends WithDebug {
|
|
12279
|
+
message;
|
|
12280
|
+
static Codec = codec$1.Class(ErrorMessage, {
|
|
12281
|
+
message: codec$1.string,
|
|
12282
|
+
});
|
|
12283
|
+
static create({ message }) {
|
|
12284
|
+
return new ErrorMessage(message);
|
|
12285
|
+
}
|
|
12286
|
+
constructor(message) {
|
|
12287
|
+
super();
|
|
12288
|
+
this.message = message;
|
|
12289
|
+
}
|
|
12290
|
+
}
|
|
12291
|
+
/** Message choice type tags */
|
|
12292
|
+
var MessageType;
|
|
12293
|
+
(function (MessageType) {
|
|
12294
|
+
MessageType[MessageType["PeerInfo"] = 0] = "PeerInfo";
|
|
12295
|
+
MessageType[MessageType["Initialize"] = 1] = "Initialize";
|
|
12296
|
+
MessageType[MessageType["StateRoot"] = 2] = "StateRoot";
|
|
12297
|
+
MessageType[MessageType["ImportBlock"] = 3] = "ImportBlock";
|
|
12298
|
+
MessageType[MessageType["GetState"] = 4] = "GetState";
|
|
12299
|
+
MessageType[MessageType["State"] = 5] = "State";
|
|
12300
|
+
MessageType[MessageType["Error"] = 255] = "Error";
|
|
12301
|
+
})(MessageType || (MessageType = {}));
|
|
12302
|
+
/**
|
|
12303
|
+
* Message ::= CHOICE {
|
|
12304
|
+
* peer-info [0] PeerInfo,
|
|
12305
|
+
* initialize [1] Initialize,
|
|
12306
|
+
* state-root [2] StateRoot,
|
|
12307
|
+
* import-block [3] ImportBlock,
|
|
12308
|
+
* get-state [4] GetState,
|
|
12309
|
+
* state [5] State,
|
|
12310
|
+
* error [255] Error
|
|
12311
|
+
* }
|
|
12312
|
+
*/
|
|
12313
|
+
const messageCodec = codec$1.custom({
|
|
12314
|
+
name: "Message",
|
|
12315
|
+
sizeHint: { bytes: 1, isExact: false },
|
|
12316
|
+
}, (e, msg) => {
|
|
12317
|
+
e.i8(msg.type);
|
|
12318
|
+
switch (msg.type) {
|
|
12319
|
+
case MessageType.PeerInfo:
|
|
12320
|
+
PeerInfo.Codec.encode(e, msg.value);
|
|
12321
|
+
break;
|
|
12322
|
+
case MessageType.Initialize:
|
|
12323
|
+
Initialize.Codec.encode(e, msg.value);
|
|
12324
|
+
break;
|
|
12325
|
+
case MessageType.StateRoot:
|
|
12326
|
+
stateRootCodec.encode(e, msg.value);
|
|
12327
|
+
break;
|
|
12328
|
+
case MessageType.ImportBlock:
|
|
12329
|
+
Block.Codec.View.encode(e, msg.value);
|
|
12330
|
+
break;
|
|
12331
|
+
case MessageType.GetState:
|
|
12332
|
+
getStateCodec.encode(e, msg.value);
|
|
12333
|
+
break;
|
|
12334
|
+
case MessageType.State:
|
|
12335
|
+
stateCodec.encode(e, msg.value);
|
|
12336
|
+
break;
|
|
12337
|
+
case MessageType.Error:
|
|
12338
|
+
ErrorMessage.Codec.encode(e, msg.value);
|
|
12339
|
+
break;
|
|
12340
|
+
default:
|
|
12341
|
+
throw new Error(`Unknown message type: ${msg}`);
|
|
12342
|
+
}
|
|
12343
|
+
}, (d) => {
|
|
12344
|
+
const type = d.u8();
|
|
12345
|
+
switch (type) {
|
|
12346
|
+
case MessageType.PeerInfo:
|
|
12347
|
+
return { type: MessageType.PeerInfo, value: PeerInfo.Codec.decode(d) };
|
|
12348
|
+
case MessageType.Initialize:
|
|
12349
|
+
return { type: MessageType.Initialize, value: Initialize.Codec.decode(d) };
|
|
12350
|
+
case MessageType.StateRoot:
|
|
12351
|
+
return { type: MessageType.StateRoot, value: stateRootCodec.decode(d) };
|
|
12352
|
+
case MessageType.ImportBlock:
|
|
12353
|
+
return { type: MessageType.ImportBlock, value: Block.Codec.View.decode(d) };
|
|
12354
|
+
case MessageType.GetState:
|
|
12355
|
+
return { type: MessageType.GetState, value: getStateCodec.decode(d) };
|
|
12356
|
+
case MessageType.State:
|
|
12357
|
+
return { type: MessageType.State, value: stateCodec.decode(d) };
|
|
12358
|
+
case MessageType.Error:
|
|
12359
|
+
return { type: MessageType.Error, value: ErrorMessage.Codec.decode(d) };
|
|
12360
|
+
default:
|
|
12361
|
+
throw new Error(`Unknown message type: ${type}`);
|
|
12362
|
+
}
|
|
12363
|
+
}, (s) => {
|
|
12364
|
+
const type = s.decoder.u8();
|
|
12365
|
+
switch (type) {
|
|
12366
|
+
case MessageType.PeerInfo:
|
|
12367
|
+
PeerInfo.Codec.View.skip(s);
|
|
12368
|
+
break;
|
|
12369
|
+
case MessageType.Initialize:
|
|
12370
|
+
Initialize.Codec.View.skip(s);
|
|
12371
|
+
break;
|
|
12372
|
+
case MessageType.StateRoot:
|
|
12373
|
+
stateRootCodec.View.skip(s);
|
|
12374
|
+
break;
|
|
12375
|
+
case MessageType.ImportBlock:
|
|
12376
|
+
Block.Codec.View.skip(s);
|
|
12377
|
+
break;
|
|
12378
|
+
case MessageType.GetState:
|
|
12379
|
+
getStateCodec.View.skip(s);
|
|
12380
|
+
break;
|
|
12381
|
+
case MessageType.State:
|
|
12382
|
+
stateCodec.View.skip(s);
|
|
12383
|
+
break;
|
|
12384
|
+
case MessageType.Error:
|
|
12385
|
+
ErrorMessage.Codec.View.skip(s);
|
|
12386
|
+
break;
|
|
12387
|
+
default:
|
|
12388
|
+
throw new Error(`Unknown message type: ${type}`);
|
|
12389
|
+
}
|
|
12390
|
+
});
|
|
12391
|
+
|
|
12392
|
+
const logger$4 = Logger.new(import.meta.filename, "ext-ipc-fuzz-v1");
|
|
12393
|
+
class FuzzTarget {
|
|
12394
|
+
msgHandler;
|
|
12395
|
+
sender;
|
|
12396
|
+
spec;
|
|
12397
|
+
sessionFeatures = 0;
|
|
12398
|
+
constructor(msgHandler, sender, spec) {
|
|
12399
|
+
this.msgHandler = msgHandler;
|
|
12400
|
+
this.sender = sender;
|
|
12401
|
+
this.spec = spec;
|
|
12402
|
+
}
|
|
12403
|
+
async onSocketMessage(msg) {
|
|
12404
|
+
// attempt to decode the messsage
|
|
12405
|
+
try {
|
|
12406
|
+
const message = Decoder.decodeObject(messageCodec, msg, this.spec);
|
|
12407
|
+
logger$4.log `[${message.type}] incoming message`;
|
|
12408
|
+
await this.processAndRespond(message);
|
|
12409
|
+
}
|
|
12410
|
+
catch (e) {
|
|
12411
|
+
logger$4.error `Error while processing fuzz v1 message: ${e}`;
|
|
12412
|
+
logger$4.error `${e}`;
|
|
12413
|
+
if (e instanceof Error) {
|
|
12414
|
+
logger$4.error `${e.stack ?? ""}`;
|
|
12415
|
+
}
|
|
12416
|
+
this.sender.close();
|
|
12417
|
+
}
|
|
12418
|
+
}
|
|
12419
|
+
async processAndRespond(message) {
|
|
12420
|
+
let response = null;
|
|
12421
|
+
switch (message.type) {
|
|
12422
|
+
case MessageType.PeerInfo: {
|
|
12423
|
+
// only support V1
|
|
12424
|
+
if (message.value.fuzzVersion !== 1) {
|
|
12425
|
+
logger$4.warn `Unsupported fuzzer protocol version: ${message.value.fuzzVersion}. Closing`;
|
|
12426
|
+
this.sender.close();
|
|
12427
|
+
return;
|
|
12428
|
+
}
|
|
12429
|
+
// Handle handshake
|
|
12430
|
+
const ourPeerInfo = await this.msgHandler.getPeerInfo(message.value);
|
|
12431
|
+
// Calculate session features (intersection of both peer features)
|
|
12432
|
+
this.sessionFeatures = message.value.features & ourPeerInfo.features;
|
|
12433
|
+
logger$4.info `Handshake completed. Shared features: 0b${this.sessionFeatures.toString(2)}`;
|
|
12434
|
+
logger$4.log `Feature ancestry: ${(this.sessionFeatures & Features.Ancestry) !== 0}`;
|
|
12435
|
+
logger$4.log `Feature fork: ${(this.sessionFeatures & Features.Fork) !== 0}`;
|
|
12436
|
+
response = {
|
|
12437
|
+
type: MessageType.PeerInfo,
|
|
12438
|
+
value: ourPeerInfo,
|
|
12439
|
+
};
|
|
12440
|
+
break;
|
|
12441
|
+
}
|
|
12442
|
+
case MessageType.Initialize: {
|
|
12443
|
+
const stateRoot = await this.msgHandler.initialize(message.value);
|
|
12444
|
+
response = {
|
|
12445
|
+
type: MessageType.StateRoot,
|
|
12446
|
+
value: stateRoot,
|
|
12447
|
+
};
|
|
12448
|
+
break;
|
|
12449
|
+
}
|
|
12450
|
+
case MessageType.ImportBlock: {
|
|
12451
|
+
const result = await this.msgHandler.importBlock(message.value);
|
|
12452
|
+
if (result.isOk) {
|
|
12453
|
+
response = {
|
|
12454
|
+
type: MessageType.StateRoot,
|
|
12455
|
+
value: result.ok,
|
|
12456
|
+
};
|
|
12457
|
+
}
|
|
12458
|
+
else {
|
|
12459
|
+
response = {
|
|
12460
|
+
type: MessageType.Error,
|
|
12461
|
+
value: result.error,
|
|
12462
|
+
};
|
|
12463
|
+
}
|
|
12464
|
+
break;
|
|
12465
|
+
}
|
|
12466
|
+
case MessageType.GetState: {
|
|
12467
|
+
const state = await this.msgHandler.getSerializedState(message.value);
|
|
12468
|
+
response = {
|
|
12469
|
+
type: MessageType.State,
|
|
12470
|
+
value: state,
|
|
12471
|
+
};
|
|
12472
|
+
break;
|
|
12473
|
+
}
|
|
12474
|
+
case MessageType.StateRoot: {
|
|
12475
|
+
logger$4.log `--> Received unexpected 'StateRoot' message from the fuzzer. Closing.`;
|
|
12476
|
+
this.sender.close();
|
|
12477
|
+
return;
|
|
12478
|
+
}
|
|
12479
|
+
case MessageType.State: {
|
|
12480
|
+
logger$4.log `--> Received unexpected 'State' message from the fuzzer. Closing.`;
|
|
12481
|
+
this.sender.close();
|
|
12482
|
+
return;
|
|
12483
|
+
}
|
|
12484
|
+
case MessageType.Error: {
|
|
12485
|
+
logger$4.log `--> Received unexpected 'Error' message from the fuzzer. Closing.`;
|
|
12486
|
+
this.sender.close();
|
|
12487
|
+
return;
|
|
12488
|
+
}
|
|
12489
|
+
default: {
|
|
12490
|
+
logger$4.log `--> Received unexpected message type ${JSON.stringify(message)} from the fuzzer. Closing.`;
|
|
12491
|
+
this.sender.close();
|
|
12492
|
+
try {
|
|
12493
|
+
assertNever(message);
|
|
12494
|
+
}
|
|
12495
|
+
catch {
|
|
12496
|
+
return;
|
|
12497
|
+
}
|
|
12498
|
+
}
|
|
12499
|
+
}
|
|
12500
|
+
if (response !== null) {
|
|
12501
|
+
logger$4.trace `<-- responding with: ${response.type}`;
|
|
12502
|
+
const encoded = Encoder.encodeObject(messageCodec, response, this.spec);
|
|
12503
|
+
this.sender.send(encoded);
|
|
12504
|
+
}
|
|
12505
|
+
else {
|
|
12506
|
+
logger$4.warn `<-- no response generated for: ${message.type}`;
|
|
12507
|
+
}
|
|
12508
|
+
}
|
|
12509
|
+
onClose({ error }) {
|
|
12510
|
+
logger$4.log `Closing the v1 handler. Reason: ${error !== undefined ? error.message : "close"}.`;
|
|
12511
|
+
}
|
|
12512
|
+
/** Check if a specific feature is enabled in the session */
|
|
12513
|
+
hasFeature(feature) {
|
|
12514
|
+
return (this.sessionFeatures & feature) !== 0;
|
|
12515
|
+
}
|
|
12516
|
+
}
|
|
12517
|
+
|
|
12518
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
12519
|
+
__proto__: null,
|
|
12520
|
+
AncestryItem: AncestryItem,
|
|
12521
|
+
ErrorMessage: ErrorMessage,
|
|
12522
|
+
get Features () { return Features; },
|
|
12523
|
+
FuzzTarget: FuzzTarget,
|
|
12524
|
+
Initialize: Initialize,
|
|
12525
|
+
KeyValue: KeyValue,
|
|
12526
|
+
get MessageType () { return MessageType; },
|
|
12527
|
+
PeerInfo: PeerInfo,
|
|
12528
|
+
Version: Version,
|
|
12529
|
+
ancestryCodec: ancestryCodec,
|
|
12530
|
+
getStateCodec: getStateCodec,
|
|
12531
|
+
messageCodec: messageCodec,
|
|
12532
|
+
stateCodec: stateCodec,
|
|
12533
|
+
stateRootCodec: stateRootCodec
|
|
12534
|
+
});
|
|
12535
|
+
|
|
12536
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
12537
|
+
__proto__: null,
|
|
12538
|
+
v1: index$b
|
|
12539
|
+
});
|
|
12540
|
+
|
|
12078
12541
|
/** Size of the transfer memo. */
|
|
12079
12542
|
const TRANSFER_MEMO_BYTES = W_T;
|
|
12080
12543
|
/**
|
|
@@ -14122,6 +14585,17 @@ class PageRange {
|
|
|
14122
14585
|
}
|
|
14123
14586
|
return new PageRange(start, length);
|
|
14124
14587
|
}
|
|
14588
|
+
/** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
|
|
14589
|
+
isWrapped() {
|
|
14590
|
+
return this.start >= this.end && !this.isEmpty();
|
|
14591
|
+
}
|
|
14592
|
+
/** Checks if given page number is within the range */
|
|
14593
|
+
isInRange(page) {
|
|
14594
|
+
if (this.isWrapped()) {
|
|
14595
|
+
return page >= this.start || page < this.end;
|
|
14596
|
+
}
|
|
14597
|
+
return page >= this.start && page < this.end;
|
|
14598
|
+
}
|
|
14125
14599
|
/** Checks if a range is empty (`length === 0`) */
|
|
14126
14600
|
isEmpty() {
|
|
14127
14601
|
return this.length === 0;
|
|
@@ -14462,10 +14936,11 @@ class MemoryBuilder {
|
|
|
14462
14936
|
startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
|
|
14463
14937
|
`;
|
|
14464
14938
|
this.ensureNotFinalized();
|
|
14465
|
-
const
|
|
14466
|
-
const
|
|
14467
|
-
|
|
14468
|
-
|
|
14939
|
+
const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
14940
|
+
const heapPagesRange = PageRange.fromMemoryRange(heapRange);
|
|
14941
|
+
const initializedPageNumbers = Array.from(this.initialMemory.keys());
|
|
14942
|
+
for (const pageNumber of initializedPageNumbers) {
|
|
14943
|
+
if (heapPagesRange.isInRange(pageNumber)) {
|
|
14469
14944
|
throw new IncorrectSbrkIndex();
|
|
14470
14945
|
}
|
|
14471
14946
|
}
|
|
@@ -16905,8 +17380,8 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
16905
17380
|
asOpaqueType: asOpaqueType,
|
|
16906
17381
|
assertEmpty: assertEmpty,
|
|
16907
17382
|
assertNever: assertNever,
|
|
16908
|
-
block: index$
|
|
16909
|
-
bytes: index$
|
|
17383
|
+
block: index$l,
|
|
17384
|
+
bytes: index$s,
|
|
16910
17385
|
check: check,
|
|
16911
17386
|
clampU64ToU32: clampU64ToU32,
|
|
16912
17387
|
createResults: createResults,
|
|
@@ -16914,13 +17389,13 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
16914
17389
|
extractCodeAndMetadata: extractCodeAndMetadata,
|
|
16915
17390
|
getServiceId: getServiceId,
|
|
16916
17391
|
getServiceIdOrCurrent: getServiceIdOrCurrent,
|
|
16917
|
-
hash: index$
|
|
17392
|
+
hash: index$p,
|
|
16918
17393
|
inspect: inspect,
|
|
16919
17394
|
instructionArgumentTypeMap: instructionArgumentTypeMap,
|
|
16920
17395
|
interpreter: index$7,
|
|
16921
17396
|
isBrowser: isBrowser,
|
|
16922
17397
|
measure: measure,
|
|
16923
|
-
numbers: index$
|
|
17398
|
+
numbers: index$r,
|
|
16924
17399
|
resultToString: resultToString,
|
|
16925
17400
|
seeThrough: seeThrough,
|
|
16926
17401
|
slotsToPreimageStatus: slotsToPreimageStatus,
|
|
@@ -17634,4 +18109,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
17634
18109
|
WorkPackageExecutor: WorkPackageExecutor
|
|
17635
18110
|
});
|
|
17636
18111
|
|
|
17637
|
-
export { index$
|
|
18112
|
+
export { index$l as block, index$j as block_json, index$s as bytes, index$q as codec, index$n as collections, index$m as config, index$h as config_node, index$o as crypto, index$d as database, index$c as erasure_coding, index$a as fuzz_proto, index$p as hash, index$9 as jam_host_calls, index$k as json_parser, index$i as logger, index$8 as mmr, index$r as numbers, index$t as ordering, index$3 as pvm, index$6 as pvm_host_calls, index$7 as pvm_interpreter, index$4 as pvm_program, index$5 as pvm_spi_decoder, index$2 as shuffling, index$g as state, index$1 as state_json, index$e as state_merkleization, index as transition, index$f as trie, index$u as utils };
|