@typeberry/jam 0.1.3-8fd7637 → 0.1.3-a6eda68
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 +422 -328
- package/bootstrap-importer.mjs.map +1 -1
- package/bootstrap-network.mjs +287 -253
- package/bootstrap-network.mjs.map +1 -1
- package/index.js +505 -331
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -24332,8 +24332,9 @@ function parseCurrentVersion(env) {
|
|
|
24332
24332
|
}
|
|
24333
24333
|
}
|
|
24334
24334
|
function parseCurrentSuite(env) {
|
|
24335
|
-
if (env === undefined)
|
|
24335
|
+
if (env === undefined) {
|
|
24336
24336
|
return undefined;
|
|
24337
|
+
}
|
|
24337
24338
|
switch (env) {
|
|
24338
24339
|
case TestSuite.W3F_DAVXY:
|
|
24339
24340
|
case TestSuite.JAMDUNA:
|
|
@@ -24764,10 +24765,12 @@ function deepEqual(actual, expected, { context = [], errorsCollector, ignore = [
|
|
|
24764
24765
|
.sort((a, b) => {
|
|
24765
24766
|
const aKey = `${a.key}`;
|
|
24766
24767
|
const bKey = `${b.key}`;
|
|
24767
|
-
if (aKey < bKey)
|
|
24768
|
+
if (aKey < bKey) {
|
|
24768
24769
|
return -1;
|
|
24769
|
-
|
|
24770
|
+
}
|
|
24771
|
+
if (bKey < aKey) {
|
|
24770
24772
|
return 1;
|
|
24773
|
+
}
|
|
24771
24774
|
return 0;
|
|
24772
24775
|
});
|
|
24773
24776
|
};
|
|
@@ -25779,7 +25782,7 @@ class Skipper {
|
|
|
25779
25782
|
*
|
|
25780
25783
|
* Descriptors can be composed to form more complex typings.
|
|
25781
25784
|
*/
|
|
25782
|
-
class
|
|
25785
|
+
class Descriptor {
|
|
25783
25786
|
name;
|
|
25784
25787
|
sizeHint;
|
|
25785
25788
|
encode;
|
|
@@ -25789,11 +25792,11 @@ class descriptor_Descriptor {
|
|
|
25789
25792
|
View;
|
|
25790
25793
|
/** New descriptor with specialized `View`. */
|
|
25791
25794
|
static withView(name, sizeHint, encode, decode, skip, view) {
|
|
25792
|
-
return new
|
|
25795
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, view);
|
|
25793
25796
|
}
|
|
25794
25797
|
/** Create a new descriptor without a specialized `View`. */
|
|
25795
25798
|
static new(name, sizeHint, encode, decode, skip) {
|
|
25796
|
-
return new
|
|
25799
|
+
return new Descriptor(name, sizeHint, encode, decode, skip, null);
|
|
25797
25800
|
}
|
|
25798
25801
|
constructor(
|
|
25799
25802
|
/** Descriptive name of the coded data. */
|
|
@@ -25830,7 +25833,7 @@ class descriptor_Descriptor {
|
|
|
25830
25833
|
}
|
|
25831
25834
|
/** Return a new descriptor that converts data into some other type. */
|
|
25832
25835
|
convert(input, output) {
|
|
25833
|
-
return new
|
|
25836
|
+
return new Descriptor(this.name, this.sizeHint, (e, elem) => this.encode(e, input(elem)), (d) => output(this.decode(d)), this.skip, this.View);
|
|
25834
25837
|
}
|
|
25835
25838
|
/** Safely cast the descriptor value to a opaque type. */
|
|
25836
25839
|
asOpaque() {
|
|
@@ -26528,51 +26531,51 @@ var descriptors_codec;
|
|
|
26528
26531
|
return (len) => {
|
|
26529
26532
|
let ret = cache.get(len);
|
|
26530
26533
|
if (ret === undefined) {
|
|
26531
|
-
ret =
|
|
26534
|
+
ret = Descriptor.new(`Bytes<${len}>`, exactHint(len), (e, v) => e.bytes(v), (d) => d.bytes(len), (s) => s.bytes(len));
|
|
26532
26535
|
cache.set(len, ret);
|
|
26533
26536
|
}
|
|
26534
26537
|
return ret;
|
|
26535
26538
|
};
|
|
26536
26539
|
})();
|
|
26537
26540
|
/** Variable-length U32. */
|
|
26538
|
-
codec.varU32 =
|
|
26541
|
+
codec.varU32 = Descriptor.new("var_u32", { bytes: 4, isExact: false }, (e, v) => e.varU32(v), (d) => d.varU32(), (d) => d.varU32());
|
|
26539
26542
|
/** Variable-length U64. */
|
|
26540
|
-
codec.varU64 =
|
|
26543
|
+
codec.varU64 = Descriptor.new("var_u64", { bytes: 8, isExact: false }, (e, v) => e.varU64(v), (d) => d.varU64(), (d) => d.varU64());
|
|
26541
26544
|
/** Unsigned 64-bit number. */
|
|
26542
|
-
codec.u64 =
|
|
26545
|
+
codec.u64 = Descriptor.withView("u64", exactHint(8), (e, v) => e.i64(v), (d) => d.u64(), (d) => d.u64(), codec.bytes(8));
|
|
26543
26546
|
/** Unsigned 32-bit number. */
|
|
26544
|
-
codec.u32 =
|
|
26547
|
+
codec.u32 = Descriptor.withView("u32", exactHint(4), (e, v) => e.i32(v), (d) => d.u32(), (d) => d.u32(), codec.bytes(4));
|
|
26545
26548
|
/** Unsigned 24-bit number. */
|
|
26546
|
-
codec.u24 =
|
|
26549
|
+
codec.u24 = Descriptor.withView("u24", exactHint(3), (e, v) => e.i24(v), (d) => d.u24(), (d) => d.u24(), codec.bytes(3));
|
|
26547
26550
|
/** Unsigned 16-bit number. */
|
|
26548
|
-
codec.u16 =
|
|
26551
|
+
codec.u16 = Descriptor.withView("u16", exactHint(2), (e, v) => e.i16(v), (d) => d.u16(), (d) => d.u16(), codec.bytes(2));
|
|
26549
26552
|
/** Unsigned 8-bit number. */
|
|
26550
|
-
codec.u8 =
|
|
26553
|
+
codec.u8 = Descriptor.new("u8", exactHint(1), (e, v) => e.i8(v), (d) => d.u8(), (d) => d.u8());
|
|
26551
26554
|
/** Signed 64-bit number. */
|
|
26552
|
-
codec.i64 =
|
|
26555
|
+
codec.i64 = Descriptor.withView("u64", exactHint(8), (e, v) => e.i64(v), (d) => d.i64(), (s) => s.u64(), codec.bytes(8));
|
|
26553
26556
|
/** Signed 32-bit number. */
|
|
26554
|
-
codec.i32 =
|
|
26557
|
+
codec.i32 = Descriptor.withView("i32", exactHint(4), (e, v) => e.i32(v), (d) => d.i32(), (s) => s.u32(), codec.bytes(4));
|
|
26555
26558
|
/** Signed 24-bit number. */
|
|
26556
|
-
codec.i24 =
|
|
26559
|
+
codec.i24 = Descriptor.withView("i24", exactHint(3), (e, v) => e.i24(v), (d) => d.i24(), (s) => s.u24(), codec.bytes(3));
|
|
26557
26560
|
/** Signed 16-bit number. */
|
|
26558
|
-
codec.i16 =
|
|
26561
|
+
codec.i16 = Descriptor.withView("i16", exactHint(2), (e, v) => e.i16(v), (d) => d.i16(), (s) => s.u16(), codec.bytes(2));
|
|
26559
26562
|
/** Signed 8-bit number. */
|
|
26560
|
-
codec.i8 =
|
|
26563
|
+
codec.i8 = Descriptor.new("i8", exactHint(1), (e, v) => e.i8(v), (d) => d.i8(), (s) => s.u8());
|
|
26561
26564
|
/** 1-byte boolean value. */
|
|
26562
|
-
codec.bool =
|
|
26565
|
+
codec.bool = Descriptor.new("bool", exactHint(1), (e, v) => e.bool(v), (d) => d.bool(), (s) => s.bool());
|
|
26563
26566
|
/** Variable-length bytes blob. */
|
|
26564
|
-
codec.blob =
|
|
26567
|
+
codec.blob = Descriptor.new("BytesBlob", { bytes: TYPICAL_SEQUENCE_LENGTH, isExact: false }, (e, v) => e.bytesBlob(v), (d) => d.bytesBlob(), (s) => s.bytesBlob());
|
|
26565
26568
|
/** String encoded as variable-length bytes blob. */
|
|
26566
|
-
codec.string =
|
|
26569
|
+
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);
|
|
26567
26570
|
/** Variable-length bit vector. */
|
|
26568
|
-
codec.bitVecVarLen =
|
|
26571
|
+
codec.bitVecVarLen = Descriptor.new("BitVec[?]", { bytes: TYPICAL_SEQUENCE_LENGTH >>> 3, isExact: false }, (e, v) => e.bitVecVarLen(v), (d) => d.bitVecVarLen(), (s) => s.bitVecVarLen());
|
|
26569
26572
|
/** Fixed-length bit vector. */
|
|
26570
|
-
codec.bitVecFixLen = (bitLen) =>
|
|
26573
|
+
codec.bitVecFixLen = (bitLen) => Descriptor.new(`BitVec[${bitLen}]`, exactHint(bitLen >>> 3), (e, v) => e.bitVecFixLen(v), (d) => d.bitVecFixLen(bitLen), (s) => s.bitVecFixLen(bitLen));
|
|
26571
26574
|
/** Optionality wrapper for given type. */
|
|
26572
26575
|
codec.optional = (type) => {
|
|
26573
|
-
const self =
|
|
26576
|
+
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));
|
|
26574
26577
|
if (hasUniqueView(type)) {
|
|
26575
|
-
return
|
|
26578
|
+
return Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.optional(type.View));
|
|
26576
26579
|
}
|
|
26577
26580
|
return self;
|
|
26578
26581
|
};
|
|
@@ -26583,7 +26586,7 @@ var descriptors_codec;
|
|
|
26583
26586
|
}) => {
|
|
26584
26587
|
const name = `Sequence<${type.name}>[?]`;
|
|
26585
26588
|
const typicalLength = options.typicalLength ?? TYPICAL_SEQUENCE_LENGTH;
|
|
26586
|
-
return
|
|
26589
|
+
return Descriptor.withView(name, { bytes: typicalLength * type.sizeHint.bytes, isExact: false }, (e, v) => {
|
|
26587
26590
|
validateLength(options, v.length, name);
|
|
26588
26591
|
e.sequenceVarLen(type, v);
|
|
26589
26592
|
}, (d) => {
|
|
@@ -26597,10 +26600,10 @@ var descriptors_codec;
|
|
|
26597
26600
|
}, sequenceViewVarLen(type, options));
|
|
26598
26601
|
};
|
|
26599
26602
|
/** Fixed-length sequence of given type. */
|
|
26600
|
-
codec.sequenceFixLen = (type, len) =>
|
|
26603
|
+
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 }));
|
|
26601
26604
|
/** Small dictionary codec. */
|
|
26602
26605
|
codec.dictionary = (key, value, { sortKeys, fixedLength, }) => {
|
|
26603
|
-
const self =
|
|
26606
|
+
const self = Descriptor.new(`Dictionary<${key.name}, ${value.name}>[${fixedLength ?? "?"}]`, {
|
|
26604
26607
|
bytes: fixedLength !== undefined
|
|
26605
26608
|
? fixedLength * addSizeHints(key.sizeHint, value.sizeHint).bytes
|
|
26606
26609
|
: TYPICAL_DICTIONARY_LENGTH * (addSizeHints(key.sizeHint, value.sizeHint).bytes ?? 0),
|
|
@@ -26639,13 +26642,13 @@ var descriptors_codec;
|
|
|
26639
26642
|
s.sequenceFixLen(value, len);
|
|
26640
26643
|
});
|
|
26641
26644
|
if (hasUniqueView(value)) {
|
|
26642
|
-
return
|
|
26645
|
+
return Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.dictionary(key, value.View, { sortKeys, fixedLength }));
|
|
26643
26646
|
}
|
|
26644
26647
|
return self;
|
|
26645
26648
|
};
|
|
26646
26649
|
/** Encoding of pair of two values. */
|
|
26647
26650
|
codec.pair = (a, b) => {
|
|
26648
|
-
const self =
|
|
26651
|
+
const self = Descriptor.new(`Pair<${a.name}, ${b.name}>`, addSizeHints(a.sizeHint, b.sizeHint), (e, elem) => {
|
|
26649
26652
|
a.encode(e, elem[0]);
|
|
26650
26653
|
b.encode(e, elem[1]);
|
|
26651
26654
|
}, (d) => {
|
|
@@ -26657,14 +26660,14 @@ var descriptors_codec;
|
|
|
26657
26660
|
b.skip(s);
|
|
26658
26661
|
});
|
|
26659
26662
|
if (hasUniqueView(a) && hasUniqueView(b)) {
|
|
26660
|
-
return
|
|
26663
|
+
return Descriptor.withView(self.name, self.sizeHint, self.encode, self.decode, self.skip, codec.pair(a.View, b.View));
|
|
26661
26664
|
}
|
|
26662
26665
|
return self;
|
|
26663
26666
|
};
|
|
26664
26667
|
/** Custom encoding / decoding logic. */
|
|
26665
|
-
codec.custom = ({ name, sizeHint = { bytes: 0, isExact: false }, }, encode, decode, skip) =>
|
|
26668
|
+
codec.custom = ({ name, sizeHint = { bytes: 0, isExact: false }, }, encode, decode, skip) => Descriptor.new(name, sizeHint, encode, decode, skip);
|
|
26666
26669
|
/** Choose a descriptor depending on the encoding/decoding context. */
|
|
26667
|
-
codec.select = ({ name, sizeHint, }, chooser) =>
|
|
26670
|
+
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);
|
|
26668
26671
|
/**
|
|
26669
26672
|
* A descriptor for a more complex POJO.
|
|
26670
26673
|
*
|
|
@@ -26701,7 +26704,7 @@ var descriptors_codec;
|
|
|
26701
26704
|
};
|
|
26702
26705
|
const view = objectView(Class, descriptors, sizeHint, skipper);
|
|
26703
26706
|
// and create the descriptor for the entire class.
|
|
26704
|
-
return
|
|
26707
|
+
return Descriptor.withView(Class.name, sizeHint, (e, t) => {
|
|
26705
26708
|
forEachDescriptor(descriptors, (key, descriptor) => {
|
|
26706
26709
|
const value = t[key];
|
|
26707
26710
|
descriptor.encode(e, value);
|
|
@@ -26752,7 +26755,7 @@ function objectView(Class, descriptors, sizeHint, skipper) {
|
|
|
26752
26755
|
});
|
|
26753
26756
|
}
|
|
26754
26757
|
});
|
|
26755
|
-
return
|
|
26758
|
+
return Descriptor.new(`View<${Class.name}>`, sizeHint, (e, t) => {
|
|
26756
26759
|
const encoded = t.encoded();
|
|
26757
26760
|
e.bytes(bytes_Bytes.fromBlob(encoded.raw, encoded.length));
|
|
26758
26761
|
}, (d) => {
|
|
@@ -26771,7 +26774,7 @@ function sequenceViewVarLen(type, options) {
|
|
|
26771
26774
|
validateLength(options, length, name);
|
|
26772
26775
|
return s.sequenceFixLen(type, length);
|
|
26773
26776
|
};
|
|
26774
|
-
return
|
|
26777
|
+
return Descriptor.new(name, sizeHint, (e, t) => {
|
|
26775
26778
|
validateLength(options, t.length, name);
|
|
26776
26779
|
const encoded = t.encoded();
|
|
26777
26780
|
e.bytes(bytes_Bytes.fromBlob(encoded.raw, encoded.length));
|
|
@@ -26787,7 +26790,7 @@ function sequenceViewFixLen(type, { fixedLength }) {
|
|
|
26787
26790
|
const skipper = (s) => s.sequenceFixLen(type, fixedLength);
|
|
26788
26791
|
const view = type.name !== type.View.name ? `, ${type.View.name}` : "";
|
|
26789
26792
|
const name = `SeqView<${type.name}${view}>[${fixedLength}]`;
|
|
26790
|
-
return
|
|
26793
|
+
return Descriptor.new(name, sizeHint, (e, t) => {
|
|
26791
26794
|
const encoded = t.encoded();
|
|
26792
26795
|
e.bytes(bytes_Bytes.fromBlob(encoded.raw, encoded.length));
|
|
26793
26796
|
}, (d) => {
|
|
@@ -29088,7 +29091,7 @@ const codecFixedSizeArray = (val, len) => {
|
|
|
29088
29091
|
};
|
|
29089
29092
|
/** Codec for a hash-dictionary. */
|
|
29090
29093
|
const codecHashDictionary = (value, extractKey, { typicalLength = TYPICAL_DICTIONARY_LENGTH, compare = (a, b) => extractKey(a).compare(extractKey(b)), } = {}) => {
|
|
29091
|
-
return
|
|
29094
|
+
return Descriptor.new(`HashDictionary<${value.name}>[?]`, {
|
|
29092
29095
|
bytes: typicalLength * value.sizeHint.bytes,
|
|
29093
29096
|
isExact: false,
|
|
29094
29097
|
}, (e, v) => {
|
|
@@ -32151,6 +32154,13 @@ const W_T = 128;
|
|
|
32151
32154
|
/** `W_M`: The maximum number of exports in a work-package. */
|
|
32152
32155
|
const W_X = 3_072;
|
|
32153
32156
|
// TODO [ToDr] Not sure where these should live yet :(
|
|
32157
|
+
/**
|
|
32158
|
+
* `S`: The minimum public service index.
|
|
32159
|
+
* Services of indices below these may only be created by the Registrar.
|
|
32160
|
+
*
|
|
32161
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/447a00447a00?v=0.7.2
|
|
32162
|
+
*/
|
|
32163
|
+
const MIN_PUBLIC_SERVICE_INDEX = 2 ** 16;
|
|
32154
32164
|
/**
|
|
32155
32165
|
* `J`: The maximum sum of dependency items in a work-report.
|
|
32156
32166
|
*
|
|
@@ -32162,9 +32172,209 @@ const AUTHORIZATION_QUEUE_SIZE = Q;
|
|
|
32162
32172
|
/** `O`: Maximal authorization pool size. */
|
|
32163
32173
|
const MAX_AUTH_POOL_SIZE = O;
|
|
32164
32174
|
|
|
32175
|
+
;// CONCATENATED MODULE: ./packages/core/pvm-interpreter/ops/math-consts.ts
|
|
32176
|
+
const MAX_VALUE = 4294967295;
|
|
32177
|
+
const math_consts_MAX_VALUE_U64 = (/* unused pure expression or super */ null && (2n ** 63n));
|
|
32178
|
+
const MIN_VALUE = -(2 ** 31);
|
|
32179
|
+
const MAX_SHIFT_U32 = 32;
|
|
32180
|
+
const MAX_SHIFT_U64 = 64n;
|
|
32181
|
+
|
|
32182
|
+
;// CONCATENATED MODULE: ./packages/jam/state/service.ts
|
|
32183
|
+
|
|
32184
|
+
|
|
32185
|
+
|
|
32186
|
+
|
|
32187
|
+
|
|
32188
|
+
|
|
32189
|
+
/**
|
|
32190
|
+
* `B_S`: The basic minimum balance which all services require.
|
|
32191
|
+
*
|
|
32192
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
|
|
32193
|
+
*/
|
|
32194
|
+
const BASE_SERVICE_BALANCE = 100n;
|
|
32195
|
+
/**
|
|
32196
|
+
* `B_I`: The additional minimum balance required per item of elective service state.
|
|
32197
|
+
*
|
|
32198
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
|
|
32199
|
+
*/
|
|
32200
|
+
const ELECTIVE_ITEM_BALANCE = 10n;
|
|
32201
|
+
/**
|
|
32202
|
+
* `B_L`: The additional minimum balance required per octet of elective service state.
|
|
32203
|
+
*
|
|
32204
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
|
|
32205
|
+
*/
|
|
32206
|
+
const ELECTIVE_BYTE_BALANCE = 1n;
|
|
32207
|
+
const zeroSizeHint = {
|
|
32208
|
+
bytes: 0,
|
|
32209
|
+
isExact: true,
|
|
32210
|
+
};
|
|
32211
|
+
/** 0-byte read, return given default value */
|
|
32212
|
+
const ignoreValueWithDefault = (defaultValue) => Descriptor.new("ignoreValue", zeroSizeHint, (_e, _v) => { }, (_d) => defaultValue, (_s) => { });
|
|
32213
|
+
/** Encode and decode object with leading version number. */
|
|
32214
|
+
const codecWithVersion = (val) => Descriptor.new("withVersion", {
|
|
32215
|
+
bytes: val.sizeHint.bytes + 8,
|
|
32216
|
+
isExact: false,
|
|
32217
|
+
}, (e, v) => {
|
|
32218
|
+
e.varU64(0n);
|
|
32219
|
+
val.encode(e, v);
|
|
32220
|
+
}, (d) => {
|
|
32221
|
+
const version = d.varU64();
|
|
32222
|
+
if (version !== 0n) {
|
|
32223
|
+
throw new Error("Non-zero version is not supported!");
|
|
32224
|
+
}
|
|
32225
|
+
return val.decode(d);
|
|
32226
|
+
}, (s) => {
|
|
32227
|
+
s.varU64();
|
|
32228
|
+
val.skip(s);
|
|
32229
|
+
});
|
|
32230
|
+
/**
|
|
32231
|
+
* Service account details.
|
|
32232
|
+
*
|
|
32233
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
|
|
32234
|
+
*/
|
|
32235
|
+
class ServiceAccountInfo extends WithDebug {
|
|
32236
|
+
codeHash;
|
|
32237
|
+
balance;
|
|
32238
|
+
accumulateMinGas;
|
|
32239
|
+
onTransferMinGas;
|
|
32240
|
+
storageUtilisationBytes;
|
|
32241
|
+
gratisStorage;
|
|
32242
|
+
storageUtilisationCount;
|
|
32243
|
+
created;
|
|
32244
|
+
lastAccumulation;
|
|
32245
|
+
parentService;
|
|
32246
|
+
static Codec = descriptors_codec.Class(ServiceAccountInfo, {
|
|
32247
|
+
codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
32248
|
+
balance: descriptors_codec.u64,
|
|
32249
|
+
accumulateMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
32250
|
+
onTransferMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
32251
|
+
storageUtilisationBytes: descriptors_codec.u64,
|
|
32252
|
+
gratisStorage: descriptors_codec.u64,
|
|
32253
|
+
storageUtilisationCount: descriptors_codec.u32,
|
|
32254
|
+
created: descriptors_codec.u32.convert((x) => x, tryAsTimeSlot),
|
|
32255
|
+
lastAccumulation: descriptors_codec.u32.convert((x) => x, tryAsTimeSlot),
|
|
32256
|
+
parentService: descriptors_codec.u32.convert((x) => x, tryAsServiceId),
|
|
32257
|
+
});
|
|
32258
|
+
static create(a) {
|
|
32259
|
+
return new ServiceAccountInfo(a.codeHash, a.balance, a.accumulateMinGas, a.onTransferMinGas, a.storageUtilisationBytes, a.gratisStorage, a.storageUtilisationCount, a.created, a.lastAccumulation, a.parentService);
|
|
32260
|
+
}
|
|
32261
|
+
/**
|
|
32262
|
+
* `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
|
|
32263
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
|
|
32264
|
+
*/
|
|
32265
|
+
static calculateThresholdBalance(items, bytes, gratisStorage) {
|
|
32266
|
+
const storageCost = BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
|
|
32267
|
+
if (storageCost < 0n) {
|
|
32268
|
+
return numbers_tryAsU64(0);
|
|
32269
|
+
}
|
|
32270
|
+
if (storageCost >= 2n ** 64n) {
|
|
32271
|
+
return numbers_tryAsU64(2n ** 64n - 1n);
|
|
32272
|
+
}
|
|
32273
|
+
return numbers_tryAsU64(storageCost);
|
|
32274
|
+
}
|
|
32275
|
+
constructor(
|
|
32276
|
+
/** `a_c`: Hash of the service code. */
|
|
32277
|
+
codeHash,
|
|
32278
|
+
/** `a_b`: Current account balance. */
|
|
32279
|
+
balance,
|
|
32280
|
+
/** `a_g`: Minimal gas required to execute Accumulate entrypoint. */
|
|
32281
|
+
accumulateMinGas,
|
|
32282
|
+
/** `a_m`: Minimal gas required to execute On Transfer entrypoint. */
|
|
32283
|
+
onTransferMinGas,
|
|
32284
|
+
/** `a_o`: Total number of octets in storage. */
|
|
32285
|
+
storageUtilisationBytes,
|
|
32286
|
+
/** `a_f`: Cost-free storage. Decreases both storage item count and total byte size. */
|
|
32287
|
+
gratisStorage,
|
|
32288
|
+
/** `a_i`: Number of items in storage. */
|
|
32289
|
+
storageUtilisationCount,
|
|
32290
|
+
/** `a_r`: Creation account time slot. */
|
|
32291
|
+
created,
|
|
32292
|
+
/** `a_a`: Most recent accumulation time slot. */
|
|
32293
|
+
lastAccumulation,
|
|
32294
|
+
/** `a_p`: Parent service ID. */
|
|
32295
|
+
parentService) {
|
|
32296
|
+
super();
|
|
32297
|
+
this.codeHash = codeHash;
|
|
32298
|
+
this.balance = balance;
|
|
32299
|
+
this.accumulateMinGas = accumulateMinGas;
|
|
32300
|
+
this.onTransferMinGas = onTransferMinGas;
|
|
32301
|
+
this.storageUtilisationBytes = storageUtilisationBytes;
|
|
32302
|
+
this.gratisStorage = gratisStorage;
|
|
32303
|
+
this.storageUtilisationCount = storageUtilisationCount;
|
|
32304
|
+
this.created = created;
|
|
32305
|
+
this.lastAccumulation = lastAccumulation;
|
|
32306
|
+
this.parentService = parentService;
|
|
32307
|
+
}
|
|
32308
|
+
}
|
|
32309
|
+
class PreimageItem extends WithDebug {
|
|
32310
|
+
hash;
|
|
32311
|
+
blob;
|
|
32312
|
+
static Codec = descriptors_codec.Class(PreimageItem, {
|
|
32313
|
+
hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
32314
|
+
blob: descriptors_codec.blob,
|
|
32315
|
+
});
|
|
32316
|
+
static create({ hash, blob }) {
|
|
32317
|
+
return new PreimageItem(hash, blob);
|
|
32318
|
+
}
|
|
32319
|
+
constructor(hash, blob) {
|
|
32320
|
+
super();
|
|
32321
|
+
this.hash = hash;
|
|
32322
|
+
this.blob = blob;
|
|
32323
|
+
}
|
|
32324
|
+
}
|
|
32325
|
+
class StorageItem extends WithDebug {
|
|
32326
|
+
key;
|
|
32327
|
+
value;
|
|
32328
|
+
static Codec = descriptors_codec.Class(StorageItem, {
|
|
32329
|
+
key: descriptors_codec.blob.convert((i) => i, (o) => opaque_asOpaqueType(o)),
|
|
32330
|
+
value: descriptors_codec.blob,
|
|
32331
|
+
});
|
|
32332
|
+
static create({ key, value }) {
|
|
32333
|
+
return new StorageItem(key, value);
|
|
32334
|
+
}
|
|
32335
|
+
constructor(key, value) {
|
|
32336
|
+
super();
|
|
32337
|
+
this.key = key;
|
|
32338
|
+
this.value = value;
|
|
32339
|
+
}
|
|
32340
|
+
}
|
|
32341
|
+
const MAX_LOOKUP_HISTORY_SLOTS = 3;
|
|
32342
|
+
function tryAsLookupHistorySlots(items) {
|
|
32343
|
+
const knownSize = sized_array_asKnownSize(items);
|
|
32344
|
+
if (knownSize.length > MAX_LOOKUP_HISTORY_SLOTS) {
|
|
32345
|
+
throw new Error(`Lookup history items must contain 0-${MAX_LOOKUP_HISTORY_SLOTS} timeslots.`);
|
|
32346
|
+
}
|
|
32347
|
+
return knownSize;
|
|
32348
|
+
}
|
|
32349
|
+
/** https://graypaper.fluffylabs.dev/#/5f542d7/115400115800 */
|
|
32350
|
+
class LookupHistoryItem {
|
|
32351
|
+
hash;
|
|
32352
|
+
length;
|
|
32353
|
+
slots;
|
|
32354
|
+
constructor(hash, length,
|
|
32355
|
+
/**
|
|
32356
|
+
* Preimage availability history as a sequence of time slots.
|
|
32357
|
+
* See PreimageStatus and the following GP fragment for more details.
|
|
32358
|
+
* https://graypaper.fluffylabs.dev/#/5f542d7/11780011a500 */
|
|
32359
|
+
slots) {
|
|
32360
|
+
this.hash = hash;
|
|
32361
|
+
this.length = length;
|
|
32362
|
+
this.slots = slots;
|
|
32363
|
+
}
|
|
32364
|
+
static isRequested(item) {
|
|
32365
|
+
if ("slots" in item) {
|
|
32366
|
+
return item.slots.length === 0;
|
|
32367
|
+
}
|
|
32368
|
+
return item.length === 0;
|
|
32369
|
+
}
|
|
32370
|
+
}
|
|
32371
|
+
|
|
32165
32372
|
;// CONCATENATED MODULE: ./packages/jam/state/privileged-services.ts
|
|
32166
32373
|
|
|
32167
32374
|
|
|
32375
|
+
|
|
32376
|
+
|
|
32377
|
+
|
|
32168
32378
|
/** Dictionary entry of services that auto-accumulate every block. */
|
|
32169
32379
|
class AutoAccumulate {
|
|
32170
32380
|
service;
|
|
@@ -32186,39 +32396,50 @@ class AutoAccumulate {
|
|
|
32186
32396
|
}
|
|
32187
32397
|
}
|
|
32188
32398
|
/**
|
|
32189
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
32399
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/114402114402?v=0.7.2
|
|
32190
32400
|
*/
|
|
32191
32401
|
class PrivilegedServices {
|
|
32192
32402
|
manager;
|
|
32193
|
-
|
|
32194
|
-
|
|
32403
|
+
delegator;
|
|
32404
|
+
registrar;
|
|
32405
|
+
assigners;
|
|
32195
32406
|
autoAccumulateServices;
|
|
32407
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bbd023bcb02?v=0.7.2 */
|
|
32196
32408
|
static Codec = descriptors_codec.Class(PrivilegedServices, {
|
|
32197
32409
|
manager: descriptors_codec.u32.asOpaque(),
|
|
32198
|
-
|
|
32199
|
-
|
|
32410
|
+
assigners: codecPerCore(descriptors_codec.u32.asOpaque()),
|
|
32411
|
+
delegator: descriptors_codec.u32.asOpaque(),
|
|
32412
|
+
registrar: Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
32413
|
+
? descriptors_codec.u32.asOpaque()
|
|
32414
|
+
: ignoreValueWithDefault(tryAsServiceId(2 ** 32 - 1)),
|
|
32200
32415
|
autoAccumulateServices: readonlyArray(descriptors_codec.sequenceVarLen(AutoAccumulate.Codec)),
|
|
32201
32416
|
});
|
|
32202
|
-
static create(
|
|
32203
|
-
return new PrivilegedServices(manager,
|
|
32417
|
+
static create(a) {
|
|
32418
|
+
return new PrivilegedServices(a.manager, a.delegator, a.registrar, a.assigners, a.autoAccumulateServices);
|
|
32204
32419
|
}
|
|
32205
32420
|
constructor(
|
|
32206
32421
|
/**
|
|
32207
|
-
*
|
|
32208
|
-
* the service able to effect an alteration of χ from block to block,
|
|
32422
|
+
* `χ_M`: Manages alteration of χ from block to block,
|
|
32209
32423
|
* as well as bestow services with storage deposit credits.
|
|
32210
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
32424
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/111502111902?v=0.7.2
|
|
32211
32425
|
*/
|
|
32212
32426
|
manager,
|
|
32213
|
-
/**
|
|
32214
|
-
|
|
32215
|
-
/**
|
|
32216
|
-
|
|
32217
|
-
|
|
32427
|
+
/** `χ_V`: Managers validator keys. */
|
|
32428
|
+
delegator,
|
|
32429
|
+
/**
|
|
32430
|
+
* `χ_R`: Manages the creation of services in protected range.
|
|
32431
|
+
*
|
|
32432
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/111b02111d02?v=0.7.2
|
|
32433
|
+
*/
|
|
32434
|
+
registrar,
|
|
32435
|
+
/** `χ_A`: Manages authorization queue one for each core. */
|
|
32436
|
+
assigners,
|
|
32437
|
+
/** `χ_Z`: Dictionary of services that auto-accumulate every block with their gas limit. */
|
|
32218
32438
|
autoAccumulateServices) {
|
|
32219
32439
|
this.manager = manager;
|
|
32220
|
-
this.
|
|
32221
|
-
this.
|
|
32440
|
+
this.delegator = delegator;
|
|
32441
|
+
this.registrar = registrar;
|
|
32442
|
+
this.assigners = assigners;
|
|
32222
32443
|
this.autoAccumulateServices = autoAccumulateServices;
|
|
32223
32444
|
}
|
|
32224
32445
|
}
|
|
@@ -32306,7 +32527,7 @@ class RecentBlocks extends WithDebug {
|
|
|
32306
32527
|
*/
|
|
32307
32528
|
class RecentBlocksHistory extends WithDebug {
|
|
32308
32529
|
current;
|
|
32309
|
-
static Codec =
|
|
32530
|
+
static Codec = Descriptor.new("RecentBlocksHistory", RecentBlocks.Codec.sizeHint, (encoder, value) => RecentBlocks.Codec.encode(encoder, value.asCurrent()), (decoder) => {
|
|
32310
32531
|
const recentBlocks = RecentBlocks.Codec.decode(decoder);
|
|
32311
32532
|
return RecentBlocksHistory.create(recentBlocks);
|
|
32312
32533
|
}, (skip) => {
|
|
@@ -32503,196 +32724,6 @@ class SafroleData {
|
|
|
32503
32724
|
}
|
|
32504
32725
|
}
|
|
32505
32726
|
|
|
32506
|
-
;// CONCATENATED MODULE: ./packages/jam/state/service.ts
|
|
32507
|
-
|
|
32508
|
-
|
|
32509
|
-
|
|
32510
|
-
|
|
32511
|
-
|
|
32512
|
-
|
|
32513
|
-
/**
|
|
32514
|
-
* `B_S`: The basic minimum balance which all services require.
|
|
32515
|
-
*
|
|
32516
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
|
|
32517
|
-
*/
|
|
32518
|
-
const BASE_SERVICE_BALANCE = 100n;
|
|
32519
|
-
/**
|
|
32520
|
-
* `B_I`: The additional minimum balance required per item of elective service state.
|
|
32521
|
-
*
|
|
32522
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
|
|
32523
|
-
*/
|
|
32524
|
-
const ELECTIVE_ITEM_BALANCE = 10n;
|
|
32525
|
-
/**
|
|
32526
|
-
* `B_L`: The additional minimum balance required per octet of elective service state.
|
|
32527
|
-
*
|
|
32528
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
|
|
32529
|
-
*/
|
|
32530
|
-
const ELECTIVE_BYTE_BALANCE = 1n;
|
|
32531
|
-
const zeroSizeHint = {
|
|
32532
|
-
bytes: 0,
|
|
32533
|
-
isExact: true,
|
|
32534
|
-
};
|
|
32535
|
-
/** 0-byte read, return given default value */
|
|
32536
|
-
const ignoreValueWithDefault = (defaultValue) => Descriptor.new("ignoreValue", zeroSizeHint, (_e, _v) => { }, (_d) => defaultValue, (_s) => { });
|
|
32537
|
-
/** Encode and decode object with leading version number. */
|
|
32538
|
-
const codecWithVersion = (val) => descriptor_Descriptor.new("withVersion", {
|
|
32539
|
-
bytes: val.sizeHint.bytes + 8,
|
|
32540
|
-
isExact: false,
|
|
32541
|
-
}, (e, v) => {
|
|
32542
|
-
e.varU64(0n);
|
|
32543
|
-
val.encode(e, v);
|
|
32544
|
-
}, (d) => {
|
|
32545
|
-
const version = d.varU64();
|
|
32546
|
-
if (version !== 0n) {
|
|
32547
|
-
throw new Error("Non-zero version is not supported!");
|
|
32548
|
-
}
|
|
32549
|
-
return val.decode(d);
|
|
32550
|
-
}, (s) => {
|
|
32551
|
-
s.varU64();
|
|
32552
|
-
val.skip(s);
|
|
32553
|
-
});
|
|
32554
|
-
/**
|
|
32555
|
-
* Service account details.
|
|
32556
|
-
*
|
|
32557
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
|
|
32558
|
-
*/
|
|
32559
|
-
class ServiceAccountInfo extends WithDebug {
|
|
32560
|
-
codeHash;
|
|
32561
|
-
balance;
|
|
32562
|
-
accumulateMinGas;
|
|
32563
|
-
onTransferMinGas;
|
|
32564
|
-
storageUtilisationBytes;
|
|
32565
|
-
gratisStorage;
|
|
32566
|
-
storageUtilisationCount;
|
|
32567
|
-
created;
|
|
32568
|
-
lastAccumulation;
|
|
32569
|
-
parentService;
|
|
32570
|
-
static Codec = descriptors_codec.Class(ServiceAccountInfo, {
|
|
32571
|
-
codeHash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
32572
|
-
balance: descriptors_codec.u64,
|
|
32573
|
-
accumulateMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
32574
|
-
onTransferMinGas: descriptors_codec.u64.convert((x) => x, tryAsServiceGas),
|
|
32575
|
-
storageUtilisationBytes: descriptors_codec.u64,
|
|
32576
|
-
gratisStorage: descriptors_codec.u64,
|
|
32577
|
-
storageUtilisationCount: descriptors_codec.u32,
|
|
32578
|
-
created: descriptors_codec.u32.convert((x) => x, tryAsTimeSlot),
|
|
32579
|
-
lastAccumulation: descriptors_codec.u32.convert((x) => x, tryAsTimeSlot),
|
|
32580
|
-
parentService: descriptors_codec.u32.convert((x) => x, tryAsServiceId),
|
|
32581
|
-
});
|
|
32582
|
-
static create(a) {
|
|
32583
|
-
return new ServiceAccountInfo(a.codeHash, a.balance, a.accumulateMinGas, a.onTransferMinGas, a.storageUtilisationBytes, a.gratisStorage, a.storageUtilisationCount, a.created, a.lastAccumulation, a.parentService);
|
|
32584
|
-
}
|
|
32585
|
-
/**
|
|
32586
|
-
* `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
|
|
32587
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
|
|
32588
|
-
*/
|
|
32589
|
-
static calculateThresholdBalance(items, bytes, gratisStorage) {
|
|
32590
|
-
const storageCost = BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
|
|
32591
|
-
if (storageCost < 0n) {
|
|
32592
|
-
return numbers_tryAsU64(0);
|
|
32593
|
-
}
|
|
32594
|
-
if (storageCost >= 2n ** 64n) {
|
|
32595
|
-
return numbers_tryAsU64(2n ** 64n - 1n);
|
|
32596
|
-
}
|
|
32597
|
-
return numbers_tryAsU64(storageCost);
|
|
32598
|
-
}
|
|
32599
|
-
constructor(
|
|
32600
|
-
/** `a_c`: Hash of the service code. */
|
|
32601
|
-
codeHash,
|
|
32602
|
-
/** `a_b`: Current account balance. */
|
|
32603
|
-
balance,
|
|
32604
|
-
/** `a_g`: Minimal gas required to execute Accumulate entrypoint. */
|
|
32605
|
-
accumulateMinGas,
|
|
32606
|
-
/** `a_m`: Minimal gas required to execute On Transfer entrypoint. */
|
|
32607
|
-
onTransferMinGas,
|
|
32608
|
-
/** `a_o`: Total number of octets in storage. */
|
|
32609
|
-
storageUtilisationBytes,
|
|
32610
|
-
/** `a_f`: Cost-free storage. Decreases both storage item count and total byte size. */
|
|
32611
|
-
gratisStorage,
|
|
32612
|
-
/** `a_i`: Number of items in storage. */
|
|
32613
|
-
storageUtilisationCount,
|
|
32614
|
-
/** `a_r`: Creation account time slot. */
|
|
32615
|
-
created,
|
|
32616
|
-
/** `a_a`: Most recent accumulation time slot. */
|
|
32617
|
-
lastAccumulation,
|
|
32618
|
-
/** `a_p`: Parent service ID. */
|
|
32619
|
-
parentService) {
|
|
32620
|
-
super();
|
|
32621
|
-
this.codeHash = codeHash;
|
|
32622
|
-
this.balance = balance;
|
|
32623
|
-
this.accumulateMinGas = accumulateMinGas;
|
|
32624
|
-
this.onTransferMinGas = onTransferMinGas;
|
|
32625
|
-
this.storageUtilisationBytes = storageUtilisationBytes;
|
|
32626
|
-
this.gratisStorage = gratisStorage;
|
|
32627
|
-
this.storageUtilisationCount = storageUtilisationCount;
|
|
32628
|
-
this.created = created;
|
|
32629
|
-
this.lastAccumulation = lastAccumulation;
|
|
32630
|
-
this.parentService = parentService;
|
|
32631
|
-
}
|
|
32632
|
-
}
|
|
32633
|
-
class PreimageItem extends WithDebug {
|
|
32634
|
-
hash;
|
|
32635
|
-
blob;
|
|
32636
|
-
static Codec = descriptors_codec.Class(PreimageItem, {
|
|
32637
|
-
hash: descriptors_codec.bytes(hash_HASH_SIZE).asOpaque(),
|
|
32638
|
-
blob: descriptors_codec.blob,
|
|
32639
|
-
});
|
|
32640
|
-
static create({ hash, blob }) {
|
|
32641
|
-
return new PreimageItem(hash, blob);
|
|
32642
|
-
}
|
|
32643
|
-
constructor(hash, blob) {
|
|
32644
|
-
super();
|
|
32645
|
-
this.hash = hash;
|
|
32646
|
-
this.blob = blob;
|
|
32647
|
-
}
|
|
32648
|
-
}
|
|
32649
|
-
class StorageItem extends WithDebug {
|
|
32650
|
-
key;
|
|
32651
|
-
value;
|
|
32652
|
-
static Codec = descriptors_codec.Class(StorageItem, {
|
|
32653
|
-
key: descriptors_codec.blob.convert((i) => i, (o) => opaque_asOpaqueType(o)),
|
|
32654
|
-
value: descriptors_codec.blob,
|
|
32655
|
-
});
|
|
32656
|
-
static create({ key, value }) {
|
|
32657
|
-
return new StorageItem(key, value);
|
|
32658
|
-
}
|
|
32659
|
-
constructor(key, value) {
|
|
32660
|
-
super();
|
|
32661
|
-
this.key = key;
|
|
32662
|
-
this.value = value;
|
|
32663
|
-
}
|
|
32664
|
-
}
|
|
32665
|
-
const MAX_LOOKUP_HISTORY_SLOTS = 3;
|
|
32666
|
-
function tryAsLookupHistorySlots(items) {
|
|
32667
|
-
const knownSize = sized_array_asKnownSize(items);
|
|
32668
|
-
if (knownSize.length > MAX_LOOKUP_HISTORY_SLOTS) {
|
|
32669
|
-
throw new Error(`Lookup history items must contain 0-${MAX_LOOKUP_HISTORY_SLOTS} timeslots.`);
|
|
32670
|
-
}
|
|
32671
|
-
return knownSize;
|
|
32672
|
-
}
|
|
32673
|
-
/** https://graypaper.fluffylabs.dev/#/5f542d7/115400115800 */
|
|
32674
|
-
class LookupHistoryItem {
|
|
32675
|
-
hash;
|
|
32676
|
-
length;
|
|
32677
|
-
slots;
|
|
32678
|
-
constructor(hash, length,
|
|
32679
|
-
/**
|
|
32680
|
-
* Preimage availability history as a sequence of time slots.
|
|
32681
|
-
* See PreimageStatus and the following GP fragment for more details.
|
|
32682
|
-
* https://graypaper.fluffylabs.dev/#/5f542d7/11780011a500 */
|
|
32683
|
-
slots) {
|
|
32684
|
-
this.hash = hash;
|
|
32685
|
-
this.length = length;
|
|
32686
|
-
this.slots = slots;
|
|
32687
|
-
}
|
|
32688
|
-
static isRequested(item) {
|
|
32689
|
-
if ("slots" in item) {
|
|
32690
|
-
return item.slots.length === 0;
|
|
32691
|
-
}
|
|
32692
|
-
return item.length === 0;
|
|
32693
|
-
}
|
|
32694
|
-
}
|
|
32695
|
-
|
|
32696
32727
|
;// CONCATENATED MODULE: ./packages/jam/state/state.ts
|
|
32697
32728
|
/**
|
|
32698
32729
|
* In addition to the entropy accumulator η_0, we retain
|
|
@@ -33129,6 +33160,7 @@ class StatisticsData {
|
|
|
33129
33160
|
|
|
33130
33161
|
|
|
33131
33162
|
|
|
33163
|
+
|
|
33132
33164
|
|
|
33133
33165
|
|
|
33134
33166
|
var in_memory_state_UpdateError;
|
|
@@ -33532,8 +33564,9 @@ class InMemoryState extends WithDebug {
|
|
|
33532
33564
|
epochRoot: bytes_Bytes.zero(BANDERSNATCH_RING_ROOT_BYTES).asOpaque(),
|
|
33533
33565
|
privilegedServices: PrivilegedServices.create({
|
|
33534
33566
|
manager: tryAsServiceId(0),
|
|
33535
|
-
|
|
33536
|
-
|
|
33567
|
+
assigners: tryAsPerCore(new Array(spec.coresCount).fill(tryAsServiceId(0)), spec),
|
|
33568
|
+
delegator: tryAsServiceId(0),
|
|
33569
|
+
registrar: tryAsServiceId(MAX_VALUE),
|
|
33537
33570
|
autoAccumulateServices: [],
|
|
33538
33571
|
}),
|
|
33539
33572
|
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
|
|
@@ -33769,7 +33802,7 @@ var serialize;
|
|
|
33769
33802
|
* determine the boundary of the bytes, so it can only be used
|
|
33770
33803
|
* as the last element of the codec and can't be used in sequences!
|
|
33771
33804
|
*/
|
|
33772
|
-
const dumpCodec =
|
|
33805
|
+
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()));
|
|
33773
33806
|
|
|
33774
33807
|
;// CONCATENATED MODULE: ./packages/jam/state-merkleization/serialized-state.ts
|
|
33775
33808
|
|
|
@@ -35080,7 +35113,7 @@ const codecMap = (value, extractKey, { typicalLength = TYPICAL_DICTIONARY_LENGTH
|
|
|
35080
35113
|
}
|
|
35081
35114
|
return Ordering.Equal;
|
|
35082
35115
|
}, } = {}) => {
|
|
35083
|
-
return
|
|
35116
|
+
return Descriptor.new(`Map<${value.name}>[?]`, {
|
|
35084
35117
|
bytes: typicalLength * value.sizeHint.bytes,
|
|
35085
35118
|
isExact: false,
|
|
35086
35119
|
}, (e, v) => {
|
|
@@ -35510,6 +35543,65 @@ function blockAsView(block, spec) {
|
|
|
35510
35543
|
return decoder_Decoder.decodeObject(Block.Codec.View, encoder_Encoder.encodeObject(Block.Codec, block, spec), spec);
|
|
35511
35544
|
}
|
|
35512
35545
|
|
|
35546
|
+
;// CONCATENATED MODULE: external "node:path"
|
|
35547
|
+
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
|
|
35548
|
+
var external_node_path_default = /*#__PURE__*/__nccwpck_require__.n(external_node_path_namespaceObject);
|
|
35549
|
+
;// CONCATENATED MODULE: ./packages/jam/node/export.ts
|
|
35550
|
+
|
|
35551
|
+
|
|
35552
|
+
|
|
35553
|
+
|
|
35554
|
+
|
|
35555
|
+
|
|
35556
|
+
|
|
35557
|
+
|
|
35558
|
+
|
|
35559
|
+
async function exportBlocks(jamNodeConfig, outputDir, withRelPath) {
|
|
35560
|
+
const logger = Logger.new(import.meta.filename, "export");
|
|
35561
|
+
logger.info `📤 Exporting blocks to ${outputDir}`;
|
|
35562
|
+
if (!external_node_fs_default().existsSync(outputDir)) {
|
|
35563
|
+
external_node_fs_default().mkdirSync(outputDir, { recursive: true });
|
|
35564
|
+
}
|
|
35565
|
+
const blake2b = await blake2b_Blake2b.createHasher();
|
|
35566
|
+
const chainSpec = getChainSpec(jamNodeConfig.node.flavor);
|
|
35567
|
+
const { rootDb } = openDatabase(blake2b, jamNodeConfig.nodeName, jamNodeConfig.node.chainSpec.genesisHeader, withRelPath(jamNodeConfig.node.databaseBasePath), { readOnly: true });
|
|
35568
|
+
const blocks = new LmdbBlocks(chainSpec, rootDb);
|
|
35569
|
+
logger.info `📖 Gathering blocks...`;
|
|
35570
|
+
const hashes = [];
|
|
35571
|
+
let currentHash = blocks.getBestHeaderHash();
|
|
35572
|
+
while (currentHash.isEqualTo(bytes_Bytes.zero(hash_HASH_SIZE)) !== true) {
|
|
35573
|
+
const header = blocks.getHeader(currentHash);
|
|
35574
|
+
if (header !== null) {
|
|
35575
|
+
hashes.push(currentHash);
|
|
35576
|
+
currentHash = header.parentHeaderHash.materialize();
|
|
35577
|
+
}
|
|
35578
|
+
else {
|
|
35579
|
+
break;
|
|
35580
|
+
}
|
|
35581
|
+
}
|
|
35582
|
+
// reverse to export in chronological order
|
|
35583
|
+
hashes.reverse();
|
|
35584
|
+
logger.info `📕 ${hashes.length} blocks gathered.`;
|
|
35585
|
+
for (let i = 0; i < hashes.length; i++) {
|
|
35586
|
+
const header = blocks.getHeader(hashes[i]);
|
|
35587
|
+
const extrinsic = blocks.getExtrinsic(hashes[i]);
|
|
35588
|
+
if (header === null || extrinsic === null) {
|
|
35589
|
+
throw new Error(`❌ Block ${currentHash} could not be read from the database.`);
|
|
35590
|
+
}
|
|
35591
|
+
const filename = `${header.timeSlotIndex.materialize().toString().padStart(8, "0")}.bin`;
|
|
35592
|
+
const filepath = external_node_path_default().join(outputDir, filename);
|
|
35593
|
+
const block = Block.create({
|
|
35594
|
+
header: header.materialize(),
|
|
35595
|
+
extrinsic: extrinsic.materialize(),
|
|
35596
|
+
});
|
|
35597
|
+
const encodedBlock = encoder_Encoder.encodeObject(Block.Codec, block, chainSpec);
|
|
35598
|
+
external_node_fs_default().writeFileSync(filepath, encodedBlock.raw);
|
|
35599
|
+
logger.log `✅ Exported block ${i + 1}/${hashes.length}: ${filename}`;
|
|
35600
|
+
}
|
|
35601
|
+
await rootDb.close();
|
|
35602
|
+
logger.info `🫡 Export completed successfully: ${hashes.length} blocks exported to ${outputDir}`;
|
|
35603
|
+
}
|
|
35604
|
+
|
|
35513
35605
|
;// CONCATENATED MODULE: ./packages/jam/node/jam-config.ts
|
|
35514
35606
|
|
|
35515
35607
|
const DEFAULT_DEV_CONFIG = {
|
|
@@ -39178,8 +39270,9 @@ class ce_129_state_request_Handler {
|
|
|
39178
39270
|
onStreamMessage(sender, message) {
|
|
39179
39271
|
if (this.isServer) {
|
|
39180
39272
|
ce_129_state_request_logger.info `[${sender.streamId}][server]: Received request.`;
|
|
39181
|
-
if (this.getBoundaryNodes === undefined || this.getKeyValuePairs === undefined)
|
|
39273
|
+
if (this.getBoundaryNodes === undefined || this.getKeyValuePairs === undefined) {
|
|
39182
39274
|
return;
|
|
39275
|
+
}
|
|
39183
39276
|
const request = decoder_Decoder.decodeObject(StateRequest.Codec, message);
|
|
39184
39277
|
const boundaryNodes = this.getBoundaryNodes(request.headerHash, request.startKey, request.endKey);
|
|
39185
39278
|
const keyValuePairs = this.getKeyValuePairs(request.headerHash, request.startKey, request.endKey);
|
|
@@ -40040,8 +40133,6 @@ function setupPeerListeners(syncTask, network, streamManager) {
|
|
|
40040
40133
|
|
|
40041
40134
|
;// CONCATENATED MODULE: external "node:net"
|
|
40042
40135
|
const external_node_net_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:net");
|
|
40043
|
-
;// CONCATENATED MODULE: external "node:path"
|
|
40044
|
-
const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path");
|
|
40045
40136
|
;// CONCATENATED MODULE: ./packages/extensions/ipc/server.ts
|
|
40046
40137
|
|
|
40047
40138
|
|
|
@@ -41904,11 +41995,17 @@ class AccumulationStateUpdate {
|
|
|
41904
41995
|
if (from.privilegedServices !== null) {
|
|
41905
41996
|
update.privilegedServices = PrivilegedServices.create({
|
|
41906
41997
|
...from.privilegedServices,
|
|
41907
|
-
|
|
41998
|
+
assigners: sized_array_asKnownSize([...from.privilegedServices.assigners]),
|
|
41908
41999
|
});
|
|
41909
42000
|
}
|
|
41910
42001
|
return update;
|
|
41911
42002
|
}
|
|
42003
|
+
/** Retrieve and clear pending transfers. */
|
|
42004
|
+
takeTransfers() {
|
|
42005
|
+
const transfers = this.transfers;
|
|
42006
|
+
this.transfers = [];
|
|
42007
|
+
return transfers;
|
|
42008
|
+
}
|
|
41912
42009
|
}
|
|
41913
42010
|
class PartiallyUpdatedState {
|
|
41914
42011
|
state;
|
|
@@ -44043,13 +44140,6 @@ class BitOps {
|
|
|
44043
44140
|
}
|
|
44044
44141
|
}
|
|
44045
44142
|
|
|
44046
|
-
;// CONCATENATED MODULE: ./packages/core/pvm-interpreter/ops/math-consts.ts
|
|
44047
|
-
const MAX_VALUE = 4294967295;
|
|
44048
|
-
const math_consts_MAX_VALUE_U64 = (/* unused pure expression or super */ null && (2n ** 63n));
|
|
44049
|
-
const MIN_VALUE = -(2 ** 31);
|
|
44050
|
-
const MAX_SHIFT_U32 = 32;
|
|
44051
|
-
const MAX_SHIFT_U64 = 64n;
|
|
44052
|
-
|
|
44053
44143
|
;// CONCATENATED MODULE: ./packages/core/pvm-interpreter/ops/math-utils.ts
|
|
44054
44144
|
|
|
44055
44145
|
|
|
@@ -46079,6 +46169,8 @@ var NewServiceError;
|
|
|
46079
46169
|
NewServiceError[NewServiceError["InsufficientFunds"] = 0] = "InsufficientFunds";
|
|
46080
46170
|
/** Service is not privileged to set gratis storage. */
|
|
46081
46171
|
NewServiceError[NewServiceError["UnprivilegedService"] = 1] = "UnprivilegedService";
|
|
46172
|
+
/** Registrar attempting to create a service with already existing id. */
|
|
46173
|
+
NewServiceError[NewServiceError["RegistrarServiceIdAlreadyTaken"] = 2] = "RegistrarServiceIdAlreadyTaken";
|
|
46082
46174
|
})(NewServiceError || (NewServiceError = {}));
|
|
46083
46175
|
var UpdatePrivilegesError;
|
|
46084
46176
|
(function (UpdatePrivilegesError) {
|
|
@@ -46215,7 +46307,7 @@ const HostCallResult = {
|
|
|
46215
46307
|
OOB: numbers_tryAsU64(0xfffffffffffffffdn), // 2**64 - 3
|
|
46216
46308
|
/** Index unknown. */
|
|
46217
46309
|
WHO: numbers_tryAsU64(0xfffffffffffffffcn), // 2**64 - 4
|
|
46218
|
-
/** Storage full. */
|
|
46310
|
+
/** Storage full or resource already allocated. */
|
|
46219
46311
|
FULL: numbers_tryAsU64(0xfffffffffffffffbn), // 2**64 - 5
|
|
46220
46312
|
/** Core index unknown. */
|
|
46221
46313
|
CORE: numbers_tryAsU64(0xfffffffffffffffan), // 2**64 - 6
|
|
@@ -46223,7 +46315,7 @@ const HostCallResult = {
|
|
|
46223
46315
|
CASH: numbers_tryAsU64(0xfffffffffffffff9n), // 2**64 - 7
|
|
46224
46316
|
/** Gas limit too low. */
|
|
46225
46317
|
LOW: numbers_tryAsU64(0xfffffffffffffff8n), // 2**64 - 8
|
|
46226
|
-
/** The item is already solicited
|
|
46318
|
+
/** The item is already solicited, cannot be forgotten or the operation is invalid due to privilege level. */
|
|
46227
46319
|
HUH: numbers_tryAsU64(0xfffffffffffffff7n), // 2**64 - 9
|
|
46228
46320
|
/** The return value indicating general success. */
|
|
46229
46321
|
OK: numbers_tryAsU64(0n),
|
|
@@ -46277,6 +46369,7 @@ function clampU64ToU32(value) {
|
|
|
46277
46369
|
|
|
46278
46370
|
|
|
46279
46371
|
|
|
46372
|
+
|
|
46280
46373
|
/**
|
|
46281
46374
|
* Number of storage items required for ejection of the service.
|
|
46282
46375
|
*
|
|
@@ -46368,10 +46461,13 @@ class AccumulateExternalities {
|
|
|
46368
46461
|
const isExpired = status.data[1] < t - this.chainSpec.preimageExpungePeriod;
|
|
46369
46462
|
return [isExpired, isExpired ? "" : "not expired"];
|
|
46370
46463
|
}
|
|
46371
|
-
/** `check`: https://graypaper.fluffylabs.dev/#/
|
|
46464
|
+
/** `check`: https://graypaper.fluffylabs.dev/#/ab2cdbd/30c60330c603?v=0.7.2 */
|
|
46372
46465
|
getNextAvailableServiceId(serviceId) {
|
|
46373
46466
|
let currentServiceId = serviceId;
|
|
46374
|
-
const mod =
|
|
46467
|
+
const mod = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
46468
|
+
? 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8
|
|
46469
|
+
: 2 ** 32 - 2 ** 9;
|
|
46470
|
+
const offset = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? MIN_PUBLIC_SERVICE_INDEX : 2 ** 8;
|
|
46375
46471
|
for (;;) {
|
|
46376
46472
|
const service = this.getServiceInfo(currentServiceId);
|
|
46377
46473
|
// we found an empty id
|
|
@@ -46379,7 +46475,7 @@ class AccumulateExternalities {
|
|
|
46379
46475
|
return currentServiceId;
|
|
46380
46476
|
}
|
|
46381
46477
|
// keep trying
|
|
46382
|
-
currentServiceId = tryAsServiceId(((currentServiceId -
|
|
46478
|
+
currentServiceId = tryAsServiceId(((currentServiceId - offset + 1 + mod) % mod) + offset);
|
|
46383
46479
|
}
|
|
46384
46480
|
}
|
|
46385
46481
|
checkPreimageStatus(hash, length) {
|
|
@@ -46536,8 +46632,7 @@ class AccumulateExternalities {
|
|
|
46536
46632
|
}));
|
|
46537
46633
|
return result_Result.ok(result_OK);
|
|
46538
46634
|
}
|
|
46539
|
-
newService(codeHash, codeLength, accumulateMinGas, onTransferMinGas, gratisStorage) {
|
|
46540
|
-
const newServiceId = this.nextNewServiceId;
|
|
46635
|
+
newService(codeHash, codeLength, accumulateMinGas, onTransferMinGas, gratisStorage, wantedServiceId) {
|
|
46541
46636
|
// calculate the threshold. Storage is empty, one preimage requested.
|
|
46542
46637
|
// https://graypaper.fluffylabs.dev/#/7e6ff6a/115901115901?v=0.6.7
|
|
46543
46638
|
const items = numbers_tryAsU32(2 * 1 + 0);
|
|
@@ -46558,30 +46653,59 @@ class AccumulateExternalities {
|
|
|
46558
46653
|
if (balanceLeftForCurrent < thresholdForCurrent || bytes.overflow) {
|
|
46559
46654
|
return result_Result.error(NewServiceError.InsufficientFunds);
|
|
46560
46655
|
}
|
|
46656
|
+
// `a`: https://graypaper.fluffylabs.dev/#/ab2cdbd/366b02366d02?v=0.7.2
|
|
46657
|
+
const newAccount = ServiceAccountInfo.create({
|
|
46658
|
+
codeHash,
|
|
46659
|
+
balance: thresholdForNew,
|
|
46660
|
+
accumulateMinGas,
|
|
46661
|
+
onTransferMinGas,
|
|
46662
|
+
storageUtilisationBytes: bytes.value,
|
|
46663
|
+
storageUtilisationCount: items,
|
|
46664
|
+
gratisStorage,
|
|
46665
|
+
created: this.currentTimeslot,
|
|
46666
|
+
lastAccumulation: tryAsTimeSlot(0),
|
|
46667
|
+
parentService: this.currentServiceId,
|
|
46668
|
+
});
|
|
46669
|
+
const newLookupItem = new LookupHistoryItem(codeHash.asOpaque(), clampedLength, tryAsLookupHistorySlots([]));
|
|
46670
|
+
// `s`: https://graypaper.fluffylabs.dev/#/ab2cdbd/361003361003?v=0.7.2
|
|
46671
|
+
const updatedCurrentAccount = ServiceAccountInfo.create({
|
|
46672
|
+
...currentService,
|
|
46673
|
+
balance: numbers_tryAsU64(balanceLeftForCurrent),
|
|
46674
|
+
});
|
|
46675
|
+
if (Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)) {
|
|
46676
|
+
if (wantedServiceId < MIN_PUBLIC_SERVICE_INDEX &&
|
|
46677
|
+
this.currentServiceId === this.updatedState.getPrivilegedServices().registrar) {
|
|
46678
|
+
// NOTE: It's safe to cast to `Number` here, bcs here service ID cannot be bigger than 2**16
|
|
46679
|
+
const newServiceId = tryAsServiceId(Number(wantedServiceId));
|
|
46680
|
+
if (this.getServiceInfo(newServiceId) !== null) {
|
|
46681
|
+
return result_Result.error(NewServiceError.RegistrarServiceIdAlreadyTaken);
|
|
46682
|
+
}
|
|
46683
|
+
// add the new service with selected ID
|
|
46684
|
+
// https://graypaper.fluffylabs.dev/#/ab2cdbd/36be0336c003?v=0.7.2
|
|
46685
|
+
this.updatedState.stateUpdate.services.servicesUpdates.push(UpdateService.create({
|
|
46686
|
+
serviceId: newServiceId,
|
|
46687
|
+
serviceInfo: newAccount,
|
|
46688
|
+
lookupHistory: newLookupItem,
|
|
46689
|
+
}));
|
|
46690
|
+
// update the balance of current service
|
|
46691
|
+
// https://graypaper.fluffylabs.dev/#/ab2cdbd/36c20336c403?v=0.7.2
|
|
46692
|
+
this.updatedState.updateServiceInfo(this.currentServiceId, updatedCurrentAccount);
|
|
46693
|
+
return result_Result.ok(newServiceId);
|
|
46694
|
+
}
|
|
46695
|
+
// NOTE: in case the service is not a registrar or the requested serviceId is out of range,
|
|
46696
|
+
// we completely ignore the `wantedServiceId` and assign a random one
|
|
46697
|
+
}
|
|
46698
|
+
const newServiceId = this.nextNewServiceId;
|
|
46561
46699
|
// add the new service
|
|
46562
|
-
// https://graypaper.fluffylabs.dev/#/
|
|
46700
|
+
// https://graypaper.fluffylabs.dev/#/ab2cdbd/36e70336e903?v=0.7.2
|
|
46563
46701
|
this.updatedState.stateUpdate.services.servicesUpdates.push(UpdateService.create({
|
|
46564
46702
|
serviceId: newServiceId,
|
|
46565
|
-
serviceInfo:
|
|
46566
|
-
|
|
46567
|
-
balance: thresholdForNew,
|
|
46568
|
-
accumulateMinGas,
|
|
46569
|
-
onTransferMinGas,
|
|
46570
|
-
storageUtilisationBytes: bytes.value,
|
|
46571
|
-
storageUtilisationCount: items,
|
|
46572
|
-
gratisStorage,
|
|
46573
|
-
created: this.currentTimeslot,
|
|
46574
|
-
lastAccumulation: tryAsTimeSlot(0),
|
|
46575
|
-
parentService: this.currentServiceId,
|
|
46576
|
-
}),
|
|
46577
|
-
lookupHistory: new LookupHistoryItem(codeHash.asOpaque(), clampedLength, tryAsLookupHistorySlots([])),
|
|
46703
|
+
serviceInfo: newAccount,
|
|
46704
|
+
lookupHistory: newLookupItem,
|
|
46578
46705
|
}));
|
|
46579
46706
|
// update the balance of current service
|
|
46580
|
-
// https://graypaper.fluffylabs.dev/#/
|
|
46581
|
-
this.updatedState.updateServiceInfo(this.currentServiceId,
|
|
46582
|
-
...currentService,
|
|
46583
|
-
balance: numbers_tryAsU64(balanceLeftForCurrent),
|
|
46584
|
-
}));
|
|
46707
|
+
// https://graypaper.fluffylabs.dev/#/ab2cdbd/36ec0336ee03?v=0.7.2
|
|
46708
|
+
this.updatedState.updateServiceInfo(this.currentServiceId, updatedCurrentAccount);
|
|
46585
46709
|
// update the next service id we are going to create next
|
|
46586
46710
|
// https://graypaper.fluffylabs.dev/#/7e6ff6a/36a70336a703?v=0.6.7
|
|
46587
46711
|
this.nextNewServiceId = this.getNextAvailableServiceId(bumpServiceId(newServiceId));
|
|
@@ -46599,9 +46723,9 @@ class AccumulateExternalities {
|
|
|
46599
46723
|
}
|
|
46600
46724
|
updateValidatorsData(validatorsData) {
|
|
46601
46725
|
/** https://graypaper.fluffylabs.dev/#/7e6ff6a/362802362d02?v=0.6.7 */
|
|
46602
|
-
const
|
|
46603
|
-
if (
|
|
46604
|
-
accumulate_externalities_logger.trace `Current service id (${this.currentServiceId}) is not a validators manager. (expected: ${
|
|
46726
|
+
const currentDelegator = this.updatedState.getPrivilegedServices().delegator;
|
|
46727
|
+
if (currentDelegator !== this.currentServiceId) {
|
|
46728
|
+
accumulate_externalities_logger.trace `Current service id (${this.currentServiceId}) is not a validators manager. (expected: ${currentDelegator}) and cannot update validators data. Ignoring`;
|
|
46605
46729
|
return result_Result.error(UnprivilegedError);
|
|
46606
46730
|
}
|
|
46607
46731
|
this.updatedState.stateUpdate.validatorsData = validatorsData;
|
|
@@ -46611,34 +46735,38 @@ class AccumulateExternalities {
|
|
|
46611
46735
|
/** https://graypaper.fluffylabs.dev/#/9a08063/362202362202?v=0.6.6 */
|
|
46612
46736
|
this.checkpointedState = AccumulationStateUpdate.copyFrom(this.updatedState.stateUpdate);
|
|
46613
46737
|
}
|
|
46614
|
-
updateAuthorizationQueue(coreIndex, authQueue,
|
|
46738
|
+
updateAuthorizationQueue(coreIndex, authQueue, assigners) {
|
|
46615
46739
|
/** https://graypaper.fluffylabs.dev/#/7e6ff6a/36a40136a401?v=0.6.7 */
|
|
46616
46740
|
// NOTE `coreIndex` is already verified in the HC, so this is infallible.
|
|
46617
|
-
const
|
|
46618
|
-
if (
|
|
46619
|
-
accumulate_externalities_logger.trace `Current service id (${this.currentServiceId}) is not an auth manager of core ${coreIndex} (expected: ${
|
|
46741
|
+
const currentAssigners = this.updatedState.getPrivilegedServices().assigners[coreIndex];
|
|
46742
|
+
if (currentAssigners !== this.currentServiceId) {
|
|
46743
|
+
accumulate_externalities_logger.trace `Current service id (${this.currentServiceId}) is not an auth manager of core ${coreIndex} (expected: ${currentAssigners}) and cannot update authorization queue.`;
|
|
46620
46744
|
return result_Result.error(UpdatePrivilegesError.UnprivilegedService);
|
|
46621
46745
|
}
|
|
46622
|
-
if (
|
|
46623
|
-
accumulate_externalities_logger.trace `The new auth manager is not a valid service id
|
|
46746
|
+
if (assigners === null && Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)) {
|
|
46747
|
+
accumulate_externalities_logger.trace `The new auth manager is not a valid service id.`;
|
|
46624
46748
|
return result_Result.error(UpdatePrivilegesError.InvalidServiceId);
|
|
46625
46749
|
}
|
|
46626
46750
|
this.updatedState.stateUpdate.authorizationQueues.set(coreIndex, authQueue);
|
|
46627
46751
|
return result_Result.ok(result_OK);
|
|
46628
46752
|
}
|
|
46629
|
-
updatePrivilegedServices(manager, authorizers,
|
|
46753
|
+
updatePrivilegedServices(manager, authorizers, delegator, registrar, autoAccumulate) {
|
|
46630
46754
|
/** https://graypaper.fluffylabs.dev/#/7e6ff6a/36d90036de00?v=0.6.7 */
|
|
46631
46755
|
const currentManager = this.updatedState.getPrivilegedServices().manager;
|
|
46632
46756
|
if (currentManager !== this.currentServiceId) {
|
|
46633
46757
|
return result_Result.error(UpdatePrivilegesError.UnprivilegedService);
|
|
46634
46758
|
}
|
|
46635
|
-
if (manager === null ||
|
|
46636
|
-
return result_Result.error(UpdatePrivilegesError.InvalidServiceId);
|
|
46759
|
+
if (manager === null || delegator === null) {
|
|
46760
|
+
return result_Result.error(UpdatePrivilegesError.InvalidServiceId, "Either manager or delegator is not valid service id.");
|
|
46761
|
+
}
|
|
46762
|
+
if (Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) && registrar === null) {
|
|
46763
|
+
return result_Result.error(UpdatePrivilegesError.InvalidServiceId, "Register manager is not valid service id.");
|
|
46637
46764
|
}
|
|
46638
46765
|
this.updatedState.stateUpdate.privilegedServices = PrivilegedServices.create({
|
|
46639
46766
|
manager,
|
|
46640
|
-
|
|
46641
|
-
|
|
46767
|
+
assigners: authorizers,
|
|
46768
|
+
delegator,
|
|
46769
|
+
registrar: registrar ?? tryAsServiceId(0), // introduced in 0.7.1
|
|
46642
46770
|
autoAccumulateServices: autoAccumulate.map(([service, gasLimit]) => AutoAccumulate.create({ service, gasLimit })),
|
|
46643
46771
|
});
|
|
46644
46772
|
return result_Result.ok(result_OK);
|
|
@@ -46754,8 +46882,11 @@ class AccumulateExternalities {
|
|
|
46754
46882
|
}
|
|
46755
46883
|
}
|
|
46756
46884
|
function bumpServiceId(serviceId) {
|
|
46757
|
-
const mod =
|
|
46758
|
-
|
|
46885
|
+
const mod = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
46886
|
+
? 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8
|
|
46887
|
+
: 2 ** 32 - 2 ** 9;
|
|
46888
|
+
const offset = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? MIN_PUBLIC_SERVICE_INDEX : 2 ** 8;
|
|
46889
|
+
return tryAsServiceId(offset + ((serviceId - offset + 42 + mod) % mod));
|
|
46759
46890
|
}
|
|
46760
46891
|
|
|
46761
46892
|
;// CONCATENATED MODULE: ./packages/jam/transition/accumulate/accumulate-state.ts
|
|
@@ -47411,6 +47542,8 @@ class AccumulateData {
|
|
|
47411
47542
|
|
|
47412
47543
|
|
|
47413
47544
|
|
|
47545
|
+
|
|
47546
|
+
|
|
47414
47547
|
/**
|
|
47415
47548
|
* A function that removes duplicates but does not change order - it keeps the first occurence.
|
|
47416
47549
|
*/
|
|
@@ -47440,7 +47573,7 @@ const NEXT_ID_CODEC = descriptors_codec.object({
|
|
|
47440
47573
|
*
|
|
47441
47574
|
* Please not that it does not call `check` function!
|
|
47442
47575
|
*
|
|
47443
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
47576
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/2fa9042fc304?v=0.7.2
|
|
47444
47577
|
*/
|
|
47445
47578
|
function generateNextServiceId({ serviceId, entropy, timeslot }, chainSpec, blake2b) {
|
|
47446
47579
|
const encoded = encoder_Encoder.encodeObject(NEXT_ID_CODEC, {
|
|
@@ -47450,7 +47583,11 @@ function generateNextServiceId({ serviceId, entropy, timeslot }, chainSpec, blak
|
|
|
47450
47583
|
}, chainSpec);
|
|
47451
47584
|
const result = blake2b.hashBytes(encoded).raw.subarray(0, 4);
|
|
47452
47585
|
const number = leBytesAsU32(result) >>> 0;
|
|
47453
|
-
|
|
47586
|
+
const mod = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
47587
|
+
? 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8
|
|
47588
|
+
: 2 ** 32 - 2 ** 9;
|
|
47589
|
+
const offset = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? MIN_PUBLIC_SERVICE_INDEX : 2 ** 8;
|
|
47590
|
+
return tryAsServiceId((number % mod) + offset);
|
|
47454
47591
|
}
|
|
47455
47592
|
|
|
47456
47593
|
;// CONCATENATED MODULE: ./packages/jam/transition/accumulate/accumulate-queue.ts
|
|
@@ -47862,7 +47999,7 @@ class Assign {
|
|
|
47862
47999
|
// o
|
|
47863
48000
|
const authorizationQueueStart = regs.get(8);
|
|
47864
48001
|
// a
|
|
47865
|
-
const
|
|
48002
|
+
const assigners = getServiceId(regs.get(9));
|
|
47866
48003
|
const res = safeAllocUint8Array(hash_HASH_SIZE * AUTHORIZATION_QUEUE_SIZE);
|
|
47867
48004
|
const memoryReadResult = memory.loadInto(res, authorizationQueueStart);
|
|
47868
48005
|
// error while reading the memory.
|
|
@@ -47879,7 +48016,7 @@ class Assign {
|
|
|
47879
48016
|
const decoder = decoder_Decoder.fromBlob(res);
|
|
47880
48017
|
const authQueue = decoder.sequenceFixLen(descriptors_codec.bytes(hash_HASH_SIZE), AUTHORIZATION_QUEUE_SIZE);
|
|
47881
48018
|
const fixedSizeAuthQueue = FixedSizeArray.new(authQueue, AUTHORIZATION_QUEUE_SIZE);
|
|
47882
|
-
const result = this.partialState.updateAuthorizationQueue(coreIndex, fixedSizeAuthQueue,
|
|
48019
|
+
const result = this.partialState.updateAuthorizationQueue(coreIndex, fixedSizeAuthQueue, assigners);
|
|
47883
48020
|
if (result.isOk) {
|
|
47884
48021
|
regs.set(IN_OUT_REG, HostCallResult.OK);
|
|
47885
48022
|
logger_logger.trace `ASSIGN(${coreIndex}, ${fixedSizeAuthQueue}) <- OK`;
|
|
@@ -47928,7 +48065,9 @@ class Bless {
|
|
|
47928
48065
|
chainSpec;
|
|
47929
48066
|
index = host_call_handler_tryAsHostCallIndex(14);
|
|
47930
48067
|
basicGasCost = gas_tryAsSmallGas(10);
|
|
47931
|
-
tracedRegisters =
|
|
48068
|
+
tracedRegisters = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
48069
|
+
? traceRegisters(bless_IN_OUT_REG, 8, 9, 10, 11, 12)
|
|
48070
|
+
: traceRegisters(bless_IN_OUT_REG, 8, 9, 10, 11);
|
|
47932
48071
|
constructor(currentServiceId, partialState, chainSpec) {
|
|
47933
48072
|
this.currentServiceId = currentServiceId;
|
|
47934
48073
|
this.partialState = partialState;
|
|
@@ -47938,14 +48077,17 @@ class Bless {
|
|
|
47938
48077
|
// `m`: manager service (can change privileged services)
|
|
47939
48078
|
const manager = getServiceId(regs.get(bless_IN_OUT_REG));
|
|
47940
48079
|
// `a`: manages authorization queue
|
|
47941
|
-
// NOTE It can be either ServiceId (pre GP 067) or memory index (GP ^067)
|
|
47942
48080
|
const authorization = regs.get(8);
|
|
47943
48081
|
// `v`: manages validator keys
|
|
47944
|
-
const
|
|
48082
|
+
const delegator = getServiceId(regs.get(9));
|
|
48083
|
+
// `r`: manages creation of new services with id within protected range
|
|
48084
|
+
const registrar = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
48085
|
+
? getServiceId(regs.get(10))
|
|
48086
|
+
: tryAsServiceId(2 ** 32 - 1);
|
|
47945
48087
|
// `o`: memory offset
|
|
47946
|
-
const sourceStart = regs.get(10);
|
|
48088
|
+
const sourceStart = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? regs.get(11) : regs.get(10);
|
|
47947
48089
|
// `n`: number of items in the auto-accumulate dictionary
|
|
47948
|
-
const numberOfItems = regs.get(11);
|
|
48090
|
+
const numberOfItems = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? regs.get(12) : regs.get(11);
|
|
47949
48091
|
/*
|
|
47950
48092
|
* `z`: array of key-value pairs serviceId -> gas that auto-accumulate every block
|
|
47951
48093
|
* https://graypaper.fluffylabs.dev/#/7e6ff6a/368100368100?v=0.6.7
|
|
@@ -47959,7 +48101,7 @@ class Bless {
|
|
|
47959
48101
|
decoder.resetTo(0);
|
|
47960
48102
|
const memoryReadResult = memory.loadInto(result, memIndex);
|
|
47961
48103
|
if (memoryReadResult.isError) {
|
|
47962
|
-
logger_logger.trace `BLESS(${manager}, ${
|
|
48104
|
+
logger_logger.trace `BLESS(${manager}, ${delegator}, ${registrar}) <- PANIC`;
|
|
47963
48105
|
return PvmExecution.Panic;
|
|
47964
48106
|
}
|
|
47965
48107
|
const { serviceId, gas } = decoder.object(serviceIdAndGasCodec);
|
|
@@ -47972,24 +48114,25 @@ class Bless {
|
|
|
47972
48114
|
const authorizersDecoder = decoder_Decoder.fromBlob(res);
|
|
47973
48115
|
const memoryReadResult = memory.loadInto(res, authorization);
|
|
47974
48116
|
if (memoryReadResult.isError) {
|
|
47975
|
-
logger_logger.trace `BLESS(${manager}, ${
|
|
48117
|
+
logger_logger.trace `BLESS(${manager}, ${delegator}, ${registrar}, ${autoAccumulateEntries}) <- PANIC`;
|
|
47976
48118
|
return PvmExecution.Panic;
|
|
47977
48119
|
}
|
|
48120
|
+
// `a`
|
|
47978
48121
|
const authorizers = tryAsPerCore(authorizersDecoder.sequenceFixLen(descriptors_codec.u32.asOpaque(), this.chainSpec.coresCount), this.chainSpec);
|
|
47979
|
-
const updateResult = this.partialState.updatePrivilegedServices(manager, authorizers,
|
|
48122
|
+
const updateResult = this.partialState.updatePrivilegedServices(manager, authorizers, delegator, registrar, autoAccumulateEntries);
|
|
47980
48123
|
if (updateResult.isOk) {
|
|
47981
|
-
logger_logger.trace `BLESS(${manager}, ${authorizers}, ${
|
|
48124
|
+
logger_logger.trace `BLESS(${manager}, ${authorizers}, ${delegator}, ${registrar}, ${autoAccumulateEntries}) <- OK`;
|
|
47982
48125
|
regs.set(bless_IN_OUT_REG, HostCallResult.OK);
|
|
47983
48126
|
return;
|
|
47984
48127
|
}
|
|
47985
48128
|
const e = updateResult.error;
|
|
47986
48129
|
if (e === UpdatePrivilegesError.UnprivilegedService) {
|
|
47987
|
-
logger_logger.trace `BLESS(${manager}, ${authorizers}, ${
|
|
48130
|
+
logger_logger.trace `BLESS(${manager}, ${authorizers}, ${delegator}, ${registrar}, ${autoAccumulateEntries}) <- HUH`;
|
|
47988
48131
|
regs.set(bless_IN_OUT_REG, HostCallResult.HUH);
|
|
47989
48132
|
return;
|
|
47990
48133
|
}
|
|
47991
48134
|
if (e === UpdatePrivilegesError.InvalidServiceId) {
|
|
47992
|
-
logger_logger.trace `BLESS(${manager}, ${authorizers}, ${
|
|
48135
|
+
logger_logger.trace `BLESS(${manager}, ${authorizers}, ${delegator}, ${registrar}, ${autoAccumulateEntries}) <- WHO`;
|
|
47993
48136
|
regs.set(bless_IN_OUT_REG, HostCallResult.WHO);
|
|
47994
48137
|
return;
|
|
47995
48138
|
}
|
|
@@ -48241,7 +48384,9 @@ class New {
|
|
|
48241
48384
|
partialState;
|
|
48242
48385
|
index = host_call_handler_tryAsHostCallIndex(18);
|
|
48243
48386
|
basicGasCost = gas_tryAsSmallGas(10);
|
|
48244
|
-
tracedRegisters =
|
|
48387
|
+
tracedRegisters = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
48388
|
+
? traceRegisters(new_IN_OUT_REG, 8, 9, 10, 11, 12)
|
|
48389
|
+
: traceRegisters(new_IN_OUT_REG, 8, 9, 10, 11);
|
|
48245
48390
|
constructor(currentServiceId, partialState) {
|
|
48246
48391
|
this.currentServiceId = currentServiceId;
|
|
48247
48392
|
this.partialState = partialState;
|
|
@@ -48257,16 +48402,18 @@ class New {
|
|
|
48257
48402
|
const allowance = tryAsServiceGas(regs.get(10));
|
|
48258
48403
|
// `f`
|
|
48259
48404
|
const gratisStorage = regs.get(11);
|
|
48405
|
+
// `i`: requested service id. Ignored if current service is not registrar or value is bigger than `S`.
|
|
48406
|
+
const requestedServiceId = regs.get(12);
|
|
48260
48407
|
// `c`
|
|
48261
48408
|
const codeHash = bytes_Bytes.zero(hash_HASH_SIZE);
|
|
48262
48409
|
const memoryReadResult = memory.loadInto(codeHash.raw, codeHashStart);
|
|
48263
48410
|
// error while reading the memory.
|
|
48264
48411
|
if (memoryReadResult.isError) {
|
|
48265
|
-
logger_logger.trace `NEW(${codeHash}, ${codeLength}, ${gas}, ${allowance}, ${gratisStorage}) <- PANIC`;
|
|
48412
|
+
logger_logger.trace `NEW(${codeHash}, ${codeLength}, ${gas}, ${allowance}, ${gratisStorage}, ${requestedServiceId}) <- PANIC`;
|
|
48266
48413
|
return PvmExecution.Panic;
|
|
48267
48414
|
}
|
|
48268
|
-
const assignedId = this.partialState.newService(codeHash.asOpaque(), codeLength, gas, allowance, gratisStorage);
|
|
48269
|
-
logger_logger.trace `NEW(${codeHash}, ${codeLength}, ${gas}, ${allowance}, ${gratisStorage}) <- ${resultToString(assignedId)}`;
|
|
48415
|
+
const assignedId = this.partialState.newService(codeHash.asOpaque(), codeLength, gas, allowance, gratisStorage, requestedServiceId);
|
|
48416
|
+
logger_logger.trace `NEW(${codeHash}, ${codeLength}, ${gas}, ${allowance}, ${gratisStorage}, ${requestedServiceId}) <- ${resultToString(assignedId)}`;
|
|
48270
48417
|
if (assignedId.isOk) {
|
|
48271
48418
|
regs.set(new_IN_OUT_REG, numbers_tryAsU64(assignedId.ok));
|
|
48272
48419
|
return;
|
|
@@ -48280,6 +48427,11 @@ class New {
|
|
|
48280
48427
|
regs.set(new_IN_OUT_REG, HostCallResult.HUH);
|
|
48281
48428
|
return;
|
|
48282
48429
|
}
|
|
48430
|
+
// Post 0.7.1
|
|
48431
|
+
if (e === NewServiceError.RegistrarServiceIdAlreadyTaken) {
|
|
48432
|
+
regs.set(new_IN_OUT_REG, HostCallResult.FULL);
|
|
48433
|
+
return;
|
|
48434
|
+
}
|
|
48283
48435
|
debug_assertNever(e);
|
|
48284
48436
|
}
|
|
48285
48437
|
}
|
|
@@ -49537,7 +49689,7 @@ class Accumulate {
|
|
|
49537
49689
|
}
|
|
49538
49690
|
const nextServiceId = generateNextServiceId({ serviceId, entropy, timeslot: slot }, this.chainSpec, this.blake2b);
|
|
49539
49691
|
const partialState = new AccumulateExternalities(this.chainSpec, this.blake2b, new PartiallyUpdatedState(this.state, inputStateUpdate), serviceId, nextServiceId, slot);
|
|
49540
|
-
const fetchExternalities = Compatibility.isGreaterOrEqual(GpVersion.
|
|
49692
|
+
const fetchExternalities = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
49541
49693
|
? FetchExternalities.createForAccumulate({ entropy, transfers, operands }, this.chainSpec)
|
|
49542
49694
|
: FetchExternalities.createForPre071Accumulate({ entropy, operands }, this.chainSpec);
|
|
49543
49695
|
const externalities = {
|
|
@@ -49652,7 +49804,7 @@ class Accumulate {
|
|
|
49652
49804
|
const accumulateData = new AccumulateData(reportsToAccumulateInParallel, transfers, autoAccumulateServices);
|
|
49653
49805
|
const reportsToAccumulateSequentially = reports.subview(i);
|
|
49654
49806
|
const { gasCost, state: stateAfterParallelAcc, ...rest } = await this.accumulateInParallel(accumulateData, slot, entropy, statistics, stateUpdate);
|
|
49655
|
-
const newTransfers = stateAfterParallelAcc.
|
|
49807
|
+
const newTransfers = stateAfterParallelAcc.takeTransfers();
|
|
49656
49808
|
assertEmpty(rest);
|
|
49657
49809
|
// NOTE [ToDr] recursive invocation
|
|
49658
49810
|
const { accumulatedReports, gasCost: seqGasCost, state, ...seqRest } = await this.accumulateSequentially(tryAsServiceGas(gasLimit - gasCost), reportsToAccumulateSequentially, newTransfers, slot, entropy, statistics, stateAfterParallelAcc, []);
|
|
@@ -49688,17 +49840,17 @@ class Accumulate {
|
|
|
49688
49840
|
statistics.set(serviceId, serviceStatistics);
|
|
49689
49841
|
currentState = stateUpdate === null ? checkpoint : stateUpdate;
|
|
49690
49842
|
if (Compatibility.is(GpVersion.V0_7_0) && serviceId === currentManager) {
|
|
49691
|
-
const newV = currentState.privilegedServices?.
|
|
49843
|
+
const newV = currentState.privilegedServices?.delegator;
|
|
49692
49844
|
if (currentState.privilegedServices !== null && newV !== undefined && serviceIds.includes(newV)) {
|
|
49693
|
-
accumulate_logger.info `Entering completely incorrect code that probably reverts
|
|
49845
|
+
accumulate_logger.info `Entering completely incorrect code that probably reverts delegator change. This is valid in 0.7.0 only and incorrect in 0.7.1+`;
|
|
49694
49846
|
// Since serviceIds already contains newV, this service gets accumulated twice.
|
|
49695
49847
|
// To avoid double-counting, we skip stats and gas cost tracking here.
|
|
49696
|
-
// We need this accumulation to get the correct `
|
|
49848
|
+
// We need this accumulation to get the correct `delegator`
|
|
49697
49849
|
const { stateUpdate } = await this.accumulateSingleService(newV, [], accumulateData.getOperands(newV), accumulateData.getGasCost(newV), slot, entropy, checkpoint);
|
|
49698
|
-
const correctV = stateUpdate?.privilegedServices?.
|
|
49850
|
+
const correctV = stateUpdate?.privilegedServices?.delegator ?? this.state.privilegedServices.delegator;
|
|
49699
49851
|
currentState.privilegedServices = PrivilegedServices.create({
|
|
49700
49852
|
...currentState.privilegedServices,
|
|
49701
|
-
|
|
49853
|
+
delegator: correctV,
|
|
49702
49854
|
});
|
|
49703
49855
|
}
|
|
49704
49856
|
}
|
|
@@ -51937,6 +52089,7 @@ function readJsonBlock(file, chainSpec) {
|
|
|
51937
52089
|
|
|
51938
52090
|
|
|
51939
52091
|
|
|
52092
|
+
|
|
51940
52093
|
// EXTERNAL MODULE: ./node_modules/minimist/index.js
|
|
51941
52094
|
var minimist = __nccwpck_require__(8595);
|
|
51942
52095
|
var minimist_default = /*#__PURE__*/__nccwpck_require__.n(minimist);
|
|
@@ -51954,6 +52107,7 @@ Usage:
|
|
|
51954
52107
|
jam [options]
|
|
51955
52108
|
jam [options] dev <dev-validator-index>
|
|
51956
52109
|
jam [options] import <bin-or-json-blocks>
|
|
52110
|
+
jam [options] export <output-directory>
|
|
51957
52111
|
jam [options] [--version=1] fuzz-target [socket-path=/tmp/jam_target.sock]
|
|
51958
52112
|
|
|
51959
52113
|
Options:
|
|
@@ -51971,6 +52125,8 @@ var Command;
|
|
|
51971
52125
|
Command["Dev"] = "dev";
|
|
51972
52126
|
/** Import the blocks from CLI and finish. */
|
|
51973
52127
|
Command["Import"] = "import";
|
|
52128
|
+
/** Export blocks to .bin files. */
|
|
52129
|
+
Command["Export"] = "export";
|
|
51974
52130
|
/** Run as a Fuzz Target. */
|
|
51975
52131
|
Command["FuzzTarget"] = "fuzz-target";
|
|
51976
52132
|
})(Command || (Command = {}));
|
|
@@ -52035,6 +52191,21 @@ function parseArgs(input, withRelPath) {
|
|
|
52035
52191
|
},
|
|
52036
52192
|
};
|
|
52037
52193
|
}
|
|
52194
|
+
case Command.Export: {
|
|
52195
|
+
const data = parseSharedOptions(args, withRelPath);
|
|
52196
|
+
const outputDir = args._.shift();
|
|
52197
|
+
if (outputDir === undefined) {
|
|
52198
|
+
throw new Error("Missing output directory.");
|
|
52199
|
+
}
|
|
52200
|
+
assertNoMoreArgs(args);
|
|
52201
|
+
return {
|
|
52202
|
+
command: Command.Export,
|
|
52203
|
+
args: {
|
|
52204
|
+
...data,
|
|
52205
|
+
outputDir: withRelPath(outputDir),
|
|
52206
|
+
},
|
|
52207
|
+
};
|
|
52208
|
+
}
|
|
52038
52209
|
default: {
|
|
52039
52210
|
args._.unshift(command);
|
|
52040
52211
|
assertNoMoreArgs(args);
|
|
@@ -52164,6 +52335,9 @@ async function startNode(args, withRelPath) {
|
|
|
52164
52335
|
}, withRelPath);
|
|
52165
52336
|
return await importBlocks(node, args.args.files);
|
|
52166
52337
|
}
|
|
52338
|
+
if (args.command === Command.Export) {
|
|
52339
|
+
return await exportBlocks(jamNodeConfig, args.args.outputDir, withRelPath);
|
|
52340
|
+
}
|
|
52167
52341
|
// Run regular node.
|
|
52168
52342
|
return main_main(jamNodeConfig, withRelPath);
|
|
52169
52343
|
}
|