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