@typeberry/lib 0.0.1-9d0368d → 0.0.1-a2f0b71
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.d.ts +253 -398
- package/index.js +136 -184
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ declare namespace index$s {
|
|
|
60
60
|
|
|
61
61
|
declare enum GpVersion {
|
|
62
62
|
V0_6_7 = "0.6.7",
|
|
63
|
-
V0_7_0 = "0.7.0
|
|
63
|
+
V0_7_0 = "0.7.0",
|
|
64
64
|
V0_7_1 = "0.7.1-preview",
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -74,7 +74,7 @@ declare const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
|
74
74
|
declare const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
|
|
75
75
|
|
|
76
76
|
declare const env = typeof process === "undefined" ? {} : process.env;
|
|
77
|
-
declare const DEFAULT_VERSION = GpVersion.
|
|
77
|
+
declare const DEFAULT_VERSION = GpVersion.V0_7_0;
|
|
78
78
|
declare let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
|
|
79
79
|
declare let CURRENT_SUITE = parseCurrentSuite(env.TEST_SUITE) ?? DEFAULT_SUITE;
|
|
80
80
|
|
|
@@ -493,6 +493,8 @@ type DeepEqualOptions = {
|
|
|
493
493
|
errorsCollector?: ErrorsCollector;
|
|
494
494
|
};
|
|
495
495
|
|
|
496
|
+
declare let oomWarningPrinted = false;
|
|
497
|
+
|
|
496
498
|
/** Deeply compare `actual` and `expected` values. */
|
|
497
499
|
declare function deepEqual<T>(
|
|
498
500
|
actual: T | undefined,
|
|
@@ -525,7 +527,7 @@ declare function deepEqual<T>(
|
|
|
525
527
|
try {
|
|
526
528
|
assert.strictEqual(actualDisp, expectedDisp, message);
|
|
527
529
|
} catch (e) {
|
|
528
|
-
if (isOoMWorkaroundNeeded) {
|
|
530
|
+
if (isOoMWorkaroundNeeded && !oomWarningPrinted) {
|
|
529
531
|
console.warn(
|
|
530
532
|
[
|
|
531
533
|
"Stacktrace may be crappy because of a problem in nodejs.",
|
|
@@ -533,6 +535,7 @@ declare function deepEqual<T>(
|
|
|
533
535
|
"Maybe we do not need it anymore",
|
|
534
536
|
].join("\n"),
|
|
535
537
|
);
|
|
538
|
+
oomWarningPrinted = true;
|
|
536
539
|
}
|
|
537
540
|
throw e;
|
|
538
541
|
}
|
|
@@ -786,13 +789,14 @@ declare const index$r_isResult: typeof isResult;
|
|
|
786
789
|
declare const index$r_isTaggedError: typeof isTaggedError;
|
|
787
790
|
declare const index$r_maybeTaggedErrorToString: typeof maybeTaggedErrorToString;
|
|
788
791
|
declare const index$r_measure: typeof measure;
|
|
792
|
+
declare const index$r_oomWarningPrinted: typeof oomWarningPrinted;
|
|
789
793
|
declare const index$r_parseCurrentSuite: typeof parseCurrentSuite;
|
|
790
794
|
declare const index$r_parseCurrentVersion: typeof parseCurrentVersion;
|
|
791
795
|
declare const index$r_resultToString: typeof resultToString;
|
|
792
796
|
declare const index$r_seeThrough: typeof seeThrough;
|
|
793
797
|
declare const index$r_trimStack: typeof trimStack;
|
|
794
798
|
declare namespace index$r {
|
|
795
|
-
export { index$r_ALL_VERSIONS_IN_ORDER as ALL_VERSIONS_IN_ORDER, index$r_CURRENT_SUITE as CURRENT_SUITE, index$r_CURRENT_VERSION as CURRENT_VERSION, index$r_Compatibility as Compatibility, index$r_DEFAULT_SUITE as DEFAULT_SUITE, index$r_DEFAULT_VERSION as DEFAULT_VERSION, index$r_ErrorsCollector as ErrorsCollector, index$r_GpVersion as GpVersion, Result$2 as Result, index$r_RichTaggedError as RichTaggedError, index$r_TEST_COMPARE_USING as TEST_COMPARE_USING, index$r_TestSuite as TestSuite, index$r_WithDebug as WithDebug, index$r___OPAQUE_TYPE__ as __OPAQUE_TYPE__, index$r_asOpaqueType as asOpaqueType, index$r_assertEmpty as assertEmpty, index$r_assertNever as assertNever, index$r_callCompareFunction as callCompareFunction, index$r_cast as cast, index$r_check as check, index$r_deepEqual as deepEqual, index$r_ensure as ensure, index$r_env as env, index$r_getAllKeysSorted as getAllKeysSorted, index$r_inspect as inspect, index$r_isBrowser as isBrowser, index$r_isResult as isResult, index$r_isTaggedError as isTaggedError, index$r_maybeTaggedErrorToString as maybeTaggedErrorToString, index$r_measure as measure, index$r_parseCurrentSuite as parseCurrentSuite, index$r_parseCurrentVersion as parseCurrentVersion, index$r_resultToString as resultToString, index$r_seeThrough as seeThrough, index$r_trimStack as trimStack };
|
|
799
|
+
export { index$r_ALL_VERSIONS_IN_ORDER as ALL_VERSIONS_IN_ORDER, index$r_CURRENT_SUITE as CURRENT_SUITE, index$r_CURRENT_VERSION as CURRENT_VERSION, index$r_Compatibility as Compatibility, index$r_DEFAULT_SUITE as DEFAULT_SUITE, index$r_DEFAULT_VERSION as DEFAULT_VERSION, index$r_ErrorsCollector as ErrorsCollector, index$r_GpVersion as GpVersion, Result$2 as Result, index$r_RichTaggedError as RichTaggedError, index$r_TEST_COMPARE_USING as TEST_COMPARE_USING, index$r_TestSuite as TestSuite, index$r_WithDebug as WithDebug, index$r___OPAQUE_TYPE__ as __OPAQUE_TYPE__, index$r_asOpaqueType as asOpaqueType, index$r_assertEmpty as assertEmpty, index$r_assertNever as assertNever, index$r_callCompareFunction as callCompareFunction, index$r_cast as cast, index$r_check as check, index$r_deepEqual as deepEqual, index$r_ensure as ensure, index$r_env as env, index$r_getAllKeysSorted as getAllKeysSorted, index$r_inspect as inspect, index$r_isBrowser as isBrowser, index$r_isResult as isResult, index$r_isTaggedError as isTaggedError, index$r_maybeTaggedErrorToString as maybeTaggedErrorToString, index$r_measure as measure, index$r_oomWarningPrinted as oomWarningPrinted, index$r_parseCurrentSuite as parseCurrentSuite, index$r_parseCurrentVersion as parseCurrentVersion, index$r_resultToString as resultToString, index$r_seeThrough as seeThrough, index$r_trimStack as trimStack };
|
|
796
800
|
export type { index$r_DeepEqualOptions as DeepEqualOptions, index$r_EnumMapping as EnumMapping, index$r_ErrorResult as ErrorResult, index$r_OK as OK, index$r_OkResult as OkResult, index$r_Opaque as Opaque, index$r_StringLiteral as StringLiteral, index$r_TaggedError as TaggedError, index$r_TokenOf as TokenOf, index$r_Uninstantiable as Uninstantiable, index$r_WithOpaque as WithOpaque };
|
|
797
801
|
}
|
|
798
802
|
|
|
@@ -4935,6 +4939,8 @@ declare class ChainSpec extends WithDebug {
|
|
|
4935
4939
|
readonly maxBlockGas: U64;
|
|
4936
4940
|
/** `G_R`: The gas allocated to invoke a work-package’s Refine logic. */
|
|
4937
4941
|
readonly maxRefineGas: U64;
|
|
4942
|
+
/** `L`: The maximum age in timeslots of the lookup anchor. */
|
|
4943
|
+
readonly maxLookupAnchorAge: U32;
|
|
4938
4944
|
|
|
4939
4945
|
constructor(data: Omit<ChainSpec, "validatorsSuperMajority" | "thirdOfValidators" | "erasureCodedPieceSize">) {
|
|
4940
4946
|
super();
|
|
@@ -4954,6 +4960,7 @@ declare class ChainSpec extends WithDebug {
|
|
|
4954
4960
|
this.erasureCodedPieceSize = tryAsU32(EC_SEGMENT_SIZE / data.numberECPiecesPerSegment);
|
|
4955
4961
|
this.maxBlockGas = data.maxBlockGas;
|
|
4956
4962
|
this.maxRefineGas = data.maxRefineGas;
|
|
4963
|
+
this.maxLookupAnchorAge = data.maxLookupAnchorAge;
|
|
4957
4964
|
}
|
|
4958
4965
|
}
|
|
4959
4966
|
|
|
@@ -4972,6 +4979,8 @@ declare const tinyChainSpec = new ChainSpec({
|
|
|
4972
4979
|
preimageExpungePeriod: tryAsU32(32),
|
|
4973
4980
|
maxBlockGas: tryAsU64(20_000_000),
|
|
4974
4981
|
maxRefineGas: tryAsU64(1_000_000_000),
|
|
4982
|
+
// https://github.com/davxy/jam-conformance/pull/47/files#diff-27e26142b3a96e407dab40d388b63d553f5d9cdb66dec58cd93e63dd434f9e45R260
|
|
4983
|
+
maxLookupAnchorAge: tryAsU32(24),
|
|
4975
4984
|
});
|
|
4976
4985
|
|
|
4977
4986
|
/**
|
|
@@ -4991,6 +5000,7 @@ declare const fullChainSpec = new ChainSpec({
|
|
|
4991
5000
|
preimageExpungePeriod: tryAsU32(19_200),
|
|
4992
5001
|
maxBlockGas: tryAsU64(3_500_000_000),
|
|
4993
5002
|
maxRefineGas: tryAsU64(5_000_000_000),
|
|
5003
|
+
maxLookupAnchorAge: tryAsU32(14_400),
|
|
4994
5004
|
});
|
|
4995
5005
|
|
|
4996
5006
|
/**
|
|
@@ -6538,6 +6548,22 @@ declare class ValidatorKeys extends WithDebug {
|
|
|
6538
6548
|
}
|
|
6539
6549
|
}
|
|
6540
6550
|
|
|
6551
|
+
declare class TicketsMarker extends WithDebug {
|
|
6552
|
+
static Codec = codec.Class(TicketsMarker, {
|
|
6553
|
+
tickets: codecPerEpochBlock(Ticket.Codec),
|
|
6554
|
+
});
|
|
6555
|
+
|
|
6556
|
+
static create({ tickets }: CodecRecord<TicketsMarker>) {
|
|
6557
|
+
return new TicketsMarker(tickets);
|
|
6558
|
+
}
|
|
6559
|
+
|
|
6560
|
+
private constructor(public readonly tickets: PerEpochBlock<Ticket>) {
|
|
6561
|
+
super();
|
|
6562
|
+
}
|
|
6563
|
+
}
|
|
6564
|
+
|
|
6565
|
+
type TicketsMarkerView = DescribedBy<typeof TicketsMarker.Codec.View>;
|
|
6566
|
+
|
|
6541
6567
|
/**
|
|
6542
6568
|
* For the first block in a new epoch, the epoch marker is set
|
|
6543
6569
|
* and contains the epoch randomness and validator keys
|
|
@@ -6568,6 +6594,8 @@ declare class EpochMarker extends WithDebug {
|
|
|
6568
6594
|
}
|
|
6569
6595
|
}
|
|
6570
6596
|
|
|
6597
|
+
type EpochMarkerView = DescribedBy<typeof EpochMarker.Codec.View>;
|
|
6598
|
+
|
|
6571
6599
|
/**
|
|
6572
6600
|
* Return an encoded header without the seal components.
|
|
6573
6601
|
*
|
|
@@ -6590,7 +6618,7 @@ declare const legacyDescriptor = {
|
|
|
6590
6618
|
extrinsicHash: codec.bytes(HASH_SIZE).asOpaque<ExtrinsicHash>(),
|
|
6591
6619
|
timeSlotIndex: codec.u32.asOpaque<TimeSlot>(),
|
|
6592
6620
|
epochMarker: codec.optional(EpochMarker.Codec),
|
|
6593
|
-
ticketsMarker: codec.optional(
|
|
6621
|
+
ticketsMarker: codec.optional(TicketsMarker.Codec),
|
|
6594
6622
|
offendersMarker: codec.sequenceVarLen(codec.bytes(ED25519_KEY_BYTES).asOpaque<Ed25519Key>()),
|
|
6595
6623
|
bandersnatchBlockAuthorIndex: codec.u16.asOpaque<ValidatorIndex>(),
|
|
6596
6624
|
entropySource: codec.bytes(BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque<BandersnatchVrfSignature>(),
|
|
@@ -6613,7 +6641,7 @@ declare class Header extends WithDebug {
|
|
|
6613
6641
|
extrinsicHash: codec.bytes(HASH_SIZE).asOpaque<ExtrinsicHash>(),
|
|
6614
6642
|
timeSlotIndex: codec.u32.asOpaque<TimeSlot>(),
|
|
6615
6643
|
epochMarker: codec.optional(EpochMarker.Codec),
|
|
6616
|
-
ticketsMarker: codec.optional(
|
|
6644
|
+
ticketsMarker: codec.optional(TicketsMarker.Codec),
|
|
6617
6645
|
bandersnatchBlockAuthorIndex: codec.u16.asOpaque<ValidatorIndex>(),
|
|
6618
6646
|
entropySource: codec.bytes(BANDERSNATCH_VRF_SIGNATURE_BYTES).asOpaque<BandersnatchVrfSignature>(),
|
|
6619
6647
|
offendersMarker: codec.sequenceVarLen(codec.bytes(ED25519_KEY_BYTES).asOpaque<Ed25519Key>()),
|
|
@@ -6646,7 +6674,7 @@ declare class Header extends WithDebug {
|
|
|
6646
6674
|
* `H_w`: Winning tickets provides the series of 600 slot sealing "tickets"
|
|
6647
6675
|
* for the next epoch.
|
|
6648
6676
|
*/
|
|
6649
|
-
public ticketsMarker:
|
|
6677
|
+
public ticketsMarker: TicketsMarker | null = null;
|
|
6650
6678
|
/** `H_i`: Block author's index in the current validator set. */
|
|
6651
6679
|
public bandersnatchBlockAuthorIndex: ValidatorIndex = tryAsValidatorIndex(0);
|
|
6652
6680
|
/** `H_v`: Entropy-yielding VRF signature. */
|
|
@@ -6831,6 +6859,7 @@ type index$j_EntropyHash = EntropyHash;
|
|
|
6831
6859
|
type index$j_Epoch = Epoch;
|
|
6832
6860
|
type index$j_EpochMarker = EpochMarker;
|
|
6833
6861
|
declare const index$j_EpochMarker: typeof EpochMarker;
|
|
6862
|
+
type index$j_EpochMarkerView = EpochMarkerView;
|
|
6834
6863
|
type index$j_Extrinsic = Extrinsic;
|
|
6835
6864
|
declare const index$j_Extrinsic: typeof Extrinsic;
|
|
6836
6865
|
type index$j_ExtrinsicHash = ExtrinsicHash;
|
|
@@ -6850,6 +6879,9 @@ type index$j_SegmentIndex = SegmentIndex;
|
|
|
6850
6879
|
type index$j_ServiceGas = ServiceGas;
|
|
6851
6880
|
type index$j_ServiceId = ServiceId;
|
|
6852
6881
|
type index$j_StateRootHash = StateRootHash;
|
|
6882
|
+
type index$j_TicketsMarker = TicketsMarker;
|
|
6883
|
+
declare const index$j_TicketsMarker: typeof TicketsMarker;
|
|
6884
|
+
type index$j_TicketsMarkerView = TicketsMarkerView;
|
|
6853
6885
|
type index$j_TimeSlot = TimeSlot;
|
|
6854
6886
|
type index$j_ValidatorIndex = ValidatorIndex;
|
|
6855
6887
|
type index$j_ValidatorKeys = ValidatorKeys;
|
|
@@ -6882,8 +6914,8 @@ declare const index$j_workPackage: typeof workPackage;
|
|
|
6882
6914
|
declare const index$j_workReport: typeof workReport;
|
|
6883
6915
|
declare const index$j_workResult: typeof workResult;
|
|
6884
6916
|
declare namespace index$j {
|
|
6885
|
-
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_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 };
|
|
6886
|
-
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_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_TimeSlot as TimeSlot, index$j_ValidatorIndex as ValidatorIndex, index$j_WorkReportHash as WorkReportHash };
|
|
6917
|
+
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 };
|
|
6918
|
+
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 };
|
|
6887
6919
|
}
|
|
6888
6920
|
|
|
6889
6921
|
/** A type that can be read from a JSON-parsed object. */
|
|
@@ -7625,7 +7657,7 @@ declare const epochMark = json.object<JsonEpochMarker, EpochMarker>(
|
|
|
7625
7657
|
(x) => EpochMarker.create({ entropy: x.entropy, ticketsEntropy: x.tickets_entropy, validators: x.validators }),
|
|
7626
7658
|
);
|
|
7627
7659
|
|
|
7628
|
-
declare const
|
|
7660
|
+
declare const ticket = json.object<Ticket>(
|
|
7629
7661
|
{
|
|
7630
7662
|
id: fromJson.bytes32(),
|
|
7631
7663
|
attempt: fromJson.ticketAttempt,
|
|
@@ -7639,7 +7671,7 @@ type JsonHeader = {
|
|
|
7639
7671
|
extrinsic_hash: ExtrinsicHash;
|
|
7640
7672
|
slot: TimeSlot;
|
|
7641
7673
|
epoch_mark?: EpochMarker;
|
|
7642
|
-
tickets_mark?:
|
|
7674
|
+
tickets_mark?: Ticket[];
|
|
7643
7675
|
offenders_mark: Ed25519Key[];
|
|
7644
7676
|
author_index: ValidatorIndex;
|
|
7645
7677
|
entropy_source: BandersnatchVrfSignature;
|
|
@@ -7653,7 +7685,7 @@ declare const headerFromJson = json.object<JsonHeader, Header>(
|
|
|
7653
7685
|
extrinsic_hash: fromJson.bytes32(),
|
|
7654
7686
|
slot: "number",
|
|
7655
7687
|
epoch_mark: json.optional(epochMark),
|
|
7656
|
-
tickets_mark: json.optional
|
|
7688
|
+
tickets_mark: json.optional(json.array(ticket)),
|
|
7657
7689
|
offenders_mark: json.array(fromJson.bytes32<Ed25519Key>()),
|
|
7658
7690
|
author_index: "number",
|
|
7659
7691
|
entropy_source: bandersnatchVrfSignature,
|
|
@@ -7677,7 +7709,10 @@ declare const headerFromJson = json.object<JsonHeader, Header>(
|
|
|
7677
7709
|
header.extrinsicHash = extrinsic_hash;
|
|
7678
7710
|
header.timeSlotIndex = slot;
|
|
7679
7711
|
header.epochMarker = epoch_mark ?? null;
|
|
7680
|
-
header.ticketsMarker =
|
|
7712
|
+
header.ticketsMarker =
|
|
7713
|
+
tickets_mark === undefined || tickets_mark === null
|
|
7714
|
+
? null
|
|
7715
|
+
: TicketsMarker.create({ tickets: asOpaqueType(tickets_mark) });
|
|
7681
7716
|
header.offendersMarker = offenders_mark;
|
|
7682
7717
|
header.bandersnatchBlockAuthorIndex = author_index;
|
|
7683
7718
|
header.entropySource = entropy_source;
|
|
@@ -7727,9 +7762,9 @@ declare const index$h_preimagesExtrinsicFromJson: typeof preimagesExtrinsicFromJ
|
|
|
7727
7762
|
declare const index$h_refineContextFromJson: typeof refineContextFromJson;
|
|
7728
7763
|
declare const index$h_reportGuaranteeFromJson: typeof reportGuaranteeFromJson;
|
|
7729
7764
|
declare const index$h_segmentRootLookupItemFromJson: typeof segmentRootLookupItemFromJson;
|
|
7765
|
+
declare const index$h_ticket: typeof ticket;
|
|
7730
7766
|
declare const index$h_ticketEnvelopeFromJson: typeof ticketEnvelopeFromJson;
|
|
7731
7767
|
declare const index$h_ticketsExtrinsicFromJson: typeof ticketsExtrinsicFromJson;
|
|
7732
|
-
declare const index$h_ticketsMark: typeof ticketsMark;
|
|
7733
7768
|
declare const index$h_validatorKeysFromJson: typeof validatorKeysFromJson;
|
|
7734
7769
|
declare const index$h_validatorSignatureFromJson: typeof validatorSignatureFromJson;
|
|
7735
7770
|
declare const index$h_verdictFromJson: typeof verdictFromJson;
|
|
@@ -7739,7 +7774,7 @@ declare const index$h_workRefineLoadFromJson: typeof workRefineLoadFromJson;
|
|
|
7739
7774
|
declare const index$h_workReportFromJson: typeof workReportFromJson;
|
|
7740
7775
|
declare const index$h_workResultFromJson: typeof workResultFromJson;
|
|
7741
7776
|
declare namespace index$h {
|
|
7742
|
-
export { index$h_bandersnatchVrfSignature as bandersnatchVrfSignature, index$h_blockFromJson as blockFromJson, index$h_culpritFromJson as culpritFromJson, index$h_disputesExtrinsicFromJson as disputesExtrinsicFromJson, index$h_epochMark as epochMark, index$h_faultFromJson as faultFromJson, index$h_fromJson as fromJson, index$h_getAssurancesExtrinsicFromJson as getAssurancesExtrinsicFromJson, index$h_getAvailabilityAssuranceFromJson as getAvailabilityAssuranceFromJson, index$h_getExtrinsicFromJson as getExtrinsicFromJson, index$h_guaranteesExtrinsicFromJson as guaranteesExtrinsicFromJson, index$h_headerFromJson as headerFromJson, index$h_judgementFromJson as judgementFromJson, index$h_preimageFromJson as preimageFromJson, index$h_preimagesExtrinsicFromJson as preimagesExtrinsicFromJson, index$h_refineContextFromJson as refineContextFromJson, index$h_reportGuaranteeFromJson as reportGuaranteeFromJson, index$h_segmentRootLookupItemFromJson as segmentRootLookupItemFromJson, index$
|
|
7777
|
+
export { index$h_bandersnatchVrfSignature as bandersnatchVrfSignature, index$h_blockFromJson as blockFromJson, index$h_culpritFromJson as culpritFromJson, index$h_disputesExtrinsicFromJson as disputesExtrinsicFromJson, index$h_epochMark as epochMark, index$h_faultFromJson as faultFromJson, index$h_fromJson as fromJson, index$h_getAssurancesExtrinsicFromJson as getAssurancesExtrinsicFromJson, index$h_getAvailabilityAssuranceFromJson as getAvailabilityAssuranceFromJson, index$h_getExtrinsicFromJson as getExtrinsicFromJson, index$h_guaranteesExtrinsicFromJson as guaranteesExtrinsicFromJson, index$h_headerFromJson as headerFromJson, index$h_judgementFromJson as judgementFromJson, index$h_preimageFromJson as preimageFromJson, index$h_preimagesExtrinsicFromJson as preimagesExtrinsicFromJson, index$h_refineContextFromJson as refineContextFromJson, index$h_reportGuaranteeFromJson as reportGuaranteeFromJson, index$h_segmentRootLookupItemFromJson as segmentRootLookupItemFromJson, index$h_ticket as ticket, index$h_ticketEnvelopeFromJson as ticketEnvelopeFromJson, index$h_ticketsExtrinsicFromJson as ticketsExtrinsicFromJson, index$h_validatorKeysFromJson as validatorKeysFromJson, index$h_validatorSignatureFromJson as validatorSignatureFromJson, index$h_verdictFromJson as verdictFromJson, index$h_workExecResultFromJson as workExecResultFromJson, index$h_workPackageSpecFromJson as workPackageSpecFromJson, index$h_workRefineLoadFromJson as workRefineLoadFromJson, index$h_workReportFromJson as workReportFromJson, index$h_workResultFromJson as workResultFromJson };
|
|
7743
7778
|
export type { index$h_CamelToSnake as CamelToSnake, index$h_JsonCulprit as JsonCulprit, index$h_JsonEpochMarker as JsonEpochMarker, index$h_JsonFault as JsonFault, index$h_JsonHeader as JsonHeader, index$h_JsonJudgement as JsonJudgement, index$h_JsonObject as JsonObject, index$h_JsonRefineContext as JsonRefineContext, index$h_JsonReportGuarantee as JsonReportGuarantee, index$h_JsonVerdict as JsonVerdict, index$h_JsonWorkExecResult as JsonWorkExecResult, index$h_JsonWorkRefineLoad as JsonWorkRefineLoad, index$h_JsonWorkReport as JsonWorkReport, index$h_JsonWorkResult as JsonWorkResult };
|
|
7744
7779
|
}
|
|
7745
7780
|
|
|
@@ -8249,20 +8284,7 @@ declare class AutoAccumulate {
|
|
|
8249
8284
|
declare class PrivilegedServices {
|
|
8250
8285
|
static Codec = codec.Class(PrivilegedServices, {
|
|
8251
8286
|
manager: codec.u32.asOpaque<ServiceId>(),
|
|
8252
|
-
authManager:
|
|
8253
|
-
? codecPerCore(codec.u32.asOpaque<ServiceId>())
|
|
8254
|
-
: codecWithContext((ctx) =>
|
|
8255
|
-
codec.u32.asOpaque<ServiceId>().convert(
|
|
8256
|
-
// NOTE: [MaSo] In a compatibility mode we are always updating all entries
|
|
8257
|
-
// (all the entries are the same)
|
|
8258
|
-
// so it doesn't matter which one we take here.
|
|
8259
|
-
(perCore: PerCore<ServiceId>) => perCore[0],
|
|
8260
|
-
(serviceId: ServiceId) => {
|
|
8261
|
-
const array = new Array(ctx.coresCount).fill(serviceId);
|
|
8262
|
-
return tryAsPerCore(array, ctx);
|
|
8263
|
-
},
|
|
8264
|
-
),
|
|
8265
|
-
),
|
|
8287
|
+
authManager: codecPerCore(codec.u32.asOpaque<ServiceId>()),
|
|
8266
8288
|
validatorsManager: codec.u32.asOpaque<ServiceId>(),
|
|
8267
8289
|
autoAccumulateServices: readonlyArray(codec.sequenceVarLen(AutoAccumulate.Codec)),
|
|
8268
8290
|
});
|
|
@@ -8805,11 +8827,6 @@ declare class ServiceAccountInfo extends WithDebug {
|
|
|
8805
8827
|
* https://graypaper.fluffylabs.dev/#/7e6ff6a/119e01119e01?v=0.6.7
|
|
8806
8828
|
*/
|
|
8807
8829
|
static calculateThresholdBalance(items: U32, bytes: U64, gratisStorage: U64): U64 {
|
|
8808
|
-
check(
|
|
8809
|
-
gratisStorage === tryAsU64(0) || Compatibility.isGreaterOrEqual(GpVersion.V0_6_7),
|
|
8810
|
-
"Gratis storage cannot be non-zero before 0.6.7",
|
|
8811
|
-
);
|
|
8812
|
-
|
|
8813
8830
|
const storageCost =
|
|
8814
8831
|
BASE_SERVICE_BALANCE + ELECTIVE_ITEM_BALANCE * BigInt(items) + ELECTIVE_BYTE_BALANCE * bytes - gratisStorage;
|
|
8815
8832
|
|
|
@@ -10588,27 +10605,17 @@ declare function* serializeRemovedServices(servicesRemoved: ServiceId[] | undefi
|
|
|
10588
10605
|
}
|
|
10589
10606
|
}
|
|
10590
10607
|
|
|
10591
|
-
declare function getLegacyKey(serviceId: ServiceId, rawKey: StorageKey): StorageKey {
|
|
10592
|
-
const SERVICE_ID_BYTES = 4;
|
|
10593
|
-
const serviceIdAndKey = new Uint8Array(SERVICE_ID_BYTES + rawKey.length);
|
|
10594
|
-
serviceIdAndKey.set(u32AsLeBytes(serviceId));
|
|
10595
|
-
serviceIdAndKey.set(rawKey.raw, SERVICE_ID_BYTES);
|
|
10596
|
-
return asOpaqueType(BytesBlob.blobFrom(blake2b.hashBytes(serviceIdAndKey).raw));
|
|
10597
|
-
}
|
|
10598
|
-
|
|
10599
10608
|
declare function* serializeStorage(storage: UpdateStorage[] | undefined): Generator<StateEntryUpdate> {
|
|
10600
10609
|
for (const { action, serviceId } of storage ?? []) {
|
|
10601
10610
|
switch (action.kind) {
|
|
10602
10611
|
case UpdateStorageKind.Set: {
|
|
10603
|
-
const key =
|
|
10604
|
-
? action.storage.key
|
|
10605
|
-
: getLegacyKey(serviceId, action.storage.key);
|
|
10612
|
+
const key = action.storage.key;
|
|
10606
10613
|
const codec = serialize.serviceStorage(serviceId, key);
|
|
10607
10614
|
yield [StateEntryUpdateAction.Insert, codec.key, action.storage.value];
|
|
10608
10615
|
break;
|
|
10609
10616
|
}
|
|
10610
10617
|
case UpdateStorageKind.Remove: {
|
|
10611
|
-
const key =
|
|
10618
|
+
const key = action.key;
|
|
10612
10619
|
const codec = serialize.serviceStorage(serviceId, key);
|
|
10613
10620
|
yield [StateEntryUpdateAction.Remove, codec.key, EMPTY_BLOB];
|
|
10614
10621
|
break;
|
|
@@ -10748,7 +10755,7 @@ declare function* serializeBasicKeys(spec: ChainSpec, update: Partial<State>) {
|
|
|
10748
10755
|
yield doSerialize(update.recentlyAccumulated, serialize.recentlyAccumulated); // C(15)
|
|
10749
10756
|
}
|
|
10750
10757
|
|
|
10751
|
-
if (update.accumulationOutputLog !== undefined
|
|
10758
|
+
if (update.accumulationOutputLog !== undefined) {
|
|
10752
10759
|
yield doSerialize(update.accumulationOutputLog, serialize.accumulationOutputLog); // C(16)
|
|
10753
10760
|
}
|
|
10754
10761
|
}
|
|
@@ -11543,9 +11550,7 @@ declare function convertInMemoryStateToDictionary(
|
|
|
11543
11550
|
doSerialize(serialize.statistics); // C(13)
|
|
11544
11551
|
doSerialize(serialize.accumulationQueue); // C(14)
|
|
11545
11552
|
doSerialize(serialize.recentlyAccumulated); // C(15)
|
|
11546
|
-
|
|
11547
|
-
doSerialize(serialize.accumulationOutputLog); // C(16)
|
|
11548
|
-
}
|
|
11553
|
+
doSerialize(serialize.accumulationOutputLog); // C(16)
|
|
11549
11554
|
|
|
11550
11555
|
// services
|
|
11551
11556
|
for (const [serviceId, service] of state.services.entries()) {
|
|
@@ -11736,10 +11741,7 @@ declare class SerializedState<T extends SerializedStateBackend = SerializedState
|
|
|
11736
11741
|
}
|
|
11737
11742
|
|
|
11738
11743
|
get accumulationOutputLog(): State["accumulationOutputLog"] {
|
|
11739
|
-
|
|
11740
|
-
return this.retrieve(serialize.accumulationOutputLog, "accumulationOutputLog");
|
|
11741
|
-
}
|
|
11742
|
-
return [];
|
|
11744
|
+
return this.retrieve(serialize.accumulationOutputLog, "accumulationOutputLog");
|
|
11743
11745
|
}
|
|
11744
11746
|
}
|
|
11745
11747
|
|
|
@@ -11886,7 +11888,6 @@ declare const index$c_U32_BYTES: typeof U32_BYTES;
|
|
|
11886
11888
|
declare const index$c_binaryMerkleization: typeof binaryMerkleization;
|
|
11887
11889
|
declare const index$c_convertInMemoryStateToDictionary: typeof convertInMemoryStateToDictionary;
|
|
11888
11890
|
declare const index$c_dumpCodec: typeof dumpCodec;
|
|
11889
|
-
declare const index$c_getLegacyKey: typeof getLegacyKey;
|
|
11890
11891
|
declare const index$c_getSafroleData: typeof getSafroleData;
|
|
11891
11892
|
declare const index$c_legacyServiceNested: typeof legacyServiceNested;
|
|
11892
11893
|
declare const index$c_loadState: typeof loadState;
|
|
@@ -11900,7 +11901,7 @@ declare const index$c_serializeStorage: typeof serializeStorage;
|
|
|
11900
11901
|
declare const index$c_stateEntriesSequenceCodec: typeof stateEntriesSequenceCodec;
|
|
11901
11902
|
import index$c_stateKeys = stateKeys;
|
|
11902
11903
|
declare namespace index$c {
|
|
11903
|
-
export { index$c_EMPTY_BLOB as EMPTY_BLOB, index$c_SerializedService as SerializedService, index$c_SerializedState as SerializedState, index$c_StateEntries as StateEntries, index$c_StateEntryUpdateAction as StateEntryUpdateAction, index$c_StateKeyIdx as StateKeyIdx, index$c_TYPICAL_STATE_ITEMS as TYPICAL_STATE_ITEMS, index$c_TYPICAL_STATE_ITEM_LEN as TYPICAL_STATE_ITEM_LEN, index$c_U32_BYTES as U32_BYTES, index$c_binaryMerkleization as binaryMerkleization, index$c_convertInMemoryStateToDictionary as convertInMemoryStateToDictionary, index$c_dumpCodec as dumpCodec, index$
|
|
11904
|
+
export { index$c_EMPTY_BLOB as EMPTY_BLOB, index$c_SerializedService as SerializedService, index$c_SerializedState as SerializedState, index$c_StateEntries as StateEntries, index$c_StateEntryUpdateAction as StateEntryUpdateAction, index$c_StateKeyIdx as StateKeyIdx, index$c_TYPICAL_STATE_ITEMS as TYPICAL_STATE_ITEMS, index$c_TYPICAL_STATE_ITEM_LEN as TYPICAL_STATE_ITEM_LEN, index$c_U32_BYTES as U32_BYTES, index$c_binaryMerkleization as binaryMerkleization, index$c_convertInMemoryStateToDictionary as convertInMemoryStateToDictionary, index$c_dumpCodec as dumpCodec, index$c_getSafroleData as getSafroleData, index$c_legacyServiceNested as legacyServiceNested, index$c_loadState as loadState, index$c_serialize as serialize, index$c_serializeBasicKeys as serializeBasicKeys, index$c_serializePreimages as serializePreimages, index$c_serializeRemovedServices as serializeRemovedServices, index$c_serializeServiceUpdates as serializeServiceUpdates, index$c_serializeStateUpdate as serializeStateUpdate, index$c_serializeStorage as serializeStorage, index$c_stateEntriesSequenceCodec as stateEntriesSequenceCodec, index$c_stateKeys as stateKeys };
|
|
11904
11905
|
export type { index$c_EncodeFun as EncodeFun, index$c_KeyAndCodec as KeyAndCodec, index$c_SerializedStateBackend as SerializedStateBackend, index$c_StateCodec as StateCodec, index$c_StateEntryUpdate as StateEntryUpdate, StateKey$1 as StateKey };
|
|
11905
11906
|
}
|
|
11906
11907
|
|
|
@@ -12600,6 +12601,173 @@ declare const HostCallResult = {
|
|
|
12600
12601
|
OK: tryAsU64(0n),
|
|
12601
12602
|
} as const;
|
|
12602
12603
|
|
|
12604
|
+
declare enum Level {
|
|
12605
|
+
INSANE = 1,
|
|
12606
|
+
TRACE = 2,
|
|
12607
|
+
LOG = 3,
|
|
12608
|
+
INFO = 4,
|
|
12609
|
+
WARN = 5,
|
|
12610
|
+
ERROR = 6,
|
|
12611
|
+
}
|
|
12612
|
+
|
|
12613
|
+
type Options = {
|
|
12614
|
+
defaultLevel: Level;
|
|
12615
|
+
workingDir: string;
|
|
12616
|
+
modules: Map<string, Level>;
|
|
12617
|
+
};
|
|
12618
|
+
|
|
12619
|
+
/**
|
|
12620
|
+
* A function to parse logger definition (including modules) given as a string.
|
|
12621
|
+
*
|
|
12622
|
+
* Examples
|
|
12623
|
+
* - `info` - setup default logging level to `info`.
|
|
12624
|
+
* - `trace` - default logging level set to `trace`.
|
|
12625
|
+
* - `debug;consensus=trace` - default level is set to `debug/log`, but consensus is in trace mode.
|
|
12626
|
+
*/
|
|
12627
|
+
declare function parseLoggerOptions(input: string, defaultLevel: Level, workingDir?: string): Options {
|
|
12628
|
+
const modules = new Map<string, Level>();
|
|
12629
|
+
const parts = input.toLowerCase().split(",");
|
|
12630
|
+
let defLevel = defaultLevel;
|
|
12631
|
+
|
|
12632
|
+
for (const p of parts) {
|
|
12633
|
+
const clean = p.trim();
|
|
12634
|
+
// skip empty objects (forgotten `,` removed)
|
|
12635
|
+
if (clean.length === 0) {
|
|
12636
|
+
continue;
|
|
12637
|
+
}
|
|
12638
|
+
// we just have the default level
|
|
12639
|
+
if (clean.includes("=")) {
|
|
12640
|
+
const [mod, lvl] = clean.split("=");
|
|
12641
|
+
modules.set(mod.trim(), parseLevel(lvl.trim()));
|
|
12642
|
+
} else {
|
|
12643
|
+
defLevel = parseLevel(clean);
|
|
12644
|
+
}
|
|
12645
|
+
}
|
|
12646
|
+
|
|
12647
|
+
// TODO [ToDr] Fix dirname for workers.
|
|
12648
|
+
const myDir = (import.meta.dirname ?? "").split("/");
|
|
12649
|
+
myDir.pop();
|
|
12650
|
+
myDir.pop();
|
|
12651
|
+
return {
|
|
12652
|
+
defaultLevel: defLevel,
|
|
12653
|
+
modules,
|
|
12654
|
+
workingDir: workingDir ?? myDir.join("/"),
|
|
12655
|
+
};
|
|
12656
|
+
}
|
|
12657
|
+
|
|
12658
|
+
declare const GLOBAL_CONFIG = {
|
|
12659
|
+
options: DEFAULT_OPTIONS,
|
|
12660
|
+
transport: ConsoleTransport.create(DEFAULT_OPTIONS.defaultLevel, DEFAULT_OPTIONS),
|
|
12661
|
+
};
|
|
12662
|
+
|
|
12663
|
+
/**
|
|
12664
|
+
* A logger instance.
|
|
12665
|
+
*/
|
|
12666
|
+
declare class Logger {
|
|
12667
|
+
/**
|
|
12668
|
+
* Create a new logger instance given filename and an optional module name.
|
|
12669
|
+
*
|
|
12670
|
+
* If the module name is not given, `fileName` becomes the module name.
|
|
12671
|
+
* The module name can be composed from multiple parts separated with `/`.
|
|
12672
|
+
*
|
|
12673
|
+
* The logger will use a global configuration which can be changed using
|
|
12674
|
+
* [`configureLogger`] function.
|
|
12675
|
+
*/
|
|
12676
|
+
static new(fileName?: string, moduleName?: string) {
|
|
12677
|
+
const fName = fileName ?? "unknown";
|
|
12678
|
+
return new Logger(moduleName ?? fName, fName, GLOBAL_CONFIG);
|
|
12679
|
+
}
|
|
12680
|
+
|
|
12681
|
+
/**
|
|
12682
|
+
* Return currently configured level for given module. */
|
|
12683
|
+
static getLevel(moduleName: string): Level {
|
|
12684
|
+
return findLevel(GLOBAL_CONFIG.options, moduleName);
|
|
12685
|
+
}
|
|
12686
|
+
|
|
12687
|
+
/**
|
|
12688
|
+
* Global configuration of all loggers.
|
|
12689
|
+
*
|
|
12690
|
+
* One can specify a default logging level (only logs with level >= default will be printed).
|
|
12691
|
+
* It's also possible to configure per-module logging level that takes precedence
|
|
12692
|
+
* over the default one.
|
|
12693
|
+
*
|
|
12694
|
+
* Changing the options affects all previously created loggers.
|
|
12695
|
+
*/
|
|
12696
|
+
static configureAllFromOptions(options: Options) {
|
|
12697
|
+
// find minimal level to optimise logging in case
|
|
12698
|
+
// we don't care about low-level logs.
|
|
12699
|
+
const minimalLevel = Array.from(options.modules.values()).reduce((level, modLevel) => {
|
|
12700
|
+
return level < modLevel ? level : modLevel;
|
|
12701
|
+
}, options.defaultLevel);
|
|
12702
|
+
|
|
12703
|
+
const transport = ConsoleTransport.create(minimalLevel, options);
|
|
12704
|
+
|
|
12705
|
+
// set the global config
|
|
12706
|
+
GLOBAL_CONFIG.options = options;
|
|
12707
|
+
GLOBAL_CONFIG.transport = transport;
|
|
12708
|
+
}
|
|
12709
|
+
|
|
12710
|
+
/**
|
|
12711
|
+
* Global configuration of all loggers.
|
|
12712
|
+
*
|
|
12713
|
+
* Parse configuration options from an input string typically obtained
|
|
12714
|
+
* from environment variable `JAM_LOG`.
|
|
12715
|
+
*/
|
|
12716
|
+
static configureAll(input: string, defaultLevel: Level, workingDir?: string) {
|
|
12717
|
+
const options = parseLoggerOptions(input, defaultLevel, workingDir);
|
|
12718
|
+
Logger.configureAllFromOptions(options);
|
|
12719
|
+
}
|
|
12720
|
+
|
|
12721
|
+
constructor(
|
|
12722
|
+
private readonly moduleName: string,
|
|
12723
|
+
private readonly fileName: string,
|
|
12724
|
+
private readonly config: typeof GLOBAL_CONFIG,
|
|
12725
|
+
) {}
|
|
12726
|
+
|
|
12727
|
+
/** Log a message with `INSANE` level. */
|
|
12728
|
+
insane(val: string) {
|
|
12729
|
+
this.config.transport.insane(this.moduleName, val);
|
|
12730
|
+
}
|
|
12731
|
+
|
|
12732
|
+
/** Log a message with `TRACE` level. */
|
|
12733
|
+
trace(val: string) {
|
|
12734
|
+
this.config.transport.trace(this.moduleName, val);
|
|
12735
|
+
}
|
|
12736
|
+
|
|
12737
|
+
/** Log a message with `DEBUG`/`LOG` level. */
|
|
12738
|
+
log(val: string) {
|
|
12739
|
+
this.config.transport.log(this.moduleName, val);
|
|
12740
|
+
}
|
|
12741
|
+
|
|
12742
|
+
/** Log a message with `INFO` level. */
|
|
12743
|
+
info(val: string) {
|
|
12744
|
+
this.config.transport.info(this.moduleName, val);
|
|
12745
|
+
}
|
|
12746
|
+
|
|
12747
|
+
/** Log a message with `WARN` level. */
|
|
12748
|
+
warn(val: string) {
|
|
12749
|
+
this.config.transport.warn(this.moduleName, val);
|
|
12750
|
+
}
|
|
12751
|
+
|
|
12752
|
+
/** Log a message with `ERROR` level. */
|
|
12753
|
+
error(val: string) {
|
|
12754
|
+
this.config.transport.error(this.moduleName, val);
|
|
12755
|
+
}
|
|
12756
|
+
}
|
|
12757
|
+
|
|
12758
|
+
type index$9_Level = Level;
|
|
12759
|
+
declare const index$9_Level: typeof Level;
|
|
12760
|
+
type index$9_Logger = Logger;
|
|
12761
|
+
declare const index$9_Logger: typeof Logger;
|
|
12762
|
+
declare const index$9_parseLoggerOptions: typeof parseLoggerOptions;
|
|
12763
|
+
declare namespace index$9 {
|
|
12764
|
+
export {
|
|
12765
|
+
index$9_Level as Level,
|
|
12766
|
+
index$9_Logger as Logger,
|
|
12767
|
+
index$9_parseLoggerOptions as parseLoggerOptions,
|
|
12768
|
+
};
|
|
12769
|
+
}
|
|
12770
|
+
|
|
12603
12771
|
/**
|
|
12604
12772
|
* Mask class is an implementation of skip function defined in GP.
|
|
12605
12773
|
*
|
|
@@ -13879,6 +14047,7 @@ declare enum AccessType {
|
|
|
13879
14047
|
READ = 0,
|
|
13880
14048
|
WRITE = 1,
|
|
13881
14049
|
}
|
|
14050
|
+
|
|
13882
14051
|
declare class Memory {
|
|
13883
14052
|
static fromInitialMemory(initialMemoryState: InitialMemoryState) {
|
|
13884
14053
|
return new Memory(
|
|
@@ -13915,6 +14084,7 @@ declare class Memory {
|
|
|
13915
14084
|
return Result.ok(OK);
|
|
13916
14085
|
}
|
|
13917
14086
|
|
|
14087
|
+
logger.insane(`MEM[${address}] <- ${BytesBlob.blobFrom(bytes)}`);
|
|
13918
14088
|
const pagesResult = this.getPages(address, bytes.length, AccessType.WRITE);
|
|
13919
14089
|
|
|
13920
14090
|
if (pagesResult.isError) {
|
|
@@ -14003,6 +14173,7 @@ declare class Memory {
|
|
|
14003
14173
|
bytesLeft -= bytesToRead;
|
|
14004
14174
|
}
|
|
14005
14175
|
|
|
14176
|
+
logger.insane(`MEM[${startAddress}] => ${BytesBlob.blobFrom(result)}`);
|
|
14006
14177
|
return Result.ok(OK);
|
|
14007
14178
|
}
|
|
14008
14179
|
|
|
@@ -15002,6 +15173,10 @@ declare class JumpTable {
|
|
|
15002
15173
|
return new JumpTable(0, new Uint8Array());
|
|
15003
15174
|
}
|
|
15004
15175
|
|
|
15176
|
+
getSize() {
|
|
15177
|
+
return this.indices.length;
|
|
15178
|
+
}
|
|
15179
|
+
|
|
15005
15180
|
copyFrom(jt: JumpTable) {
|
|
15006
15181
|
this.indices = jt.indices;
|
|
15007
15182
|
}
|
|
@@ -15903,167 +16078,6 @@ declare class OneRegOneExtImmDispatcher {
|
|
|
15903
16078
|
}
|
|
15904
16079
|
}
|
|
15905
16080
|
|
|
15906
|
-
declare enum Level {
|
|
15907
|
-
TRACE = 1,
|
|
15908
|
-
LOG = 2,
|
|
15909
|
-
INFO = 3,
|
|
15910
|
-
WARN = 4,
|
|
15911
|
-
ERROR = 5,
|
|
15912
|
-
}
|
|
15913
|
-
|
|
15914
|
-
type Options = {
|
|
15915
|
-
defaultLevel: Level;
|
|
15916
|
-
workingDir: string;
|
|
15917
|
-
modules: Map<string, Level>;
|
|
15918
|
-
};
|
|
15919
|
-
|
|
15920
|
-
/**
|
|
15921
|
-
* A function to parse logger definition (including modules) given as a string.
|
|
15922
|
-
*
|
|
15923
|
-
* Examples
|
|
15924
|
-
* - `info` - setup default logging level to `info`.
|
|
15925
|
-
* - `trace` - default logging level set to `trace`.
|
|
15926
|
-
* - `debug;consensus=trace` - default level is set to `debug/log`, but consensus is in trace mode.
|
|
15927
|
-
*/
|
|
15928
|
-
declare function parseLoggerOptions(input: string, defaultLevel: Level, workingDir?: string): Options {
|
|
15929
|
-
const modules = new Map<string, Level>();
|
|
15930
|
-
const parts = input.toLowerCase().split(",");
|
|
15931
|
-
let defLevel = defaultLevel;
|
|
15932
|
-
|
|
15933
|
-
for (const p of parts) {
|
|
15934
|
-
const clean = p.trim();
|
|
15935
|
-
// skip empty objects (forgotten `,` removed)
|
|
15936
|
-
if (clean.length === 0) {
|
|
15937
|
-
continue;
|
|
15938
|
-
}
|
|
15939
|
-
// we just have the default level
|
|
15940
|
-
if (clean.includes("=")) {
|
|
15941
|
-
const [mod, lvl] = clean.split("=");
|
|
15942
|
-
modules.set(mod.trim(), parseLevel(lvl.trim()));
|
|
15943
|
-
} else {
|
|
15944
|
-
defLevel = parseLevel(clean);
|
|
15945
|
-
}
|
|
15946
|
-
}
|
|
15947
|
-
|
|
15948
|
-
// TODO [ToDr] Fix dirname for workers.
|
|
15949
|
-
const myDir = (import.meta.dirname ?? "").split("/");
|
|
15950
|
-
myDir.pop();
|
|
15951
|
-
myDir.pop();
|
|
15952
|
-
return {
|
|
15953
|
-
defaultLevel: defLevel,
|
|
15954
|
-
modules,
|
|
15955
|
-
workingDir: workingDir ?? myDir.join("/"),
|
|
15956
|
-
};
|
|
15957
|
-
}
|
|
15958
|
-
|
|
15959
|
-
declare const GLOBAL_CONFIG = {
|
|
15960
|
-
options: DEFAULT_OPTIONS,
|
|
15961
|
-
transport: ConsoleTransport.create(DEFAULT_OPTIONS.defaultLevel, DEFAULT_OPTIONS),
|
|
15962
|
-
};
|
|
15963
|
-
|
|
15964
|
-
/**
|
|
15965
|
-
* A logger instance.
|
|
15966
|
-
*/
|
|
15967
|
-
declare class Logger {
|
|
15968
|
-
/**
|
|
15969
|
-
* Create a new logger instance given filename and an optional module name.
|
|
15970
|
-
*
|
|
15971
|
-
* If the module name is not given, `fileName` becomes the module name.
|
|
15972
|
-
* The module name can be composed from multiple parts separated with `/`.
|
|
15973
|
-
*
|
|
15974
|
-
* The logger will use a global configuration which can be changed using
|
|
15975
|
-
* [`configureLogger`] function.
|
|
15976
|
-
*/
|
|
15977
|
-
static new(fileName?: string, moduleName?: string) {
|
|
15978
|
-
const fName = fileName ?? "unknown";
|
|
15979
|
-
return new Logger(moduleName ?? fName, fName, GLOBAL_CONFIG);
|
|
15980
|
-
}
|
|
15981
|
-
|
|
15982
|
-
/**
|
|
15983
|
-
* Return currently configured level for given module. */
|
|
15984
|
-
static getLevel(moduleName: string): Level {
|
|
15985
|
-
return findLevel(GLOBAL_CONFIG.options, moduleName);
|
|
15986
|
-
}
|
|
15987
|
-
|
|
15988
|
-
/**
|
|
15989
|
-
* Global configuration of all loggers.
|
|
15990
|
-
*
|
|
15991
|
-
* One can specify a default logging level (only logs with level >= default will be printed).
|
|
15992
|
-
* It's also possible to configure per-module logging level that takes precedence
|
|
15993
|
-
* over the default one.
|
|
15994
|
-
*
|
|
15995
|
-
* Changing the options affects all previously created loggers.
|
|
15996
|
-
*/
|
|
15997
|
-
static configureAllFromOptions(options: Options) {
|
|
15998
|
-
// find minimal level to optimise logging in case
|
|
15999
|
-
// we don't care about low-level logs.
|
|
16000
|
-
const minimalLevel = Array.from(options.modules.values()).reduce((level, modLevel) => {
|
|
16001
|
-
return level < modLevel ? level : modLevel;
|
|
16002
|
-
}, options.defaultLevel);
|
|
16003
|
-
|
|
16004
|
-
const transport = ConsoleTransport.create(minimalLevel, options);
|
|
16005
|
-
|
|
16006
|
-
// set the global config
|
|
16007
|
-
GLOBAL_CONFIG.options = options;
|
|
16008
|
-
GLOBAL_CONFIG.transport = transport;
|
|
16009
|
-
}
|
|
16010
|
-
|
|
16011
|
-
/**
|
|
16012
|
-
* Global configuration of all loggers.
|
|
16013
|
-
*
|
|
16014
|
-
* Parse configuration options from an input string typically obtained
|
|
16015
|
-
* from environment variable `JAM_LOG`.
|
|
16016
|
-
*/
|
|
16017
|
-
static configureAll(input: string, defaultLevel: Level, workingDir?: string) {
|
|
16018
|
-
const options = parseLoggerOptions(input, defaultLevel, workingDir);
|
|
16019
|
-
Logger.configureAllFromOptions(options);
|
|
16020
|
-
}
|
|
16021
|
-
|
|
16022
|
-
constructor(
|
|
16023
|
-
private readonly moduleName: string,
|
|
16024
|
-
private readonly fileName: string,
|
|
16025
|
-
private readonly config: typeof GLOBAL_CONFIG,
|
|
16026
|
-
) {}
|
|
16027
|
-
|
|
16028
|
-
/** Log a message with `TRACE` level. */
|
|
16029
|
-
trace(val: string) {
|
|
16030
|
-
this.config.transport.trace(this.moduleName, this.fileName, val);
|
|
16031
|
-
}
|
|
16032
|
-
|
|
16033
|
-
/** Log a message with `DEBUG`/`LOG` level. */
|
|
16034
|
-
log(val: string) {
|
|
16035
|
-
this.config.transport.log(this.moduleName, this.fileName, val);
|
|
16036
|
-
}
|
|
16037
|
-
|
|
16038
|
-
/** Log a message with `INFO` level. */
|
|
16039
|
-
info(val: string) {
|
|
16040
|
-
this.config.transport.info(this.moduleName, this.fileName, val);
|
|
16041
|
-
}
|
|
16042
|
-
|
|
16043
|
-
/** Log a message with `WARN` level. */
|
|
16044
|
-
warn(val: string) {
|
|
16045
|
-
this.config.transport.warn(this.moduleName, this.fileName, val);
|
|
16046
|
-
}
|
|
16047
|
-
|
|
16048
|
-
/** Log a message with `ERROR` level. */
|
|
16049
|
-
error(val: string) {
|
|
16050
|
-
this.config.transport.error(this.moduleName, this.fileName, val);
|
|
16051
|
-
}
|
|
16052
|
-
}
|
|
16053
|
-
|
|
16054
|
-
type index$9_Level = Level;
|
|
16055
|
-
declare const index$9_Level: typeof Level;
|
|
16056
|
-
type index$9_Logger = Logger;
|
|
16057
|
-
declare const index$9_Logger: typeof Logger;
|
|
16058
|
-
declare const index$9_parseLoggerOptions: typeof parseLoggerOptions;
|
|
16059
|
-
declare namespace index$9 {
|
|
16060
|
-
export {
|
|
16061
|
-
index$9_Level as Level,
|
|
16062
|
-
index$9_Logger as Logger,
|
|
16063
|
-
index$9_parseLoggerOptions as parseLoggerOptions,
|
|
16064
|
-
};
|
|
16065
|
-
}
|
|
16066
|
-
|
|
16067
16081
|
declare enum ProgramDecoderError {
|
|
16068
16082
|
InvalidProgramError = 0,
|
|
16069
16083
|
}
|
|
@@ -16146,6 +16160,8 @@ type InterpreterOptions = {
|
|
|
16146
16160
|
useSbrkGas?: boolean;
|
|
16147
16161
|
};
|
|
16148
16162
|
|
|
16163
|
+
declare const logger = Logger.new(import.meta.filename, "pvm");
|
|
16164
|
+
|
|
16149
16165
|
declare class Interpreter {
|
|
16150
16166
|
private readonly useSbrkGas: boolean;
|
|
16151
16167
|
private registers = new Registers();
|
|
@@ -16281,6 +16297,8 @@ declare class Interpreter {
|
|
|
16281
16297
|
const argsResult = this.argsDecodingResults[argsType];
|
|
16282
16298
|
this.argsDecoder.fillArgs(this.pc, argsResult);
|
|
16283
16299
|
|
|
16300
|
+
logger.insane(`[PC: ${this.pc}] ${Instruction[currentInstruction]}`);
|
|
16301
|
+
|
|
16284
16302
|
if (!isValidInstruction) {
|
|
16285
16303
|
this.instructionResult.status = Result.PANIC;
|
|
16286
16304
|
} else {
|
|
@@ -16356,6 +16374,7 @@ declare class Interpreter {
|
|
|
16356
16374
|
this.status = Status.HOST;
|
|
16357
16375
|
break;
|
|
16358
16376
|
}
|
|
16377
|
+
logger.insane(`[PC: ${this.pc}] Status: ${Result[this.instructionResult.status]}`);
|
|
16359
16378
|
return this.status;
|
|
16360
16379
|
}
|
|
16361
16380
|
|
|
@@ -16427,13 +16446,14 @@ declare const index$8_Registers: typeof Registers;
|
|
|
16427
16446
|
type index$8_SbrkIndex = SbrkIndex;
|
|
16428
16447
|
type index$8_SmallGas = SmallGas;
|
|
16429
16448
|
declare const index$8_gasCounter: typeof gasCounter;
|
|
16449
|
+
declare const index$8_logger: typeof logger;
|
|
16430
16450
|
declare const index$8_tryAsBigGas: typeof tryAsBigGas;
|
|
16431
16451
|
declare const index$8_tryAsGas: typeof tryAsGas;
|
|
16432
16452
|
declare const index$8_tryAsMemoryIndex: typeof tryAsMemoryIndex;
|
|
16433
16453
|
declare const index$8_tryAsSbrkIndex: typeof tryAsSbrkIndex;
|
|
16434
16454
|
declare const index$8_tryAsSmallGas: typeof tryAsSmallGas;
|
|
16435
16455
|
declare namespace index$8 {
|
|
16436
|
-
export { index$8_Interpreter as Interpreter, index$8_Memory as Memory, index$8_MemoryBuilder as MemoryBuilder, index$8_Registers as Registers, index$8_gasCounter as gasCounter, index$8_tryAsBigGas as tryAsBigGas, index$8_tryAsGas as tryAsGas, index$8_tryAsMemoryIndex as tryAsMemoryIndex, index$8_tryAsSbrkIndex as tryAsSbrkIndex, index$8_tryAsSmallGas as tryAsSmallGas };
|
|
16456
|
+
export { index$8_Interpreter as Interpreter, index$8_Memory as Memory, index$8_MemoryBuilder as MemoryBuilder, index$8_Registers as Registers, index$8_gasCounter as gasCounter, index$8_logger as logger, index$8_tryAsBigGas as tryAsBigGas, index$8_tryAsGas as tryAsGas, index$8_tryAsMemoryIndex as tryAsMemoryIndex, index$8_tryAsSbrkIndex as tryAsSbrkIndex, index$8_tryAsSmallGas as tryAsSmallGas };
|
|
16437
16457
|
export type { index$8_BigGas as BigGas, index$8_Gas as Gas, index$8_GasCounter as GasCounter, index$8_InterpreterOptions as InterpreterOptions, index$8_MemoryIndex as MemoryIndex, index$8_SbrkIndex as SbrkIndex, index$8_SmallGas as SmallGas };
|
|
16438
16458
|
}
|
|
16439
16459
|
|
|
@@ -16571,7 +16591,7 @@ declare class HostCallsManager {
|
|
|
16571
16591
|
return `r${idx}=${value} (0x${value.toString(16)})`;
|
|
16572
16592
|
})
|
|
16573
16593
|
.join(", ");
|
|
16574
|
-
logger.
|
|
16594
|
+
logger.insane(`[${currentServiceId}] ${context} ${name}${requested}. Gas: ${gas}. Regs: ${registerValues}.`);
|
|
16575
16595
|
}
|
|
16576
16596
|
}
|
|
16577
16597
|
|
|
@@ -16692,14 +16712,15 @@ declare class HostCalls {
|
|
|
16692
16712
|
const gasCost = typeof hostCall.gasCost === "number" ? hostCall.gasCost : hostCall.gasCost(regs);
|
|
16693
16713
|
const underflow = gas.sub(gasCost);
|
|
16694
16714
|
|
|
16715
|
+
const pcLog = `[PC: ${pvmInstance.getPC()}]`;
|
|
16695
16716
|
if (underflow) {
|
|
16696
|
-
this.hostCalls.traceHostCall(
|
|
16717
|
+
this.hostCalls.traceHostCall(`${pcLog} OOG`, index, hostCall, regs, gas.get());
|
|
16697
16718
|
return ReturnValue.fromStatus(pvmInstance.getGasConsumed(), Status.OOG);
|
|
16698
16719
|
}
|
|
16699
|
-
this.hostCalls.traceHostCall(
|
|
16720
|
+
this.hostCalls.traceHostCall(`${pcLog} Invoking`, index, hostCall, regs, gasBefore);
|
|
16700
16721
|
const result = await hostCall.execute(gas, regs, memory);
|
|
16701
16722
|
this.hostCalls.traceHostCall(
|
|
16702
|
-
result === undefined ?
|
|
16723
|
+
result === undefined ? `${pcLog} Result` : `${pcLog} Status(${PvmExecution[result]})`,
|
|
16703
16724
|
index,
|
|
16704
16725
|
hostCall,
|
|
16705
16726
|
regs,
|
|
@@ -18112,41 +18133,7 @@ declare namespace index$2 {
|
|
|
18112
18133
|
};
|
|
18113
18134
|
}
|
|
18114
18135
|
|
|
18115
|
-
declare class
|
|
18116
|
-
static fromJson = json.object<JsonServiceInfoPre067, ServiceAccountInfo>(
|
|
18117
|
-
{
|
|
18118
|
-
code_hash: fromJson.bytes32(),
|
|
18119
|
-
balance: json.fromNumber((x) => tryAsU64(x)),
|
|
18120
|
-
min_item_gas: json.fromNumber((x) => tryAsServiceGas(x)),
|
|
18121
|
-
min_memo_gas: json.fromNumber((x) => tryAsServiceGas(x)),
|
|
18122
|
-
bytes: json.fromNumber((x) => tryAsU64(x)),
|
|
18123
|
-
items: "number",
|
|
18124
|
-
},
|
|
18125
|
-
({ code_hash, balance, min_item_gas, min_memo_gas, bytes, items }) => {
|
|
18126
|
-
return ServiceAccountInfo.create({
|
|
18127
|
-
codeHash: code_hash,
|
|
18128
|
-
balance,
|
|
18129
|
-
accumulateMinGas: min_item_gas,
|
|
18130
|
-
onTransferMinGas: min_memo_gas,
|
|
18131
|
-
storageUtilisationBytes: bytes,
|
|
18132
|
-
storageUtilisationCount: items,
|
|
18133
|
-
gratisStorage: tryAsU64(0),
|
|
18134
|
-
created: tryAsTimeSlot(0),
|
|
18135
|
-
lastAccumulation: tryAsTimeSlot(0),
|
|
18136
|
-
parentService: tryAsServiceId(0),
|
|
18137
|
-
});
|
|
18138
|
-
},
|
|
18139
|
-
);
|
|
18140
|
-
|
|
18141
|
-
code_hash!: CodeHash;
|
|
18142
|
-
balance!: U64;
|
|
18143
|
-
min_item_gas!: ServiceGas;
|
|
18144
|
-
min_memo_gas!: ServiceGas;
|
|
18145
|
-
bytes!: U64;
|
|
18146
|
-
items!: U32;
|
|
18147
|
-
}
|
|
18148
|
-
|
|
18149
|
-
declare class JsonServiceInfo extends JsonServiceInfoPre067 {
|
|
18136
|
+
declare class JsonServiceInfo {
|
|
18150
18137
|
static fromJson = json.object<JsonServiceInfo, ServiceAccountInfo>(
|
|
18151
18138
|
{
|
|
18152
18139
|
code_hash: fromJson.bytes32(),
|
|
@@ -18187,6 +18174,12 @@ declare class JsonServiceInfo extends JsonServiceInfoPre067 {
|
|
|
18187
18174
|
},
|
|
18188
18175
|
);
|
|
18189
18176
|
|
|
18177
|
+
code_hash!: CodeHash;
|
|
18178
|
+
balance!: U64;
|
|
18179
|
+
min_item_gas!: ServiceGas;
|
|
18180
|
+
min_memo_gas!: ServiceGas;
|
|
18181
|
+
bytes!: U64;
|
|
18182
|
+
items!: U32;
|
|
18190
18183
|
creation_slot!: TimeSlot;
|
|
18191
18184
|
deposit_offset!: U64;
|
|
18192
18185
|
last_accumulation_slot!: TimeSlot;
|
|
@@ -18240,9 +18233,7 @@ declare class JsonService {
|
|
|
18240
18233
|
{
|
|
18241
18234
|
id: "number",
|
|
18242
18235
|
data: {
|
|
18243
|
-
service:
|
|
18244
|
-
? JsonServiceInfo.fromJson
|
|
18245
|
-
: JsonServiceInfoPre067.fromJson,
|
|
18236
|
+
service: JsonServiceInfo.fromJson,
|
|
18246
18237
|
preimages: json.optional(json.array(JsonPreimageItem.fromJson)),
|
|
18247
18238
|
storage: json.optional(json.array(JsonStorageItem.fromJson)),
|
|
18248
18239
|
lookup_meta: json.optional(json.array(lookupMetaFromJson)),
|
|
@@ -18745,138 +18736,6 @@ declare const fullStateDumpFromJson = (spec: ChainSpec) =>
|
|
|
18745
18736
|
},
|
|
18746
18737
|
);
|
|
18747
18738
|
|
|
18748
|
-
type JsonStateDumpPre067 = {
|
|
18749
|
-
alpha: AuthorizerHash[][];
|
|
18750
|
-
varphi: AuthorizerHash[][];
|
|
18751
|
-
beta: State["recentBlocks"] | null;
|
|
18752
|
-
gamma: {
|
|
18753
|
-
gamma_k: State["nextValidatorData"];
|
|
18754
|
-
gamma_z: State["epochRoot"];
|
|
18755
|
-
gamma_s: TicketsOrKeys;
|
|
18756
|
-
gamma_a: State["ticketsAccumulator"];
|
|
18757
|
-
};
|
|
18758
|
-
psi: State["disputesRecords"];
|
|
18759
|
-
eta: State["entropy"];
|
|
18760
|
-
iota: State["designatedValidatorData"];
|
|
18761
|
-
kappa: State["currentValidatorData"];
|
|
18762
|
-
lambda: State["previousValidatorData"];
|
|
18763
|
-
rho: State["availabilityAssignment"];
|
|
18764
|
-
tau: State["timeslot"];
|
|
18765
|
-
chi: {
|
|
18766
|
-
chi_m: PrivilegedServices["manager"];
|
|
18767
|
-
chi_a: ServiceId; // NOTE: [MaSo] pre067
|
|
18768
|
-
chi_v: PrivilegedServices["validatorsManager"];
|
|
18769
|
-
chi_g: PrivilegedServices["autoAccumulateServices"] | null;
|
|
18770
|
-
};
|
|
18771
|
-
pi: JsonStatisticsData;
|
|
18772
|
-
theta: State["accumulationQueue"];
|
|
18773
|
-
xi: PerEpochBlock<WorkPackageHash[]>;
|
|
18774
|
-
accounts: InMemoryService[];
|
|
18775
|
-
};
|
|
18776
|
-
|
|
18777
|
-
declare const fullStateDumpFromJsonPre067 = (spec: ChainSpec) =>
|
|
18778
|
-
json.object<JsonStateDumpPre067, InMemoryState>(
|
|
18779
|
-
{
|
|
18780
|
-
alpha: json.array(json.array(fromJson.bytes32<AuthorizerHash>())),
|
|
18781
|
-
varphi: json.array(json.array(fromJson.bytes32<AuthorizerHash>())),
|
|
18782
|
-
beta: json.nullable(recentBlocksHistoryFromJson),
|
|
18783
|
-
gamma: {
|
|
18784
|
-
gamma_k: json.array(validatorDataFromJson),
|
|
18785
|
-
gamma_a: json.array(ticketFromJson),
|
|
18786
|
-
gamma_s: TicketsOrKeys.fromJson,
|
|
18787
|
-
gamma_z: json.fromString((v) => Bytes.parseBytes(v, BANDERSNATCH_RING_ROOT_BYTES).asOpaque()),
|
|
18788
|
-
},
|
|
18789
|
-
psi: disputesRecordsFromJson,
|
|
18790
|
-
eta: json.array(fromJson.bytes32<EntropyHash>()),
|
|
18791
|
-
iota: json.array(validatorDataFromJson),
|
|
18792
|
-
kappa: json.array(validatorDataFromJson),
|
|
18793
|
-
lambda: json.array(validatorDataFromJson),
|
|
18794
|
-
rho: json.array(json.nullable(availabilityAssignmentFromJson)),
|
|
18795
|
-
tau: "number",
|
|
18796
|
-
chi: {
|
|
18797
|
-
chi_m: "number",
|
|
18798
|
-
chi_a: "number",
|
|
18799
|
-
chi_v: "number",
|
|
18800
|
-
chi_g: json.nullable(
|
|
18801
|
-
json.array({
|
|
18802
|
-
service: "number",
|
|
18803
|
-
gasLimit: json.fromNumber((v) => tryAsServiceGas(v)),
|
|
18804
|
-
}),
|
|
18805
|
-
),
|
|
18806
|
-
},
|
|
18807
|
-
pi: JsonStatisticsData.fromJson,
|
|
18808
|
-
theta: json.array(json.array(notYetAccumulatedFromJson)),
|
|
18809
|
-
xi: json.array(json.array(fromJson.bytes32())),
|
|
18810
|
-
accounts: json.array(JsonService.fromJson),
|
|
18811
|
-
},
|
|
18812
|
-
({
|
|
18813
|
-
alpha,
|
|
18814
|
-
varphi,
|
|
18815
|
-
beta,
|
|
18816
|
-
gamma,
|
|
18817
|
-
psi,
|
|
18818
|
-
eta,
|
|
18819
|
-
iota,
|
|
18820
|
-
kappa,
|
|
18821
|
-
lambda,
|
|
18822
|
-
rho,
|
|
18823
|
-
tau,
|
|
18824
|
-
chi,
|
|
18825
|
-
pi,
|
|
18826
|
-
theta,
|
|
18827
|
-
xi,
|
|
18828
|
-
accounts,
|
|
18829
|
-
}): InMemoryState => {
|
|
18830
|
-
return InMemoryState.create({
|
|
18831
|
-
authPools: tryAsPerCore(
|
|
18832
|
-
alpha.map((perCore) => {
|
|
18833
|
-
if (perCore.length > MAX_AUTH_POOL_SIZE) {
|
|
18834
|
-
throw new Error(`AuthPools: expected less than ${MAX_AUTH_POOL_SIZE}, got ${perCore.length}`);
|
|
18835
|
-
}
|
|
18836
|
-
return asKnownSize(perCore);
|
|
18837
|
-
}),
|
|
18838
|
-
spec,
|
|
18839
|
-
),
|
|
18840
|
-
authQueues: tryAsPerCore(
|
|
18841
|
-
varphi.map((perCore) => {
|
|
18842
|
-
if (perCore.length !== AUTHORIZATION_QUEUE_SIZE) {
|
|
18843
|
-
throw new Error(`AuthQueues: expected ${AUTHORIZATION_QUEUE_SIZE}, got: ${perCore.length}`);
|
|
18844
|
-
}
|
|
18845
|
-
return asKnownSize(perCore);
|
|
18846
|
-
}),
|
|
18847
|
-
spec,
|
|
18848
|
-
),
|
|
18849
|
-
recentBlocks: beta ?? RecentBlocksHistory.empty(),
|
|
18850
|
-
nextValidatorData: gamma.gamma_k,
|
|
18851
|
-
epochRoot: gamma.gamma_z,
|
|
18852
|
-
sealingKeySeries: TicketsOrKeys.toSafroleSealingKeys(gamma.gamma_s, spec),
|
|
18853
|
-
ticketsAccumulator: gamma.gamma_a,
|
|
18854
|
-
disputesRecords: psi,
|
|
18855
|
-
entropy: eta,
|
|
18856
|
-
designatedValidatorData: iota,
|
|
18857
|
-
currentValidatorData: kappa,
|
|
18858
|
-
previousValidatorData: lambda,
|
|
18859
|
-
availabilityAssignment: rho,
|
|
18860
|
-
timeslot: tau,
|
|
18861
|
-
privilegedServices: PrivilegedServices.create({
|
|
18862
|
-
manager: chi.chi_m,
|
|
18863
|
-
authManager: tryAsPerCore(new Array(spec.coresCount).fill(chi.chi_a), spec),
|
|
18864
|
-
validatorsManager: chi.chi_v,
|
|
18865
|
-
autoAccumulateServices: chi.chi_g ?? [],
|
|
18866
|
-
}),
|
|
18867
|
-
statistics: JsonStatisticsData.toStatisticsData(spec, pi),
|
|
18868
|
-
accumulationQueue: theta,
|
|
18869
|
-
recentlyAccumulated: tryAsPerEpochBlock(
|
|
18870
|
-
xi.map((x) => HashSet.from(x)),
|
|
18871
|
-
spec,
|
|
18872
|
-
),
|
|
18873
|
-
services: new Map(accounts.map((x) => [x.serviceId, x])),
|
|
18874
|
-
// NOTE Field not present in pre067, added here for compatibility reasons
|
|
18875
|
-
accumulationOutputLog: [],
|
|
18876
|
-
});
|
|
18877
|
-
},
|
|
18878
|
-
);
|
|
18879
|
-
|
|
18880
18739
|
type index$1_JsonAvailabilityAssignment = JsonAvailabilityAssignment;
|
|
18881
18740
|
type index$1_JsonCoreStatistics = JsonCoreStatistics;
|
|
18882
18741
|
declare const index$1_JsonCoreStatistics: typeof JsonCoreStatistics;
|
|
@@ -18892,12 +18751,9 @@ type index$1_JsonService = JsonService;
|
|
|
18892
18751
|
declare const index$1_JsonService: typeof JsonService;
|
|
18893
18752
|
type index$1_JsonServiceInfo = JsonServiceInfo;
|
|
18894
18753
|
declare const index$1_JsonServiceInfo: typeof JsonServiceInfo;
|
|
18895
|
-
type index$1_JsonServiceInfoPre067 = JsonServiceInfoPre067;
|
|
18896
|
-
declare const index$1_JsonServiceInfoPre067: typeof JsonServiceInfoPre067;
|
|
18897
18754
|
type index$1_JsonServiceStatistics = JsonServiceStatistics;
|
|
18898
18755
|
declare const index$1_JsonServiceStatistics: typeof JsonServiceStatistics;
|
|
18899
18756
|
type index$1_JsonStateDump = JsonStateDump;
|
|
18900
|
-
type index$1_JsonStateDumpPre067 = JsonStateDumpPre067;
|
|
18901
18757
|
type index$1_JsonStatisticsData = JsonStatisticsData;
|
|
18902
18758
|
declare const index$1_JsonStatisticsData: typeof JsonStatisticsData;
|
|
18903
18759
|
type index$1_JsonStorageItem = JsonStorageItem;
|
|
@@ -18910,7 +18766,6 @@ declare const index$1_TicketsOrKeys: typeof TicketsOrKeys;
|
|
|
18910
18766
|
declare const index$1_availabilityAssignmentFromJson: typeof availabilityAssignmentFromJson;
|
|
18911
18767
|
declare const index$1_disputesRecordsFromJson: typeof disputesRecordsFromJson;
|
|
18912
18768
|
declare const index$1_fullStateDumpFromJson: typeof fullStateDumpFromJson;
|
|
18913
|
-
declare const index$1_fullStateDumpFromJsonPre067: typeof fullStateDumpFromJsonPre067;
|
|
18914
18769
|
declare const index$1_lookupMetaFromJson: typeof lookupMetaFromJson;
|
|
18915
18770
|
declare const index$1_notYetAccumulatedFromJson: typeof notYetAccumulatedFromJson;
|
|
18916
18771
|
declare const index$1_recentBlockStateFromJson: typeof recentBlockStateFromJson;
|
|
@@ -18920,8 +18775,8 @@ declare const index$1_serviceStatisticsEntryFromJson: typeof serviceStatisticsEn
|
|
|
18920
18775
|
declare const index$1_ticketFromJson: typeof ticketFromJson;
|
|
18921
18776
|
declare const index$1_validatorDataFromJson: typeof validatorDataFromJson;
|
|
18922
18777
|
declare namespace index$1 {
|
|
18923
|
-
export { index$1_JsonCoreStatistics as JsonCoreStatistics, index$1_JsonDisputesRecords as JsonDisputesRecords, index$1_JsonPreimageItem as JsonPreimageItem, index$1_JsonService as JsonService, index$1_JsonServiceInfo as JsonServiceInfo, index$
|
|
18924
|
-
export type { index$1_JsonAvailabilityAssignment as JsonAvailabilityAssignment, index$1_JsonLookupMeta as JsonLookupMeta, index$1_JsonRecentBlockState as JsonRecentBlockState, index$1_JsonRecentBlocks as JsonRecentBlocks, index$1_JsonReportedWorkPackageInfo as JsonReportedWorkPackageInfo, index$1_JsonStateDump as JsonStateDump, index$
|
|
18778
|
+
export { index$1_JsonCoreStatistics as JsonCoreStatistics, index$1_JsonDisputesRecords as JsonDisputesRecords, index$1_JsonPreimageItem as JsonPreimageItem, index$1_JsonService as JsonService, index$1_JsonServiceInfo as JsonServiceInfo, index$1_JsonServiceStatistics as JsonServiceStatistics, index$1_JsonStatisticsData as JsonStatisticsData, index$1_JsonStorageItem as JsonStorageItem, index$1_JsonValidatorStatistics as JsonValidatorStatistics, index$1_TicketsOrKeys as TicketsOrKeys, index$1_availabilityAssignmentFromJson as availabilityAssignmentFromJson, index$1_disputesRecordsFromJson as disputesRecordsFromJson, index$1_fullStateDumpFromJson as fullStateDumpFromJson, index$1_lookupMetaFromJson as lookupMetaFromJson, index$1_notYetAccumulatedFromJson as notYetAccumulatedFromJson, index$1_recentBlockStateFromJson as recentBlockStateFromJson, index$1_recentBlocksHistoryFromJson as recentBlocksHistoryFromJson, index$1_reportedWorkPackageFromJson as reportedWorkPackageFromJson, index$1_serviceStatisticsEntryFromJson as serviceStatisticsEntryFromJson, index$1_ticketFromJson as ticketFromJson, index$1_validatorDataFromJson as validatorDataFromJson };
|
|
18779
|
+
export type { index$1_JsonAvailabilityAssignment as JsonAvailabilityAssignment, index$1_JsonLookupMeta as JsonLookupMeta, index$1_JsonRecentBlockState as JsonRecentBlockState, index$1_JsonRecentBlocks as JsonRecentBlocks, index$1_JsonReportedWorkPackageInfo as JsonReportedWorkPackageInfo, index$1_JsonStateDump as JsonStateDump, index$1_ServiceStatisticsEntry as ServiceStatisticsEntry };
|
|
18925
18780
|
}
|
|
18926
18781
|
|
|
18927
18782
|
/** Helper function to create most used hashes in the block */
|