@typeberry/lib 0.5.0-2a69cc5 → 0.5.0-8992448
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 +95 -230
- package/index.d.ts +81 -89
- package/index.js +95 -230
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -9,7 +9,6 @@ const env = typeof process === "undefined" ? {} : process.env;
|
|
|
9
9
|
|
|
10
10
|
var GpVersion;
|
|
11
11
|
(function (GpVersion) {
|
|
12
|
-
GpVersion["V0_6_7"] = "0.6.7";
|
|
13
12
|
GpVersion["V0_7_0"] = "0.7.0";
|
|
14
13
|
GpVersion["V0_7_1"] = "0.7.1";
|
|
15
14
|
GpVersion["V0_7_2"] = "0.7.2";
|
|
@@ -17,9 +16,9 @@ var GpVersion;
|
|
|
17
16
|
var TestSuite;
|
|
18
17
|
(function (TestSuite) {
|
|
19
18
|
TestSuite["W3F_DAVXY"] = "w3f-davxy";
|
|
20
|
-
TestSuite["JAMDUNA"] = "jamduna";
|
|
21
19
|
})(TestSuite || (TestSuite = {}));
|
|
22
|
-
|
|
20
|
+
// NOTE: Also acts as a supported versions
|
|
21
|
+
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
|
|
23
22
|
const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
24
23
|
const DEFAULT_VERSION = GpVersion.V0_7_2;
|
|
25
24
|
let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
|
|
@@ -6235,7 +6234,7 @@ function workItemExtrinsicsCodec(workItems) {
|
|
|
6235
6234
|
/**
|
|
6236
6235
|
* Work Item which is a part of some work package.
|
|
6237
6236
|
*
|
|
6238
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
6237
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/1a86001a9100?v=0.7.2
|
|
6239
6238
|
*/
|
|
6240
6239
|
class WorkItem extends WithDebug {
|
|
6241
6240
|
service;
|
|
@@ -6246,35 +6245,20 @@ class WorkItem extends WithDebug {
|
|
|
6246
6245
|
importSegments;
|
|
6247
6246
|
extrinsic;
|
|
6248
6247
|
exportCount;
|
|
6249
|
-
static Codec =
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
})
|
|
6264
|
-
: Class(WorkItem, {
|
|
6265
|
-
service: u32.asOpaque(),
|
|
6266
|
-
codeHash: bytes(HASH_SIZE).asOpaque(),
|
|
6267
|
-
payload: blob,
|
|
6268
|
-
refineGasLimit: u64.asOpaque(),
|
|
6269
|
-
accumulateGasLimit: u64.asOpaque(),
|
|
6270
|
-
importSegments: codecKnownSizeArray(ImportSpec.Codec, {
|
|
6271
|
-
minLength: 0,
|
|
6272
|
-
maxLength: MAX_NUMBER_OF_SEGMENTS,
|
|
6273
|
-
typicalLength: MAX_NUMBER_OF_SEGMENTS,
|
|
6274
|
-
}),
|
|
6275
|
-
extrinsic: sequenceVarLen(WorkItemExtrinsicSpec.Codec),
|
|
6276
|
-
exportCount: u16,
|
|
6277
|
-
});
|
|
6248
|
+
static Codec = Class(WorkItem, {
|
|
6249
|
+
service: u32.asOpaque(),
|
|
6250
|
+
codeHash: bytes(HASH_SIZE).asOpaque(),
|
|
6251
|
+
refineGasLimit: u64.asOpaque(),
|
|
6252
|
+
accumulateGasLimit: u64.asOpaque(),
|
|
6253
|
+
exportCount: u16,
|
|
6254
|
+
payload: blob,
|
|
6255
|
+
importSegments: codecKnownSizeArray(ImportSpec.Codec, {
|
|
6256
|
+
minLength: 0,
|
|
6257
|
+
maxLength: MAX_NUMBER_OF_SEGMENTS,
|
|
6258
|
+
typicalLength: MAX_NUMBER_OF_SEGMENTS,
|
|
6259
|
+
}),
|
|
6260
|
+
extrinsic: sequenceVarLen(WorkItemExtrinsicSpec.Codec),
|
|
6261
|
+
});
|
|
6278
6262
|
static create({ service, codeHash, payload, refineGasLimit, accumulateGasLimit, importSegments, extrinsic, exportCount, }) {
|
|
6279
6263
|
return new WorkItem(service, codeHash, payload, refineGasLimit, accumulateGasLimit, importSegments, extrinsic, exportCount);
|
|
6280
6264
|
}
|
|
@@ -6346,23 +6330,14 @@ class WorkPackage extends WithDebug {
|
|
|
6346
6330
|
parametrization;
|
|
6347
6331
|
context;
|
|
6348
6332
|
items;
|
|
6349
|
-
static Codec =
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
})
|
|
6358
|
-
: Class(WorkPackage, {
|
|
6359
|
-
authorization: blob,
|
|
6360
|
-
authCodeHost: u32.asOpaque(),
|
|
6361
|
-
authCodeHash: bytes(HASH_SIZE).asOpaque(),
|
|
6362
|
-
parametrization: blob,
|
|
6363
|
-
context: RefineContext.Codec,
|
|
6364
|
-
items: sequenceVarLen(WorkItem.Codec).convert((x) => x, (items) => FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
|
|
6365
|
-
});
|
|
6333
|
+
static Codec = Class(WorkPackage, {
|
|
6334
|
+
authCodeHost: u32.asOpaque(),
|
|
6335
|
+
authCodeHash: bytes(HASH_SIZE).asOpaque(),
|
|
6336
|
+
context: RefineContext.Codec,
|
|
6337
|
+
authorization: blob,
|
|
6338
|
+
parametrization: blob,
|
|
6339
|
+
items: sequenceVarLen(WorkItem.Codec).convert((x) => x, (items) => FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
|
|
6340
|
+
});
|
|
6366
6341
|
static create({ authorization, authCodeHost, authCodeHash, parametrization, context, items, }) {
|
|
6367
6342
|
return new WorkPackage(authorization, authCodeHost, authCodeHash, parametrization, context, items);
|
|
6368
6343
|
}
|
|
@@ -6613,9 +6588,9 @@ class WorkPackageSpec extends WithDebug {
|
|
|
6613
6588
|
/**
|
|
6614
6589
|
* A report of execution of some work package.
|
|
6615
6590
|
*
|
|
6616
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
6591
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/13bb0113c301?v=0.7.2
|
|
6617
6592
|
*/
|
|
6618
|
-
class
|
|
6593
|
+
class WorkReport extends WithDebug {
|
|
6619
6594
|
workPackageSpec;
|
|
6620
6595
|
context;
|
|
6621
6596
|
coreIndex;
|
|
@@ -6624,17 +6599,32 @@ class WorkReportNoCodec extends WithDebug {
|
|
|
6624
6599
|
segmentRootLookup;
|
|
6625
6600
|
results;
|
|
6626
6601
|
authorizationGasUsed;
|
|
6602
|
+
static Codec = Class(WorkReport, {
|
|
6603
|
+
workPackageSpec: WorkPackageSpec.Codec,
|
|
6604
|
+
context: RefineContext.Codec,
|
|
6605
|
+
coreIndex: varU32.convert((o) => tryAsU32(o), (i) => {
|
|
6606
|
+
if (!isU16(i)) {
|
|
6607
|
+
throw new Error(`Core index exceeds U16: ${i}`);
|
|
6608
|
+
}
|
|
6609
|
+
return tryAsCoreIndex(i);
|
|
6610
|
+
}),
|
|
6611
|
+
authorizerHash: bytes(HASH_SIZE).asOpaque(),
|
|
6612
|
+
authorizationGasUsed: varU64.asOpaque(),
|
|
6613
|
+
authorizationOutput: blob,
|
|
6614
|
+
segmentRootLookup: readonlyArray(sequenceVarLen(WorkPackageInfo.Codec)),
|
|
6615
|
+
results: sequenceVarLen(WorkResult.Codec).convert((x) => x, (items) => FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
|
|
6616
|
+
});
|
|
6627
6617
|
static create({ workPackageSpec, context, coreIndex, authorizerHash, authorizationOutput, segmentRootLookup, results, authorizationGasUsed, }) {
|
|
6628
|
-
return new
|
|
6618
|
+
return new WorkReport(workPackageSpec, context, coreIndex, authorizerHash, authorizationOutput, segmentRootLookup, results, authorizationGasUsed);
|
|
6629
6619
|
}
|
|
6630
6620
|
constructor(
|
|
6631
6621
|
/** `s`: Work package specification. */
|
|
6632
6622
|
workPackageSpec,
|
|
6633
|
-
/** `
|
|
6623
|
+
/** `c`: Refinement context. */
|
|
6634
6624
|
context,
|
|
6635
|
-
/**
|
|
6625
|
+
/** *`c`*: Core index on which the work is done. */
|
|
6636
6626
|
coreIndex,
|
|
6637
|
-
/**
|
|
6627
|
+
/** *`a`*: Hash of the authorizer. */
|
|
6638
6628
|
authorizerHash,
|
|
6639
6629
|
/** `o`: Authorization output. */
|
|
6640
6630
|
authorizationOutput,
|
|
@@ -6645,7 +6635,7 @@ class WorkReportNoCodec extends WithDebug {
|
|
|
6645
6635
|
segmentRootLookup,
|
|
6646
6636
|
/** `r`: The results of evaluation of each of the items in the work package. */
|
|
6647
6637
|
results,
|
|
6648
|
-
/**
|
|
6638
|
+
/** *`g`*: Gas used during authorization. */
|
|
6649
6639
|
authorizationGasUsed) {
|
|
6650
6640
|
super();
|
|
6651
6641
|
this.workPackageSpec = workPackageSpec;
|
|
@@ -6658,47 +6648,11 @@ class WorkReportNoCodec extends WithDebug {
|
|
|
6658
6648
|
this.authorizationGasUsed = authorizationGasUsed;
|
|
6659
6649
|
}
|
|
6660
6650
|
}
|
|
6661
|
-
const WorkReportCodec = Class(WorkReportNoCodec, {
|
|
6662
|
-
workPackageSpec: WorkPackageSpec.Codec,
|
|
6663
|
-
context: RefineContext.Codec,
|
|
6664
|
-
coreIndex: varU32.convert((o) => tryAsU32(o), (i) => {
|
|
6665
|
-
if (!isU16(i)) {
|
|
6666
|
-
throw new Error(`Core index exceeds U16: ${i}`);
|
|
6667
|
-
}
|
|
6668
|
-
return tryAsCoreIndex(i);
|
|
6669
|
-
}),
|
|
6670
|
-
authorizerHash: bytes(HASH_SIZE).asOpaque(),
|
|
6671
|
-
authorizationGasUsed: varU64.asOpaque(),
|
|
6672
|
-
authorizationOutput: blob,
|
|
6673
|
-
segmentRootLookup: readonlyArray(sequenceVarLen(WorkPackageInfo.Codec)),
|
|
6674
|
-
results: sequenceVarLen(WorkResult.Codec).convert((x) => x, (items) => FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
|
|
6675
|
-
});
|
|
6676
|
-
const WorkReportCodecPre070 = Class(WorkReportNoCodec, {
|
|
6677
|
-
workPackageSpec: WorkPackageSpec.Codec,
|
|
6678
|
-
context: RefineContext.Codec,
|
|
6679
|
-
coreIndex: varU32.convert((o) => tryAsU32(o), (i) => {
|
|
6680
|
-
if (!isU16(i)) {
|
|
6681
|
-
throw new Error(`Core index exceeds U16: ${i}`);
|
|
6682
|
-
}
|
|
6683
|
-
return tryAsCoreIndex(i);
|
|
6684
|
-
}),
|
|
6685
|
-
authorizerHash: bytes(HASH_SIZE).asOpaque(),
|
|
6686
|
-
authorizationOutput: blob,
|
|
6687
|
-
segmentRootLookup: readonlyArray(sequenceVarLen(WorkPackageInfo.Codec)),
|
|
6688
|
-
results: sequenceVarLen(WorkResult.Codec).convert((x) => x, (items) => FixedSizeArray.new(items, tryAsWorkItemsCount(items.length))),
|
|
6689
|
-
authorizationGasUsed: varU64.asOpaque(),
|
|
6690
|
-
});
|
|
6691
|
-
class WorkReport extends WorkReportNoCodec {
|
|
6692
|
-
static Codec = Compatibility.isGreaterOrEqual(GpVersion.V0_7_0)
|
|
6693
|
-
? WorkReportCodec
|
|
6694
|
-
: WorkReportCodecPre070;
|
|
6695
|
-
}
|
|
6696
6651
|
|
|
6697
6652
|
var workReport = /*#__PURE__*/Object.freeze({
|
|
6698
6653
|
__proto__: null,
|
|
6699
6654
|
WorkPackageSpec: WorkPackageSpec,
|
|
6700
|
-
WorkReport: WorkReport
|
|
6701
|
-
WorkReportNoCodec: WorkReportNoCodec
|
|
6655
|
+
WorkReport: WorkReport
|
|
6702
6656
|
});
|
|
6703
6657
|
|
|
6704
6658
|
const REQUIRED_CREDENTIALS_RANGE = [2, 3];
|
|
@@ -6927,41 +6881,24 @@ const encodeUnsealedHeader = (view) => {
|
|
|
6927
6881
|
const encodedUnsealedLen = encodedFullHeader.length - BANDERSNATCH_VRF_SIGNATURE_BYTES;
|
|
6928
6882
|
return BytesBlob.blobFrom(encodedFullHeader.subarray(0, encodedUnsealedLen));
|
|
6929
6883
|
};
|
|
6930
|
-
/**
|
|
6931
|
-
* Codec descriptor with pre 0.7.0 encoding order
|
|
6932
|
-
*/
|
|
6933
|
-
const legacyDescriptor = {
|
|
6934
|
-
parentHeaderHash: bytes(HASH_SIZE).asOpaque(),
|
|
6935
|
-
priorStateRoot: bytes(HASH_SIZE).asOpaque(),
|
|
6936
|
-
extrinsicHash: bytes(HASH_SIZE).asOpaque(),
|
|
6937
|
-
timeSlotIndex: u32.asOpaque(),
|
|
6938
|
-
epochMarker: optional(EpochMarker.Codec),
|
|
6939
|
-
ticketsMarker: optional(TicketsMarker.Codec),
|
|
6940
|
-
offendersMarker: sequenceVarLen(bytes(ED25519_KEY_BYTES).asOpaque()),
|
|
6941
|
-
bandersnatchBlockAuthorIndex: u16.asOpaque(),
|
|
6942
|
-
entropySource: bytes(BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
|
|
6943
|
-
seal: bytes(BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
|
|
6944
|
-
};
|
|
6945
6884
|
/**
|
|
6946
6885
|
* The header of the JAM block.
|
|
6947
6886
|
*
|
|
6948
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
6887
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/0c66000c7200?v=0.7.2
|
|
6949
6888
|
*/
|
|
6950
6889
|
class Header extends WithDebug {
|
|
6951
|
-
static Codec = Class(Header,
|
|
6952
|
-
|
|
6953
|
-
:
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
seal: bytes(BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
|
|
6964
|
-
});
|
|
6890
|
+
static Codec = Class(Header, {
|
|
6891
|
+
parentHeaderHash: bytes(HASH_SIZE).asOpaque(),
|
|
6892
|
+
priorStateRoot: bytes(HASH_SIZE).asOpaque(),
|
|
6893
|
+
extrinsicHash: bytes(HASH_SIZE).asOpaque(),
|
|
6894
|
+
timeSlotIndex: u32.asOpaque(),
|
|
6895
|
+
epochMarker: optional(EpochMarker.Codec),
|
|
6896
|
+
ticketsMarker: optional(TicketsMarker.Codec),
|
|
6897
|
+
bandersnatchBlockAuthorIndex: u16.asOpaque(),
|
|
6898
|
+
entropySource: bytes(BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
|
|
6899
|
+
offendersMarker: sequenceVarLen(bytes(ED25519_KEY_BYTES).asOpaque()),
|
|
6900
|
+
seal: bytes(BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque(),
|
|
6901
|
+
});
|
|
6965
6902
|
static create(h) {
|
|
6966
6903
|
return Object.assign(Header.empty(), h);
|
|
6967
6904
|
}
|
|
@@ -8516,7 +8453,6 @@ function binaryMerkleization(input, hasher) {
|
|
|
8516
8453
|
return upperN(input, hasher);
|
|
8517
8454
|
}
|
|
8518
8455
|
|
|
8519
|
-
const U32_BYTES = 4;
|
|
8520
8456
|
/** Numeric mapping for state entries. */
|
|
8521
8457
|
var StateKeyIdx;
|
|
8522
8458
|
(function (StateKeyIdx) {
|
|
@@ -8579,35 +8515,16 @@ var stateKeys;
|
|
|
8579
8515
|
stateKeys.serviceInfo = serviceInfo;
|
|
8580
8516
|
/** https://graypaper.fluffylabs.dev/#/1c979cb/3bba033bba03?v=0.7.1 */
|
|
8581
8517
|
function serviceStorage(blake2b, serviceId, key) {
|
|
8582
|
-
if (Compatibility.isLessThan(GpVersion.V0_6_7)) {
|
|
8583
|
-
const out = Bytes.zero(HASH_SIZE);
|
|
8584
|
-
out.raw.set(u32AsLeBytes(tryAsU32(2 ** 32 - 1)), 0);
|
|
8585
|
-
out.raw.set(key.raw.subarray(0, HASH_SIZE - U32_BYTES), U32_BYTES);
|
|
8586
|
-
return legacyServiceNested(serviceId, out);
|
|
8587
|
-
}
|
|
8588
8518
|
return serviceNested(blake2b, serviceId, tryAsU32(2 ** 32 - 1), key);
|
|
8589
8519
|
}
|
|
8590
8520
|
stateKeys.serviceStorage = serviceStorage;
|
|
8591
8521
|
/** https://graypaper.fluffylabs.dev/#/1c979cb/3bd7033bd703?v=0.7.1 */
|
|
8592
8522
|
function servicePreimage(blake2b, serviceId, hash) {
|
|
8593
|
-
if (Compatibility.isLessThan(GpVersion.V0_6_7)) {
|
|
8594
|
-
const out = Bytes.zero(HASH_SIZE);
|
|
8595
|
-
out.raw.set(u32AsLeBytes(tryAsU32(2 ** 32 - 2)), 0);
|
|
8596
|
-
out.raw.set(hash.raw.subarray(1, HASH_SIZE - U32_BYTES + 1), U32_BYTES);
|
|
8597
|
-
return legacyServiceNested(serviceId, out);
|
|
8598
|
-
}
|
|
8599
8523
|
return serviceNested(blake2b, serviceId, tryAsU32(2 ** 32 - 2), hash);
|
|
8600
8524
|
}
|
|
8601
8525
|
stateKeys.servicePreimage = servicePreimage;
|
|
8602
8526
|
/** https://graypaper.fluffylabs.dev/#/1c979cb/3b0a043b0a04?v=0.7.1 */
|
|
8603
8527
|
function serviceLookupHistory(blake2b, serviceId, hash, preimageLength) {
|
|
8604
|
-
if (Compatibility.isLessThan(GpVersion.V0_6_7)) {
|
|
8605
|
-
const doubleHash = blake2b.hashBytes(hash);
|
|
8606
|
-
const out = Bytes.zero(HASH_SIZE);
|
|
8607
|
-
out.raw.set(u32AsLeBytes(preimageLength), 0);
|
|
8608
|
-
out.raw.set(doubleHash.raw.subarray(2, HASH_SIZE - U32_BYTES + 2), U32_BYTES);
|
|
8609
|
-
return legacyServiceNested(serviceId, out);
|
|
8610
|
-
}
|
|
8611
8528
|
return serviceNested(blake2b, serviceId, preimageLength, hash);
|
|
8612
8529
|
}
|
|
8613
8530
|
stateKeys.serviceLookupHistory = serviceLookupHistory;
|
|
@@ -9282,9 +9199,6 @@ class LookupHistoryItem {
|
|
|
9282
9199
|
}
|
|
9283
9200
|
}
|
|
9284
9201
|
|
|
9285
|
-
const codecServiceId = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_7)
|
|
9286
|
-
? u32.asOpaque()
|
|
9287
|
-
: varU32.convert((s) => tryAsU32(s), (i) => tryAsServiceId(i));
|
|
9288
9202
|
/**
|
|
9289
9203
|
* Activity Record of a single validator.
|
|
9290
9204
|
*
|
|
@@ -9340,7 +9254,7 @@ const codecVarGas = varU64.convert((g) => tryAsU64(g), (i) => tryAsServiceGas(i)
|
|
|
9340
9254
|
* Single core statistics.
|
|
9341
9255
|
* Updated per block, based on incoming work reports (`w`).
|
|
9342
9256
|
*
|
|
9343
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
9257
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/197902197902?v=0.7.2
|
|
9344
9258
|
* https://github.com/gavofyork/graypaper/blob/9bffb08f3ea7b67832019176754df4fb36b9557d/text/statistics.tex#L65
|
|
9345
9259
|
*/
|
|
9346
9260
|
class CoreStatistics {
|
|
@@ -9352,27 +9266,16 @@ class CoreStatistics {
|
|
|
9352
9266
|
extrinsicCount;
|
|
9353
9267
|
bundleSize;
|
|
9354
9268
|
gasUsed;
|
|
9355
|
-
static Codec =
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
})
|
|
9366
|
-
: Class(CoreStatistics, {
|
|
9367
|
-
dataAvailabilityLoad: varU32,
|
|
9368
|
-
popularity: codecVarU16,
|
|
9369
|
-
imports: codecVarU16,
|
|
9370
|
-
exports: codecVarU16,
|
|
9371
|
-
extrinsicSize: varU32,
|
|
9372
|
-
extrinsicCount: codecVarU16,
|
|
9373
|
-
bundleSize: varU32,
|
|
9374
|
-
gasUsed: codecVarGas,
|
|
9375
|
-
});
|
|
9269
|
+
static Codec = Class(CoreStatistics, {
|
|
9270
|
+
dataAvailabilityLoad: varU32,
|
|
9271
|
+
popularity: codecVarU16,
|
|
9272
|
+
imports: codecVarU16,
|
|
9273
|
+
extrinsicCount: codecVarU16,
|
|
9274
|
+
extrinsicSize: varU32,
|
|
9275
|
+
exports: codecVarU16,
|
|
9276
|
+
bundleSize: varU32,
|
|
9277
|
+
gasUsed: codecVarGas,
|
|
9278
|
+
});
|
|
9376
9279
|
static create(v) {
|
|
9377
9280
|
return new CoreStatistics(v.dataAvailabilityLoad, v.popularity, v.imports, v.exports, v.extrinsicSize, v.extrinsicCount, v.bundleSize, v.gasUsed);
|
|
9378
9281
|
}
|
|
@@ -9413,7 +9316,7 @@ class CoreStatistics {
|
|
|
9413
9316
|
* Service statistics.
|
|
9414
9317
|
* Updated per block, based on available work reports (`W`).
|
|
9415
9318
|
*
|
|
9416
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
9319
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/19e20219e202?v=0.7.2
|
|
9417
9320
|
*/
|
|
9418
9321
|
class ServiceStatistics {
|
|
9419
9322
|
providedCount;
|
|
@@ -9435,29 +9338,15 @@ class ServiceStatistics {
|
|
|
9435
9338
|
refinementCount: varU32,
|
|
9436
9339
|
refinementGasUsed: codecVarGas,
|
|
9437
9340
|
imports: codecVarU16,
|
|
9438
|
-
exports: codecVarU16,
|
|
9439
|
-
extrinsicSize: varU32,
|
|
9440
9341
|
extrinsicCount: codecVarU16,
|
|
9342
|
+
extrinsicSize: varU32,
|
|
9343
|
+
exports: codecVarU16,
|
|
9441
9344
|
accumulateCount: varU32,
|
|
9442
9345
|
accumulateGasUsed: codecVarGas,
|
|
9443
9346
|
onTransfersCount: varU32,
|
|
9444
9347
|
onTransfersGasUsed: codecVarGas,
|
|
9445
9348
|
}),
|
|
9446
9349
|
versions: {
|
|
9447
|
-
[GpVersion.V0_7_0]: Class(ServiceStatistics, {
|
|
9448
|
-
providedCount: codecVarU16,
|
|
9449
|
-
providedSize: varU32,
|
|
9450
|
-
refinementCount: varU32,
|
|
9451
|
-
refinementGasUsed: codecVarGas,
|
|
9452
|
-
imports: codecVarU16,
|
|
9453
|
-
extrinsicCount: codecVarU16,
|
|
9454
|
-
extrinsicSize: varU32,
|
|
9455
|
-
exports: codecVarU16,
|
|
9456
|
-
accumulateCount: varU32,
|
|
9457
|
-
accumulateGasUsed: codecVarGas,
|
|
9458
|
-
onTransfersCount: varU32,
|
|
9459
|
-
onTransfersGasUsed: codecVarGas,
|
|
9460
|
-
}),
|
|
9461
9350
|
[GpVersion.V0_7_1]: Class(ServiceStatistics, {
|
|
9462
9351
|
providedCount: codecVarU16,
|
|
9463
9352
|
providedSize: varU32,
|
|
@@ -9532,7 +9421,7 @@ class StatisticsData {
|
|
|
9532
9421
|
current: codecPerValidator(ValidatorStatistics.Codec),
|
|
9533
9422
|
previous: codecPerValidator(ValidatorStatistics.Codec),
|
|
9534
9423
|
cores: codecPerCore(CoreStatistics.Codec),
|
|
9535
|
-
services: dictionary(
|
|
9424
|
+
services: dictionary(u32.asOpaque(), ServiceStatistics.Codec, {
|
|
9536
9425
|
sortKeys: (a, b) => a - b,
|
|
9537
9426
|
}),
|
|
9538
9427
|
});
|
|
@@ -10707,14 +10596,6 @@ class SerializedService {
|
|
|
10707
10596
|
}
|
|
10708
10597
|
/** Retrieve a storage item. */
|
|
10709
10598
|
getStorage(rawKey) {
|
|
10710
|
-
if (Compatibility.isLessThan(GpVersion.V0_6_7)) {
|
|
10711
|
-
const SERVICE_ID_BYTES = 4;
|
|
10712
|
-
const serviceIdAndKey = safeAllocUint8Array(SERVICE_ID_BYTES + rawKey.length);
|
|
10713
|
-
serviceIdAndKey.set(u32AsLeBytes(this.serviceId));
|
|
10714
|
-
serviceIdAndKey.set(rawKey.raw, SERVICE_ID_BYTES);
|
|
10715
|
-
const key = asOpaqueType(BytesBlob.blobFrom(this.blake2b.hashBytes(serviceIdAndKey).raw));
|
|
10716
|
-
return this.retrieveOptional(serialize.serviceStorage(this.blake2b, this.serviceId, key)) ?? null;
|
|
10717
|
-
}
|
|
10718
10599
|
return this.retrieveOptional(serialize.serviceStorage(this.blake2b, this.serviceId, rawKey)) ?? null;
|
|
10719
10600
|
}
|
|
10720
10601
|
/**
|
|
@@ -18595,12 +18476,7 @@ const MEMO_START_REG = 10; // `o`
|
|
|
18595
18476
|
class Transfer {
|
|
18596
18477
|
currentServiceId;
|
|
18597
18478
|
partialState;
|
|
18598
|
-
index = tryAsHostCallIndex(
|
|
18599
|
-
fallback: 11,
|
|
18600
|
-
versions: {
|
|
18601
|
-
[GpVersion.V0_6_7]: 20,
|
|
18602
|
-
},
|
|
18603
|
-
}));
|
|
18479
|
+
index = tryAsHostCallIndex(20);
|
|
18604
18480
|
/**
|
|
18605
18481
|
* `g = 10 + t`
|
|
18606
18482
|
*
|
|
@@ -20299,38 +20175,27 @@ const GAS_TO_INVOKE_WORK_REPORT = 10000000n;
|
|
|
20299
20175
|
/**
|
|
20300
20176
|
* The set of wrangled operand tuples, used as an operand to the PVM Accumulation function.
|
|
20301
20177
|
*
|
|
20302
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
20178
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/176b00176b00?v=0.7.2
|
|
20303
20179
|
*/
|
|
20304
20180
|
class Operand extends WithDebug {
|
|
20305
|
-
|
|
20306
|
-
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
// a
|
|
20322
|
-
authorizerHash: bytes(HASH_SIZE).asOpaque(),
|
|
20323
|
-
// y
|
|
20324
|
-
payloadHash: bytes(HASH_SIZE),
|
|
20325
|
-
// g
|
|
20326
|
-
gas: varU64.asOpaque(),
|
|
20327
|
-
// d
|
|
20328
|
-
result: WorkExecResult.Codec,
|
|
20329
|
-
// o
|
|
20330
|
-
authorizationOutput: blob,
|
|
20331
|
-
});
|
|
20181
|
+
static Codec = Class(Operand, {
|
|
20182
|
+
// h
|
|
20183
|
+
hash: bytes(HASH_SIZE).asOpaque(),
|
|
20184
|
+
// e
|
|
20185
|
+
exportsRoot: bytes(HASH_SIZE).asOpaque(),
|
|
20186
|
+
// a
|
|
20187
|
+
authorizerHash: bytes(HASH_SIZE).asOpaque(),
|
|
20188
|
+
// y
|
|
20189
|
+
payloadHash: bytes(HASH_SIZE),
|
|
20190
|
+
// g
|
|
20191
|
+
gas: varU64.asOpaque(),
|
|
20192
|
+
// d
|
|
20193
|
+
result: WorkExecResult.Codec,
|
|
20194
|
+
// o
|
|
20195
|
+
authorizationOutput: blob,
|
|
20196
|
+
});
|
|
20332
20197
|
/**
|
|
20333
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
20198
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/18680118eb01?v=0.7.2
|
|
20334
20199
|
*/
|
|
20335
20200
|
hash;
|
|
20336
20201
|
exportsRoot;
|