@typeberry/lib 0.1.2-953c012 → 0.1.2-b25cc82
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 +69 -38
- package/index.d.ts +26 -5
- package/index.js +69 -38
- package/package.json +1 -1
- package/bin/lib/index.d.ts +0 -29
- package/configs/index.d.ts +0 -76
package/index.cjs
CHANGED
|
@@ -5957,6 +5957,40 @@ var assurances = /*#__PURE__*/Object.freeze({
|
|
|
5957
5957
|
assurancesExtrinsicCodec: assurancesExtrinsicCodec
|
|
5958
5958
|
});
|
|
5959
5959
|
|
|
5960
|
+
/** Attempt to convert a number into `TimeSlot`. */
|
|
5961
|
+
const tryAsTimeSlot = (v) => asOpaqueType(tryAsU32(v));
|
|
5962
|
+
/** Attempt to convert a number into `ValidatorIndex`. */
|
|
5963
|
+
const tryAsValidatorIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
5964
|
+
/** Attempt to convert a number into `ServiceId`. */
|
|
5965
|
+
const tryAsServiceId = (v) => asOpaqueType(tryAsU32(v));
|
|
5966
|
+
const tryAsServiceGas = (v) => asOpaqueType(tryAsU64(v));
|
|
5967
|
+
/** Attempt to convert a number into `CoreIndex`. */
|
|
5968
|
+
const tryAsCoreIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
5969
|
+
/** Attempt to convert a number into `Epoch`. */
|
|
5970
|
+
const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
|
|
5971
|
+
function tryAsPerValidator(array, spec) {
|
|
5972
|
+
check `
|
|
5973
|
+
${array.length === spec.validatorsCount}
|
|
5974
|
+
Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
|
|
5975
|
+
`;
|
|
5976
|
+
return asKnownSize(array);
|
|
5977
|
+
}
|
|
5978
|
+
const codecPerValidator = (val) => codecWithContext((context) => {
|
|
5979
|
+
return codecKnownSizeArray(val, {
|
|
5980
|
+
fixedLength: context.validatorsCount,
|
|
5981
|
+
});
|
|
5982
|
+
});
|
|
5983
|
+
function tryAsPerEpochBlock(array, spec) {
|
|
5984
|
+
check `
|
|
5985
|
+
${array.length === spec.epochLength}
|
|
5986
|
+
Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
|
|
5987
|
+
`;
|
|
5988
|
+
return asKnownSize(array);
|
|
5989
|
+
}
|
|
5990
|
+
const codecPerEpochBlock = (val) => codecWithContext((context) => {
|
|
5991
|
+
return codecKnownSizeArray(val, { fixedLength: context.epochLength });
|
|
5992
|
+
});
|
|
5993
|
+
|
|
5960
5994
|
/**
|
|
5961
5995
|
* Proof of signing a contradictory [`Judgement`] of a work report.
|
|
5962
5996
|
*/
|
|
@@ -6148,40 +6182,6 @@ var disputes = /*#__PURE__*/Object.freeze({
|
|
|
6148
6182
|
Verdict: Verdict
|
|
6149
6183
|
});
|
|
6150
6184
|
|
|
6151
|
-
/** Attempt to convert a number into `TimeSlot`. */
|
|
6152
|
-
const tryAsTimeSlot = (v) => asOpaqueType(tryAsU32(v));
|
|
6153
|
-
/** Attempt to convert a number into `ValidatorIndex`. */
|
|
6154
|
-
const tryAsValidatorIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
6155
|
-
/** Attempt to convert a number into `ServiceId`. */
|
|
6156
|
-
const tryAsServiceId = (v) => asOpaqueType(tryAsU32(v));
|
|
6157
|
-
const tryAsServiceGas = (v) => asOpaqueType(tryAsU64(v));
|
|
6158
|
-
/** Attempt to convert a number into `CoreIndex`. */
|
|
6159
|
-
const tryAsCoreIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
6160
|
-
/** Attempt to convert a number into `Epoch`. */
|
|
6161
|
-
const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
|
|
6162
|
-
function tryAsPerValidator(array, spec) {
|
|
6163
|
-
check `
|
|
6164
|
-
${array.length === spec.validatorsCount}
|
|
6165
|
-
Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
|
|
6166
|
-
`;
|
|
6167
|
-
return asKnownSize(array);
|
|
6168
|
-
}
|
|
6169
|
-
const codecPerValidator = (val) => codecWithContext((context) => {
|
|
6170
|
-
return codecKnownSizeArray(val, {
|
|
6171
|
-
fixedLength: context.validatorsCount,
|
|
6172
|
-
});
|
|
6173
|
-
});
|
|
6174
|
-
function tryAsPerEpochBlock(array, spec) {
|
|
6175
|
-
check `
|
|
6176
|
-
${array.length === spec.epochLength}
|
|
6177
|
-
Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
|
|
6178
|
-
`;
|
|
6179
|
-
return asKnownSize(array);
|
|
6180
|
-
}
|
|
6181
|
-
const codecPerEpochBlock = (val) => codecWithContext((context) => {
|
|
6182
|
-
return codecKnownSizeArray(val, { fixedLength: context.epochLength });
|
|
6183
|
-
});
|
|
6184
|
-
|
|
6185
6185
|
/**
|
|
6186
6186
|
* Mapping between work package hash and root hash of it's exports.
|
|
6187
6187
|
*
|
|
@@ -7260,6 +7260,24 @@ class Block extends WithDebug {
|
|
|
7260
7260
|
this.extrinsic = extrinsic;
|
|
7261
7261
|
}
|
|
7262
7262
|
}
|
|
7263
|
+
function emptyBlock(slot = tryAsTimeSlot(0)) {
|
|
7264
|
+
const header = Header.empty();
|
|
7265
|
+
header.timeSlotIndex = slot;
|
|
7266
|
+
return Block.create({
|
|
7267
|
+
header,
|
|
7268
|
+
extrinsic: Extrinsic.create({
|
|
7269
|
+
tickets: asKnownSize([]),
|
|
7270
|
+
preimages: [],
|
|
7271
|
+
assurances: asKnownSize([]),
|
|
7272
|
+
guarantees: asKnownSize([]),
|
|
7273
|
+
disputes: {
|
|
7274
|
+
verdicts: [],
|
|
7275
|
+
culprits: [],
|
|
7276
|
+
faults: [],
|
|
7277
|
+
},
|
|
7278
|
+
}),
|
|
7279
|
+
});
|
|
7280
|
+
}
|
|
7263
7281
|
|
|
7264
7282
|
var index$j = /*#__PURE__*/Object.freeze({
|
|
7265
7283
|
__proto__: null,
|
|
@@ -7276,6 +7294,7 @@ var index$j = /*#__PURE__*/Object.freeze({
|
|
|
7276
7294
|
codecPerValidator: codecPerValidator,
|
|
7277
7295
|
codecUtils: codec,
|
|
7278
7296
|
disputes: disputes,
|
|
7297
|
+
emptyBlock: emptyBlock,
|
|
7279
7298
|
encodeUnsealedHeader: encodeUnsealedHeader,
|
|
7280
7299
|
guarantees: guarantees,
|
|
7281
7300
|
headerViewWithHashCodec: headerViewWithHashCodec,
|
|
@@ -14125,6 +14144,17 @@ class PageRange {
|
|
|
14125
14144
|
}
|
|
14126
14145
|
return new PageRange(start, length);
|
|
14127
14146
|
}
|
|
14147
|
+
/** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
|
|
14148
|
+
isWrapped() {
|
|
14149
|
+
return this.start >= this.end && !this.isEmpty();
|
|
14150
|
+
}
|
|
14151
|
+
/** Checks if given page number is within the range */
|
|
14152
|
+
isInRange(page) {
|
|
14153
|
+
if (this.isWrapped()) {
|
|
14154
|
+
return page >= this.start || page < this.end;
|
|
14155
|
+
}
|
|
14156
|
+
return page >= this.start && page < this.end;
|
|
14157
|
+
}
|
|
14128
14158
|
/** Checks if a range is empty (`length === 0`) */
|
|
14129
14159
|
isEmpty() {
|
|
14130
14160
|
return this.length === 0;
|
|
@@ -14465,10 +14495,11 @@ class MemoryBuilder {
|
|
|
14465
14495
|
startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
|
|
14466
14496
|
`;
|
|
14467
14497
|
this.ensureNotFinalized();
|
|
14468
|
-
const
|
|
14469
|
-
const
|
|
14470
|
-
|
|
14471
|
-
|
|
14498
|
+
const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
14499
|
+
const heapPagesRange = PageRange.fromMemoryRange(heapRange);
|
|
14500
|
+
const initializedPageNumbers = Array.from(this.initialMemory.keys());
|
|
14501
|
+
for (const pageNumber of initializedPageNumbers) {
|
|
14502
|
+
if (heapPagesRange.isInRange(pageNumber)) {
|
|
14472
14503
|
throw new IncorrectSbrkIndex();
|
|
14473
14504
|
}
|
|
14474
14505
|
}
|
package/index.d.ts
CHANGED
|
@@ -6873,6 +6873,25 @@ declare class Block extends WithDebug {
|
|
|
6873
6873
|
/** Undecoded View of a [`Block`]. */
|
|
6874
6874
|
type BlockView = DescribedBy<typeof Block.Codec.View>;
|
|
6875
6875
|
|
|
6876
|
+
declare function emptyBlock(slot: TimeSlot = tryAsTimeSlot(0)) {
|
|
6877
|
+
const header = Header.empty();
|
|
6878
|
+
header.timeSlotIndex = slot;
|
|
6879
|
+
return Block.create({
|
|
6880
|
+
header,
|
|
6881
|
+
extrinsic: Extrinsic.create({
|
|
6882
|
+
tickets: asKnownSize([]),
|
|
6883
|
+
preimages: [],
|
|
6884
|
+
assurances: asKnownSize([]),
|
|
6885
|
+
guarantees: asKnownSize([]),
|
|
6886
|
+
disputes: {
|
|
6887
|
+
verdicts: [],
|
|
6888
|
+
culprits: [],
|
|
6889
|
+
faults: [],
|
|
6890
|
+
},
|
|
6891
|
+
}),
|
|
6892
|
+
});
|
|
6893
|
+
}
|
|
6894
|
+
|
|
6876
6895
|
type index$j_Block = Block;
|
|
6877
6896
|
declare const index$j_Block: typeof Block;
|
|
6878
6897
|
type index$j_BlockView = BlockView;
|
|
@@ -6916,6 +6935,7 @@ declare const index$j_assurances: typeof assurances;
|
|
|
6916
6935
|
declare const index$j_codecPerEpochBlock: typeof codecPerEpochBlock;
|
|
6917
6936
|
declare const index$j_codecPerValidator: typeof codecPerValidator;
|
|
6918
6937
|
declare const index$j_disputes: typeof disputes;
|
|
6938
|
+
declare const index$j_emptyBlock: typeof emptyBlock;
|
|
6919
6939
|
declare const index$j_encodeUnsealedHeader: typeof encodeUnsealedHeader;
|
|
6920
6940
|
declare const index$j_guarantees: typeof guarantees;
|
|
6921
6941
|
declare const index$j_headerViewWithHashCodec: typeof headerViewWithHashCodec;
|
|
@@ -6937,7 +6957,7 @@ declare const index$j_workPackage: typeof workPackage;
|
|
|
6937
6957
|
declare const index$j_workReport: typeof workReport;
|
|
6938
6958
|
declare const index$j_workResult: typeof workResult;
|
|
6939
6959
|
declare namespace index$j {
|
|
6940
|
-
export { index$j_Block as Block, index$j_EpochMarker as EpochMarker, index$j_Extrinsic as Extrinsic, index$j_Header as Header, index$j_HeaderViewWithHash as HeaderViewWithHash, index$j_MAX_NUMBER_OF_SEGMENTS as MAX_NUMBER_OF_SEGMENTS, index$j_TicketsMarker as TicketsMarker, index$j_ValidatorKeys as ValidatorKeys, index$j_W_E as W_E, index$j_W_S as W_S, index$j_assurances as assurances, index$j_codecPerEpochBlock as codecPerEpochBlock, index$j_codecPerValidator as codecPerValidator, codec as codecUtils, index$j_disputes as disputes, index$j_encodeUnsealedHeader as encodeUnsealedHeader, index$j_guarantees as guarantees, index$j_headerViewWithHashCodec as headerViewWithHashCodec, index$j_legacyDescriptor as legacyDescriptor, index$j_preimage as preimage, index$j_refineContext as refineContext, index$j_tickets as tickets, index$j_tryAsCoreIndex as tryAsCoreIndex, index$j_tryAsEpoch as tryAsEpoch, index$j_tryAsPerEpochBlock as tryAsPerEpochBlock, index$j_tryAsPerValidator as tryAsPerValidator, index$j_tryAsSegmentIndex as tryAsSegmentIndex, index$j_tryAsServiceGas as tryAsServiceGas, index$j_tryAsServiceId as tryAsServiceId, index$j_tryAsTimeSlot as tryAsTimeSlot, index$j_tryAsValidatorIndex as tryAsValidatorIndex, index$j_workItem as workItem, index$j_workPackage as workPackage, index$j_workReport as workReport, index$j_workResult as workResult };
|
|
6960
|
+
export { index$j_Block as Block, index$j_EpochMarker as EpochMarker, index$j_Extrinsic as Extrinsic, index$j_Header as Header, index$j_HeaderViewWithHash as HeaderViewWithHash, index$j_MAX_NUMBER_OF_SEGMENTS as MAX_NUMBER_OF_SEGMENTS, index$j_TicketsMarker as TicketsMarker, index$j_ValidatorKeys as ValidatorKeys, index$j_W_E as W_E, index$j_W_S as W_S, index$j_assurances as assurances, index$j_codecPerEpochBlock as codecPerEpochBlock, index$j_codecPerValidator as codecPerValidator, codec as codecUtils, index$j_disputes as disputes, index$j_emptyBlock as emptyBlock, index$j_encodeUnsealedHeader as encodeUnsealedHeader, index$j_guarantees as guarantees, index$j_headerViewWithHashCodec as headerViewWithHashCodec, index$j_legacyDescriptor as legacyDescriptor, index$j_preimage as preimage, index$j_refineContext as refineContext, index$j_tickets as tickets, index$j_tryAsCoreIndex as tryAsCoreIndex, index$j_tryAsEpoch as tryAsEpoch, index$j_tryAsPerEpochBlock as tryAsPerEpochBlock, index$j_tryAsPerValidator as tryAsPerValidator, index$j_tryAsSegmentIndex as tryAsSegmentIndex, index$j_tryAsServiceGas as tryAsServiceGas, index$j_tryAsServiceId as tryAsServiceId, index$j_tryAsTimeSlot as tryAsTimeSlot, index$j_tryAsValidatorIndex as tryAsValidatorIndex, index$j_workItem as workItem, index$j_workPackage as workPackage, index$j_workReport as workReport, index$j_workResult as workResult };
|
|
6941
6961
|
export type { index$j_BlockView as BlockView, index$j_CodeHash as CodeHash, index$j_CoreIndex as CoreIndex, index$j_EntropyHash as EntropyHash, index$j_Epoch as Epoch, index$j_EpochMarkerView as EpochMarkerView, index$j_ExtrinsicHash as ExtrinsicHash, index$j_ExtrinsicView as ExtrinsicView, index$j_HeaderHash as HeaderHash, index$j_HeaderView as HeaderView, index$j_PerEpochBlock as PerEpochBlock, index$j_PerValidator as PerValidator, index$j_SEGMENT_BYTES as SEGMENT_BYTES, index$j_Segment as Segment, index$j_SegmentIndex as SegmentIndex, index$j_ServiceGas as ServiceGas, index$j_ServiceId as ServiceId, index$j_StateRootHash as StateRootHash, index$j_TicketsMarkerView as TicketsMarkerView, index$j_TimeSlot as TimeSlot, index$j_ValidatorIndex as ValidatorIndex, index$j_WorkReportHash as WorkReportHash };
|
|
6942
6962
|
}
|
|
6943
6963
|
|
|
@@ -14780,11 +14800,12 @@ declare class MemoryBuilder {
|
|
|
14780
14800
|
`;
|
|
14781
14801
|
this.ensureNotFinalized();
|
|
14782
14802
|
|
|
14783
|
-
const
|
|
14784
|
-
const
|
|
14803
|
+
const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
14804
|
+
const heapPagesRange = PageRange.fromMemoryRange(heapRange);
|
|
14805
|
+
const initializedPageNumbers = Array.from(this.initialMemory.keys());
|
|
14785
14806
|
|
|
14786
|
-
for (const pageNumber of
|
|
14787
|
-
if (
|
|
14807
|
+
for (const pageNumber of initializedPageNumbers) {
|
|
14808
|
+
if (heapPagesRange.isInRange(pageNumber)) {
|
|
14788
14809
|
throw new IncorrectSbrkIndex();
|
|
14789
14810
|
}
|
|
14790
14811
|
}
|
package/index.js
CHANGED
|
@@ -5954,6 +5954,40 @@ var assurances = /*#__PURE__*/Object.freeze({
|
|
|
5954
5954
|
assurancesExtrinsicCodec: assurancesExtrinsicCodec
|
|
5955
5955
|
});
|
|
5956
5956
|
|
|
5957
|
+
/** Attempt to convert a number into `TimeSlot`. */
|
|
5958
|
+
const tryAsTimeSlot = (v) => asOpaqueType(tryAsU32(v));
|
|
5959
|
+
/** Attempt to convert a number into `ValidatorIndex`. */
|
|
5960
|
+
const tryAsValidatorIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
5961
|
+
/** Attempt to convert a number into `ServiceId`. */
|
|
5962
|
+
const tryAsServiceId = (v) => asOpaqueType(tryAsU32(v));
|
|
5963
|
+
const tryAsServiceGas = (v) => asOpaqueType(tryAsU64(v));
|
|
5964
|
+
/** Attempt to convert a number into `CoreIndex`. */
|
|
5965
|
+
const tryAsCoreIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
5966
|
+
/** Attempt to convert a number into `Epoch`. */
|
|
5967
|
+
const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
|
|
5968
|
+
function tryAsPerValidator(array, spec) {
|
|
5969
|
+
check `
|
|
5970
|
+
${array.length === spec.validatorsCount}
|
|
5971
|
+
Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
|
|
5972
|
+
`;
|
|
5973
|
+
return asKnownSize(array);
|
|
5974
|
+
}
|
|
5975
|
+
const codecPerValidator = (val) => codecWithContext((context) => {
|
|
5976
|
+
return codecKnownSizeArray(val, {
|
|
5977
|
+
fixedLength: context.validatorsCount,
|
|
5978
|
+
});
|
|
5979
|
+
});
|
|
5980
|
+
function tryAsPerEpochBlock(array, spec) {
|
|
5981
|
+
check `
|
|
5982
|
+
${array.length === spec.epochLength}
|
|
5983
|
+
Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
|
|
5984
|
+
`;
|
|
5985
|
+
return asKnownSize(array);
|
|
5986
|
+
}
|
|
5987
|
+
const codecPerEpochBlock = (val) => codecWithContext((context) => {
|
|
5988
|
+
return codecKnownSizeArray(val, { fixedLength: context.epochLength });
|
|
5989
|
+
});
|
|
5990
|
+
|
|
5957
5991
|
/**
|
|
5958
5992
|
* Proof of signing a contradictory [`Judgement`] of a work report.
|
|
5959
5993
|
*/
|
|
@@ -6145,40 +6179,6 @@ var disputes = /*#__PURE__*/Object.freeze({
|
|
|
6145
6179
|
Verdict: Verdict
|
|
6146
6180
|
});
|
|
6147
6181
|
|
|
6148
|
-
/** Attempt to convert a number into `TimeSlot`. */
|
|
6149
|
-
const tryAsTimeSlot = (v) => asOpaqueType(tryAsU32(v));
|
|
6150
|
-
/** Attempt to convert a number into `ValidatorIndex`. */
|
|
6151
|
-
const tryAsValidatorIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
6152
|
-
/** Attempt to convert a number into `ServiceId`. */
|
|
6153
|
-
const tryAsServiceId = (v) => asOpaqueType(tryAsU32(v));
|
|
6154
|
-
const tryAsServiceGas = (v) => asOpaqueType(tryAsU64(v));
|
|
6155
|
-
/** Attempt to convert a number into `CoreIndex`. */
|
|
6156
|
-
const tryAsCoreIndex = (v) => asOpaqueType(tryAsU16(v));
|
|
6157
|
-
/** Attempt to convert a number into `Epoch`. */
|
|
6158
|
-
const tryAsEpoch = (v) => asOpaqueType(tryAsU32(v));
|
|
6159
|
-
function tryAsPerValidator(array, spec) {
|
|
6160
|
-
check `
|
|
6161
|
-
${array.length === spec.validatorsCount}
|
|
6162
|
-
Invalid per-validator array length. Expected ${spec.validatorsCount}, got: ${array.length}
|
|
6163
|
-
`;
|
|
6164
|
-
return asKnownSize(array);
|
|
6165
|
-
}
|
|
6166
|
-
const codecPerValidator = (val) => codecWithContext((context) => {
|
|
6167
|
-
return codecKnownSizeArray(val, {
|
|
6168
|
-
fixedLength: context.validatorsCount,
|
|
6169
|
-
});
|
|
6170
|
-
});
|
|
6171
|
-
function tryAsPerEpochBlock(array, spec) {
|
|
6172
|
-
check `
|
|
6173
|
-
${array.length === spec.epochLength}
|
|
6174
|
-
Invalid per-epoch-block array length. Expected ${spec.epochLength}, got: ${array.length}
|
|
6175
|
-
`;
|
|
6176
|
-
return asKnownSize(array);
|
|
6177
|
-
}
|
|
6178
|
-
const codecPerEpochBlock = (val) => codecWithContext((context) => {
|
|
6179
|
-
return codecKnownSizeArray(val, { fixedLength: context.epochLength });
|
|
6180
|
-
});
|
|
6181
|
-
|
|
6182
6182
|
/**
|
|
6183
6183
|
* Mapping between work package hash and root hash of it's exports.
|
|
6184
6184
|
*
|
|
@@ -7257,6 +7257,24 @@ class Block extends WithDebug {
|
|
|
7257
7257
|
this.extrinsic = extrinsic;
|
|
7258
7258
|
}
|
|
7259
7259
|
}
|
|
7260
|
+
function emptyBlock(slot = tryAsTimeSlot(0)) {
|
|
7261
|
+
const header = Header.empty();
|
|
7262
|
+
header.timeSlotIndex = slot;
|
|
7263
|
+
return Block.create({
|
|
7264
|
+
header,
|
|
7265
|
+
extrinsic: Extrinsic.create({
|
|
7266
|
+
tickets: asKnownSize([]),
|
|
7267
|
+
preimages: [],
|
|
7268
|
+
assurances: asKnownSize([]),
|
|
7269
|
+
guarantees: asKnownSize([]),
|
|
7270
|
+
disputes: {
|
|
7271
|
+
verdicts: [],
|
|
7272
|
+
culprits: [],
|
|
7273
|
+
faults: [],
|
|
7274
|
+
},
|
|
7275
|
+
}),
|
|
7276
|
+
});
|
|
7277
|
+
}
|
|
7260
7278
|
|
|
7261
7279
|
var index$j = /*#__PURE__*/Object.freeze({
|
|
7262
7280
|
__proto__: null,
|
|
@@ -7273,6 +7291,7 @@ var index$j = /*#__PURE__*/Object.freeze({
|
|
|
7273
7291
|
codecPerValidator: codecPerValidator,
|
|
7274
7292
|
codecUtils: codec,
|
|
7275
7293
|
disputes: disputes,
|
|
7294
|
+
emptyBlock: emptyBlock,
|
|
7276
7295
|
encodeUnsealedHeader: encodeUnsealedHeader,
|
|
7277
7296
|
guarantees: guarantees,
|
|
7278
7297
|
headerViewWithHashCodec: headerViewWithHashCodec,
|
|
@@ -14122,6 +14141,17 @@ class PageRange {
|
|
|
14122
14141
|
}
|
|
14123
14142
|
return new PageRange(start, length);
|
|
14124
14143
|
}
|
|
14144
|
+
/** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
|
|
14145
|
+
isWrapped() {
|
|
14146
|
+
return this.start >= this.end && !this.isEmpty();
|
|
14147
|
+
}
|
|
14148
|
+
/** Checks if given page number is within the range */
|
|
14149
|
+
isInRange(page) {
|
|
14150
|
+
if (this.isWrapped()) {
|
|
14151
|
+
return page >= this.start || page < this.end;
|
|
14152
|
+
}
|
|
14153
|
+
return page >= this.start && page < this.end;
|
|
14154
|
+
}
|
|
14125
14155
|
/** Checks if a range is empty (`length === 0`) */
|
|
14126
14156
|
isEmpty() {
|
|
14127
14157
|
return this.length === 0;
|
|
@@ -14462,10 +14492,11 @@ class MemoryBuilder {
|
|
|
14462
14492
|
startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
|
|
14463
14493
|
`;
|
|
14464
14494
|
this.ensureNotFinalized();
|
|
14465
|
-
const
|
|
14466
|
-
const
|
|
14467
|
-
|
|
14468
|
-
|
|
14495
|
+
const heapRange = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
14496
|
+
const heapPagesRange = PageRange.fromMemoryRange(heapRange);
|
|
14497
|
+
const initializedPageNumbers = Array.from(this.initialMemory.keys());
|
|
14498
|
+
for (const pageNumber of initializedPageNumbers) {
|
|
14499
|
+
if (heapPagesRange.isInRange(pageNumber)) {
|
|
14469
14500
|
throw new IncorrectSbrkIndex();
|
|
14470
14501
|
}
|
|
14471
14502
|
}
|
package/package.json
CHANGED
package/bin/lib/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export * as block from "@typeberry/block";
|
|
2
|
-
export * as block_json from "@typeberry/block-json";
|
|
3
|
-
export * as bytes from "@typeberry/bytes";
|
|
4
|
-
export * as codec from "@typeberry/codec";
|
|
5
|
-
export * as collections from "@typeberry/collections";
|
|
6
|
-
export * as config from "@typeberry/config";
|
|
7
|
-
export * as config_node from "@typeberry/config-node";
|
|
8
|
-
export * as crypto from "@typeberry/crypto";
|
|
9
|
-
export * as database from "@typeberry/database";
|
|
10
|
-
export * as erasure_coding from "@typeberry/erasure-coding";
|
|
11
|
-
export * as hash from "@typeberry/hash";
|
|
12
|
-
export * as jam_host_calls from "@typeberry/jam-host-calls";
|
|
13
|
-
export * as json_parser from "@typeberry/json-parser";
|
|
14
|
-
export * as logger from "@typeberry/logger";
|
|
15
|
-
export * as mmr from "@typeberry/mmr";
|
|
16
|
-
export * as numbers from "@typeberry/numbers";
|
|
17
|
-
export * as ordering from "@typeberry/ordering";
|
|
18
|
-
export * as pvm from "@typeberry/pvm-debugger-adapter";
|
|
19
|
-
export * as pvm_host_calls from "@typeberry/pvm-host-calls";
|
|
20
|
-
export * as pvm_interpreter from "@typeberry/pvm-interpreter";
|
|
21
|
-
export * as pvm_program from "@typeberry/pvm-program";
|
|
22
|
-
export * as pvm_spi_decoder from "@typeberry/pvm-spi-decoder";
|
|
23
|
-
export * as shuffling from "@typeberry/shuffling";
|
|
24
|
-
export * as state from "@typeberry/state";
|
|
25
|
-
export * as state_json from "@typeberry/state-json";
|
|
26
|
-
export * as state_merkleization from "@typeberry/state-merkleization";
|
|
27
|
-
export * as transition from "@typeberry/transition";
|
|
28
|
-
export * as trie from "@typeberry/trie";
|
|
29
|
-
export * as utils from "@typeberry/utils";
|
package/configs/index.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export declare const configs: {
|
|
2
|
-
default: {
|
|
3
|
-
$schema: string;
|
|
4
|
-
version: number;
|
|
5
|
-
flavor: string;
|
|
6
|
-
authorship: {
|
|
7
|
-
omit_seal_verification: boolean;
|
|
8
|
-
};
|
|
9
|
-
chain_spec: {
|
|
10
|
-
id: string;
|
|
11
|
-
bootnodes: string[];
|
|
12
|
-
genesis_header: string;
|
|
13
|
-
genesis_state: {
|
|
14
|
-
"0b000000000000000000000000000000000000000000000000000000000000": string;
|
|
15
|
-
"04000000000000000000000000000000000000000000000000000000000000": string;
|
|
16
|
-
"08000000000000000000000000000000000000000000000000000000000000": string;
|
|
17
|
-
"07000000000000000000000000000000000000000000000000000000000000": string;
|
|
18
|
-
"00c500b600120062b94ad574028369bc6bd19a65f989134c022ea372cd4df6": string;
|
|
19
|
-
"00ad0027003e003dc43472190923b0d2a1755796224bd5684c60fd0f6872c8": string;
|
|
20
|
-
"008000c100e3000732d3152ca7f3bbf14ff40da18def60c6f78e93e4602f3d": string;
|
|
21
|
-
"00f800e700990073c506a4ae6f6c368ca2c41dd8270472e9590c9ada0b87db": string;
|
|
22
|
-
"09000000000000000000000000000000000000000000000000000000000000": string;
|
|
23
|
-
ff000000000000000000000000000000000000000000000000000000000000: string;
|
|
24
|
-
"0d000000000000000000000000000000000000000000000000000000000000": string;
|
|
25
|
-
"01000000000000000000000000000000000000000000000000000000000000": string;
|
|
26
|
-
"10000000000000000000000000000000000000000000000000000000000000": string;
|
|
27
|
-
"0c000000000000000000000000000000000000000000000000000000000000": string;
|
|
28
|
-
"06000000000000000000000000000000000000000000000000000000000000": string;
|
|
29
|
-
"0a000000000000000000000000000000000000000000000000000000000000": string;
|
|
30
|
-
"03000000000000000000000000000000000000000000000000000000000000": string;
|
|
31
|
-
"0e000000000000000000000000000000000000000000000000000000000000": string;
|
|
32
|
-
"0f000000000000000000000000000000000000000000000000000000000000": string;
|
|
33
|
-
"02000000000000000000000000000000000000000000000000000000000000": string;
|
|
34
|
-
"05000000000000000000000000000000000000000000000000000000000000": string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
database_base_path: string;
|
|
38
|
-
};
|
|
39
|
-
dev: {
|
|
40
|
-
$schema: string;
|
|
41
|
-
version: number;
|
|
42
|
-
flavor: string;
|
|
43
|
-
authorship: {
|
|
44
|
-
omit_seal_verification: boolean;
|
|
45
|
-
};
|
|
46
|
-
chain_spec: {
|
|
47
|
-
id: string;
|
|
48
|
-
bootnodes: string[];
|
|
49
|
-
genesis_header: string;
|
|
50
|
-
genesis_state: {
|
|
51
|
-
"0b000000000000000000000000000000000000000000000000000000000000": string;
|
|
52
|
-
"04000000000000000000000000000000000000000000000000000000000000": string;
|
|
53
|
-
"08000000000000000000000000000000000000000000000000000000000000": string;
|
|
54
|
-
"07000000000000000000000000000000000000000000000000000000000000": string;
|
|
55
|
-
"00c500b600120062b94ad574028369bc6bd19a65f989134c022ea372cd4df6": string;
|
|
56
|
-
"00ad0027003e003dc43472190923b0d2a1755796224bd5684c60fd0f6872c8": string;
|
|
57
|
-
"008000c100e3000732d3152ca7f3bbf14ff40da18def60c6f78e93e4602f3d": string;
|
|
58
|
-
"00f800e700990073c506a4ae6f6c368ca2c41dd8270472e9590c9ada0b87db": string;
|
|
59
|
-
"09000000000000000000000000000000000000000000000000000000000000": string;
|
|
60
|
-
ff000000000000000000000000000000000000000000000000000000000000: string;
|
|
61
|
-
"0d000000000000000000000000000000000000000000000000000000000000": string;
|
|
62
|
-
"01000000000000000000000000000000000000000000000000000000000000": string;
|
|
63
|
-
"10000000000000000000000000000000000000000000000000000000000000": string;
|
|
64
|
-
"0c000000000000000000000000000000000000000000000000000000000000": string;
|
|
65
|
-
"06000000000000000000000000000000000000000000000000000000000000": string;
|
|
66
|
-
"0a000000000000000000000000000000000000000000000000000000000000": string;
|
|
67
|
-
"03000000000000000000000000000000000000000000000000000000000000": string;
|
|
68
|
-
"0e000000000000000000000000000000000000000000000000000000000000": string;
|
|
69
|
-
"0f000000000000000000000000000000000000000000000000000000000000": string;
|
|
70
|
-
"02000000000000000000000000000000000000000000000000000000000000": string;
|
|
71
|
-
"05000000000000000000000000000000000000000000000000000000000000": string;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
database_base_path: string;
|
|
75
|
-
};
|
|
76
|
-
};
|