@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.cjs
CHANGED
|
@@ -563,7 +563,7 @@ function isResult(x) {
|
|
|
563
563
|
* as an afterthought.
|
|
564
564
|
*/
|
|
565
565
|
|
|
566
|
-
var index$
|
|
566
|
+
var index$u = /*#__PURE__*/Object.freeze({
|
|
567
567
|
__proto__: null,
|
|
568
568
|
get CURRENT_SUITE () { return CURRENT_SUITE; },
|
|
569
569
|
get CURRENT_VERSION () { return CURRENT_VERSION; },
|
|
@@ -717,7 +717,7 @@ class Ordering {
|
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
|
|
720
|
-
var index$
|
|
720
|
+
var index$t = /*#__PURE__*/Object.freeze({
|
|
721
721
|
__proto__: null,
|
|
722
722
|
Ordering: Ordering
|
|
723
723
|
});
|
|
@@ -968,7 +968,7 @@ function u8ArraySameLengthEqual(self, other) {
|
|
|
968
968
|
}
|
|
969
969
|
const bytesBlobComparator = (a, b) => a.compare(b);
|
|
970
970
|
|
|
971
|
-
var index$
|
|
971
|
+
var index$s = /*#__PURE__*/Object.freeze({
|
|
972
972
|
__proto__: null,
|
|
973
973
|
BitVec: BitVec,
|
|
974
974
|
Bytes: Bytes,
|
|
@@ -1070,7 +1070,7 @@ const minU64 = (a, ...values) => values.reduce((min, value) => (value > min ? mi
|
|
|
1070
1070
|
/** Get the biggest value between U64 a and values given as input parameters. */
|
|
1071
1071
|
const maxU64 = (a, ...values) => values.reduce((max, value) => (value < max ? max : value), a);
|
|
1072
1072
|
|
|
1073
|
-
var index$
|
|
1073
|
+
var index$r = /*#__PURE__*/Object.freeze({
|
|
1074
1074
|
__proto__: null,
|
|
1075
1075
|
isU16: isU16,
|
|
1076
1076
|
isU32: isU32,
|
|
@@ -1947,13 +1947,15 @@ function validateLength(range, length, context) {
|
|
|
1947
1947
|
|
|
1948
1948
|
/** A caching wrapper for either object or sequence item. */
|
|
1949
1949
|
class ViewField {
|
|
1950
|
+
name;
|
|
1950
1951
|
getView;
|
|
1951
1952
|
getValue;
|
|
1952
1953
|
getEncoded;
|
|
1953
1954
|
cachedValue;
|
|
1954
1955
|
cachedView;
|
|
1955
1956
|
cachedBlob;
|
|
1956
|
-
constructor(getView, getValue, getEncoded) {
|
|
1957
|
+
constructor(name, getView, getValue, getEncoded) {
|
|
1958
|
+
this.name = name;
|
|
1957
1959
|
this.getView = getView;
|
|
1958
1960
|
this.getValue = getValue;
|
|
1959
1961
|
this.getEncoded = getEncoded;
|
|
@@ -1979,6 +1981,9 @@ class ViewField {
|
|
|
1979
1981
|
}
|
|
1980
1982
|
return this.cachedBlob;
|
|
1981
1983
|
}
|
|
1984
|
+
toString() {
|
|
1985
|
+
return `ViewField<${this.name}>`;
|
|
1986
|
+
}
|
|
1982
1987
|
}
|
|
1983
1988
|
/**
|
|
1984
1989
|
* A base class for all the lazy views.
|
|
@@ -2053,7 +2058,7 @@ class ObjectView {
|
|
|
2053
2058
|
const fieldDecoder = skipper.decoder.clone();
|
|
2054
2059
|
const field = this.descriptorsKeys[i];
|
|
2055
2060
|
const type = this.descriptors[field];
|
|
2056
|
-
lastItem = new ViewField(() => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
|
|
2061
|
+
lastItem = new ViewField(`${this.toString()}.${String(field)}`, () => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
|
|
2057
2062
|
// skip the field
|
|
2058
2063
|
type.skip(skipper);
|
|
2059
2064
|
// cache data
|
|
@@ -2065,6 +2070,9 @@ class ObjectView {
|
|
|
2065
2070
|
}
|
|
2066
2071
|
return lastItem;
|
|
2067
2072
|
}
|
|
2073
|
+
toString() {
|
|
2074
|
+
return `View<${this.materializedConstructor.name}>(cache: ${this.cache.size})`;
|
|
2075
|
+
}
|
|
2068
2076
|
}
|
|
2069
2077
|
/**
|
|
2070
2078
|
* A lazy-evaluated decoder of a sequence.
|
|
@@ -2153,7 +2161,7 @@ class SequenceView {
|
|
|
2153
2161
|
// create new cached prop
|
|
2154
2162
|
const fieldDecoder = skipper.decoder.clone();
|
|
2155
2163
|
const type = this.descriptor;
|
|
2156
|
-
lastItem = new ViewField(() => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
|
|
2164
|
+
lastItem = new ViewField(`${this.toString()}[${index}]`, () => type.View.decode(fieldDecoder.clone()), () => type.decode(fieldDecoder.clone()), () => type.skipEncoded(fieldDecoder.clone()));
|
|
2157
2165
|
// skip the field
|
|
2158
2166
|
type.skip(skipper);
|
|
2159
2167
|
// cache data
|
|
@@ -2165,6 +2173,9 @@ class SequenceView {
|
|
|
2165
2173
|
}
|
|
2166
2174
|
return lastItem;
|
|
2167
2175
|
}
|
|
2176
|
+
toString() {
|
|
2177
|
+
return `SequenceView<${this.descriptor.name}>(cache: ${this.cache.size})`;
|
|
2178
|
+
}
|
|
2168
2179
|
}
|
|
2169
2180
|
|
|
2170
2181
|
/**
|
|
@@ -2480,7 +2491,7 @@ function sequenceViewFixLen(type, { fixedLength }) {
|
|
|
2480
2491
|
}, skipper);
|
|
2481
2492
|
}
|
|
2482
2493
|
|
|
2483
|
-
var index$
|
|
2494
|
+
var index$q = /*#__PURE__*/Object.freeze({
|
|
2484
2495
|
__proto__: null,
|
|
2485
2496
|
Decoder: Decoder,
|
|
2486
2497
|
Descriptor: Descriptor,
|
|
@@ -4919,7 +4930,7 @@ var keccak = /*#__PURE__*/Object.freeze({
|
|
|
4919
4930
|
hashBlobs: hashBlobs
|
|
4920
4931
|
});
|
|
4921
4932
|
|
|
4922
|
-
var index$
|
|
4933
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
4923
4934
|
__proto__: null,
|
|
4924
4935
|
HASH_SIZE: HASH_SIZE,
|
|
4925
4936
|
PageAllocator: PageAllocator,
|
|
@@ -4985,7 +4996,7 @@ var keyDerivation = /*#__PURE__*/Object.freeze({
|
|
|
4985
4996
|
trivialSeed: trivialSeed
|
|
4986
4997
|
});
|
|
4987
4998
|
|
|
4988
|
-
var index$
|
|
4999
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
4989
5000
|
__proto__: null,
|
|
4990
5001
|
BANDERSNATCH_KEY_BYTES: BANDERSNATCH_KEY_BYTES,
|
|
4991
5002
|
BANDERSNATCH_PROOF_BYTES: BANDERSNATCH_PROOF_BYTES,
|
|
@@ -5589,7 +5600,7 @@ class TruncatedHashDictionary {
|
|
|
5589
5600
|
}
|
|
5590
5601
|
}
|
|
5591
5602
|
|
|
5592
|
-
var index$
|
|
5603
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
5593
5604
|
__proto__: null,
|
|
5594
5605
|
FixedSizeArray: FixedSizeArray,
|
|
5595
5606
|
HashDictionary: HashDictionary,
|
|
@@ -5784,7 +5795,7 @@ class Bootnode {
|
|
|
5784
5795
|
}
|
|
5785
5796
|
}
|
|
5786
5797
|
|
|
5787
|
-
var index$
|
|
5798
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
5788
5799
|
__proto__: null,
|
|
5789
5800
|
Bootnode: Bootnode,
|
|
5790
5801
|
ChainSpec: ChainSpec,
|
|
@@ -5957,6 +5968,40 @@ var assurances = /*#__PURE__*/Object.freeze({
|
|
|
5957
5968
|
assurancesExtrinsicCodec: assurancesExtrinsicCodec
|
|
5958
5969
|
});
|
|
5959
5970
|
|
|
5971
|
+
/** Attempt to convert a number into `TimeSlot`. */
|
|
5972
|
+
const tryAsTimeSlot = (v) => asOpaqueType(tryAsU32(v));
|
|
5973
|
+
/** Attempt to convert a number into `ValidatorIndex`. */
|
|
5974
|
+
const tryAsValidatorIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
5975
|
+
/** Attempt to convert a number into `ServiceId`. */
|
|
5976
|
+
const tryAsServiceId = (v) => asOpaqueType(tryAsU32(v));
|
|
5977
|
+
const tryAsServiceGas = (v) => asOpaqueType(tryAsU64(v));
|
|
5978
|
+
/** Attempt to convert a number into `CoreIndex`. */
|
|
5979
|
+
const tryAsCoreIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
5980
|
+
/** Attempt to convert a number into `Epoch`. */
|
|
5981
|
+
const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
|
|
5982
|
+
function tryAsPerValidator(array, spec) {
|
|
5983
|
+
check `
|
|
5984
|
+
${array.length === spec.validatorsCount}
|
|
5985
|
+
Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
|
|
5986
|
+
`;
|
|
5987
|
+
return asKnownSize(array);
|
|
5988
|
+
}
|
|
5989
|
+
const codecPerValidator = (val) => codecWithContext((context) => {
|
|
5990
|
+
return codecKnownSizeArray(val, {
|
|
5991
|
+
fixedLength: context.validatorsCount,
|
|
5992
|
+
});
|
|
5993
|
+
});
|
|
5994
|
+
function tryAsPerEpochBlock(array, spec) {
|
|
5995
|
+
check `
|
|
5996
|
+
${array.length === spec.epochLength}
|
|
5997
|
+
Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
|
|
5998
|
+
`;
|
|
5999
|
+
return asKnownSize(array);
|
|
6000
|
+
}
|
|
6001
|
+
const codecPerEpochBlock = (val) => codecWithContext((context) => {
|
|
6002
|
+
return codecKnownSizeArray(val, { fixedLength: context.epochLength });
|
|
6003
|
+
});
|
|
6004
|
+
|
|
5960
6005
|
/**
|
|
5961
6006
|
* Proof of signing a contradictory [`Judgement`] of a work report.
|
|
5962
6007
|
*/
|
|
@@ -6148,40 +6193,6 @@ var disputes = /*#__PURE__*/Object.freeze({
|
|
|
6148
6193
|
Verdict: Verdict
|
|
6149
6194
|
});
|
|
6150
6195
|
|
|
6151
|
-
/** Attempt to convert a number into `TimeSlot`. */
|
|
6152
|
-
const tryAsTimeSlot = (v) => asOpaqueType(tryAsU32(v));
|
|
6153
|
-
/** Attempt to convert a number into `ValidatorIndex`. */
|
|
6154
|
-
const tryAsValidatorIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
6155
|
-
/** Attempt to convert a number into `ServiceId`. */
|
|
6156
|
-
const tryAsServiceId = (v) => asOpaqueType(tryAsU32(v));
|
|
6157
|
-
const tryAsServiceGas = (v) => asOpaqueType(tryAsU64(v));
|
|
6158
|
-
/** Attempt to convert a number into `CoreIndex`. */
|
|
6159
|
-
const tryAsCoreIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
6160
|
-
/** Attempt to convert a number into `Epoch`. */
|
|
6161
|
-
const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
|
|
6162
|
-
function tryAsPerValidator(array, spec) {
|
|
6163
|
-
check `
|
|
6164
|
-
${array.length === spec.validatorsCount}
|
|
6165
|
-
Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
|
|
6166
|
-
`;
|
|
6167
|
-
return asKnownSize(array);
|
|
6168
|
-
}
|
|
6169
|
-
const codecPerValidator = (val) => codecWithContext((context) => {
|
|
6170
|
-
return codecKnownSizeArray(val, {
|
|
6171
|
-
fixedLength: context.validatorsCount,
|
|
6172
|
-
});
|
|
6173
|
-
});
|
|
6174
|
-
function tryAsPerEpochBlock(array, spec) {
|
|
6175
|
-
check `
|
|
6176
|
-
${array.length === spec.epochLength}
|
|
6177
|
-
Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
|
|
6178
|
-
`;
|
|
6179
|
-
return asKnownSize(array);
|
|
6180
|
-
}
|
|
6181
|
-
const codecPerEpochBlock = (val) => codecWithContext((context) => {
|
|
6182
|
-
return codecKnownSizeArray(val, { fixedLength: context.epochLength });
|
|
6183
|
-
});
|
|
6184
|
-
|
|
6185
6196
|
/**
|
|
6186
6197
|
* Mapping between work package hash and root hash of it's exports.
|
|
6187
6198
|
*
|
|
@@ -7260,8 +7271,26 @@ class Block extends WithDebug {
|
|
|
7260
7271
|
this.extrinsic = extrinsic;
|
|
7261
7272
|
}
|
|
7262
7273
|
}
|
|
7274
|
+
function emptyBlock(slot = tryAsTimeSlot(0)) {
|
|
7275
|
+
const header = Header.empty();
|
|
7276
|
+
header.timeSlotIndex = slot;
|
|
7277
|
+
return Block.create({
|
|
7278
|
+
header,
|
|
7279
|
+
extrinsic: Extrinsic.create({
|
|
7280
|
+
tickets: asKnownSize([]),
|
|
7281
|
+
preimages: [],
|
|
7282
|
+
assurances: asKnownSize([]),
|
|
7283
|
+
guarantees: asKnownSize([]),
|
|
7284
|
+
disputes: {
|
|
7285
|
+
verdicts: [],
|
|
7286
|
+
culprits: [],
|
|
7287
|
+
faults: [],
|
|
7288
|
+
},
|
|
7289
|
+
}),
|
|
7290
|
+
});
|
|
7291
|
+
}
|
|
7263
7292
|
|
|
7264
|
-
var index$
|
|
7293
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
7265
7294
|
__proto__: null,
|
|
7266
7295
|
Block: Block,
|
|
7267
7296
|
EpochMarker: EpochMarker,
|
|
@@ -7276,6 +7305,7 @@ var index$j = /*#__PURE__*/Object.freeze({
|
|
|
7276
7305
|
codecPerValidator: codecPerValidator,
|
|
7277
7306
|
codecUtils: codec,
|
|
7278
7307
|
disputes: disputes,
|
|
7308
|
+
emptyBlock: emptyBlock,
|
|
7279
7309
|
encodeUnsealedHeader: encodeUnsealedHeader,
|
|
7280
7310
|
guarantees: guarantees,
|
|
7281
7311
|
headerViewWithHashCodec: headerViewWithHashCodec,
|
|
@@ -7516,7 +7546,7 @@ var json;
|
|
|
7516
7546
|
json.object = object;
|
|
7517
7547
|
})(json || (json = {}));
|
|
7518
7548
|
|
|
7519
|
-
var index$
|
|
7549
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
7520
7550
|
__proto__: null,
|
|
7521
7551
|
get json () { return json; },
|
|
7522
7552
|
parseFromJson: parseFromJson
|
|
@@ -7786,7 +7816,7 @@ const blockFromJson = (spec) => json.object({
|
|
|
7786
7816
|
extrinsic: getExtrinsicFromJson(spec),
|
|
7787
7817
|
}, ({ header, extrinsic }) => Block.create({ header, extrinsic }));
|
|
7788
7818
|
|
|
7789
|
-
var index$
|
|
7819
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
7790
7820
|
__proto__: null,
|
|
7791
7821
|
blockFromJson: blockFromJson,
|
|
7792
7822
|
disputesExtrinsicFromJson: disputesExtrinsicFromJson,
|
|
@@ -8052,8 +8082,8 @@ function print(level, levelAndName, strings, data) {
|
|
|
8052
8082
|
return;
|
|
8053
8083
|
}
|
|
8054
8084
|
const lvlText = Level[level].padEnd(5);
|
|
8055
|
-
const val = strings.map((v, idx) => `${v}${data[idx]}`);
|
|
8056
|
-
const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
|
|
8085
|
+
const val = strings.map((v, idx) => `${v}${idx < data.length ? data[idx] : ""}`);
|
|
8086
|
+
const msg = `${lvlText} [${levelAndName[1]}] ${val.join("")}`;
|
|
8057
8087
|
if (level === Level.WARN) {
|
|
8058
8088
|
console.warn(msg);
|
|
8059
8089
|
}
|
|
@@ -8284,7 +8314,7 @@ class Logger {
|
|
|
8284
8314
|
}
|
|
8285
8315
|
}
|
|
8286
8316
|
|
|
8287
|
-
var index$
|
|
8317
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
8288
8318
|
__proto__: null,
|
|
8289
8319
|
get Level () { return Level; },
|
|
8290
8320
|
Logger: Logger,
|
|
@@ -8307,7 +8337,7 @@ class AuthorshipOptions {
|
|
|
8307
8337
|
}
|
|
8308
8338
|
}
|
|
8309
8339
|
|
|
8310
|
-
const logger$
|
|
8340
|
+
const logger$5 = Logger.new(undefined, "config");
|
|
8311
8341
|
/** Development config. Will accept unsealed blocks for now. */
|
|
8312
8342
|
const DEV_CONFIG = "dev";
|
|
8313
8343
|
/** Default config file. */
|
|
@@ -8366,15 +8396,15 @@ class NodeConfiguration {
|
|
|
8366
8396
|
}
|
|
8367
8397
|
function loadConfig(configPath) {
|
|
8368
8398
|
if (configPath === DEFAULT_CONFIG) {
|
|
8369
|
-
logger$
|
|
8399
|
+
logger$5.log `🔧 Loading DEFAULT config`;
|
|
8370
8400
|
return parseFromJson(configs.default, NodeConfiguration.fromJson);
|
|
8371
8401
|
}
|
|
8372
8402
|
if (configPath === DEV_CONFIG) {
|
|
8373
|
-
logger$
|
|
8403
|
+
logger$5.log `🔧 Loading DEV config`;
|
|
8374
8404
|
return parseFromJson(configs.dev, NodeConfiguration.fromJson);
|
|
8375
8405
|
}
|
|
8376
8406
|
try {
|
|
8377
|
-
logger$
|
|
8407
|
+
logger$5.log `🔧 Loading config from ${configPath}`;
|
|
8378
8408
|
const configFile = fs.readFileSync(configPath, "utf8");
|
|
8379
8409
|
const parsed = JSON.parse(configFile);
|
|
8380
8410
|
return parseFromJson(parsed, NodeConfiguration.fromJson);
|
|
@@ -8384,7 +8414,7 @@ function loadConfig(configPath) {
|
|
|
8384
8414
|
}
|
|
8385
8415
|
}
|
|
8386
8416
|
|
|
8387
|
-
var index$
|
|
8417
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
8388
8418
|
__proto__: null,
|
|
8389
8419
|
DEFAULT_CONFIG: DEFAULT_CONFIG,
|
|
8390
8420
|
DEV_CONFIG: DEV_CONFIG,
|
|
@@ -10050,7 +10080,7 @@ const serviceDataCodec = codec$1.dictionary(codec$1.u32.asOpaque(), serviceEntri
|
|
|
10050
10080
|
sortKeys: (a, b) => a - b,
|
|
10051
10081
|
});
|
|
10052
10082
|
|
|
10053
|
-
var index$
|
|
10083
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
10054
10084
|
__proto__: null,
|
|
10055
10085
|
AccumulationOutput: AccumulationOutput,
|
|
10056
10086
|
AutoAccumulate: AutoAccumulate,
|
|
@@ -11060,7 +11090,7 @@ const bitLookup = [
|
|
|
11060
11090
|
[0b00000000, 8],
|
|
11061
11091
|
];
|
|
11062
11092
|
|
|
11063
|
-
var index$
|
|
11093
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
11064
11094
|
__proto__: null,
|
|
11065
11095
|
BranchNode: BranchNode,
|
|
11066
11096
|
InMemoryTrie: InMemoryTrie,
|
|
@@ -11406,7 +11436,7 @@ function loadState(spec, entries) {
|
|
|
11406
11436
|
* hashmap of `key -> value` entries.
|
|
11407
11437
|
*/
|
|
11408
11438
|
|
|
11409
|
-
var index$
|
|
11439
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
11410
11440
|
__proto__: null,
|
|
11411
11441
|
SerializedService: SerializedService,
|
|
11412
11442
|
SerializedState: SerializedState,
|
|
@@ -11692,7 +11722,7 @@ class InMemoryStates {
|
|
|
11692
11722
|
}
|
|
11693
11723
|
}
|
|
11694
11724
|
|
|
11695
|
-
var index$
|
|
11725
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
11696
11726
|
__proto__: null,
|
|
11697
11727
|
InMemoryBlocks: InMemoryBlocks,
|
|
11698
11728
|
InMemoryStates: InMemoryStates,
|
|
@@ -12054,7 +12084,7 @@ const initEc = async () => {
|
|
|
12054
12084
|
await init.reedSolomon();
|
|
12055
12085
|
};
|
|
12056
12086
|
|
|
12057
|
-
var index$
|
|
12087
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
12058
12088
|
__proto__: null,
|
|
12059
12089
|
N_CHUNKS_REDUNDANCY: N_CHUNKS_REDUNDANCY,
|
|
12060
12090
|
N_CHUNKS_REQUIRED: N_CHUNKS_REQUIRED,
|
|
@@ -12078,6 +12108,439 @@ var index$a = /*#__PURE__*/Object.freeze({
|
|
|
12078
12108
|
unzip: unzip
|
|
12079
12109
|
});
|
|
12080
12110
|
|
|
12111
|
+
/**
|
|
12112
|
+
* Version ::= SEQUENCE {
|
|
12113
|
+
* major INTEGER (0..255),
|
|
12114
|
+
* minor INTEGER (0..255),
|
|
12115
|
+
* patch INTEGER (0..255)
|
|
12116
|
+
* }
|
|
12117
|
+
*/
|
|
12118
|
+
class Version extends WithDebug {
|
|
12119
|
+
major;
|
|
12120
|
+
minor;
|
|
12121
|
+
patch;
|
|
12122
|
+
static Codec = codec$1.Class(Version, {
|
|
12123
|
+
major: codec$1.u8,
|
|
12124
|
+
minor: codec$1.u8,
|
|
12125
|
+
patch: codec$1.u8,
|
|
12126
|
+
});
|
|
12127
|
+
static tryFromString(str) {
|
|
12128
|
+
const parse = (v) => tryAsU8(Number(v));
|
|
12129
|
+
try {
|
|
12130
|
+
const [major, minor, patch] = str.trim().split(".").map(parse);
|
|
12131
|
+
return Version.create({
|
|
12132
|
+
major,
|
|
12133
|
+
minor,
|
|
12134
|
+
patch,
|
|
12135
|
+
});
|
|
12136
|
+
}
|
|
12137
|
+
catch (e) {
|
|
12138
|
+
throw new Error(`Unable to parse ${str} as Version: ${e}`);
|
|
12139
|
+
}
|
|
12140
|
+
}
|
|
12141
|
+
static create({ major, minor, patch }) {
|
|
12142
|
+
return new Version(major, minor, patch);
|
|
12143
|
+
}
|
|
12144
|
+
constructor(major, minor, patch) {
|
|
12145
|
+
super();
|
|
12146
|
+
this.major = major;
|
|
12147
|
+
this.minor = minor;
|
|
12148
|
+
this.patch = patch;
|
|
12149
|
+
}
|
|
12150
|
+
}
|
|
12151
|
+
/**
|
|
12152
|
+
* Fuzzer Protocol V1
|
|
12153
|
+
* Reference: https://github.com/davxy/jam-conformance/blob/main/fuzz-proto/fuzz.asn
|
|
12154
|
+
*/
|
|
12155
|
+
// Feature bit constants
|
|
12156
|
+
var Features;
|
|
12157
|
+
(function (Features) {
|
|
12158
|
+
Features[Features["Ancestry"] = 1] = "Ancestry";
|
|
12159
|
+
Features[Features["Fork"] = 2] = "Fork";
|
|
12160
|
+
Features[Features["Reserved"] = 2147483648] = "Reserved";
|
|
12161
|
+
})(Features || (Features = {}));
|
|
12162
|
+
/**
|
|
12163
|
+
* PeerInfo ::= SEQUENCE {
|
|
12164
|
+
* fuzz-version U8,
|
|
12165
|
+
* features Features,
|
|
12166
|
+
* jam-version Version,
|
|
12167
|
+
* app-version Version,
|
|
12168
|
+
* name UTF8String
|
|
12169
|
+
* }
|
|
12170
|
+
*/
|
|
12171
|
+
class PeerInfo extends WithDebug {
|
|
12172
|
+
fuzzVersion;
|
|
12173
|
+
features;
|
|
12174
|
+
jamVersion;
|
|
12175
|
+
appVersion;
|
|
12176
|
+
name;
|
|
12177
|
+
static Codec = codec$1.Class(PeerInfo, {
|
|
12178
|
+
fuzzVersion: codec$1.u8,
|
|
12179
|
+
features: codec$1.u32,
|
|
12180
|
+
jamVersion: Version.Codec,
|
|
12181
|
+
appVersion: Version.Codec,
|
|
12182
|
+
name: codec$1.string,
|
|
12183
|
+
});
|
|
12184
|
+
static create({ fuzzVersion, features, appVersion, jamVersion, name }) {
|
|
12185
|
+
return new PeerInfo(fuzzVersion, features, jamVersion, appVersion, name);
|
|
12186
|
+
}
|
|
12187
|
+
constructor(fuzzVersion, features, jamVersion, appVersion, name) {
|
|
12188
|
+
super();
|
|
12189
|
+
this.fuzzVersion = fuzzVersion;
|
|
12190
|
+
this.features = features;
|
|
12191
|
+
this.jamVersion = jamVersion;
|
|
12192
|
+
this.appVersion = appVersion;
|
|
12193
|
+
this.name = name;
|
|
12194
|
+
}
|
|
12195
|
+
}
|
|
12196
|
+
/**
|
|
12197
|
+
* AncestryItem ::= SEQUENCE {
|
|
12198
|
+
* slot TimeSlot,
|
|
12199
|
+
* header-hash HeaderHash
|
|
12200
|
+
* }
|
|
12201
|
+
*/
|
|
12202
|
+
class AncestryItem extends WithDebug {
|
|
12203
|
+
slot;
|
|
12204
|
+
headerHash;
|
|
12205
|
+
static Codec = codec$1.Class(AncestryItem, {
|
|
12206
|
+
slot: codec$1.u32.asOpaque(),
|
|
12207
|
+
headerHash: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
12208
|
+
});
|
|
12209
|
+
static create({ slot, headerHash }) {
|
|
12210
|
+
return new AncestryItem(slot, headerHash);
|
|
12211
|
+
}
|
|
12212
|
+
constructor(slot, headerHash) {
|
|
12213
|
+
super();
|
|
12214
|
+
this.slot = slot;
|
|
12215
|
+
this.headerHash = headerHash;
|
|
12216
|
+
}
|
|
12217
|
+
}
|
|
12218
|
+
/**
|
|
12219
|
+
* KeyValue ::= SEQUENCE {
|
|
12220
|
+
* key TrieKey,
|
|
12221
|
+
* value OCTET STRING
|
|
12222
|
+
* }
|
|
12223
|
+
*/
|
|
12224
|
+
class KeyValue extends WithDebug {
|
|
12225
|
+
key;
|
|
12226
|
+
value;
|
|
12227
|
+
static Codec = codec$1.Class(KeyValue, {
|
|
12228
|
+
key: codec$1.bytes(TRUNCATED_HASH_SIZE),
|
|
12229
|
+
value: codec$1.blob,
|
|
12230
|
+
});
|
|
12231
|
+
static create({ key, value }) {
|
|
12232
|
+
return new KeyValue(key, value);
|
|
12233
|
+
}
|
|
12234
|
+
constructor(key, value) {
|
|
12235
|
+
super();
|
|
12236
|
+
this.key = key;
|
|
12237
|
+
this.value = value;
|
|
12238
|
+
}
|
|
12239
|
+
}
|
|
12240
|
+
/** State ::= SEQUENCE OF KeyValue */
|
|
12241
|
+
const stateCodec = codec$1.sequenceVarLen(KeyValue.Codec);
|
|
12242
|
+
/**
|
|
12243
|
+
* Ancestry ::= SEQUENCE (SIZE(0..24)) OF AncestryItem
|
|
12244
|
+
* Empty when `feature-ancestry` is not supported by both parties
|
|
12245
|
+
*/
|
|
12246
|
+
const ancestryCodec = codec$1.sequenceVarLen(AncestryItem.Codec, {
|
|
12247
|
+
minLength: 0,
|
|
12248
|
+
maxLength: 24,
|
|
12249
|
+
});
|
|
12250
|
+
/**
|
|
12251
|
+
* Initialize ::= SEQUENCE {
|
|
12252
|
+
* header Header,
|
|
12253
|
+
* keyvals State,
|
|
12254
|
+
* ancestry Ancestry
|
|
12255
|
+
* }
|
|
12256
|
+
*/
|
|
12257
|
+
class Initialize extends WithDebug {
|
|
12258
|
+
header;
|
|
12259
|
+
keyvals;
|
|
12260
|
+
ancestry;
|
|
12261
|
+
static Codec = codec$1.Class(Initialize, {
|
|
12262
|
+
header: Header.Codec,
|
|
12263
|
+
keyvals: stateCodec,
|
|
12264
|
+
ancestry: ancestryCodec,
|
|
12265
|
+
});
|
|
12266
|
+
static create({ header, keyvals, ancestry }) {
|
|
12267
|
+
return new Initialize(header, keyvals, ancestry);
|
|
12268
|
+
}
|
|
12269
|
+
constructor(header, keyvals, ancestry) {
|
|
12270
|
+
super();
|
|
12271
|
+
this.header = header;
|
|
12272
|
+
this.keyvals = keyvals;
|
|
12273
|
+
this.ancestry = ancestry;
|
|
12274
|
+
}
|
|
12275
|
+
}
|
|
12276
|
+
/** GetState ::= HeaderHash */
|
|
12277
|
+
const getStateCodec = codec$1.bytes(HASH_SIZE).asOpaque();
|
|
12278
|
+
/** StateRoot ::= StateRootHash */
|
|
12279
|
+
const stateRootCodec = codec$1.bytes(HASH_SIZE).asOpaque();
|
|
12280
|
+
/** Error ::= UTF8String */
|
|
12281
|
+
class ErrorMessage extends WithDebug {
|
|
12282
|
+
message;
|
|
12283
|
+
static Codec = codec$1.Class(ErrorMessage, {
|
|
12284
|
+
message: codec$1.string,
|
|
12285
|
+
});
|
|
12286
|
+
static create({ message }) {
|
|
12287
|
+
return new ErrorMessage(message);
|
|
12288
|
+
}
|
|
12289
|
+
constructor(message) {
|
|
12290
|
+
super();
|
|
12291
|
+
this.message = message;
|
|
12292
|
+
}
|
|
12293
|
+
}
|
|
12294
|
+
/** Message choice type tags */
|
|
12295
|
+
var MessageType;
|
|
12296
|
+
(function (MessageType) {
|
|
12297
|
+
MessageType[MessageType["PeerInfo"] = 0] = "PeerInfo";
|
|
12298
|
+
MessageType[MessageType["Initialize"] = 1] = "Initialize";
|
|
12299
|
+
MessageType[MessageType["StateRoot"] = 2] = "StateRoot";
|
|
12300
|
+
MessageType[MessageType["ImportBlock"] = 3] = "ImportBlock";
|
|
12301
|
+
MessageType[MessageType["GetState"] = 4] = "GetState";
|
|
12302
|
+
MessageType[MessageType["State"] = 5] = "State";
|
|
12303
|
+
MessageType[MessageType["Error"] = 255] = "Error";
|
|
12304
|
+
})(MessageType || (MessageType = {}));
|
|
12305
|
+
/**
|
|
12306
|
+
* Message ::= CHOICE {
|
|
12307
|
+
* peer-info [0] PeerInfo,
|
|
12308
|
+
* initialize [1] Initialize,
|
|
12309
|
+
* state-root [2] StateRoot,
|
|
12310
|
+
* import-block [3] ImportBlock,
|
|
12311
|
+
* get-state [4] GetState,
|
|
12312
|
+
* state [5] State,
|
|
12313
|
+
* error [255] Error
|
|
12314
|
+
* }
|
|
12315
|
+
*/
|
|
12316
|
+
const messageCodec = codec$1.custom({
|
|
12317
|
+
name: "Message",
|
|
12318
|
+
sizeHint: { bytes: 1, isExact: false },
|
|
12319
|
+
}, (e, msg) => {
|
|
12320
|
+
e.i8(msg.type);
|
|
12321
|
+
switch (msg.type) {
|
|
12322
|
+
case MessageType.PeerInfo:
|
|
12323
|
+
PeerInfo.Codec.encode(e, msg.value);
|
|
12324
|
+
break;
|
|
12325
|
+
case MessageType.Initialize:
|
|
12326
|
+
Initialize.Codec.encode(e, msg.value);
|
|
12327
|
+
break;
|
|
12328
|
+
case MessageType.StateRoot:
|
|
12329
|
+
stateRootCodec.encode(e, msg.value);
|
|
12330
|
+
break;
|
|
12331
|
+
case MessageType.ImportBlock:
|
|
12332
|
+
Block.Codec.View.encode(e, msg.value);
|
|
12333
|
+
break;
|
|
12334
|
+
case MessageType.GetState:
|
|
12335
|
+
getStateCodec.encode(e, msg.value);
|
|
12336
|
+
break;
|
|
12337
|
+
case MessageType.State:
|
|
12338
|
+
stateCodec.encode(e, msg.value);
|
|
12339
|
+
break;
|
|
12340
|
+
case MessageType.Error:
|
|
12341
|
+
ErrorMessage.Codec.encode(e, msg.value);
|
|
12342
|
+
break;
|
|
12343
|
+
default:
|
|
12344
|
+
throw new Error(`Unknown message type: ${msg}`);
|
|
12345
|
+
}
|
|
12346
|
+
}, (d) => {
|
|
12347
|
+
const type = d.u8();
|
|
12348
|
+
switch (type) {
|
|
12349
|
+
case MessageType.PeerInfo:
|
|
12350
|
+
return { type: MessageType.PeerInfo, value: PeerInfo.Codec.decode(d) };
|
|
12351
|
+
case MessageType.Initialize:
|
|
12352
|
+
return { type: MessageType.Initialize, value: Initialize.Codec.decode(d) };
|
|
12353
|
+
case MessageType.StateRoot:
|
|
12354
|
+
return { type: MessageType.StateRoot, value: stateRootCodec.decode(d) };
|
|
12355
|
+
case MessageType.ImportBlock:
|
|
12356
|
+
return { type: MessageType.ImportBlock, value: Block.Codec.View.decode(d) };
|
|
12357
|
+
case MessageType.GetState:
|
|
12358
|
+
return { type: MessageType.GetState, value: getStateCodec.decode(d) };
|
|
12359
|
+
case MessageType.State:
|
|
12360
|
+
return { type: MessageType.State, value: stateCodec.decode(d) };
|
|
12361
|
+
case MessageType.Error:
|
|
12362
|
+
return { type: MessageType.Error, value: ErrorMessage.Codec.decode(d) };
|
|
12363
|
+
default:
|
|
12364
|
+
throw new Error(`Unknown message type: ${type}`);
|
|
12365
|
+
}
|
|
12366
|
+
}, (s) => {
|
|
12367
|
+
const type = s.decoder.u8();
|
|
12368
|
+
switch (type) {
|
|
12369
|
+
case MessageType.PeerInfo:
|
|
12370
|
+
PeerInfo.Codec.View.skip(s);
|
|
12371
|
+
break;
|
|
12372
|
+
case MessageType.Initialize:
|
|
12373
|
+
Initialize.Codec.View.skip(s);
|
|
12374
|
+
break;
|
|
12375
|
+
case MessageType.StateRoot:
|
|
12376
|
+
stateRootCodec.View.skip(s);
|
|
12377
|
+
break;
|
|
12378
|
+
case MessageType.ImportBlock:
|
|
12379
|
+
Block.Codec.View.skip(s);
|
|
12380
|
+
break;
|
|
12381
|
+
case MessageType.GetState:
|
|
12382
|
+
getStateCodec.View.skip(s);
|
|
12383
|
+
break;
|
|
12384
|
+
case MessageType.State:
|
|
12385
|
+
stateCodec.View.skip(s);
|
|
12386
|
+
break;
|
|
12387
|
+
case MessageType.Error:
|
|
12388
|
+
ErrorMessage.Codec.View.skip(s);
|
|
12389
|
+
break;
|
|
12390
|
+
default:
|
|
12391
|
+
throw new Error(`Unknown message type: ${type}`);
|
|
12392
|
+
}
|
|
12393
|
+
});
|
|
12394
|
+
|
|
12395
|
+
const logger$4 = Logger.new(undefined, "ext-ipc-fuzz-v1");
|
|
12396
|
+
class FuzzTarget {
|
|
12397
|
+
msgHandler;
|
|
12398
|
+
sender;
|
|
12399
|
+
spec;
|
|
12400
|
+
sessionFeatures = 0;
|
|
12401
|
+
constructor(msgHandler, sender, spec) {
|
|
12402
|
+
this.msgHandler = msgHandler;
|
|
12403
|
+
this.sender = sender;
|
|
12404
|
+
this.spec = spec;
|
|
12405
|
+
}
|
|
12406
|
+
async onSocketMessage(msg) {
|
|
12407
|
+
// attempt to decode the messsage
|
|
12408
|
+
try {
|
|
12409
|
+
const message = Decoder.decodeObject(messageCodec, msg, this.spec);
|
|
12410
|
+
logger$4.log `[${message.type}] incoming message`;
|
|
12411
|
+
await this.processAndRespond(message);
|
|
12412
|
+
}
|
|
12413
|
+
catch (e) {
|
|
12414
|
+
logger$4.error `Error while processing fuzz v1 message: ${e}`;
|
|
12415
|
+
logger$4.error `${e}`;
|
|
12416
|
+
if (e instanceof Error) {
|
|
12417
|
+
logger$4.error `${e.stack ?? ""}`;
|
|
12418
|
+
}
|
|
12419
|
+
this.sender.close();
|
|
12420
|
+
}
|
|
12421
|
+
}
|
|
12422
|
+
async processAndRespond(message) {
|
|
12423
|
+
let response = null;
|
|
12424
|
+
switch (message.type) {
|
|
12425
|
+
case MessageType.PeerInfo: {
|
|
12426
|
+
// only support V1
|
|
12427
|
+
if (message.value.fuzzVersion !== 1) {
|
|
12428
|
+
logger$4.warn `Unsupported fuzzer protocol version: ${message.value.fuzzVersion}. Closing`;
|
|
12429
|
+
this.sender.close();
|
|
12430
|
+
return;
|
|
12431
|
+
}
|
|
12432
|
+
// Handle handshake
|
|
12433
|
+
const ourPeerInfo = await this.msgHandler.getPeerInfo(message.value);
|
|
12434
|
+
// Calculate session features (intersection of both peer features)
|
|
12435
|
+
this.sessionFeatures = message.value.features & ourPeerInfo.features;
|
|
12436
|
+
logger$4.info `Handshake completed. Shared features: 0b${this.sessionFeatures.toString(2)}`;
|
|
12437
|
+
logger$4.log `Feature ancestry: ${(this.sessionFeatures & Features.Ancestry) !== 0}`;
|
|
12438
|
+
logger$4.log `Feature fork: ${(this.sessionFeatures & Features.Fork) !== 0}`;
|
|
12439
|
+
response = {
|
|
12440
|
+
type: MessageType.PeerInfo,
|
|
12441
|
+
value: ourPeerInfo,
|
|
12442
|
+
};
|
|
12443
|
+
break;
|
|
12444
|
+
}
|
|
12445
|
+
case MessageType.Initialize: {
|
|
12446
|
+
const stateRoot = await this.msgHandler.initialize(message.value);
|
|
12447
|
+
response = {
|
|
12448
|
+
type: MessageType.StateRoot,
|
|
12449
|
+
value: stateRoot,
|
|
12450
|
+
};
|
|
12451
|
+
break;
|
|
12452
|
+
}
|
|
12453
|
+
case MessageType.ImportBlock: {
|
|
12454
|
+
const result = await this.msgHandler.importBlock(message.value);
|
|
12455
|
+
if (result.isOk) {
|
|
12456
|
+
response = {
|
|
12457
|
+
type: MessageType.StateRoot,
|
|
12458
|
+
value: result.ok,
|
|
12459
|
+
};
|
|
12460
|
+
}
|
|
12461
|
+
else {
|
|
12462
|
+
response = {
|
|
12463
|
+
type: MessageType.Error,
|
|
12464
|
+
value: result.error,
|
|
12465
|
+
};
|
|
12466
|
+
}
|
|
12467
|
+
break;
|
|
12468
|
+
}
|
|
12469
|
+
case MessageType.GetState: {
|
|
12470
|
+
const state = await this.msgHandler.getSerializedState(message.value);
|
|
12471
|
+
response = {
|
|
12472
|
+
type: MessageType.State,
|
|
12473
|
+
value: state,
|
|
12474
|
+
};
|
|
12475
|
+
break;
|
|
12476
|
+
}
|
|
12477
|
+
case MessageType.StateRoot: {
|
|
12478
|
+
logger$4.log `--> Received unexpected 'StateRoot' message from the fuzzer. Closing.`;
|
|
12479
|
+
this.sender.close();
|
|
12480
|
+
return;
|
|
12481
|
+
}
|
|
12482
|
+
case MessageType.State: {
|
|
12483
|
+
logger$4.log `--> Received unexpected 'State' message from the fuzzer. Closing.`;
|
|
12484
|
+
this.sender.close();
|
|
12485
|
+
return;
|
|
12486
|
+
}
|
|
12487
|
+
case MessageType.Error: {
|
|
12488
|
+
logger$4.log `--> Received unexpected 'Error' message from the fuzzer. Closing.`;
|
|
12489
|
+
this.sender.close();
|
|
12490
|
+
return;
|
|
12491
|
+
}
|
|
12492
|
+
default: {
|
|
12493
|
+
logger$4.log `--> Received unexpected message type ${JSON.stringify(message)} from the fuzzer. Closing.`;
|
|
12494
|
+
this.sender.close();
|
|
12495
|
+
try {
|
|
12496
|
+
assertNever(message);
|
|
12497
|
+
}
|
|
12498
|
+
catch {
|
|
12499
|
+
return;
|
|
12500
|
+
}
|
|
12501
|
+
}
|
|
12502
|
+
}
|
|
12503
|
+
if (response !== null) {
|
|
12504
|
+
logger$4.trace `<-- responding with: ${response.type}`;
|
|
12505
|
+
const encoded = Encoder.encodeObject(messageCodec, response, this.spec);
|
|
12506
|
+
this.sender.send(encoded);
|
|
12507
|
+
}
|
|
12508
|
+
else {
|
|
12509
|
+
logger$4.warn `<-- no response generated for: ${message.type}`;
|
|
12510
|
+
}
|
|
12511
|
+
}
|
|
12512
|
+
onClose({ error }) {
|
|
12513
|
+
logger$4.log `Closing the v1 handler. Reason: ${error !== undefined ? error.message : "close"}.`;
|
|
12514
|
+
}
|
|
12515
|
+
/** Check if a specific feature is enabled in the session */
|
|
12516
|
+
hasFeature(feature) {
|
|
12517
|
+
return (this.sessionFeatures & feature) !== 0;
|
|
12518
|
+
}
|
|
12519
|
+
}
|
|
12520
|
+
|
|
12521
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
12522
|
+
__proto__: null,
|
|
12523
|
+
AncestryItem: AncestryItem,
|
|
12524
|
+
ErrorMessage: ErrorMessage,
|
|
12525
|
+
get Features () { return Features; },
|
|
12526
|
+
FuzzTarget: FuzzTarget,
|
|
12527
|
+
Initialize: Initialize,
|
|
12528
|
+
KeyValue: KeyValue,
|
|
12529
|
+
get MessageType () { return MessageType; },
|
|
12530
|
+
PeerInfo: PeerInfo,
|
|
12531
|
+
Version: Version,
|
|
12532
|
+
ancestryCodec: ancestryCodec,
|
|
12533
|
+
getStateCodec: getStateCodec,
|
|
12534
|
+
messageCodec: messageCodec,
|
|
12535
|
+
stateCodec: stateCodec,
|
|
12536
|
+
stateRootCodec: stateRootCodec
|
|
12537
|
+
});
|
|
12538
|
+
|
|
12539
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
12540
|
+
__proto__: null,
|
|
12541
|
+
v1: index$b
|
|
12542
|
+
});
|
|
12543
|
+
|
|
12081
12544
|
/** Size of the transfer memo. */
|
|
12082
12545
|
const TRANSFER_MEMO_BYTES = W_T;
|
|
12083
12546
|
/**
|
|
@@ -14125,6 +14588,17 @@ class PageRange {
|
|
|
14125
14588
|
}
|
|
14126
14589
|
return new PageRange(start, length);
|
|
14127
14590
|
}
|
|
14591
|
+
/** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
|
|
14592
|
+
isWrapped() {
|
|
14593
|
+
return this.start >= this.end && !this.isEmpty();
|
|
14594
|
+
}
|
|
14595
|
+
/** Checks if given page number is within the range */
|
|
14596
|
+
isInRange(page) {
|
|
14597
|
+
if (this.isWrapped()) {
|
|
14598
|
+
return page >= this.start || page < this.end;
|
|
14599
|
+
}
|
|
14600
|
+
return page >= this.start && page < this.end;
|
|
14601
|
+
}
|
|
14128
14602
|
/** Checks if a range is empty (`length === 0`) */
|
|
14129
14603
|
isEmpty() {
|
|
14130
14604
|
return this.length === 0;
|
|
@@ -14465,10 +14939,11 @@ class MemoryBuilder {
|
|
|
14465
14939
|
startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
|
|
14466
14940
|
`;
|
|
14467
14941
|
this.ensureNotFinalized();
|
|
14468
|
-
const
|
|
14469
|
-
const
|
|
14470
|
-
|
|
14471
|
-
|
|
14942
|
+
const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
14943
|
+
const heapPagesRange = PageRange.fromMemoryRange(heapRange);
|
|
14944
|
+
const initializedPageNumbers = Array.from(this.initialMemory.keys());
|
|
14945
|
+
for (const pageNumber of initializedPageNumbers) {
|
|
14946
|
+
if (heapPagesRange.isInRange(pageNumber)) {
|
|
14472
14947
|
throw new IncorrectSbrkIndex();
|
|
14473
14948
|
}
|
|
14474
14949
|
}
|
|
@@ -16908,8 +17383,8 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
16908
17383
|
asOpaqueType: asOpaqueType,
|
|
16909
17384
|
assertEmpty: assertEmpty,
|
|
16910
17385
|
assertNever: assertNever,
|
|
16911
|
-
block: index$
|
|
16912
|
-
bytes: index$
|
|
17386
|
+
block: index$l,
|
|
17387
|
+
bytes: index$s,
|
|
16913
17388
|
check: check,
|
|
16914
17389
|
clampU64ToU32: clampU64ToU32,
|
|
16915
17390
|
createResults: createResults,
|
|
@@ -16917,13 +17392,13 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
16917
17392
|
extractCodeAndMetadata: extractCodeAndMetadata,
|
|
16918
17393
|
getServiceId: getServiceId,
|
|
16919
17394
|
getServiceIdOrCurrent: getServiceIdOrCurrent,
|
|
16920
|
-
hash: index$
|
|
17395
|
+
hash: index$p,
|
|
16921
17396
|
inspect: inspect,
|
|
16922
17397
|
instructionArgumentTypeMap: instructionArgumentTypeMap,
|
|
16923
17398
|
interpreter: index$7,
|
|
16924
17399
|
isBrowser: isBrowser,
|
|
16925
17400
|
measure: measure,
|
|
16926
|
-
numbers: index$
|
|
17401
|
+
numbers: index$r,
|
|
16927
17402
|
resultToString: resultToString,
|
|
16928
17403
|
seeThrough: seeThrough,
|
|
16929
17404
|
slotsToPreimageStatus: slotsToPreimageStatus,
|
|
@@ -17637,32 +18112,33 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
17637
18112
|
WorkPackageExecutor: WorkPackageExecutor
|
|
17638
18113
|
});
|
|
17639
18114
|
|
|
17640
|
-
exports.block = index$
|
|
17641
|
-
exports.block_json = index$
|
|
17642
|
-
exports.bytes = index$
|
|
17643
|
-
exports.codec = index$
|
|
17644
|
-
exports.collections = index$
|
|
17645
|
-
exports.config = index$
|
|
17646
|
-
exports.config_node = index$
|
|
17647
|
-
exports.crypto = index$
|
|
17648
|
-
exports.database = index$
|
|
17649
|
-
exports.erasure_coding = index$
|
|
17650
|
-
exports.
|
|
18115
|
+
exports.block = index$l;
|
|
18116
|
+
exports.block_json = index$j;
|
|
18117
|
+
exports.bytes = index$s;
|
|
18118
|
+
exports.codec = index$q;
|
|
18119
|
+
exports.collections = index$n;
|
|
18120
|
+
exports.config = index$m;
|
|
18121
|
+
exports.config_node = index$h;
|
|
18122
|
+
exports.crypto = index$o;
|
|
18123
|
+
exports.database = index$d;
|
|
18124
|
+
exports.erasure_coding = index$c;
|
|
18125
|
+
exports.fuzz_proto = index$a;
|
|
18126
|
+
exports.hash = index$p;
|
|
17651
18127
|
exports.jam_host_calls = index$9;
|
|
17652
|
-
exports.json_parser = index$
|
|
17653
|
-
exports.logger = index$
|
|
18128
|
+
exports.json_parser = index$k;
|
|
18129
|
+
exports.logger = index$i;
|
|
17654
18130
|
exports.mmr = index$8;
|
|
17655
|
-
exports.numbers = index$
|
|
17656
|
-
exports.ordering = index$
|
|
18131
|
+
exports.numbers = index$r;
|
|
18132
|
+
exports.ordering = index$t;
|
|
17657
18133
|
exports.pvm = index$3;
|
|
17658
18134
|
exports.pvm_host_calls = index$6;
|
|
17659
18135
|
exports.pvm_interpreter = index$7;
|
|
17660
18136
|
exports.pvm_program = index$4;
|
|
17661
18137
|
exports.pvm_spi_decoder = index$5;
|
|
17662
18138
|
exports.shuffling = index$2;
|
|
17663
|
-
exports.state = index$
|
|
18139
|
+
exports.state = index$g;
|
|
17664
18140
|
exports.state_json = index$1;
|
|
17665
|
-
exports.state_merkleization = index$
|
|
18141
|
+
exports.state_merkleization = index$e;
|
|
17666
18142
|
exports.transition = index;
|
|
17667
|
-
exports.trie = index$
|
|
17668
|
-
exports.utils = index$
|
|
18143
|
+
exports.trie = index$f;
|
|
18144
|
+
exports.utils = index$u;
|