@typeberry/lib 0.2.0-b6e3410 → 0.2.0-c3df163
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 +919 -767
- package/index.d.ts +1897 -1619
- package/index.js +919 -767
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -2091,6 +2091,9 @@ class ObjectView {
|
|
|
2091
2091
|
toString() {
|
|
2092
2092
|
return `View<${this.materializedConstructor.name}>(cache: ${this.cache.size})`;
|
|
2093
2093
|
}
|
|
2094
|
+
[TEST_COMPARE_USING]() {
|
|
2095
|
+
return this.materialize();
|
|
2096
|
+
}
|
|
2094
2097
|
}
|
|
2095
2098
|
/**
|
|
2096
2099
|
* A lazy-evaluated decoder of a sequence.
|
|
@@ -2376,7 +2379,15 @@ var codec$1;
|
|
|
2376
2379
|
/** Custom encoding / decoding logic. */
|
|
2377
2380
|
codec.custom = ({ name, sizeHint = { bytes: 0, isExact: false }, }, encode, decode, skip) => Descriptor.new(name, sizeHint, encode, decode, skip);
|
|
2378
2381
|
/** Choose a descriptor depending on the encoding/decoding context. */
|
|
2379
|
-
codec.select = ({ name, sizeHint, }, chooser) =>
|
|
2382
|
+
codec.select = ({ name, sizeHint, }, chooser) => {
|
|
2383
|
+
const Self = chooser(null);
|
|
2384
|
+
return 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), hasUniqueView(Self)
|
|
2385
|
+
? codec.select({
|
|
2386
|
+
name: Self.View.name,
|
|
2387
|
+
sizeHint: Self.View.sizeHint,
|
|
2388
|
+
}, (ctx) => chooser(ctx).View)
|
|
2389
|
+
: Self.View);
|
|
2390
|
+
};
|
|
2380
2391
|
/**
|
|
2381
2392
|
* A descriptor for a more complex POJO.
|
|
2382
2393
|
*
|
|
@@ -6675,6 +6686,17 @@ function emptyBlock(slot = tryAsTimeSlot(0)) {
|
|
|
6675
6686
|
});
|
|
6676
6687
|
}
|
|
6677
6688
|
|
|
6689
|
+
/**
|
|
6690
|
+
* Take an input data and re-encode that data as view.
|
|
6691
|
+
*
|
|
6692
|
+
* NOTE: this function should NEVER be used in any production code,
|
|
6693
|
+
* it's only a test helper.
|
|
6694
|
+
*/
|
|
6695
|
+
function reencodeAsView(codec, object, chainSpec) {
|
|
6696
|
+
const encoded = Encoder.encodeObject(codec, object, chainSpec);
|
|
6697
|
+
return Decoder.decodeObject(codec.View, encoded, chainSpec);
|
|
6698
|
+
}
|
|
6699
|
+
|
|
6678
6700
|
var index$l = /*#__PURE__*/Object.freeze({
|
|
6679
6701
|
__proto__: null,
|
|
6680
6702
|
Block: Block,
|
|
@@ -6695,6 +6717,7 @@ var index$l = /*#__PURE__*/Object.freeze({
|
|
|
6695
6717
|
guarantees: guarantees,
|
|
6696
6718
|
headerViewWithHashCodec: headerViewWithHashCodec,
|
|
6697
6719
|
preimage: preimage,
|
|
6720
|
+
reencodeAsView: reencodeAsView,
|
|
6698
6721
|
refineContext: refineContext,
|
|
6699
6722
|
tickets: tickets,
|
|
6700
6723
|
tryAsCoreIndex: tryAsCoreIndex,
|
|
@@ -8045,6 +8068,72 @@ function accumulationOutputComparator(a, b) {
|
|
|
8045
8068
|
return Ordering.Equal;
|
|
8046
8069
|
}
|
|
8047
8070
|
|
|
8071
|
+
/** `O`: Maximum number of items in the authorizations pool. */
|
|
8072
|
+
const O = 8;
|
|
8073
|
+
/** `Q`: The number of items in the authorizations queue. */
|
|
8074
|
+
const Q = 80;
|
|
8075
|
+
/** `W_B`: The maximum size of the concatenated variable-size blobs, extrinsics and imported segments of a work-package, in octets */
|
|
8076
|
+
Compatibility.isGreaterOrEqual(GpVersion.V0_7_2) ? 13_791_360 : 13_794_305;
|
|
8077
|
+
/** `W_T`: The size of a transfer memo in octets. */
|
|
8078
|
+
const W_T = 128;
|
|
8079
|
+
/**
|
|
8080
|
+
* `J`: The maximum sum of dependency items in a work-report.
|
|
8081
|
+
*
|
|
8082
|
+
* https://graypaper.fluffylabs.dev/#/5f542d7/416a00416a00?v=0.6.2
|
|
8083
|
+
*/
|
|
8084
|
+
const MAX_REPORT_DEPENDENCIES = 8;
|
|
8085
|
+
|
|
8086
|
+
/**
|
|
8087
|
+
* Ready (i.e. available and/or audited) but not-yet-accumulated work-reports.
|
|
8088
|
+
*
|
|
8089
|
+
* https://graypaper.fluffylabs.dev/#/5f542d7/165300165400
|
|
8090
|
+
*/
|
|
8091
|
+
class NotYetAccumulatedReport extends WithDebug {
|
|
8092
|
+
report;
|
|
8093
|
+
dependencies;
|
|
8094
|
+
static Codec = codec$1.Class(NotYetAccumulatedReport, {
|
|
8095
|
+
report: WorkReport.Codec,
|
|
8096
|
+
dependencies: codecKnownSizeArray(codec$1.bytes(HASH_SIZE).asOpaque(), {
|
|
8097
|
+
typicalLength: MAX_REPORT_DEPENDENCIES / 2,
|
|
8098
|
+
maxLength: MAX_REPORT_DEPENDENCIES,
|
|
8099
|
+
minLength: 0,
|
|
8100
|
+
}),
|
|
8101
|
+
});
|
|
8102
|
+
static create({ report, dependencies }) {
|
|
8103
|
+
return new NotYetAccumulatedReport(report, dependencies);
|
|
8104
|
+
}
|
|
8105
|
+
constructor(
|
|
8106
|
+
/**
|
|
8107
|
+
* Each of these were made available at most one epoch ago
|
|
8108
|
+
* but have or had unfulfilled dependencies.
|
|
8109
|
+
*/
|
|
8110
|
+
report,
|
|
8111
|
+
/**
|
|
8112
|
+
* Alongside the work-report itself, we retain its un-accumulated
|
|
8113
|
+
* dependencies, a set of work-package hashes.
|
|
8114
|
+
*
|
|
8115
|
+
* https://graypaper.fluffylabs.dev/#/5f542d7/165800165800
|
|
8116
|
+
*/
|
|
8117
|
+
dependencies) {
|
|
8118
|
+
super();
|
|
8119
|
+
this.report = report;
|
|
8120
|
+
this.dependencies = dependencies;
|
|
8121
|
+
}
|
|
8122
|
+
}
|
|
8123
|
+
const accumulationQueueCodec = codecPerEpochBlock(readonlyArray(codec$1.sequenceVarLen(NotYetAccumulatedReport.Codec)));
|
|
8124
|
+
|
|
8125
|
+
/** Check if given array has correct length before casting to the opaque type. */
|
|
8126
|
+
function tryAsPerCore(array, spec) {
|
|
8127
|
+
check `
|
|
8128
|
+
${array.length === spec.coresCount}
|
|
8129
|
+
Invalid per-core array length. Expected ${spec.coresCount}, got: ${array.length}
|
|
8130
|
+
`;
|
|
8131
|
+
return asOpaqueType(array);
|
|
8132
|
+
}
|
|
8133
|
+
const codecPerCore = (val) => codecWithContext((context) => {
|
|
8134
|
+
return codecKnownSizeArray(val, { fixedLength: context.coresCount });
|
|
8135
|
+
});
|
|
8136
|
+
|
|
8048
8137
|
/**
|
|
8049
8138
|
* Assignment of particular work report to a core.
|
|
8050
8139
|
*
|
|
@@ -8073,18 +8162,18 @@ class AvailabilityAssignment extends WithDebug {
|
|
|
8073
8162
|
this.timeout = timeout;
|
|
8074
8163
|
}
|
|
8075
8164
|
}
|
|
8165
|
+
const availabilityAssignmentsCodec = codecPerCore(codec$1.optional(AvailabilityAssignment.Codec));
|
|
8076
8166
|
|
|
8077
|
-
/**
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
});
|
|
8167
|
+
/** `O`: Maximal authorization pool size. */
|
|
8168
|
+
const MAX_AUTH_POOL_SIZE = O;
|
|
8169
|
+
/** `Q`: Size of the authorization queue. */
|
|
8170
|
+
const AUTHORIZATION_QUEUE_SIZE = Q;
|
|
8171
|
+
const authPoolsCodec = codecPerCore(codecKnownSizeArray(codec$1.bytes(HASH_SIZE).asOpaque(), {
|
|
8172
|
+
minLength: 0,
|
|
8173
|
+
maxLength: MAX_AUTH_POOL_SIZE,
|
|
8174
|
+
typicalLength: MAX_AUTH_POOL_SIZE,
|
|
8175
|
+
}));
|
|
8176
|
+
const authQueuesCodec = codecPerCore(codecFixedSizeArray(codec$1.bytes(HASH_SIZE).asOpaque(), AUTHORIZATION_QUEUE_SIZE));
|
|
8088
8177
|
|
|
8089
8178
|
const sortedSetCodec = () => readonlyArray(codec$1.sequenceVarLen(codec$1.bytes(HASH_SIZE))).convert((input) => input.array, (output) => {
|
|
8090
8179
|
const typed = output.map((x) => x.asOpaque());
|
|
@@ -8148,103 +8237,301 @@ function hashComparator(a, b) {
|
|
|
8148
8237
|
return a.compare(b);
|
|
8149
8238
|
}
|
|
8150
8239
|
|
|
8151
|
-
/** `O`: Maximum number of items in the authorizations pool. */
|
|
8152
|
-
const O = 8;
|
|
8153
|
-
/** `Q`: The number of items in the authorizations queue. */
|
|
8154
|
-
const Q = 80;
|
|
8155
|
-
/** `W_T`: The size of a transfer memo in octets. */
|
|
8156
|
-
const W_T = 128;
|
|
8157
|
-
/**
|
|
8158
|
-
* `J`: The maximum sum of dependency items in a work-report.
|
|
8159
|
-
*
|
|
8160
|
-
* https://graypaper.fluffylabs.dev/#/5f542d7/416a00416a00?v=0.6.2
|
|
8161
|
-
*/
|
|
8162
|
-
const MAX_REPORT_DEPENDENCIES = 8;
|
|
8163
|
-
/** `Q`: Size of the authorization queue. */
|
|
8164
|
-
const AUTHORIZATION_QUEUE_SIZE = Q;
|
|
8165
|
-
/** `O`: Maximal authorization pool size. */
|
|
8166
|
-
const MAX_AUTH_POOL_SIZE = O;
|
|
8167
|
-
|
|
8168
8240
|
const MAX_VALUE = 4294967295;
|
|
8169
8241
|
const MIN_VALUE = -2147483648;
|
|
8170
8242
|
const MAX_SHIFT_U32 = 32;
|
|
8171
8243
|
const MAX_SHIFT_U64 = 64n;
|
|
8172
8244
|
|
|
8173
8245
|
/**
|
|
8174
|
-
* `
|
|
8246
|
+
* `H = 8`: The size of recent history, in blocks.
|
|
8175
8247
|
*
|
|
8176
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
8248
|
+
* https://graypaper.fluffylabs.dev/#/579bd12/416300416500
|
|
8177
8249
|
*/
|
|
8178
|
-
const
|
|
8250
|
+
const MAX_RECENT_HISTORY = 8;
|
|
8251
|
+
/** Recent history of a single block. */
|
|
8252
|
+
class BlockState extends WithDebug {
|
|
8253
|
+
headerHash;
|
|
8254
|
+
accumulationResult;
|
|
8255
|
+
postStateRoot;
|
|
8256
|
+
reported;
|
|
8257
|
+
static Codec = codec$1.Class(BlockState, {
|
|
8258
|
+
headerHash: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
8259
|
+
accumulationResult: codec$1.bytes(HASH_SIZE),
|
|
8260
|
+
postStateRoot: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
8261
|
+
reported: codecHashDictionary(WorkPackageInfo.Codec, (x) => x.workPackageHash),
|
|
8262
|
+
});
|
|
8263
|
+
static create({ headerHash, accumulationResult, postStateRoot, reported }) {
|
|
8264
|
+
return new BlockState(headerHash, accumulationResult, postStateRoot, reported);
|
|
8265
|
+
}
|
|
8266
|
+
constructor(
|
|
8267
|
+
/** Header hash. */
|
|
8268
|
+
headerHash,
|
|
8269
|
+
/** Merkle mountain belt of accumulation result. */
|
|
8270
|
+
accumulationResult,
|
|
8271
|
+
/** Posterior state root filled in with a 1-block delay. */
|
|
8272
|
+
postStateRoot,
|
|
8273
|
+
/** Reported work packages (no more than number of cores). */
|
|
8274
|
+
reported) {
|
|
8275
|
+
super();
|
|
8276
|
+
this.headerHash = headerHash;
|
|
8277
|
+
this.accumulationResult = accumulationResult;
|
|
8278
|
+
this.postStateRoot = postStateRoot;
|
|
8279
|
+
this.reported = reported;
|
|
8280
|
+
}
|
|
8281
|
+
}
|
|
8179
8282
|
/**
|
|
8180
|
-
*
|
|
8283
|
+
* Recent history of blocks.
|
|
8181
8284
|
*
|
|
8182
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/
|
|
8285
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/0fc9010fc901?v=0.6.7
|
|
8183
8286
|
*/
|
|
8184
|
-
|
|
8287
|
+
class RecentBlocks extends WithDebug {
|
|
8288
|
+
blocks;
|
|
8289
|
+
accumulationLog;
|
|
8290
|
+
static Codec = codec$1.Class(RecentBlocks, {
|
|
8291
|
+
blocks: codecKnownSizeArray(BlockState.Codec, {
|
|
8292
|
+
minLength: 0,
|
|
8293
|
+
maxLength: MAX_RECENT_HISTORY,
|
|
8294
|
+
typicalLength: MAX_RECENT_HISTORY,
|
|
8295
|
+
}),
|
|
8296
|
+
accumulationLog: codec$1.object({
|
|
8297
|
+
peaks: readonlyArray(codec$1.sequenceVarLen(codec$1.optional(codec$1.bytes(HASH_SIZE)))),
|
|
8298
|
+
}),
|
|
8299
|
+
});
|
|
8300
|
+
static empty() {
|
|
8301
|
+
return new RecentBlocks(asKnownSize([]), {
|
|
8302
|
+
peaks: [],
|
|
8303
|
+
});
|
|
8304
|
+
}
|
|
8305
|
+
static create(a) {
|
|
8306
|
+
return new RecentBlocks(a.blocks, a.accumulationLog);
|
|
8307
|
+
}
|
|
8308
|
+
constructor(
|
|
8309
|
+
/**
|
|
8310
|
+
* Most recent blocks.
|
|
8311
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/0fea010fea01?v=0.6.7
|
|
8312
|
+
*/
|
|
8313
|
+
blocks,
|
|
8314
|
+
/**
|
|
8315
|
+
* Accumulation output log.
|
|
8316
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/0f02020f0202?v=0.6.7
|
|
8317
|
+
*/
|
|
8318
|
+
accumulationLog) {
|
|
8319
|
+
super();
|
|
8320
|
+
this.blocks = blocks;
|
|
8321
|
+
this.accumulationLog = accumulationLog;
|
|
8322
|
+
}
|
|
8323
|
+
}
|
|
8324
|
+
|
|
8325
|
+
const recentlyAccumulatedCodec = codecPerEpochBlock(codec$1.sequenceVarLen(codec$1.bytes(HASH_SIZE).asOpaque()).convert((x) => Array.from(x), (x) => HashSet.from(x)));
|
|
8326
|
+
|
|
8185
8327
|
/**
|
|
8186
|
-
*
|
|
8328
|
+
* Fixed size of validator metadata.
|
|
8187
8329
|
*
|
|
8188
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
8330
|
+
* https://graypaper.fluffylabs.dev/#/5f542d7/0d55010d5501
|
|
8189
8331
|
*/
|
|
8190
|
-
const
|
|
8191
|
-
const zeroSizeHint = {
|
|
8192
|
-
bytes: 0,
|
|
8193
|
-
isExact: true,
|
|
8194
|
-
};
|
|
8195
|
-
/** 0-byte read, return given default value */
|
|
8196
|
-
const ignoreValueWithDefault = (defaultValue) => Descriptor.new("ignoreValue", zeroSizeHint, (_e, _v) => { }, (_d) => defaultValue, (_s) => { });
|
|
8197
|
-
/** Encode and decode object with leading version number. */
|
|
8198
|
-
const codecWithVersion = (val) => Descriptor.new("withVersion", {
|
|
8199
|
-
bytes: val.sizeHint.bytes + 8,
|
|
8200
|
-
isExact: false,
|
|
8201
|
-
}, (e, v) => {
|
|
8202
|
-
e.varU64(0n);
|
|
8203
|
-
val.encode(e, v);
|
|
8204
|
-
}, (d) => {
|
|
8205
|
-
const version = d.varU64();
|
|
8206
|
-
if (version !== 0n) {
|
|
8207
|
-
throw new Error("Non-zero version is not supported!");
|
|
8208
|
-
}
|
|
8209
|
-
return val.decode(d);
|
|
8210
|
-
}, (s) => {
|
|
8211
|
-
s.varU64();
|
|
8212
|
-
val.skip(s);
|
|
8213
|
-
});
|
|
8332
|
+
const VALIDATOR_META_BYTES = 128;
|
|
8214
8333
|
/**
|
|
8215
|
-
*
|
|
8334
|
+
* Details about validators' identity.
|
|
8216
8335
|
*
|
|
8217
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
8336
|
+
* https://graypaper.fluffylabs.dev/#/5f542d7/0d4b010d4c01
|
|
8218
8337
|
*/
|
|
8219
|
-
class
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
parentService;
|
|
8230
|
-
static Codec = codec$1.Class(ServiceAccountInfo, {
|
|
8231
|
-
codeHash: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
8232
|
-
balance: codec$1.u64,
|
|
8233
|
-
accumulateMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
|
|
8234
|
-
onTransferMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
|
|
8235
|
-
storageUtilisationBytes: codec$1.u64,
|
|
8236
|
-
gratisStorage: codec$1.u64,
|
|
8237
|
-
storageUtilisationCount: codec$1.u32,
|
|
8238
|
-
created: codec$1.u32.convert((x) => x, tryAsTimeSlot),
|
|
8239
|
-
lastAccumulation: codec$1.u32.convert((x) => x, tryAsTimeSlot),
|
|
8240
|
-
parentService: codec$1.u32.convert((x) => x, tryAsServiceId),
|
|
8338
|
+
class ValidatorData extends WithDebug {
|
|
8339
|
+
bandersnatch;
|
|
8340
|
+
ed25519;
|
|
8341
|
+
bls;
|
|
8342
|
+
metadata;
|
|
8343
|
+
static Codec = codec$1.Class(ValidatorData, {
|
|
8344
|
+
bandersnatch: codec$1.bytes(BANDERSNATCH_KEY_BYTES).asOpaque(),
|
|
8345
|
+
ed25519: codec$1.bytes(ED25519_KEY_BYTES).asOpaque(),
|
|
8346
|
+
bls: codec$1.bytes(BLS_KEY_BYTES).asOpaque(),
|
|
8347
|
+
metadata: codec$1.bytes(VALIDATOR_META_BYTES),
|
|
8241
8348
|
});
|
|
8242
|
-
static create(
|
|
8243
|
-
return new
|
|
8349
|
+
static create({ ed25519, bandersnatch, bls, metadata }) {
|
|
8350
|
+
return new ValidatorData(bandersnatch, ed25519, bls, metadata);
|
|
8244
8351
|
}
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8352
|
+
constructor(
|
|
8353
|
+
/** Bandersnatch public key. */
|
|
8354
|
+
bandersnatch,
|
|
8355
|
+
/** ED25519 key data. */
|
|
8356
|
+
ed25519,
|
|
8357
|
+
/** BLS public key. */
|
|
8358
|
+
bls,
|
|
8359
|
+
/** Validator-defined additional metdata. */
|
|
8360
|
+
metadata) {
|
|
8361
|
+
super();
|
|
8362
|
+
this.bandersnatch = bandersnatch;
|
|
8363
|
+
this.ed25519 = ed25519;
|
|
8364
|
+
this.bls = bls;
|
|
8365
|
+
this.metadata = metadata;
|
|
8366
|
+
}
|
|
8367
|
+
}
|
|
8368
|
+
const validatorsDataCodec = codecPerValidator(ValidatorData.Codec);
|
|
8369
|
+
|
|
8370
|
+
var SafroleSealingKeysKind;
|
|
8371
|
+
(function (SafroleSealingKeysKind) {
|
|
8372
|
+
SafroleSealingKeysKind[SafroleSealingKeysKind["Tickets"] = 0] = "Tickets";
|
|
8373
|
+
SafroleSealingKeysKind[SafroleSealingKeysKind["Keys"] = 1] = "Keys";
|
|
8374
|
+
})(SafroleSealingKeysKind || (SafroleSealingKeysKind = {}));
|
|
8375
|
+
const codecBandersnatchKey = codec$1.bytes(BANDERSNATCH_KEY_BYTES).asOpaque();
|
|
8376
|
+
class SafroleSealingKeysData extends WithDebug {
|
|
8377
|
+
kind;
|
|
8378
|
+
keys;
|
|
8379
|
+
tickets;
|
|
8380
|
+
static Codec = codecWithContext((context) => {
|
|
8381
|
+
return codec$1.custom({
|
|
8382
|
+
name: "SafroleSealingKeys",
|
|
8383
|
+
sizeHint: { bytes: 1 + HASH_SIZE * context.epochLength, isExact: false },
|
|
8384
|
+
}, (e, x) => {
|
|
8385
|
+
e.varU32(tryAsU32(x.kind));
|
|
8386
|
+
if (x.kind === SafroleSealingKeysKind.Keys) {
|
|
8387
|
+
e.sequenceFixLen(codecBandersnatchKey, x.keys);
|
|
8388
|
+
}
|
|
8389
|
+
else {
|
|
8390
|
+
e.sequenceFixLen(Ticket.Codec, x.tickets);
|
|
8391
|
+
}
|
|
8392
|
+
}, (d) => {
|
|
8393
|
+
const epochLength = context.epochLength;
|
|
8394
|
+
const kind = d.varU32();
|
|
8395
|
+
if (kind === SafroleSealingKeysKind.Keys) {
|
|
8396
|
+
const keys = d.sequenceFixLen(codecBandersnatchKey, epochLength);
|
|
8397
|
+
return SafroleSealingKeysData.keys(tryAsPerEpochBlock(keys, context));
|
|
8398
|
+
}
|
|
8399
|
+
if (kind === SafroleSealingKeysKind.Tickets) {
|
|
8400
|
+
const tickets = d.sequenceFixLen(Ticket.Codec, epochLength);
|
|
8401
|
+
return SafroleSealingKeysData.tickets(tryAsPerEpochBlock(tickets, context));
|
|
8402
|
+
}
|
|
8403
|
+
throw new Error(`Unexpected safrole sealing keys kind: ${kind}`);
|
|
8404
|
+
}, (s) => {
|
|
8405
|
+
const kind = s.decoder.varU32();
|
|
8406
|
+
if (kind === SafroleSealingKeysKind.Keys) {
|
|
8407
|
+
s.sequenceFixLen(codecBandersnatchKey, context.epochLength);
|
|
8408
|
+
return;
|
|
8409
|
+
}
|
|
8410
|
+
if (kind === SafroleSealingKeysKind.Tickets) {
|
|
8411
|
+
s.sequenceFixLen(Ticket.Codec, context.epochLength);
|
|
8412
|
+
return;
|
|
8413
|
+
}
|
|
8414
|
+
throw new Error(`Unexpected safrole sealing keys kind: ${kind}`);
|
|
8415
|
+
});
|
|
8416
|
+
});
|
|
8417
|
+
static keys(keys) {
|
|
8418
|
+
return new SafroleSealingKeysData(SafroleSealingKeysKind.Keys, keys, undefined);
|
|
8419
|
+
}
|
|
8420
|
+
static tickets(tickets) {
|
|
8421
|
+
return new SafroleSealingKeysData(SafroleSealingKeysKind.Tickets, undefined, tickets);
|
|
8422
|
+
}
|
|
8423
|
+
constructor(kind, keys, tickets) {
|
|
8424
|
+
super();
|
|
8425
|
+
this.kind = kind;
|
|
8426
|
+
this.keys = keys;
|
|
8427
|
+
this.tickets = tickets;
|
|
8428
|
+
}
|
|
8429
|
+
}
|
|
8430
|
+
class SafroleData {
|
|
8431
|
+
nextValidatorData;
|
|
8432
|
+
epochRoot;
|
|
8433
|
+
sealingKeySeries;
|
|
8434
|
+
ticketsAccumulator;
|
|
8435
|
+
static Codec = codec$1.Class(SafroleData, {
|
|
8436
|
+
nextValidatorData: codecPerValidator(ValidatorData.Codec),
|
|
8437
|
+
epochRoot: codec$1.bytes(BANDERSNATCH_RING_ROOT_BYTES).asOpaque(),
|
|
8438
|
+
sealingKeySeries: SafroleSealingKeysData.Codec,
|
|
8439
|
+
ticketsAccumulator: readonlyArray(codec$1.sequenceVarLen(Ticket.Codec)).convert(seeThrough, asKnownSize),
|
|
8440
|
+
});
|
|
8441
|
+
static create({ nextValidatorData, epochRoot, sealingKeySeries, ticketsAccumulator }) {
|
|
8442
|
+
return new SafroleData(nextValidatorData, epochRoot, sealingKeySeries, ticketsAccumulator);
|
|
8443
|
+
}
|
|
8444
|
+
constructor(
|
|
8445
|
+
/** gamma_k */
|
|
8446
|
+
nextValidatorData,
|
|
8447
|
+
/** gamma_z */
|
|
8448
|
+
epochRoot,
|
|
8449
|
+
/** gamma_s */
|
|
8450
|
+
sealingKeySeries,
|
|
8451
|
+
/** gamma_a */
|
|
8452
|
+
ticketsAccumulator) {
|
|
8453
|
+
this.nextValidatorData = nextValidatorData;
|
|
8454
|
+
this.epochRoot = epochRoot;
|
|
8455
|
+
this.sealingKeySeries = sealingKeySeries;
|
|
8456
|
+
this.ticketsAccumulator = ticketsAccumulator;
|
|
8457
|
+
}
|
|
8458
|
+
}
|
|
8459
|
+
|
|
8460
|
+
/**
|
|
8461
|
+
* `B_S`: The basic minimum balance which all services require.
|
|
8462
|
+
*
|
|
8463
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445800445800?v=0.6.7
|
|
8464
|
+
*/
|
|
8465
|
+
const BASE_SERVICE_BALANCE = 100n;
|
|
8466
|
+
/**
|
|
8467
|
+
* `B_I`: The additional minimum balance required per item of elective service state.
|
|
8468
|
+
*
|
|
8469
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445000445000?v=0.6.7
|
|
8470
|
+
*/
|
|
8471
|
+
const ELECTIVE_ITEM_BALANCE = 10n;
|
|
8472
|
+
/**
|
|
8473
|
+
* `B_L`: The additional minimum balance required per octet of elective service state.
|
|
8474
|
+
*
|
|
8475
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/445400445400?v=0.6.7
|
|
8476
|
+
*/
|
|
8477
|
+
const ELECTIVE_BYTE_BALANCE = 1n;
|
|
8478
|
+
const zeroSizeHint = {
|
|
8479
|
+
bytes: 0,
|
|
8480
|
+
isExact: true,
|
|
8481
|
+
};
|
|
8482
|
+
/** 0-byte read, return given default value */
|
|
8483
|
+
const ignoreValueWithDefault = (defaultValue) => Descriptor.new("ignoreValue", zeroSizeHint, (_e, _v) => { }, (_d) => defaultValue, (_s) => { });
|
|
8484
|
+
/** Encode and decode object with leading version number. */
|
|
8485
|
+
const codecWithVersion = (val) => Descriptor.new("withVersion", {
|
|
8486
|
+
bytes: val.sizeHint.bytes + 8,
|
|
8487
|
+
isExact: false,
|
|
8488
|
+
}, (e, v) => {
|
|
8489
|
+
e.varU64(0n);
|
|
8490
|
+
val.encode(e, v);
|
|
8491
|
+
}, (d) => {
|
|
8492
|
+
const version = d.varU64();
|
|
8493
|
+
if (version !== 0n) {
|
|
8494
|
+
throw new Error("Non-zero version is not supported!");
|
|
8495
|
+
}
|
|
8496
|
+
return val.decode(d);
|
|
8497
|
+
}, (s) => {
|
|
8498
|
+
s.varU64();
|
|
8499
|
+
val.skip(s);
|
|
8500
|
+
});
|
|
8501
|
+
/**
|
|
8502
|
+
* Service account details.
|
|
8503
|
+
*
|
|
8504
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
|
|
8505
|
+
*/
|
|
8506
|
+
class ServiceAccountInfo extends WithDebug {
|
|
8507
|
+
codeHash;
|
|
8508
|
+
balance;
|
|
8509
|
+
accumulateMinGas;
|
|
8510
|
+
onTransferMinGas;
|
|
8511
|
+
storageUtilisationBytes;
|
|
8512
|
+
gratisStorage;
|
|
8513
|
+
storageUtilisationCount;
|
|
8514
|
+
created;
|
|
8515
|
+
lastAccumulation;
|
|
8516
|
+
parentService;
|
|
8517
|
+
static Codec = codec$1.Class(ServiceAccountInfo, {
|
|
8518
|
+
codeHash: codec$1.bytes(HASH_SIZE).asOpaque(),
|
|
8519
|
+
balance: codec$1.u64,
|
|
8520
|
+
accumulateMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
|
|
8521
|
+
onTransferMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
|
|
8522
|
+
storageUtilisationBytes: codec$1.u64,
|
|
8523
|
+
gratisStorage: codec$1.u64,
|
|
8524
|
+
storageUtilisationCount: codec$1.u32,
|
|
8525
|
+
created: codec$1.u32.convert((x) => x, tryAsTimeSlot),
|
|
8526
|
+
lastAccumulation: codec$1.u32.convert((x) => x, tryAsTimeSlot),
|
|
8527
|
+
parentService: codec$1.u32.convert((x) => x, tryAsServiceId),
|
|
8528
|
+
});
|
|
8529
|
+
static create(a) {
|
|
8530
|
+
return new ServiceAccountInfo(a.codeHash, a.balance, a.accumulateMinGas, a.onTransferMinGas, a.storageUtilisationBytes, a.gratisStorage, a.storageUtilisationCount, a.created, a.lastAccumulation, a.parentService);
|
|
8531
|
+
}
|
|
8532
|
+
/**
|
|
8533
|
+
* `a_t = max(0, BS + BI * a_i + BL * a_o - a_f)`
|
|
8534
|
+
* https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
|
|
8248
8535
|
*/
|
|
8249
8536
|
static calculateThresholdBalance(items, bytes, gratisStorage) {
|
|
8250
8537
|
const storageCost = BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
|
|
@@ -8353,329 +8640,394 @@ class LookupHistoryItem {
|
|
|
8353
8640
|
}
|
|
8354
8641
|
}
|
|
8355
8642
|
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8643
|
+
const codecServiceId = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_7)
|
|
8644
|
+
? codec$1.u32.asOpaque()
|
|
8645
|
+
: codec$1.varU32.convert((s) => tryAsU32(s), (i) => tryAsServiceId(i));
|
|
8646
|
+
/**
|
|
8647
|
+
* Activity Record of a single validator.
|
|
8648
|
+
*
|
|
8649
|
+
* https://graypaper.fluffylabs.dev/#/579bd12/183701183701
|
|
8650
|
+
*/
|
|
8651
|
+
class ValidatorStatistics {
|
|
8652
|
+
blocks;
|
|
8653
|
+
tickets;
|
|
8654
|
+
preImages;
|
|
8655
|
+
preImagesSize;
|
|
8656
|
+
guarantees;
|
|
8657
|
+
assurances;
|
|
8658
|
+
static Codec = codec$1.Class(ValidatorStatistics, {
|
|
8659
|
+
blocks: codec$1.u32,
|
|
8660
|
+
tickets: codec$1.u32,
|
|
8661
|
+
preImages: codec$1.u32,
|
|
8662
|
+
preImagesSize: codec$1.u32,
|
|
8663
|
+
guarantees: codec$1.u32,
|
|
8664
|
+
assurances: codec$1.u32,
|
|
8363
8665
|
});
|
|
8364
|
-
static create({
|
|
8365
|
-
return new
|
|
8666
|
+
static create({ blocks, tickets, preImages, preImagesSize, guarantees, assurances, }) {
|
|
8667
|
+
return new ValidatorStatistics(blocks, tickets, preImages, preImagesSize, guarantees, assurances);
|
|
8366
8668
|
}
|
|
8367
8669
|
constructor(
|
|
8368
|
-
/**
|
|
8369
|
-
|
|
8370
|
-
/**
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8670
|
+
/** The number of blocks produced by the validator. */
|
|
8671
|
+
blocks,
|
|
8672
|
+
/** The number of tickets introduced by the validator. */
|
|
8673
|
+
tickets,
|
|
8674
|
+
/** The number of preimages introduced by the validator. */
|
|
8675
|
+
preImages,
|
|
8676
|
+
/** The total number of octets across all preimages introduced by the validator. */
|
|
8677
|
+
preImagesSize,
|
|
8678
|
+
/** The number of reports guaranteed by the validator. */
|
|
8679
|
+
guarantees,
|
|
8680
|
+
/** The number of availability assurances made by the validator. */
|
|
8681
|
+
assurances) {
|
|
8682
|
+
this.blocks = blocks;
|
|
8683
|
+
this.tickets = tickets;
|
|
8684
|
+
this.preImages = preImages;
|
|
8685
|
+
this.preImagesSize = preImagesSize;
|
|
8686
|
+
this.guarantees = guarantees;
|
|
8687
|
+
this.assurances = assurances;
|
|
8688
|
+
}
|
|
8689
|
+
static empty() {
|
|
8690
|
+
const zero = tryAsU32(0);
|
|
8691
|
+
return new ValidatorStatistics(zero, zero, zero, zero, zero, zero);
|
|
8374
8692
|
}
|
|
8375
8693
|
}
|
|
8694
|
+
const codecVarU16 = codec$1.varU32.convert((i) => tryAsU32(i), (o) => tryAsU16(o));
|
|
8695
|
+
/** Encode/decode unsigned gas. */
|
|
8696
|
+
const codecVarGas = codec$1.varU64.convert((g) => tryAsU64(g), (i) => tryAsServiceGas(i));
|
|
8376
8697
|
/**
|
|
8377
|
-
*
|
|
8698
|
+
* Single core statistics.
|
|
8699
|
+
* Updated per block, based on incoming work reports (`w`).
|
|
8700
|
+
*
|
|
8701
|
+
* https://graypaper.fluffylabs.dev/#/68eaa1f/18f10318f103?v=0.6.4
|
|
8702
|
+
* https://github.com/gavofyork/graypaper/blob/9bffb08f3ea7b67832019176754df4fb36b9557d/text/statistics.tex#L65
|
|
8378
8703
|
*/
|
|
8379
|
-
class
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
:
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8704
|
+
class CoreStatistics {
|
|
8705
|
+
dataAvailabilityLoad;
|
|
8706
|
+
popularity;
|
|
8707
|
+
imports;
|
|
8708
|
+
exports;
|
|
8709
|
+
extrinsicSize;
|
|
8710
|
+
extrinsicCount;
|
|
8711
|
+
bundleSize;
|
|
8712
|
+
gasUsed;
|
|
8713
|
+
static Codec = Compatibility.isGreaterOrEqual(GpVersion.V0_7_0)
|
|
8714
|
+
? codec$1.Class(CoreStatistics, {
|
|
8715
|
+
dataAvailabilityLoad: codec$1.varU32,
|
|
8716
|
+
popularity: codecVarU16,
|
|
8717
|
+
imports: codecVarU16,
|
|
8718
|
+
extrinsicCount: codecVarU16,
|
|
8719
|
+
extrinsicSize: codec$1.varU32,
|
|
8720
|
+
exports: codecVarU16,
|
|
8721
|
+
bundleSize: codec$1.varU32,
|
|
8722
|
+
gasUsed: codecVarGas,
|
|
8723
|
+
})
|
|
8724
|
+
: codec$1.Class(CoreStatistics, {
|
|
8725
|
+
dataAvailabilityLoad: codec$1.varU32,
|
|
8726
|
+
popularity: codecVarU16,
|
|
8727
|
+
imports: codecVarU16,
|
|
8728
|
+
exports: codecVarU16,
|
|
8729
|
+
extrinsicSize: codec$1.varU32,
|
|
8730
|
+
extrinsicCount: codecVarU16,
|
|
8731
|
+
bundleSize: codec$1.varU32,
|
|
8732
|
+
gasUsed: codecVarGas,
|
|
8733
|
+
});
|
|
8734
|
+
static create(v) {
|
|
8735
|
+
return new CoreStatistics(v.dataAvailabilityLoad, v.popularity, v.imports, v.exports, v.extrinsicSize, v.extrinsicCount, v.bundleSize, v.gasUsed);
|
|
8397
8736
|
}
|
|
8398
8737
|
constructor(
|
|
8399
|
-
/**
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
/**
|
|
8406
|
-
|
|
8407
|
-
/**
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
/**
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
this.
|
|
8418
|
-
this.
|
|
8419
|
-
this.
|
|
8420
|
-
this.
|
|
8421
|
-
this.
|
|
8738
|
+
/** `d` */
|
|
8739
|
+
dataAvailabilityLoad,
|
|
8740
|
+
/** `p` */
|
|
8741
|
+
popularity,
|
|
8742
|
+
/** `i` */
|
|
8743
|
+
imports,
|
|
8744
|
+
/** `e` */
|
|
8745
|
+
exports,
|
|
8746
|
+
/** `z` */
|
|
8747
|
+
extrinsicSize,
|
|
8748
|
+
/** `x` */
|
|
8749
|
+
extrinsicCount,
|
|
8750
|
+
/** `b` */
|
|
8751
|
+
bundleSize,
|
|
8752
|
+
/** `u` */
|
|
8753
|
+
gasUsed) {
|
|
8754
|
+
this.dataAvailabilityLoad = dataAvailabilityLoad;
|
|
8755
|
+
this.popularity = popularity;
|
|
8756
|
+
this.imports = imports;
|
|
8757
|
+
this.exports = exports;
|
|
8758
|
+
this.extrinsicSize = extrinsicSize;
|
|
8759
|
+
this.extrinsicCount = extrinsicCount;
|
|
8760
|
+
this.bundleSize = bundleSize;
|
|
8761
|
+
this.gasUsed = gasUsed;
|
|
8762
|
+
}
|
|
8763
|
+
static empty() {
|
|
8764
|
+
const zero = tryAsU32(0);
|
|
8765
|
+
const zero16 = tryAsU16(0);
|
|
8766
|
+
const zeroGas = tryAsServiceGas(0);
|
|
8767
|
+
return new CoreStatistics(zero, zero16, zero16, zero16, zero, zero16, zero, zeroGas);
|
|
8422
8768
|
}
|
|
8423
8769
|
}
|
|
8424
|
-
|
|
8425
8770
|
/**
|
|
8426
|
-
*
|
|
8771
|
+
* Service statistics.
|
|
8772
|
+
* Updated per block, based on available work reports (`W`).
|
|
8427
8773
|
*
|
|
8428
|
-
* https://graypaper.fluffylabs.dev/#/
|
|
8774
|
+
* https://graypaper.fluffylabs.dev/#/1c979cb/199802199802?v=0.7.1
|
|
8429
8775
|
*/
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8776
|
+
class ServiceStatistics {
|
|
8777
|
+
providedCount;
|
|
8778
|
+
providedSize;
|
|
8779
|
+
refinementCount;
|
|
8780
|
+
refinementGasUsed;
|
|
8781
|
+
imports;
|
|
8782
|
+
exports;
|
|
8783
|
+
extrinsicSize;
|
|
8784
|
+
extrinsicCount;
|
|
8785
|
+
accumulateCount;
|
|
8786
|
+
accumulateGasUsed;
|
|
8787
|
+
onTransfersCount;
|
|
8788
|
+
onTransfersGasUsed;
|
|
8789
|
+
static Codec = Compatibility.selectIfGreaterOrEqual({
|
|
8790
|
+
fallback: codec$1.Class(ServiceStatistics, {
|
|
8791
|
+
providedCount: codecVarU16,
|
|
8792
|
+
providedSize: codec$1.varU32,
|
|
8793
|
+
refinementCount: codec$1.varU32,
|
|
8794
|
+
refinementGasUsed: codecVarGas,
|
|
8795
|
+
imports: codecVarU16,
|
|
8796
|
+
exports: codecVarU16,
|
|
8797
|
+
extrinsicSize: codec$1.varU32,
|
|
8798
|
+
extrinsicCount: codecVarU16,
|
|
8799
|
+
accumulateCount: codec$1.varU32,
|
|
8800
|
+
accumulateGasUsed: codecVarGas,
|
|
8801
|
+
onTransfersCount: codec$1.varU32,
|
|
8802
|
+
onTransfersGasUsed: codecVarGas,
|
|
8803
|
+
}),
|
|
8804
|
+
versions: {
|
|
8805
|
+
[GpVersion.V0_7_0]: codec$1.Class(ServiceStatistics, {
|
|
8806
|
+
providedCount: codecVarU16,
|
|
8807
|
+
providedSize: codec$1.varU32,
|
|
8808
|
+
refinementCount: codec$1.varU32,
|
|
8809
|
+
refinementGasUsed: codecVarGas,
|
|
8810
|
+
imports: codecVarU16,
|
|
8811
|
+
extrinsicCount: codecVarU16,
|
|
8812
|
+
extrinsicSize: codec$1.varU32,
|
|
8813
|
+
exports: codecVarU16,
|
|
8814
|
+
accumulateCount: codec$1.varU32,
|
|
8815
|
+
accumulateGasUsed: codecVarGas,
|
|
8816
|
+
onTransfersCount: codec$1.varU32,
|
|
8817
|
+
onTransfersGasUsed: codecVarGas,
|
|
8818
|
+
}),
|
|
8819
|
+
[GpVersion.V0_7_1]: codec$1.Class(ServiceStatistics, {
|
|
8820
|
+
providedCount: codecVarU16,
|
|
8821
|
+
providedSize: codec$1.varU32,
|
|
8822
|
+
refinementCount: codec$1.varU32,
|
|
8823
|
+
refinementGasUsed: codecVarGas,
|
|
8824
|
+
imports: codecVarU16,
|
|
8825
|
+
extrinsicCount: codecVarU16,
|
|
8826
|
+
extrinsicSize: codec$1.varU32,
|
|
8827
|
+
exports: codecVarU16,
|
|
8828
|
+
accumulateCount: codec$1.varU32,
|
|
8829
|
+
accumulateGasUsed: codecVarGas,
|
|
8830
|
+
onTransfersCount: ignoreValueWithDefault(tryAsU32(0)),
|
|
8831
|
+
onTransfersGasUsed: ignoreValueWithDefault(tryAsServiceGas(0)),
|
|
8832
|
+
}),
|
|
8833
|
+
},
|
|
8442
8834
|
});
|
|
8443
|
-
static create(
|
|
8444
|
-
return new
|
|
8835
|
+
static create(v) {
|
|
8836
|
+
return new ServiceStatistics(v.providedCount, v.providedSize, v.refinementCount, v.refinementGasUsed, v.imports, v.exports, v.extrinsicSize, v.extrinsicCount, v.accumulateCount, v.accumulateGasUsed, v.onTransfersCount, v.onTransfersGasUsed);
|
|
8445
8837
|
}
|
|
8446
8838
|
constructor(
|
|
8447
|
-
/**
|
|
8448
|
-
|
|
8449
|
-
/**
|
|
8450
|
-
|
|
8451
|
-
/**
|
|
8452
|
-
|
|
8453
|
-
/**
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8839
|
+
/** `p.0` */
|
|
8840
|
+
providedCount,
|
|
8841
|
+
/** `p.1` */
|
|
8842
|
+
providedSize,
|
|
8843
|
+
/** `r.0` */
|
|
8844
|
+
refinementCount,
|
|
8845
|
+
/** `r.1` */
|
|
8846
|
+
refinementGasUsed,
|
|
8847
|
+
/** `i` */
|
|
8848
|
+
imports,
|
|
8849
|
+
/** `e` */
|
|
8850
|
+
exports,
|
|
8851
|
+
/** `z` */
|
|
8852
|
+
extrinsicSize,
|
|
8853
|
+
/** `x` */
|
|
8854
|
+
extrinsicCount,
|
|
8855
|
+
/** `a.0` */
|
|
8856
|
+
accumulateCount,
|
|
8857
|
+
/** `a.1` */
|
|
8858
|
+
accumulateGasUsed,
|
|
8859
|
+
/** `t.0` @deprecated since 0.7.1 */
|
|
8860
|
+
onTransfersCount,
|
|
8861
|
+
/** `t.1` @deprecated since 0.7.1 */
|
|
8862
|
+
onTransfersGasUsed) {
|
|
8863
|
+
this.providedCount = providedCount;
|
|
8864
|
+
this.providedSize = providedSize;
|
|
8865
|
+
this.refinementCount = refinementCount;
|
|
8866
|
+
this.refinementGasUsed = refinementGasUsed;
|
|
8867
|
+
this.imports = imports;
|
|
8868
|
+
this.exports = exports;
|
|
8869
|
+
this.extrinsicSize = extrinsicSize;
|
|
8870
|
+
this.extrinsicCount = extrinsicCount;
|
|
8871
|
+
this.accumulateCount = accumulateCount;
|
|
8872
|
+
this.accumulateGasUsed = accumulateGasUsed;
|
|
8873
|
+
this.onTransfersCount = onTransfersCount;
|
|
8874
|
+
this.onTransfersGasUsed = onTransfersGasUsed;
|
|
8875
|
+
}
|
|
8876
|
+
static empty() {
|
|
8877
|
+
const zero = tryAsU32(0);
|
|
8878
|
+
const zero16 = tryAsU16(0);
|
|
8879
|
+
const zeroGas = tryAsServiceGas(0);
|
|
8880
|
+
return new ServiceStatistics(zero16, zero, zero, zeroGas, zero16, zero16, zero, zero16, zero, zeroGas, zero, zeroGas);
|
|
8460
8881
|
}
|
|
8461
8882
|
}
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8883
|
+
/** `pi`: Statistics of each validator, cores statistics and services statistics. */
|
|
8884
|
+
class StatisticsData {
|
|
8885
|
+
current;
|
|
8886
|
+
previous;
|
|
8887
|
+
cores;
|
|
8888
|
+
services;
|
|
8889
|
+
static Codec = codec$1.Class(StatisticsData, {
|
|
8890
|
+
current: codecPerValidator(ValidatorStatistics.Codec),
|
|
8891
|
+
previous: codecPerValidator(ValidatorStatistics.Codec),
|
|
8892
|
+
cores: codecPerCore(CoreStatistics.Codec),
|
|
8893
|
+
services: codec$1.dictionary(codecServiceId, ServiceStatistics.Codec, {
|
|
8894
|
+
sortKeys: (a, b) => a - b,
|
|
8473
8895
|
}),
|
|
8474
8896
|
});
|
|
8475
|
-
static create(
|
|
8476
|
-
return new
|
|
8897
|
+
static create(v) {
|
|
8898
|
+
return new StatisticsData(v.current, v.previous, v.cores, v.services);
|
|
8477
8899
|
}
|
|
8478
|
-
constructor(
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
blocks,
|
|
8484
|
-
/**
|
|
8485
|
-
* Accumulation output log.
|
|
8486
|
-
* https://graypaper.fluffylabs.dev/#/7e6ff6a/0f02020f0202?v=0.6.7
|
|
8487
|
-
*/
|
|
8488
|
-
accumulationLog) {
|
|
8489
|
-
super();
|
|
8490
|
-
this.blocks = blocks;
|
|
8491
|
-
this.accumulationLog = accumulationLog;
|
|
8900
|
+
constructor(current, previous, cores, services) {
|
|
8901
|
+
this.current = current;
|
|
8902
|
+
this.previous = previous;
|
|
8903
|
+
this.cores = cores;
|
|
8904
|
+
this.services = services;
|
|
8492
8905
|
}
|
|
8493
8906
|
}
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
static Codec = Descriptor.new("RecentBlocksHistory", RecentBlocks.Codec.sizeHint, (encoder, value) => RecentBlocks.Codec.encode(encoder, value.asCurrent()), (decoder) => {
|
|
8502
|
-
const recentBlocks = RecentBlocks.Codec.decode(decoder);
|
|
8503
|
-
return RecentBlocksHistory.create(recentBlocks);
|
|
8504
|
-
}, (skip) => {
|
|
8505
|
-
return RecentBlocks.Codec.skip(skip);
|
|
8506
|
-
});
|
|
8507
|
-
static create(recentBlocks) {
|
|
8508
|
-
return new RecentBlocksHistory(recentBlocks);
|
|
8907
|
+
|
|
8908
|
+
class InMemoryStateView {
|
|
8909
|
+
chainSpec;
|
|
8910
|
+
state;
|
|
8911
|
+
constructor(chainSpec, state) {
|
|
8912
|
+
this.chainSpec = chainSpec;
|
|
8913
|
+
this.state = state;
|
|
8509
8914
|
}
|
|
8510
|
-
|
|
8511
|
-
return
|
|
8512
|
-
blocks: asKnownSize([]),
|
|
8513
|
-
accumulationLog: { peaks: [] },
|
|
8514
|
-
}));
|
|
8915
|
+
availabilityAssignmentView() {
|
|
8916
|
+
return reencodeAsView(availabilityAssignmentsCodec, this.state.availabilityAssignment, this.chainSpec);
|
|
8515
8917
|
}
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
*/
|
|
8519
|
-
static accumulationResult(block) {
|
|
8520
|
-
return block.accumulationResult;
|
|
8918
|
+
designatedValidatorDataView() {
|
|
8919
|
+
return reencodeAsView(validatorsDataCodec, this.state.designatedValidatorData, this.chainSpec);
|
|
8521
8920
|
}
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
this.current = current;
|
|
8921
|
+
currentValidatorDataView() {
|
|
8922
|
+
return reencodeAsView(validatorsDataCodec, this.state.currentValidatorData, this.chainSpec);
|
|
8525
8923
|
}
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
if (this.current !== null) {
|
|
8529
|
-
return this.current.blocks;
|
|
8530
|
-
}
|
|
8531
|
-
throw new Error("RecentBlocksHistory is in invalid state");
|
|
8924
|
+
previousValidatorDataView() {
|
|
8925
|
+
return reencodeAsView(validatorsDataCodec, this.state.previousValidatorData, this.chainSpec);
|
|
8532
8926
|
}
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
throw new Error("Cannot access current RecentBlocks format");
|
|
8536
|
-
}
|
|
8537
|
-
return this.current;
|
|
8927
|
+
authPoolsView() {
|
|
8928
|
+
return reencodeAsView(authPoolsCodec, this.state.authPools, this.chainSpec);
|
|
8538
8929
|
}
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
return RecentBlocksHistory.create(RecentBlocks.create({
|
|
8542
|
-
...this.current,
|
|
8543
|
-
blocks: asOpaqueType(blocks),
|
|
8544
|
-
}));
|
|
8545
|
-
}
|
|
8546
|
-
throw new Error("RecentBlocksHistory is in invalid state. Cannot be updated!");
|
|
8930
|
+
authQueuesView() {
|
|
8931
|
+
return reencodeAsView(authQueuesCodec, this.state.authQueues, this.chainSpec);
|
|
8547
8932
|
}
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
/**
|
|
8551
|
-
* Fixed size of validator metadata.
|
|
8552
|
-
*
|
|
8553
|
-
* https://graypaper.fluffylabs.dev/#/5f542d7/0d55010d5501
|
|
8554
|
-
*/
|
|
8555
|
-
const VALIDATOR_META_BYTES = 128;
|
|
8556
|
-
/**
|
|
8557
|
-
* Details about validators' identity.
|
|
8558
|
-
*
|
|
8559
|
-
* https://graypaper.fluffylabs.dev/#/5f542d7/0d4b010d4c01
|
|
8560
|
-
*/
|
|
8561
|
-
class ValidatorData extends WithDebug {
|
|
8562
|
-
bandersnatch;
|
|
8563
|
-
ed25519;
|
|
8564
|
-
bls;
|
|
8565
|
-
metadata;
|
|
8566
|
-
static Codec = codec$1.Class(ValidatorData, {
|
|
8567
|
-
bandersnatch: codec$1.bytes(BANDERSNATCH_KEY_BYTES).asOpaque(),
|
|
8568
|
-
ed25519: codec$1.bytes(ED25519_KEY_BYTES).asOpaque(),
|
|
8569
|
-
bls: codec$1.bytes(BLS_KEY_BYTES).asOpaque(),
|
|
8570
|
-
metadata: codec$1.bytes(VALIDATOR_META_BYTES),
|
|
8571
|
-
});
|
|
8572
|
-
static create({ ed25519, bandersnatch, bls, metadata }) {
|
|
8573
|
-
return new ValidatorData(bandersnatch, ed25519, bls, metadata);
|
|
8933
|
+
recentBlocksView() {
|
|
8934
|
+
return reencodeAsView(RecentBlocks.Codec, this.state.recentBlocks, this.chainSpec);
|
|
8574
8935
|
}
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8936
|
+
statisticsView() {
|
|
8937
|
+
return reencodeAsView(StatisticsData.Codec, this.state.statistics, this.chainSpec);
|
|
8938
|
+
}
|
|
8939
|
+
accumulationQueueView() {
|
|
8940
|
+
return reencodeAsView(accumulationQueueCodec, this.state.accumulationQueue, this.chainSpec);
|
|
8941
|
+
}
|
|
8942
|
+
recentlyAccumulatedView() {
|
|
8943
|
+
return reencodeAsView(recentlyAccumulatedCodec, this.state.recentlyAccumulated, this.chainSpec);
|
|
8944
|
+
}
|
|
8945
|
+
safroleDataView() {
|
|
8946
|
+
// TODO [ToDr] Consider exposting `safrole` from state
|
|
8947
|
+
// instead of individual fields
|
|
8948
|
+
const safrole = SafroleData.create({
|
|
8949
|
+
nextValidatorData: this.state.nextValidatorData,
|
|
8950
|
+
epochRoot: this.state.epochRoot,
|
|
8951
|
+
sealingKeySeries: this.state.sealingKeySeries,
|
|
8952
|
+
ticketsAccumulator: this.state.ticketsAccumulator,
|
|
8953
|
+
});
|
|
8954
|
+
return reencodeAsView(SafroleData.Codec, safrole, this.chainSpec);
|
|
8955
|
+
}
|
|
8956
|
+
getServiceInfoView(id) {
|
|
8957
|
+
const service = this.state.getService(id);
|
|
8958
|
+
if (service === null) {
|
|
8959
|
+
return null;
|
|
8960
|
+
}
|
|
8961
|
+
return reencodeAsView(ServiceAccountInfo.Codec, service.getInfo(), this.chainSpec);
|
|
8589
8962
|
}
|
|
8590
8963
|
}
|
|
8591
8964
|
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
kind;
|
|
8600
|
-
keys;
|
|
8601
|
-
tickets;
|
|
8602
|
-
static Codec = codecWithContext((context) => {
|
|
8603
|
-
return codec$1.custom({
|
|
8604
|
-
name: "SafroleSealingKeys",
|
|
8605
|
-
sizeHint: { bytes: 1 + HASH_SIZE * context.epochLength, isExact: false },
|
|
8606
|
-
}, (e, x) => {
|
|
8607
|
-
e.varU32(tryAsU32(x.kind));
|
|
8608
|
-
if (x.kind === SafroleSealingKeysKind.Keys) {
|
|
8609
|
-
e.sequenceFixLen(codecBandersnatchKey, x.keys);
|
|
8610
|
-
}
|
|
8611
|
-
else {
|
|
8612
|
-
e.sequenceFixLen(Ticket.Codec, x.tickets);
|
|
8613
|
-
}
|
|
8614
|
-
}, (d) => {
|
|
8615
|
-
const epochLength = context.epochLength;
|
|
8616
|
-
const kind = d.varU32();
|
|
8617
|
-
if (kind === SafroleSealingKeysKind.Keys) {
|
|
8618
|
-
const keys = d.sequenceFixLen(codecBandersnatchKey, epochLength);
|
|
8619
|
-
return SafroleSealingKeysData.keys(tryAsPerEpochBlock(keys, context));
|
|
8620
|
-
}
|
|
8621
|
-
if (kind === SafroleSealingKeysKind.Tickets) {
|
|
8622
|
-
const tickets = d.sequenceFixLen(Ticket.Codec, epochLength);
|
|
8623
|
-
return SafroleSealingKeysData.tickets(tryAsPerEpochBlock(tickets, context));
|
|
8624
|
-
}
|
|
8625
|
-
throw new Error(`Unexpected safrole sealing keys kind: ${kind}`);
|
|
8626
|
-
}, (s) => {
|
|
8627
|
-
const kind = s.decoder.varU32();
|
|
8628
|
-
if (kind === SafroleSealingKeysKind.Keys) {
|
|
8629
|
-
s.sequenceFixLen(codecBandersnatchKey, context.epochLength);
|
|
8630
|
-
return;
|
|
8631
|
-
}
|
|
8632
|
-
if (kind === SafroleSealingKeysKind.Tickets) {
|
|
8633
|
-
s.sequenceFixLen(Ticket.Codec, context.epochLength);
|
|
8634
|
-
return;
|
|
8635
|
-
}
|
|
8636
|
-
throw new Error(`Unexpected safrole sealing keys kind: ${kind}`);
|
|
8637
|
-
});
|
|
8965
|
+
/** Dictionary entry of services that auto-accumulate every block. */
|
|
8966
|
+
class AutoAccumulate {
|
|
8967
|
+
service;
|
|
8968
|
+
gasLimit;
|
|
8969
|
+
static Codec = codec$1.Class(AutoAccumulate, {
|
|
8970
|
+
service: codec$1.u32.asOpaque(),
|
|
8971
|
+
gasLimit: codec$1.u64.asOpaque(),
|
|
8638
8972
|
});
|
|
8639
|
-
static
|
|
8640
|
-
return new
|
|
8641
|
-
}
|
|
8642
|
-
static tickets(tickets) {
|
|
8643
|
-
return new SafroleSealingKeysData(SafroleSealingKeysKind.Tickets, undefined, tickets);
|
|
8973
|
+
static create({ service, gasLimit }) {
|
|
8974
|
+
return new AutoAccumulate(service, gasLimit);
|
|
8644
8975
|
}
|
|
8645
|
-
constructor(
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8976
|
+
constructor(
|
|
8977
|
+
/** Service id that auto-accumulates. */
|
|
8978
|
+
service,
|
|
8979
|
+
/** Gas limit for auto-accumulation. */
|
|
8980
|
+
gasLimit) {
|
|
8981
|
+
this.service = service;
|
|
8982
|
+
this.gasLimit = gasLimit;
|
|
8650
8983
|
}
|
|
8651
8984
|
}
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8985
|
+
/**
|
|
8986
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/114402114402?v=0.7.2
|
|
8987
|
+
*/
|
|
8988
|
+
class PrivilegedServices {
|
|
8989
|
+
manager;
|
|
8990
|
+
delegator;
|
|
8991
|
+
registrar;
|
|
8992
|
+
assigners;
|
|
8993
|
+
autoAccumulateServices;
|
|
8994
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bbd023bcb02?v=0.7.2 */
|
|
8995
|
+
static Codec = codec$1.Class(PrivilegedServices, {
|
|
8996
|
+
manager: codec$1.u32.asOpaque(),
|
|
8997
|
+
assigners: codecPerCore(codec$1.u32.asOpaque()),
|
|
8998
|
+
delegator: codec$1.u32.asOpaque(),
|
|
8999
|
+
registrar: Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)
|
|
9000
|
+
? codec$1.u32.asOpaque()
|
|
9001
|
+
: ignoreValueWithDefault(tryAsServiceId(2 ** 32 - 1)),
|
|
9002
|
+
autoAccumulateServices: readonlyArray(codec$1.sequenceVarLen(AutoAccumulate.Codec)),
|
|
8662
9003
|
});
|
|
8663
|
-
static create(
|
|
8664
|
-
return new
|
|
9004
|
+
static create(a) {
|
|
9005
|
+
return new PrivilegedServices(a.manager, a.delegator, a.registrar, a.assigners, a.autoAccumulateServices);
|
|
8665
9006
|
}
|
|
8666
9007
|
constructor(
|
|
8667
|
-
/**
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
/**
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
9008
|
+
/**
|
|
9009
|
+
* `χ_M`: Manages alteration of χ from block to block,
|
|
9010
|
+
* as well as bestow services with storage deposit credits.
|
|
9011
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/111502111902?v=0.7.2
|
|
9012
|
+
*/
|
|
9013
|
+
manager,
|
|
9014
|
+
/** `χ_V`: Managers validator keys. */
|
|
9015
|
+
delegator,
|
|
9016
|
+
/**
|
|
9017
|
+
* `χ_R`: Manages the creation of services in protected range.
|
|
9018
|
+
*
|
|
9019
|
+
* https://graypaper.fluffylabs.dev/#/ab2cdbd/111b02111d02?v=0.7.2
|
|
9020
|
+
*/
|
|
9021
|
+
registrar,
|
|
9022
|
+
/** `χ_A`: Manages authorization queue one for each core. */
|
|
9023
|
+
assigners,
|
|
9024
|
+
/** `χ_Z`: Dictionary of services that auto-accumulate every block with their gas limit. */
|
|
9025
|
+
autoAccumulateServices) {
|
|
9026
|
+
this.manager = manager;
|
|
9027
|
+
this.delegator = delegator;
|
|
9028
|
+
this.registrar = registrar;
|
|
9029
|
+
this.assigners = assigners;
|
|
9030
|
+
this.autoAccumulateServices = autoAccumulateServices;
|
|
8679
9031
|
}
|
|
8680
9032
|
}
|
|
8681
9033
|
|
|
@@ -8785,319 +9137,54 @@ class UpdateService {
|
|
|
8785
9137
|
static update({ serviceId, serviceInfo }) {
|
|
8786
9138
|
return new UpdateService(serviceId, {
|
|
8787
9139
|
kind: UpdateServiceKind.Update,
|
|
8788
|
-
account: serviceInfo,
|
|
8789
|
-
});
|
|
8790
|
-
}
|
|
8791
|
-
static create({ serviceId, serviceInfo, lookupHistory, }) {
|
|
8792
|
-
return new UpdateService(serviceId, {
|
|
8793
|
-
kind: UpdateServiceKind.Create,
|
|
8794
|
-
account: serviceInfo,
|
|
8795
|
-
lookupHistory,
|
|
8796
|
-
});
|
|
8797
|
-
}
|
|
8798
|
-
}
|
|
8799
|
-
/** Update service storage kind. */
|
|
8800
|
-
var UpdateStorageKind;
|
|
8801
|
-
(function (UpdateStorageKind) {
|
|
8802
|
-
/** Set a storage value. */
|
|
8803
|
-
UpdateStorageKind[UpdateStorageKind["Set"] = 0] = "Set";
|
|
8804
|
-
/** Remove a storage value. */
|
|
8805
|
-
UpdateStorageKind[UpdateStorageKind["Remove"] = 1] = "Remove";
|
|
8806
|
-
})(UpdateStorageKind || (UpdateStorageKind = {}));
|
|
8807
|
-
/**
|
|
8808
|
-
* Update service storage item.
|
|
8809
|
-
*
|
|
8810
|
-
* Can either create/modify an entry or remove it.
|
|
8811
|
-
*/
|
|
8812
|
-
class UpdateStorage {
|
|
8813
|
-
serviceId;
|
|
8814
|
-
action;
|
|
8815
|
-
constructor(serviceId, action) {
|
|
8816
|
-
this.serviceId = serviceId;
|
|
8817
|
-
this.action = action;
|
|
8818
|
-
}
|
|
8819
|
-
static set({ serviceId, storage }) {
|
|
8820
|
-
return new UpdateStorage(serviceId, { kind: UpdateStorageKind.Set, storage });
|
|
8821
|
-
}
|
|
8822
|
-
static remove({ serviceId, key }) {
|
|
8823
|
-
return new UpdateStorage(serviceId, { kind: UpdateStorageKind.Remove, key });
|
|
8824
|
-
}
|
|
8825
|
-
get key() {
|
|
8826
|
-
if (this.action.kind === UpdateStorageKind.Remove) {
|
|
8827
|
-
return this.action.key;
|
|
8828
|
-
}
|
|
8829
|
-
return this.action.storage.key;
|
|
8830
|
-
}
|
|
8831
|
-
get value() {
|
|
8832
|
-
if (this.action.kind === UpdateStorageKind.Remove) {
|
|
8833
|
-
return null;
|
|
8834
|
-
}
|
|
8835
|
-
return this.action.storage.value;
|
|
8836
|
-
}
|
|
8837
|
-
}
|
|
8838
|
-
|
|
8839
|
-
const codecServiceId = Compatibility.isSuite(TestSuite.W3F_DAVXY) || Compatibility.isSuite(TestSuite.JAMDUNA, GpVersion.V0_6_7)
|
|
8840
|
-
? codec$1.u32.asOpaque()
|
|
8841
|
-
: codec$1.varU32.convert((s) => tryAsU32(s), (i) => tryAsServiceId(i));
|
|
8842
|
-
/**
|
|
8843
|
-
* Activity Record of a single validator.
|
|
8844
|
-
*
|
|
8845
|
-
* https://graypaper.fluffylabs.dev/#/579bd12/183701183701
|
|
8846
|
-
*/
|
|
8847
|
-
class ValidatorStatistics {
|
|
8848
|
-
blocks;
|
|
8849
|
-
tickets;
|
|
8850
|
-
preImages;
|
|
8851
|
-
preImagesSize;
|
|
8852
|
-
guarantees;
|
|
8853
|
-
assurances;
|
|
8854
|
-
static Codec = codec$1.Class(ValidatorStatistics, {
|
|
8855
|
-
blocks: codec$1.u32,
|
|
8856
|
-
tickets: codec$1.u32,
|
|
8857
|
-
preImages: codec$1.u32,
|
|
8858
|
-
preImagesSize: codec$1.u32,
|
|
8859
|
-
guarantees: codec$1.u32,
|
|
8860
|
-
assurances: codec$1.u32,
|
|
8861
|
-
});
|
|
8862
|
-
static create({ blocks, tickets, preImages, preImagesSize, guarantees, assurances, }) {
|
|
8863
|
-
return new ValidatorStatistics(blocks, tickets, preImages, preImagesSize, guarantees, assurances);
|
|
8864
|
-
}
|
|
8865
|
-
constructor(
|
|
8866
|
-
/** The number of blocks produced by the validator. */
|
|
8867
|
-
blocks,
|
|
8868
|
-
/** The number of tickets introduced by the validator. */
|
|
8869
|
-
tickets,
|
|
8870
|
-
/** The number of preimages introduced by the validator. */
|
|
8871
|
-
preImages,
|
|
8872
|
-
/** The total number of octets across all preimages introduced by the validator. */
|
|
8873
|
-
preImagesSize,
|
|
8874
|
-
/** The number of reports guaranteed by the validator. */
|
|
8875
|
-
guarantees,
|
|
8876
|
-
/** The number of availability assurances made by the validator. */
|
|
8877
|
-
assurances) {
|
|
8878
|
-
this.blocks = blocks;
|
|
8879
|
-
this.tickets = tickets;
|
|
8880
|
-
this.preImages = preImages;
|
|
8881
|
-
this.preImagesSize = preImagesSize;
|
|
8882
|
-
this.guarantees = guarantees;
|
|
8883
|
-
this.assurances = assurances;
|
|
8884
|
-
}
|
|
8885
|
-
static empty() {
|
|
8886
|
-
const zero = tryAsU32(0);
|
|
8887
|
-
return new ValidatorStatistics(zero, zero, zero, zero, zero, zero);
|
|
8888
|
-
}
|
|
8889
|
-
}
|
|
8890
|
-
const codecVarU16 = codec$1.varU32.convert((i) => tryAsU32(i), (o) => tryAsU16(o));
|
|
8891
|
-
/** Encode/decode unsigned gas. */
|
|
8892
|
-
const codecVarGas = codec$1.varU64.convert((g) => tryAsU64(g), (i) => tryAsServiceGas(i));
|
|
8893
|
-
/**
|
|
8894
|
-
* Single core statistics.
|
|
8895
|
-
* Updated per block, based on incoming work reports (`w`).
|
|
8896
|
-
*
|
|
8897
|
-
* https://graypaper.fluffylabs.dev/#/68eaa1f/18f10318f103?v=0.6.4
|
|
8898
|
-
* https://github.com/gavofyork/graypaper/blob/9bffb08f3ea7b67832019176754df4fb36b9557d/text/statistics.tex#L65
|
|
8899
|
-
*/
|
|
8900
|
-
class CoreStatistics {
|
|
8901
|
-
dataAvailabilityLoad;
|
|
8902
|
-
popularity;
|
|
8903
|
-
imports;
|
|
8904
|
-
exports;
|
|
8905
|
-
extrinsicSize;
|
|
8906
|
-
extrinsicCount;
|
|
8907
|
-
bundleSize;
|
|
8908
|
-
gasUsed;
|
|
8909
|
-
static Codec = Compatibility.isGreaterOrEqual(GpVersion.V0_7_0)
|
|
8910
|
-
? codec$1.Class(CoreStatistics, {
|
|
8911
|
-
dataAvailabilityLoad: codec$1.varU32,
|
|
8912
|
-
popularity: codecVarU16,
|
|
8913
|
-
imports: codecVarU16,
|
|
8914
|
-
extrinsicCount: codecVarU16,
|
|
8915
|
-
extrinsicSize: codec$1.varU32,
|
|
8916
|
-
exports: codecVarU16,
|
|
8917
|
-
bundleSize: codec$1.varU32,
|
|
8918
|
-
gasUsed: codecVarGas,
|
|
8919
|
-
})
|
|
8920
|
-
: codec$1.Class(CoreStatistics, {
|
|
8921
|
-
dataAvailabilityLoad: codec$1.varU32,
|
|
8922
|
-
popularity: codecVarU16,
|
|
8923
|
-
imports: codecVarU16,
|
|
8924
|
-
exports: codecVarU16,
|
|
8925
|
-
extrinsicSize: codec$1.varU32,
|
|
8926
|
-
extrinsicCount: codecVarU16,
|
|
8927
|
-
bundleSize: codec$1.varU32,
|
|
8928
|
-
gasUsed: codecVarGas,
|
|
8929
|
-
});
|
|
8930
|
-
static create(v) {
|
|
8931
|
-
return new CoreStatistics(v.dataAvailabilityLoad, v.popularity, v.imports, v.exports, v.extrinsicSize, v.extrinsicCount, v.bundleSize, v.gasUsed);
|
|
8932
|
-
}
|
|
8933
|
-
constructor(
|
|
8934
|
-
/** `d` */
|
|
8935
|
-
dataAvailabilityLoad,
|
|
8936
|
-
/** `p` */
|
|
8937
|
-
popularity,
|
|
8938
|
-
/** `i` */
|
|
8939
|
-
imports,
|
|
8940
|
-
/** `e` */
|
|
8941
|
-
exports,
|
|
8942
|
-
/** `z` */
|
|
8943
|
-
extrinsicSize,
|
|
8944
|
-
/** `x` */
|
|
8945
|
-
extrinsicCount,
|
|
8946
|
-
/** `b` */
|
|
8947
|
-
bundleSize,
|
|
8948
|
-
/** `u` */
|
|
8949
|
-
gasUsed) {
|
|
8950
|
-
this.dataAvailabilityLoad = dataAvailabilityLoad;
|
|
8951
|
-
this.popularity = popularity;
|
|
8952
|
-
this.imports = imports;
|
|
8953
|
-
this.exports = exports;
|
|
8954
|
-
this.extrinsicSize = extrinsicSize;
|
|
8955
|
-
this.extrinsicCount = extrinsicCount;
|
|
8956
|
-
this.bundleSize = bundleSize;
|
|
8957
|
-
this.gasUsed = gasUsed;
|
|
8958
|
-
}
|
|
8959
|
-
static empty() {
|
|
8960
|
-
const zero = tryAsU32(0);
|
|
8961
|
-
const zero16 = tryAsU16(0);
|
|
8962
|
-
const zeroGas = tryAsServiceGas(0);
|
|
8963
|
-
return new CoreStatistics(zero, zero16, zero16, zero16, zero, zero16, zero, zeroGas);
|
|
9140
|
+
account: serviceInfo,
|
|
9141
|
+
});
|
|
9142
|
+
}
|
|
9143
|
+
static create({ serviceId, serviceInfo, lookupHistory, }) {
|
|
9144
|
+
return new UpdateService(serviceId, {
|
|
9145
|
+
kind: UpdateServiceKind.Create,
|
|
9146
|
+
account: serviceInfo,
|
|
9147
|
+
lookupHistory,
|
|
9148
|
+
});
|
|
8964
9149
|
}
|
|
8965
9150
|
}
|
|
9151
|
+
/** Update service storage kind. */
|
|
9152
|
+
var UpdateStorageKind;
|
|
9153
|
+
(function (UpdateStorageKind) {
|
|
9154
|
+
/** Set a storage value. */
|
|
9155
|
+
UpdateStorageKind[UpdateStorageKind["Set"] = 0] = "Set";
|
|
9156
|
+
/** Remove a storage value. */
|
|
9157
|
+
UpdateStorageKind[UpdateStorageKind["Remove"] = 1] = "Remove";
|
|
9158
|
+
})(UpdateStorageKind || (UpdateStorageKind = {}));
|
|
8966
9159
|
/**
|
|
8967
|
-
*
|
|
8968
|
-
* Updated per block, based on available work reports (`W`).
|
|
9160
|
+
* Update service storage item.
|
|
8969
9161
|
*
|
|
8970
|
-
*
|
|
9162
|
+
* Can either create/modify an entry or remove it.
|
|
8971
9163
|
*/
|
|
8972
|
-
class
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
exports;
|
|
8979
|
-
extrinsicSize;
|
|
8980
|
-
extrinsicCount;
|
|
8981
|
-
accumulateCount;
|
|
8982
|
-
accumulateGasUsed;
|
|
8983
|
-
onTransfersCount;
|
|
8984
|
-
onTransfersGasUsed;
|
|
8985
|
-
static Codec = Compatibility.selectIfGreaterOrEqual({
|
|
8986
|
-
fallback: codec$1.Class(ServiceStatistics, {
|
|
8987
|
-
providedCount: codecVarU16,
|
|
8988
|
-
providedSize: codec$1.varU32,
|
|
8989
|
-
refinementCount: codec$1.varU32,
|
|
8990
|
-
refinementGasUsed: codecVarGas,
|
|
8991
|
-
imports: codecVarU16,
|
|
8992
|
-
exports: codecVarU16,
|
|
8993
|
-
extrinsicSize: codec$1.varU32,
|
|
8994
|
-
extrinsicCount: codecVarU16,
|
|
8995
|
-
accumulateCount: codec$1.varU32,
|
|
8996
|
-
accumulateGasUsed: codecVarGas,
|
|
8997
|
-
onTransfersCount: codec$1.varU32,
|
|
8998
|
-
onTransfersGasUsed: codecVarGas,
|
|
8999
|
-
}),
|
|
9000
|
-
versions: {
|
|
9001
|
-
[GpVersion.V0_7_0]: codec$1.Class(ServiceStatistics, {
|
|
9002
|
-
providedCount: codecVarU16,
|
|
9003
|
-
providedSize: codec$1.varU32,
|
|
9004
|
-
refinementCount: codec$1.varU32,
|
|
9005
|
-
refinementGasUsed: codecVarGas,
|
|
9006
|
-
imports: codecVarU16,
|
|
9007
|
-
extrinsicCount: codecVarU16,
|
|
9008
|
-
extrinsicSize: codec$1.varU32,
|
|
9009
|
-
exports: codecVarU16,
|
|
9010
|
-
accumulateCount: codec$1.varU32,
|
|
9011
|
-
accumulateGasUsed: codecVarGas,
|
|
9012
|
-
onTransfersCount: codec$1.varU32,
|
|
9013
|
-
onTransfersGasUsed: codecVarGas,
|
|
9014
|
-
}),
|
|
9015
|
-
[GpVersion.V0_7_1]: codec$1.Class(ServiceStatistics, {
|
|
9016
|
-
providedCount: codecVarU16,
|
|
9017
|
-
providedSize: codec$1.varU32,
|
|
9018
|
-
refinementCount: codec$1.varU32,
|
|
9019
|
-
refinementGasUsed: codecVarGas,
|
|
9020
|
-
imports: codecVarU16,
|
|
9021
|
-
extrinsicCount: codecVarU16,
|
|
9022
|
-
extrinsicSize: codec$1.varU32,
|
|
9023
|
-
exports: codecVarU16,
|
|
9024
|
-
accumulateCount: codec$1.varU32,
|
|
9025
|
-
accumulateGasUsed: codecVarGas,
|
|
9026
|
-
onTransfersCount: ignoreValueWithDefault(tryAsU32(0)),
|
|
9027
|
-
onTransfersGasUsed: ignoreValueWithDefault(tryAsServiceGas(0)),
|
|
9028
|
-
}),
|
|
9029
|
-
},
|
|
9030
|
-
});
|
|
9031
|
-
static create(v) {
|
|
9032
|
-
return new ServiceStatistics(v.providedCount, v.providedSize, v.refinementCount, v.refinementGasUsed, v.imports, v.exports, v.extrinsicSize, v.extrinsicCount, v.accumulateCount, v.accumulateGasUsed, v.onTransfersCount, v.onTransfersGasUsed);
|
|
9164
|
+
class UpdateStorage {
|
|
9165
|
+
serviceId;
|
|
9166
|
+
action;
|
|
9167
|
+
constructor(serviceId, action) {
|
|
9168
|
+
this.serviceId = serviceId;
|
|
9169
|
+
this.action = action;
|
|
9033
9170
|
}
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
providedCount,
|
|
9037
|
-
/** `p.1` */
|
|
9038
|
-
providedSize,
|
|
9039
|
-
/** `r.0` */
|
|
9040
|
-
refinementCount,
|
|
9041
|
-
/** `r.1` */
|
|
9042
|
-
refinementGasUsed,
|
|
9043
|
-
/** `i` */
|
|
9044
|
-
imports,
|
|
9045
|
-
/** `e` */
|
|
9046
|
-
exports,
|
|
9047
|
-
/** `z` */
|
|
9048
|
-
extrinsicSize,
|
|
9049
|
-
/** `x` */
|
|
9050
|
-
extrinsicCount,
|
|
9051
|
-
/** `a.0` */
|
|
9052
|
-
accumulateCount,
|
|
9053
|
-
/** `a.1` */
|
|
9054
|
-
accumulateGasUsed,
|
|
9055
|
-
/** `t.0` @deprecated since 0.7.1 */
|
|
9056
|
-
onTransfersCount,
|
|
9057
|
-
/** `t.1` @deprecated since 0.7.1 */
|
|
9058
|
-
onTransfersGasUsed) {
|
|
9059
|
-
this.providedCount = providedCount;
|
|
9060
|
-
this.providedSize = providedSize;
|
|
9061
|
-
this.refinementCount = refinementCount;
|
|
9062
|
-
this.refinementGasUsed = refinementGasUsed;
|
|
9063
|
-
this.imports = imports;
|
|
9064
|
-
this.exports = exports;
|
|
9065
|
-
this.extrinsicSize = extrinsicSize;
|
|
9066
|
-
this.extrinsicCount = extrinsicCount;
|
|
9067
|
-
this.accumulateCount = accumulateCount;
|
|
9068
|
-
this.accumulateGasUsed = accumulateGasUsed;
|
|
9069
|
-
this.onTransfersCount = onTransfersCount;
|
|
9070
|
-
this.onTransfersGasUsed = onTransfersGasUsed;
|
|
9171
|
+
static set({ serviceId, storage }) {
|
|
9172
|
+
return new UpdateStorage(serviceId, { kind: UpdateStorageKind.Set, storage });
|
|
9071
9173
|
}
|
|
9072
|
-
static
|
|
9073
|
-
|
|
9074
|
-
const zero16 = tryAsU16(0);
|
|
9075
|
-
const zeroGas = tryAsServiceGas(0);
|
|
9076
|
-
return new ServiceStatistics(zero16, zero, zero, zeroGas, zero16, zero16, zero, zero16, zero, zeroGas, zero, zeroGas);
|
|
9174
|
+
static remove({ serviceId, key }) {
|
|
9175
|
+
return new UpdateStorage(serviceId, { kind: UpdateStorageKind.Remove, key });
|
|
9077
9176
|
}
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
cores;
|
|
9084
|
-
services;
|
|
9085
|
-
static Codec = codec$1.Class(StatisticsData, {
|
|
9086
|
-
current: codecPerValidator(ValidatorStatistics.Codec),
|
|
9087
|
-
previous: codecPerValidator(ValidatorStatistics.Codec),
|
|
9088
|
-
cores: codecPerCore(CoreStatistics.Codec),
|
|
9089
|
-
services: codec$1.dictionary(codecServiceId, ServiceStatistics.Codec, {
|
|
9090
|
-
sortKeys: (a, b) => a - b,
|
|
9091
|
-
}),
|
|
9092
|
-
});
|
|
9093
|
-
static create(v) {
|
|
9094
|
-
return new StatisticsData(v.current, v.previous, v.cores, v.services);
|
|
9177
|
+
get key() {
|
|
9178
|
+
if (this.action.kind === UpdateStorageKind.Remove) {
|
|
9179
|
+
return this.action.key;
|
|
9180
|
+
}
|
|
9181
|
+
return this.action.storage.key;
|
|
9095
9182
|
}
|
|
9096
|
-
|
|
9097
|
-
this.
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
this.
|
|
9183
|
+
get value() {
|
|
9184
|
+
if (this.action.kind === UpdateStorageKind.Remove) {
|
|
9185
|
+
return null;
|
|
9186
|
+
}
|
|
9187
|
+
return this.action.storage.value;
|
|
9101
9188
|
}
|
|
9102
9189
|
}
|
|
9103
9190
|
|
|
@@ -9200,9 +9287,10 @@ class InMemoryService extends WithDebug {
|
|
|
9200
9287
|
* A special version of state, stored fully in-memory.
|
|
9201
9288
|
*/
|
|
9202
9289
|
class InMemoryState extends WithDebug {
|
|
9290
|
+
chainSpec;
|
|
9203
9291
|
/** Create a new `InMemoryState` by providing all required fields. */
|
|
9204
|
-
static
|
|
9205
|
-
return new InMemoryState(state);
|
|
9292
|
+
static new(chainSpec, state) {
|
|
9293
|
+
return new InMemoryState(chainSpec, state);
|
|
9206
9294
|
}
|
|
9207
9295
|
/**
|
|
9208
9296
|
* Create a new `InMemoryState` with a partial state override.
|
|
@@ -9218,7 +9306,7 @@ class InMemoryState extends WithDebug {
|
|
|
9218
9306
|
/**
|
|
9219
9307
|
* Create a new `InMemoryState` from some other state object.
|
|
9220
9308
|
*/
|
|
9221
|
-
static copyFrom(other, servicesData) {
|
|
9309
|
+
static copyFrom(chainSpec, other, servicesData) {
|
|
9222
9310
|
const services = new Map();
|
|
9223
9311
|
for (const [id, entries] of servicesData.entries()) {
|
|
9224
9312
|
const service = other.getService(id);
|
|
@@ -9228,7 +9316,7 @@ class InMemoryState extends WithDebug {
|
|
|
9228
9316
|
const inMemService = InMemoryService.copyFrom(service, entries);
|
|
9229
9317
|
services.set(id, inMemService);
|
|
9230
9318
|
}
|
|
9231
|
-
return InMemoryState.
|
|
9319
|
+
return InMemoryState.new(chainSpec, {
|
|
9232
9320
|
availabilityAssignment: other.availabilityAssignment,
|
|
9233
9321
|
accumulationQueue: other.accumulationQueue,
|
|
9234
9322
|
designatedValidatorData: other.designatedValidatorData,
|
|
@@ -9425,8 +9513,9 @@ class InMemoryState extends WithDebug {
|
|
|
9425
9513
|
getService(id) {
|
|
9426
9514
|
return this.services.get(id) ?? null;
|
|
9427
9515
|
}
|
|
9428
|
-
constructor(s) {
|
|
9516
|
+
constructor(chainSpec, s) {
|
|
9429
9517
|
super();
|
|
9518
|
+
this.chainSpec = chainSpec;
|
|
9430
9519
|
this.availabilityAssignment = s.availabilityAssignment;
|
|
9431
9520
|
this.designatedValidatorData = s.designatedValidatorData;
|
|
9432
9521
|
this.nextValidatorData = s.nextValidatorData;
|
|
@@ -9448,11 +9537,14 @@ class InMemoryState extends WithDebug {
|
|
|
9448
9537
|
this.accumulationOutputLog = s.accumulationOutputLog;
|
|
9449
9538
|
this.services = s.services;
|
|
9450
9539
|
}
|
|
9540
|
+
view() {
|
|
9541
|
+
return new InMemoryStateView(this.chainSpec, this);
|
|
9542
|
+
}
|
|
9451
9543
|
/**
|
|
9452
9544
|
* Create an empty and possibly incoherent `InMemoryState`.
|
|
9453
9545
|
*/
|
|
9454
9546
|
static empty(spec) {
|
|
9455
|
-
return new InMemoryState({
|
|
9547
|
+
return new InMemoryState(spec, {
|
|
9456
9548
|
availabilityAssignment: tryAsPerCore(Array.from({ length: spec.coresCount }, () => null), spec),
|
|
9457
9549
|
designatedValidatorData: tryAsPerValidator(Array.from({ length: spec.validatorsCount }, () => ValidatorData.create({
|
|
9458
9550
|
bandersnatch: Bytes.zero(BANDERSNATCH_KEY_BYTES).asOpaque(),
|
|
@@ -9488,7 +9580,7 @@ class InMemoryState extends WithDebug {
|
|
|
9488
9580
|
entropy: FixedSizeArray.fill(() => Bytes.zero(HASH_SIZE).asOpaque(), ENTROPY_ENTRIES),
|
|
9489
9581
|
authPools: tryAsPerCore(Array.from({ length: spec.coresCount }, () => asKnownSize([])), spec),
|
|
9490
9582
|
authQueues: tryAsPerCore(Array.from({ length: spec.coresCount }, () => FixedSizeArray.fill(() => Bytes.zero(HASH_SIZE).asOpaque(), AUTHORIZATION_QUEUE_SIZE)), spec),
|
|
9491
|
-
recentBlocks:
|
|
9583
|
+
recentBlocks: RecentBlocks.empty(),
|
|
9492
9584
|
statistics: StatisticsData.create({
|
|
9493
9585
|
current: tryAsPerValidator(Array.from({ length: spec.validatorsCount }, () => ValidatorStatistics.empty()), spec),
|
|
9494
9586
|
previous: tryAsPerValidator(Array.from({ length: spec.validatorsCount }, () => ValidatorStatistics.empty()), spec),
|
|
@@ -9526,6 +9618,7 @@ const serviceDataCodec = codec$1.dictionary(codec$1.u32.asOpaque(), serviceEntri
|
|
|
9526
9618
|
|
|
9527
9619
|
var index$g = /*#__PURE__*/Object.freeze({
|
|
9528
9620
|
__proto__: null,
|
|
9621
|
+
AUTHORIZATION_QUEUE_SIZE: AUTHORIZATION_QUEUE_SIZE,
|
|
9529
9622
|
AccumulationOutput: AccumulationOutput,
|
|
9530
9623
|
AutoAccumulate: AutoAccumulate,
|
|
9531
9624
|
AvailabilityAssignment: AvailabilityAssignment,
|
|
@@ -9539,11 +9632,12 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
9539
9632
|
InMemoryService: InMemoryService,
|
|
9540
9633
|
InMemoryState: InMemoryState,
|
|
9541
9634
|
LookupHistoryItem: LookupHistoryItem,
|
|
9635
|
+
MAX_AUTH_POOL_SIZE: MAX_AUTH_POOL_SIZE,
|
|
9542
9636
|
MAX_RECENT_HISTORY: MAX_RECENT_HISTORY,
|
|
9637
|
+
NotYetAccumulatedReport: NotYetAccumulatedReport,
|
|
9543
9638
|
PreimageItem: PreimageItem,
|
|
9544
9639
|
PrivilegedServices: PrivilegedServices,
|
|
9545
9640
|
RecentBlocks: RecentBlocks,
|
|
9546
|
-
RecentBlocksHistory: RecentBlocksHistory,
|
|
9547
9641
|
SafroleData: SafroleData,
|
|
9548
9642
|
SafroleSealingKeysData: SafroleSealingKeysData,
|
|
9549
9643
|
get SafroleSealingKeysKind () { return SafroleSealingKeysKind; },
|
|
@@ -9562,71 +9656,35 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
9562
9656
|
ValidatorData: ValidatorData,
|
|
9563
9657
|
ValidatorStatistics: ValidatorStatistics,
|
|
9564
9658
|
accumulationOutputComparator: accumulationOutputComparator,
|
|
9659
|
+
accumulationQueueCodec: accumulationQueueCodec,
|
|
9660
|
+
authPoolsCodec: authPoolsCodec,
|
|
9661
|
+
authQueuesCodec: authQueuesCodec,
|
|
9662
|
+
availabilityAssignmentsCodec: availabilityAssignmentsCodec,
|
|
9565
9663
|
codecPerCore: codecPerCore,
|
|
9566
9664
|
codecWithVersion: codecWithVersion,
|
|
9567
9665
|
hashComparator: hashComparator,
|
|
9568
9666
|
ignoreValueWithDefault: ignoreValueWithDefault,
|
|
9667
|
+
recentlyAccumulatedCodec: recentlyAccumulatedCodec,
|
|
9569
9668
|
serviceDataCodec: serviceDataCodec,
|
|
9570
9669
|
serviceEntriesCodec: serviceEntriesCodec,
|
|
9571
9670
|
tryAsLookupHistorySlots: tryAsLookupHistorySlots,
|
|
9572
|
-
tryAsPerCore: tryAsPerCore
|
|
9671
|
+
tryAsPerCore: tryAsPerCore,
|
|
9672
|
+
validatorsDataCodec: validatorsDataCodec
|
|
9573
9673
|
});
|
|
9574
9674
|
|
|
9575
|
-
/**
|
|
9576
|
-
* Ready (i.e. available and/or audited) but not-yet-accumulated work-reports.
|
|
9577
|
-
*
|
|
9578
|
-
* https://graypaper.fluffylabs.dev/#/5f542d7/165300165400
|
|
9579
|
-
*/
|
|
9580
|
-
class NotYetAccumulatedReport extends WithDebug {
|
|
9581
|
-
report;
|
|
9582
|
-
dependencies;
|
|
9583
|
-
static Codec = codec$1.Class(NotYetAccumulatedReport, {
|
|
9584
|
-
report: WorkReport.Codec,
|
|
9585
|
-
dependencies: codecKnownSizeArray(codec$1.bytes(HASH_SIZE).asOpaque(), {
|
|
9586
|
-
typicalLength: MAX_REPORT_DEPENDENCIES / 2,
|
|
9587
|
-
maxLength: MAX_REPORT_DEPENDENCIES,
|
|
9588
|
-
minLength: 0,
|
|
9589
|
-
}),
|
|
9590
|
-
});
|
|
9591
|
-
static create({ report, dependencies }) {
|
|
9592
|
-
return new NotYetAccumulatedReport(report, dependencies);
|
|
9593
|
-
}
|
|
9594
|
-
constructor(
|
|
9595
|
-
/**
|
|
9596
|
-
* Each of these were made available at most one epoch ago
|
|
9597
|
-
* but have or had unfulfilled dependencies.
|
|
9598
|
-
*/
|
|
9599
|
-
report,
|
|
9600
|
-
/**
|
|
9601
|
-
* Alongside the work-report itself, we retain its un-accumulated
|
|
9602
|
-
* dependencies, a set of work-package hashes.
|
|
9603
|
-
*
|
|
9604
|
-
* https://graypaper.fluffylabs.dev/#/5f542d7/165800165800
|
|
9605
|
-
*/
|
|
9606
|
-
dependencies) {
|
|
9607
|
-
super();
|
|
9608
|
-
this.report = report;
|
|
9609
|
-
this.dependencies = dependencies;
|
|
9610
|
-
}
|
|
9611
|
-
}
|
|
9612
|
-
|
|
9613
9675
|
/** Serialization for particular state entries. */
|
|
9614
9676
|
var serialize;
|
|
9615
9677
|
(function (serialize) {
|
|
9616
9678
|
/** C(1): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b15013b1501?v=0.6.7 */
|
|
9617
9679
|
serialize.authPools = {
|
|
9618
9680
|
key: stateKeys.index(StateKeyIdx.Alpha),
|
|
9619
|
-
Codec:
|
|
9620
|
-
minLength: 0,
|
|
9621
|
-
maxLength: MAX_AUTH_POOL_SIZE,
|
|
9622
|
-
typicalLength: MAX_AUTH_POOL_SIZE,
|
|
9623
|
-
})),
|
|
9681
|
+
Codec: authPoolsCodec,
|
|
9624
9682
|
extract: (s) => s.authPools,
|
|
9625
9683
|
};
|
|
9626
9684
|
/** C(2): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b31013b3101?v=0.6.7 */
|
|
9627
9685
|
serialize.authQueues = {
|
|
9628
9686
|
key: stateKeys.index(StateKeyIdx.Phi),
|
|
9629
|
-
Codec:
|
|
9687
|
+
Codec: authQueuesCodec,
|
|
9630
9688
|
extract: (s) => s.authQueues,
|
|
9631
9689
|
};
|
|
9632
9690
|
/**
|
|
@@ -9635,7 +9693,7 @@ var serialize;
|
|
|
9635
9693
|
*/
|
|
9636
9694
|
serialize.recentBlocks = {
|
|
9637
9695
|
key: stateKeys.index(StateKeyIdx.Beta),
|
|
9638
|
-
Codec:
|
|
9696
|
+
Codec: RecentBlocks.Codec,
|
|
9639
9697
|
extract: (s) => s.recentBlocks,
|
|
9640
9698
|
};
|
|
9641
9699
|
/** C(4): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b63013b6301?v=0.6.7 */
|
|
@@ -9664,25 +9722,25 @@ var serialize;
|
|
|
9664
9722
|
/** C(7): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b00023b0002?v=0.6.7 */
|
|
9665
9723
|
serialize.designatedValidators = {
|
|
9666
9724
|
key: stateKeys.index(StateKeyIdx.Iota),
|
|
9667
|
-
Codec:
|
|
9725
|
+
Codec: validatorsDataCodec,
|
|
9668
9726
|
extract: (s) => s.designatedValidatorData,
|
|
9669
9727
|
};
|
|
9670
9728
|
/** C(8): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b0d023b0d02?v=0.6.7 */
|
|
9671
9729
|
serialize.currentValidators = {
|
|
9672
9730
|
key: stateKeys.index(StateKeyIdx.Kappa),
|
|
9673
|
-
Codec:
|
|
9731
|
+
Codec: validatorsDataCodec,
|
|
9674
9732
|
extract: (s) => s.currentValidatorData,
|
|
9675
9733
|
};
|
|
9676
9734
|
/** C(9): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b1a023b1a02?v=0.6.7 */
|
|
9677
9735
|
serialize.previousValidators = {
|
|
9678
9736
|
key: stateKeys.index(StateKeyIdx.Lambda),
|
|
9679
|
-
Codec:
|
|
9737
|
+
Codec: validatorsDataCodec,
|
|
9680
9738
|
extract: (s) => s.previousValidatorData,
|
|
9681
9739
|
};
|
|
9682
9740
|
/** C(10): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b27023b2702?v=0.6.7 */
|
|
9683
9741
|
serialize.availabilityAssignment = {
|
|
9684
9742
|
key: stateKeys.index(StateKeyIdx.Rho),
|
|
9685
|
-
Codec:
|
|
9743
|
+
Codec: availabilityAssignmentsCodec,
|
|
9686
9744
|
extract: (s) => s.availabilityAssignment,
|
|
9687
9745
|
};
|
|
9688
9746
|
/** C(11): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b3e023b3e02?v=0.6.7 */
|
|
@@ -9706,13 +9764,13 @@ var serialize;
|
|
|
9706
9764
|
/** C(14): https://graypaper.fluffylabs.dev/#/1c979cb/3bf0023bf002?v=0.7.1 */
|
|
9707
9765
|
serialize.accumulationQueue = {
|
|
9708
9766
|
key: stateKeys.index(StateKeyIdx.Omega),
|
|
9709
|
-
Codec:
|
|
9767
|
+
Codec: accumulationQueueCodec,
|
|
9710
9768
|
extract: (s) => s.accumulationQueue,
|
|
9711
9769
|
};
|
|
9712
9770
|
/** C(15): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b96023b9602?v=0.6.7 */
|
|
9713
9771
|
serialize.recentlyAccumulated = {
|
|
9714
9772
|
key: stateKeys.index(StateKeyIdx.Xi),
|
|
9715
|
-
Codec:
|
|
9773
|
+
Codec: recentlyAccumulatedCodec,
|
|
9716
9774
|
extract: (s) => s.recentlyAccumulated,
|
|
9717
9775
|
};
|
|
9718
9776
|
/** C(16): https://graypaper.fluffylabs.dev/#/38c4e62/3b46033b4603?v=0.7.0 */
|
|
@@ -9753,6 +9811,84 @@ var serialize;
|
|
|
9753
9811
|
*/
|
|
9754
9812
|
const dumpCodec = Descriptor.new("Dump", { bytes: 64, isExact: false }, (e, v) => e.bytes(Bytes.fromBlob(v.raw, v.raw.length)), (d) => BytesBlob.blobFrom(d.bytes(d.source.length - d.bytesRead()).raw), (s) => s.bytes(s.decoder.source.length - s.decoder.bytesRead()));
|
|
9755
9813
|
|
|
9814
|
+
class SerializedStateView {
|
|
9815
|
+
spec;
|
|
9816
|
+
backend;
|
|
9817
|
+
recentlyUsedServices;
|
|
9818
|
+
viewCache;
|
|
9819
|
+
constructor(spec, backend,
|
|
9820
|
+
/** Best-effort list of recently active services. */
|
|
9821
|
+
recentlyUsedServices, viewCache) {
|
|
9822
|
+
this.spec = spec;
|
|
9823
|
+
this.backend = backend;
|
|
9824
|
+
this.recentlyUsedServices = recentlyUsedServices;
|
|
9825
|
+
this.viewCache = viewCache;
|
|
9826
|
+
}
|
|
9827
|
+
retrieveView({ key, Codec }, description) {
|
|
9828
|
+
const cached = this.viewCache.get(key);
|
|
9829
|
+
if (cached !== undefined) {
|
|
9830
|
+
return cached;
|
|
9831
|
+
}
|
|
9832
|
+
const bytes = this.backend.get(key);
|
|
9833
|
+
if (bytes === null) {
|
|
9834
|
+
throw new Error(`Required state entry for ${description} is missing!. Accessing view of key: ${key}`);
|
|
9835
|
+
}
|
|
9836
|
+
// NOTE [ToDr] we are not using `Decoder.decodeObject` here because
|
|
9837
|
+
// it needs to get to the end of the data (skip), yet that's expensive.
|
|
9838
|
+
// we assume that the state data is correct and coherent anyway, so
|
|
9839
|
+
// for performance reasons we simply create the view here.
|
|
9840
|
+
const d = Decoder.fromBytesBlob(bytes);
|
|
9841
|
+
d.attachContext(this.spec);
|
|
9842
|
+
const view = Codec.View.decode(d);
|
|
9843
|
+
this.viewCache.set(key, view);
|
|
9844
|
+
return view;
|
|
9845
|
+
}
|
|
9846
|
+
availabilityAssignmentView() {
|
|
9847
|
+
return this.retrieveView(serialize.availabilityAssignment, "availabilityAssignmentView");
|
|
9848
|
+
}
|
|
9849
|
+
designatedValidatorDataView() {
|
|
9850
|
+
return this.retrieveView(serialize.designatedValidators, "designatedValidatorsView");
|
|
9851
|
+
}
|
|
9852
|
+
currentValidatorDataView() {
|
|
9853
|
+
return this.retrieveView(serialize.currentValidators, "currentValidatorsView");
|
|
9854
|
+
}
|
|
9855
|
+
previousValidatorDataView() {
|
|
9856
|
+
return this.retrieveView(serialize.previousValidators, "previousValidatorsView");
|
|
9857
|
+
}
|
|
9858
|
+
authPoolsView() {
|
|
9859
|
+
return this.retrieveView(serialize.authPools, "authPoolsView");
|
|
9860
|
+
}
|
|
9861
|
+
authQueuesView() {
|
|
9862
|
+
return this.retrieveView(serialize.authQueues, "authQueuesView");
|
|
9863
|
+
}
|
|
9864
|
+
recentBlocksView() {
|
|
9865
|
+
return this.retrieveView(serialize.recentBlocks, "recentBlocksView");
|
|
9866
|
+
}
|
|
9867
|
+
statisticsView() {
|
|
9868
|
+
return this.retrieveView(serialize.statistics, "statisticsView");
|
|
9869
|
+
}
|
|
9870
|
+
accumulationQueueView() {
|
|
9871
|
+
return this.retrieveView(serialize.accumulationQueue, "accumulationQueueView");
|
|
9872
|
+
}
|
|
9873
|
+
recentlyAccumulatedView() {
|
|
9874
|
+
return this.retrieveView(serialize.recentlyAccumulated, "recentlyAccumulatedView");
|
|
9875
|
+
}
|
|
9876
|
+
safroleDataView() {
|
|
9877
|
+
return this.retrieveView(serialize.safrole, "safroleDataView");
|
|
9878
|
+
}
|
|
9879
|
+
getServiceInfoView(id) {
|
|
9880
|
+
const serviceData = serialize.serviceData(id);
|
|
9881
|
+
const bytes = this.backend.get(serviceData.key);
|
|
9882
|
+
if (bytes === null) {
|
|
9883
|
+
return null;
|
|
9884
|
+
}
|
|
9885
|
+
if (!this.recentlyUsedServices.includes(id)) {
|
|
9886
|
+
this.recentlyUsedServices.push(id);
|
|
9887
|
+
}
|
|
9888
|
+
return Decoder.decodeObject(serviceData.Codec.View, bytes, this.spec);
|
|
9889
|
+
}
|
|
9890
|
+
}
|
|
9891
|
+
|
|
9756
9892
|
/**
|
|
9757
9893
|
* State object which reads it's entries from some backend.
|
|
9758
9894
|
*
|
|
@@ -9765,7 +9901,7 @@ class SerializedState {
|
|
|
9765
9901
|
spec;
|
|
9766
9902
|
blake2b;
|
|
9767
9903
|
backend;
|
|
9768
|
-
|
|
9904
|
+
recentlyUsedServices;
|
|
9769
9905
|
/** Create a state-like object from collection of serialized entries. */
|
|
9770
9906
|
static fromStateEntries(spec, blake2b, state, recentServices = []) {
|
|
9771
9907
|
return new SerializedState(spec, blake2b, state, recentServices);
|
|
@@ -9774,49 +9910,63 @@ class SerializedState {
|
|
|
9774
9910
|
static new(spec, blake2b, db, recentServices = []) {
|
|
9775
9911
|
return new SerializedState(spec, blake2b, db, recentServices);
|
|
9776
9912
|
}
|
|
9913
|
+
dataCache = HashDictionary.new();
|
|
9914
|
+
viewCache = HashDictionary.new();
|
|
9777
9915
|
constructor(spec, blake2b, backend,
|
|
9778
9916
|
/** Best-effort list of recently active services. */
|
|
9779
|
-
|
|
9917
|
+
recentlyUsedServices) {
|
|
9780
9918
|
this.spec = spec;
|
|
9781
9919
|
this.blake2b = blake2b;
|
|
9782
9920
|
this.backend = backend;
|
|
9783
|
-
this.
|
|
9921
|
+
this.recentlyUsedServices = recentlyUsedServices;
|
|
9784
9922
|
}
|
|
9785
9923
|
/** Comparing the serialized states, just means comparing their backends. */
|
|
9786
9924
|
[TEST_COMPARE_USING]() {
|
|
9787
9925
|
return this.backend;
|
|
9788
9926
|
}
|
|
9927
|
+
/** Return a non-decoding version of the state. */
|
|
9928
|
+
view() {
|
|
9929
|
+
return new SerializedStateView(this.spec, this.backend, this.recentlyUsedServices, this.viewCache);
|
|
9930
|
+
}
|
|
9789
9931
|
// TODO [ToDr] Temporary method to update the state,
|
|
9790
9932
|
// without changing references.
|
|
9791
9933
|
updateBackend(newBackend) {
|
|
9792
9934
|
this.backend = newBackend;
|
|
9935
|
+
this.dataCache = HashDictionary.new();
|
|
9936
|
+
this.viewCache = HashDictionary.new();
|
|
9793
9937
|
}
|
|
9794
9938
|
recentServiceIds() {
|
|
9795
|
-
return this.
|
|
9939
|
+
return this.recentlyUsedServices;
|
|
9796
9940
|
}
|
|
9797
9941
|
getService(id) {
|
|
9798
9942
|
const serviceData = this.retrieveOptional(serialize.serviceData(id));
|
|
9799
9943
|
if (serviceData === undefined) {
|
|
9800
9944
|
return null;
|
|
9801
9945
|
}
|
|
9802
|
-
if (!this.
|
|
9803
|
-
this.
|
|
9946
|
+
if (!this.recentlyUsedServices.includes(id)) {
|
|
9947
|
+
this.recentlyUsedServices.push(id);
|
|
9804
9948
|
}
|
|
9805
9949
|
return new SerializedService(this.blake2b, id, serviceData, (key) => this.retrieveOptional(key));
|
|
9806
9950
|
}
|
|
9807
|
-
retrieve(
|
|
9808
|
-
const
|
|
9809
|
-
if (
|
|
9810
|
-
throw new Error(`Required state entry for ${description} is missing!. Accessing key: ${key}`);
|
|
9951
|
+
retrieve(k, description) {
|
|
9952
|
+
const data = this.retrieveOptional(k);
|
|
9953
|
+
if (data === undefined) {
|
|
9954
|
+
throw new Error(`Required state entry for ${description} is missing!. Accessing key: ${k.key}`);
|
|
9811
9955
|
}
|
|
9812
|
-
return
|
|
9956
|
+
return data;
|
|
9813
9957
|
}
|
|
9814
9958
|
retrieveOptional({ key, Codec }) {
|
|
9959
|
+
const cached = this.dataCache.get(key);
|
|
9960
|
+
if (cached !== undefined) {
|
|
9961
|
+
return cached;
|
|
9962
|
+
}
|
|
9815
9963
|
const bytes = this.backend.get(key);
|
|
9816
9964
|
if (bytes === null) {
|
|
9817
9965
|
return undefined;
|
|
9818
9966
|
}
|
|
9819
|
-
|
|
9967
|
+
const data = Decoder.decodeObject(Codec, bytes, this.spec);
|
|
9968
|
+
this.dataCache.set(key, data);
|
|
9969
|
+
return data;
|
|
9820
9970
|
}
|
|
9821
9971
|
get availabilityAssignment() {
|
|
9822
9972
|
return this.retrieve(serialize.availabilityAssignment, "availabilityAssignment");
|
|
@@ -10894,6 +11044,7 @@ var index$e = /*#__PURE__*/Object.freeze({
|
|
|
10894
11044
|
__proto__: null,
|
|
10895
11045
|
SerializedService: SerializedService,
|
|
10896
11046
|
SerializedState: SerializedState,
|
|
11047
|
+
SerializedStateView: SerializedStateView,
|
|
10897
11048
|
StateEntries: StateEntries,
|
|
10898
11049
|
get StateEntryUpdateAction () { return StateEntryUpdateAction; },
|
|
10899
11050
|
get StateKeyIdx () { return StateKeyIdx; },
|
|
@@ -11086,7 +11237,11 @@ class ServiceWithCodec extends InMemoryService {
|
|
|
11086
11237
|
return new ServiceWithCodec(serviceId, data);
|
|
11087
11238
|
}
|
|
11088
11239
|
}
|
|
11089
|
-
const inMemoryStateCodec = codec$1.Class(InMemoryState
|
|
11240
|
+
const inMemoryStateCodec = (spec) => codec$1.Class(class State extends InMemoryState {
|
|
11241
|
+
static create(data) {
|
|
11242
|
+
return InMemoryState.new(spec, data);
|
|
11243
|
+
}
|
|
11244
|
+
}, {
|
|
11090
11245
|
// alpha
|
|
11091
11246
|
authPools: serialize.authPools.Codec,
|
|
11092
11247
|
// phi
|
|
@@ -11165,7 +11320,7 @@ class InMemoryStates {
|
|
|
11165
11320
|
}
|
|
11166
11321
|
/** Insert a full state into the database. */
|
|
11167
11322
|
async insertState(headerHash, state) {
|
|
11168
|
-
const encoded = Encoder.encodeObject(inMemoryStateCodec, state, this.spec);
|
|
11323
|
+
const encoded = Encoder.encodeObject(inMemoryStateCodec(this.spec), state, this.spec);
|
|
11169
11324
|
this.db.set(headerHash, encoded);
|
|
11170
11325
|
return Result$1.ok(OK);
|
|
11171
11326
|
}
|
|
@@ -11174,7 +11329,7 @@ class InMemoryStates {
|
|
|
11174
11329
|
if (encodedState === undefined) {
|
|
11175
11330
|
return null;
|
|
11176
11331
|
}
|
|
11177
|
-
return Decoder.decodeObject(inMemoryStateCodec, encodedState, this.spec);
|
|
11332
|
+
return Decoder.decodeObject(inMemoryStateCodec(this.spec), encodedState, this.spec);
|
|
11178
11333
|
}
|
|
11179
11334
|
}
|
|
11180
11335
|
|
|
@@ -16359,9 +16514,6 @@ class HostCallMemory {
|
|
|
16359
16514
|
}
|
|
16360
16515
|
return this.memory.loadInto(result, tryAsMemoryIndex(Number(startAddress)));
|
|
16361
16516
|
}
|
|
16362
|
-
getMemory() {
|
|
16363
|
-
return this.memory;
|
|
16364
|
-
}
|
|
16365
16517
|
}
|
|
16366
16518
|
|
|
16367
16519
|
class HostCallRegisters {
|
|
@@ -17104,10 +17256,10 @@ const recentBlocksHistoryFromJson = json.object({
|
|
|
17104
17256
|
peaks: json.array(json.nullable(fromJson.bytes32())),
|
|
17105
17257
|
},
|
|
17106
17258
|
}, ({ history, mmr }) => {
|
|
17107
|
-
return
|
|
17259
|
+
return RecentBlocks.create({
|
|
17108
17260
|
blocks: history,
|
|
17109
17261
|
accumulationLog: mmr,
|
|
17110
|
-
})
|
|
17262
|
+
});
|
|
17111
17263
|
});
|
|
17112
17264
|
|
|
17113
17265
|
const ticketFromJson = json.object({
|
|
@@ -17305,7 +17457,7 @@ const fullStateDumpFromJson = (spec) => json.object({
|
|
|
17305
17457
|
if (Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) && chi.chi_r === undefined) {
|
|
17306
17458
|
throw new Error("Registrar is required in Privileges GP ^0.7.1");
|
|
17307
17459
|
}
|
|
17308
|
-
return InMemoryState.
|
|
17460
|
+
return InMemoryState.new(spec, {
|
|
17309
17461
|
authPools: tryAsPerCore(alpha.map((perCore) => {
|
|
17310
17462
|
if (perCore.length > MAX_AUTH_POOL_SIZE) {
|
|
17311
17463
|
throw new Error(`AuthPools: expected less than ${MAX_AUTH_POOL_SIZE}, got ${perCore.length}`);
|
|
@@ -17318,7 +17470,7 @@ const fullStateDumpFromJson = (spec) => json.object({
|
|
|
17318
17470
|
}
|
|
17319
17471
|
return asKnownSize(perCore);
|
|
17320
17472
|
}), spec),
|
|
17321
|
-
recentBlocks: beta ??
|
|
17473
|
+
recentBlocks: beta ?? RecentBlocks.empty(),
|
|
17322
17474
|
nextValidatorData: gamma.gamma_k,
|
|
17323
17475
|
epochRoot: gamma.gamma_z,
|
|
17324
17476
|
sealingKeySeries: TicketsOrKeys.toSafroleSealingKeys(gamma.gamma_s, spec),
|
|
@@ -17391,21 +17543,21 @@ class TransitionHasher {
|
|
|
17391
17543
|
*/
|
|
17392
17544
|
extrinsic(extrinsicView) {
|
|
17393
17545
|
// https://graypaper.fluffylabs.dev/#/cc517d7/0cfb000cfb00?v=0.6.5
|
|
17394
|
-
const
|
|
17546
|
+
const guaranteesCount = tryAsU32(extrinsicView.guarantees.view().length);
|
|
17547
|
+
const countEncoded = Encoder.encodeObject(codec$1.varU32, guaranteesCount);
|
|
17548
|
+
const guaranteesBlobs = extrinsicView.guarantees
|
|
17395
17549
|
.view()
|
|
17396
17550
|
.map((g) => g.view())
|
|
17397
|
-
.
|
|
17551
|
+
.reduce((aggregated, guarantee) => {
|
|
17398
17552
|
const reportHash = this.blake2b.hashBytes(guarantee.report.encoded()).asOpaque();
|
|
17399
|
-
|
|
17400
|
-
|
|
17401
|
-
|
|
17402
|
-
|
|
17403
|
-
|
|
17404
|
-
});
|
|
17405
|
-
const guaranteeBlob = Encoder.encodeObject(codec$1.sequenceVarLen(dumpCodec), guarantees, this.context);
|
|
17553
|
+
aggregated.push(reportHash.raw);
|
|
17554
|
+
aggregated.push(guarantee.slot.encoded().raw);
|
|
17555
|
+
aggregated.push(guarantee.credentials.encoded().raw);
|
|
17556
|
+
return aggregated;
|
|
17557
|
+
}, [countEncoded.raw]);
|
|
17406
17558
|
const et = this.blake2b.hashBytes(extrinsicView.tickets.encoded()).asOpaque();
|
|
17407
17559
|
const ep = this.blake2b.hashBytes(extrinsicView.preimages.encoded()).asOpaque();
|
|
17408
|
-
const eg = this.blake2b.
|
|
17560
|
+
const eg = this.blake2b.hashBlobs(guaranteesBlobs).asOpaque();
|
|
17409
17561
|
const ea = this.blake2b.hashBytes(extrinsicView.assurances.encoded()).asOpaque();
|
|
17410
17562
|
const ed = this.blake2b.hashBytes(extrinsicView.disputes.encoded()).asOpaque();
|
|
17411
17563
|
const encoded = BytesBlob.blobFromParts([et.raw, ep.raw, eg.raw, ea.raw, ed.raw]);
|