@typeberry/lib 0.0.5-1ef0e31 → 0.0.5-6e657f4
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 +25 -7
- package/index.js +14 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -8743,6 +8743,20 @@ declare class AccumulationOutput {
|
|
|
8743
8743
|
) {}
|
|
8744
8744
|
}
|
|
8745
8745
|
|
|
8746
|
+
declare function accumulationOutputComparator(a: AccumulationOutput, b: AccumulationOutput) {
|
|
8747
|
+
const result = a.serviceId - b.serviceId;
|
|
8748
|
+
|
|
8749
|
+
if (result < 0) {
|
|
8750
|
+
return Ordering.Less;
|
|
8751
|
+
}
|
|
8752
|
+
|
|
8753
|
+
if (result > 0) {
|
|
8754
|
+
return Ordering.Greater;
|
|
8755
|
+
}
|
|
8756
|
+
|
|
8757
|
+
return Ordering.Equal;
|
|
8758
|
+
}
|
|
8759
|
+
|
|
8746
8760
|
declare const codecWithHash = <T, V, H extends OpaqueHash>(val: Descriptor<T, V>): Descriptor<WithHash<H, T>, V> =>
|
|
8747
8761
|
Descriptor.withView(
|
|
8748
8762
|
val.name,
|
|
@@ -10043,7 +10057,7 @@ type State = {
|
|
|
10043
10057
|
*
|
|
10044
10058
|
* NOTE Maximum size of this array is unspecified in GP
|
|
10045
10059
|
*/
|
|
10046
|
-
readonly accumulationOutputLog: AccumulationOutput
|
|
10060
|
+
readonly accumulationOutputLog: SortedArray<AccumulationOutput>;
|
|
10047
10061
|
|
|
10048
10062
|
/**
|
|
10049
10063
|
* Retrieve details about single service.
|
|
@@ -10631,7 +10645,7 @@ declare class InMemoryState extends WithDebug implements State, EnumerableState
|
|
|
10631
10645
|
sealingKeySeries: SafroleSealingKeys;
|
|
10632
10646
|
epochRoot: BandersnatchRingRoot;
|
|
10633
10647
|
privilegedServices: PrivilegedServices;
|
|
10634
|
-
accumulationOutputLog: AccumulationOutput
|
|
10648
|
+
accumulationOutputLog: SortedArray<AccumulationOutput>;
|
|
10635
10649
|
services: Map<ServiceId, InMemoryService>;
|
|
10636
10650
|
|
|
10637
10651
|
recentServiceIds(): readonly ServiceId[] {
|
|
@@ -10775,7 +10789,7 @@ declare class InMemoryState extends WithDebug implements State, EnumerableState
|
|
|
10775
10789
|
validatorsManager: tryAsServiceId(0),
|
|
10776
10790
|
autoAccumulateServices: [],
|
|
10777
10791
|
}),
|
|
10778
|
-
accumulationOutputLog: [],
|
|
10792
|
+
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
|
|
10779
10793
|
services: new Map(),
|
|
10780
10794
|
});
|
|
10781
10795
|
}
|
|
@@ -10900,6 +10914,7 @@ type index$d_ValidatorData = ValidatorData;
|
|
|
10900
10914
|
declare const index$d_ValidatorData: typeof ValidatorData;
|
|
10901
10915
|
type index$d_ValidatorStatistics = ValidatorStatistics;
|
|
10902
10916
|
declare const index$d_ValidatorStatistics: typeof ValidatorStatistics;
|
|
10917
|
+
declare const index$d_accumulationOutputComparator: typeof accumulationOutputComparator;
|
|
10903
10918
|
declare const index$d_codecBandersnatchKey: typeof codecBandersnatchKey;
|
|
10904
10919
|
declare const index$d_codecPerCore: typeof codecPerCore;
|
|
10905
10920
|
declare const index$d_codecServiceId: typeof codecServiceId;
|
|
@@ -10916,7 +10931,7 @@ declare const index$d_tryAsPerCore: typeof tryAsPerCore;
|
|
|
10916
10931
|
declare const index$d_workReportsSortedSetCodec: typeof workReportsSortedSetCodec;
|
|
10917
10932
|
declare const index$d_zeroSizeHint: typeof zeroSizeHint;
|
|
10918
10933
|
declare namespace index$d {
|
|
10919
|
-
export { index$d_AccumulationOutput as AccumulationOutput, index$d_AutoAccumulate as AutoAccumulate, index$d_AvailabilityAssignment as AvailabilityAssignment, index$d_BASE_SERVICE_BALANCE as BASE_SERVICE_BALANCE, index$d_BlockState as BlockState, index$d_CoreStatistics as CoreStatistics, index$d_DisputesRecords as DisputesRecords, index$d_ELECTIVE_BYTE_BALANCE as ELECTIVE_BYTE_BALANCE, index$d_ELECTIVE_ITEM_BALANCE as ELECTIVE_ITEM_BALANCE, index$d_InMemoryService as InMemoryService, index$d_InMemoryState as InMemoryState, index$d_LookupHistoryItem as LookupHistoryItem, index$d_MAX_LOOKUP_HISTORY_SLOTS as MAX_LOOKUP_HISTORY_SLOTS, index$d_PreimageItem as PreimageItem, index$d_PrivilegedServices as PrivilegedServices, index$d_RecentBlocks as RecentBlocks, index$d_RecentBlocksHistory as RecentBlocksHistory, index$d_SafroleData as SafroleData, index$d_SafroleSealingKeysData as SafroleSealingKeysData, index$d_SafroleSealingKeysKind as SafroleSealingKeysKind, index$d_ServiceAccountInfo as ServiceAccountInfo, index$d_ServiceStatistics as ServiceStatistics, index$d_StatisticsData as StatisticsData, index$d_StorageItem as StorageItem, index$d_UpdateError as UpdateError, index$d_UpdatePreimage as UpdatePreimage, index$d_UpdatePreimageKind as UpdatePreimageKind, index$d_UpdateService as UpdateService, index$d_UpdateServiceKind as UpdateServiceKind, index$d_UpdateStorage as UpdateStorage, index$d_UpdateStorageKind as UpdateStorageKind, index$d_ValidatorData as ValidatorData, index$d_ValidatorStatistics as ValidatorStatistics, index$d_codecBandersnatchKey as codecBandersnatchKey, index$d_codecPerCore as codecPerCore, index$d_codecServiceId as codecServiceId, index$d_codecVarGas as codecVarGas, index$d_codecVarU16 as codecVarU16, index$d_codecWithHash as codecWithHash, index$d_hashComparator as hashComparator, index$d_ignoreValueWithDefault as ignoreValueWithDefault, index$d_serviceDataCodec as serviceDataCodec, index$d_serviceEntriesCodec as serviceEntriesCodec, index$d_sortedSetCodec as sortedSetCodec, index$d_tryAsLookupHistorySlots as tryAsLookupHistorySlots, index$d_tryAsPerCore as tryAsPerCore, index$d_workReportsSortedSetCodec as workReportsSortedSetCodec, index$d_zeroSizeHint as zeroSizeHint };
|
|
10934
|
+
export { index$d_AccumulationOutput as AccumulationOutput, index$d_AutoAccumulate as AutoAccumulate, index$d_AvailabilityAssignment as AvailabilityAssignment, index$d_BASE_SERVICE_BALANCE as BASE_SERVICE_BALANCE, index$d_BlockState as BlockState, index$d_CoreStatistics as CoreStatistics, index$d_DisputesRecords as DisputesRecords, index$d_ELECTIVE_BYTE_BALANCE as ELECTIVE_BYTE_BALANCE, index$d_ELECTIVE_ITEM_BALANCE as ELECTIVE_ITEM_BALANCE, index$d_InMemoryService as InMemoryService, index$d_InMemoryState as InMemoryState, index$d_LookupHistoryItem as LookupHistoryItem, index$d_MAX_LOOKUP_HISTORY_SLOTS as MAX_LOOKUP_HISTORY_SLOTS, index$d_PreimageItem as PreimageItem, index$d_PrivilegedServices as PrivilegedServices, index$d_RecentBlocks as RecentBlocks, index$d_RecentBlocksHistory as RecentBlocksHistory, index$d_SafroleData as SafroleData, index$d_SafroleSealingKeysData as SafroleSealingKeysData, index$d_SafroleSealingKeysKind as SafroleSealingKeysKind, index$d_ServiceAccountInfo as ServiceAccountInfo, index$d_ServiceStatistics as ServiceStatistics, index$d_StatisticsData as StatisticsData, index$d_StorageItem as StorageItem, index$d_UpdateError as UpdateError, index$d_UpdatePreimage as UpdatePreimage, index$d_UpdatePreimageKind as UpdatePreimageKind, index$d_UpdateService as UpdateService, index$d_UpdateServiceKind as UpdateServiceKind, index$d_UpdateStorage as UpdateStorage, index$d_UpdateStorageKind as UpdateStorageKind, index$d_ValidatorData as ValidatorData, index$d_ValidatorStatistics as ValidatorStatistics, index$d_accumulationOutputComparator as accumulationOutputComparator, index$d_codecBandersnatchKey as codecBandersnatchKey, index$d_codecPerCore as codecPerCore, index$d_codecServiceId as codecServiceId, index$d_codecVarGas as codecVarGas, index$d_codecVarU16 as codecVarU16, index$d_codecWithHash as codecWithHash, index$d_hashComparator as hashComparator, index$d_ignoreValueWithDefault as ignoreValueWithDefault, index$d_serviceDataCodec as serviceDataCodec, index$d_serviceEntriesCodec as serviceEntriesCodec, index$d_sortedSetCodec as sortedSetCodec, index$d_tryAsLookupHistorySlots as tryAsLookupHistorySlots, index$d_tryAsPerCore as tryAsPerCore, index$d_workReportsSortedSetCodec as workReportsSortedSetCodec, index$d_zeroSizeHint as zeroSizeHint };
|
|
10920
10935
|
export type { index$d_BlocksState as BlocksState, index$d_ENTROPY_ENTRIES as ENTROPY_ENTRIES, index$d_EnumerableState as EnumerableState, index$d_FieldNames as FieldNames, index$d_InMemoryStateFields as InMemoryStateFields, index$d_LookupHistorySlots as LookupHistorySlots, index$d_MAX_RECENT_HISTORY as MAX_RECENT_HISTORY, index$d_PerCore as PerCore, index$d_SafroleSealingKeys as SafroleSealingKeys, index$d_Service as Service, index$d_ServiceData as ServiceData, index$d_ServiceEntries as ServiceEntries, index$d_ServicesUpdate as ServicesUpdate, index$d_State as State, index$d_StorageKey as StorageKey, index$d_VALIDATOR_META_BYTES as VALIDATOR_META_BYTES };
|
|
10921
10936
|
}
|
|
10922
10937
|
|
|
@@ -11191,7 +11206,10 @@ declare namespace serialize {
|
|
|
11191
11206
|
/** C(16): https://graypaper.fluffylabs.dev/#/38c4e62/3b46033b4603?v=0.7.0 */
|
|
11192
11207
|
export const accumulationOutputLog: StateCodec<State["accumulationOutputLog"]> = {
|
|
11193
11208
|
key: stateKeys.index(StateKeyIdx.Theta),
|
|
11194
|
-
Codec: codec.sequenceVarLen(AccumulationOutput.Codec)
|
|
11209
|
+
Codec: codec.sequenceVarLen(AccumulationOutput.Codec).convert(
|
|
11210
|
+
(i) => i.array,
|
|
11211
|
+
(o) => SortedArray.fromSortedArray(accumulationOutputComparator, o),
|
|
11212
|
+
),
|
|
11195
11213
|
extract: (s) => s.accumulationOutputLog,
|
|
11196
11214
|
};
|
|
11197
11215
|
|
|
@@ -18630,7 +18648,7 @@ type JsonStateDump = {
|
|
|
18630
18648
|
pi: JsonStatisticsData;
|
|
18631
18649
|
omega: State["accumulationQueue"];
|
|
18632
18650
|
xi: PerEpochBlock<WorkPackageHash[]>;
|
|
18633
|
-
theta:
|
|
18651
|
+
theta: AccumulationOutput[] | null;
|
|
18634
18652
|
accounts: InMemoryService[];
|
|
18635
18653
|
};
|
|
18636
18654
|
|
|
@@ -18732,7 +18750,7 @@ declare const fullStateDumpFromJson = (spec: ChainSpec) =>
|
|
|
18732
18750
|
xi.map((x) => HashSet.from(x)),
|
|
18733
18751
|
spec,
|
|
18734
18752
|
),
|
|
18735
|
-
accumulationOutputLog: theta ?? [],
|
|
18753
|
+
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, theta ?? []),
|
|
18736
18754
|
services: new Map(accounts.map((x) => [x.serviceId, x])),
|
|
18737
18755
|
});
|
|
18738
18756
|
},
|
package/index.js
CHANGED
|
@@ -8214,6 +8214,16 @@ class AccumulationOutput {
|
|
|
8214
8214
|
this.output = output;
|
|
8215
8215
|
}
|
|
8216
8216
|
}
|
|
8217
|
+
function accumulationOutputComparator(a, b) {
|
|
8218
|
+
const result = a.serviceId - b.serviceId;
|
|
8219
|
+
if (result < 0) {
|
|
8220
|
+
return Ordering.Less;
|
|
8221
|
+
}
|
|
8222
|
+
if (result > 0) {
|
|
8223
|
+
return Ordering.Greater;
|
|
8224
|
+
}
|
|
8225
|
+
return Ordering.Equal;
|
|
8226
|
+
}
|
|
8217
8227
|
|
|
8218
8228
|
const codecWithHash = (val) => Descriptor.withView(val.name, val.sizeHint, (e, elem) => val.encode(e, elem.data), (d) => {
|
|
8219
8229
|
const decoder2 = d.clone();
|
|
@@ -9612,7 +9622,7 @@ class InMemoryState extends WithDebug {
|
|
|
9612
9622
|
validatorsManager: tryAsServiceId(0),
|
|
9613
9623
|
autoAccumulateServices: [],
|
|
9614
9624
|
}),
|
|
9615
|
-
accumulationOutputLog: [],
|
|
9625
|
+
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, []),
|
|
9616
9626
|
services: new Map(),
|
|
9617
9627
|
});
|
|
9618
9628
|
}
|
|
@@ -9666,6 +9676,7 @@ var index$f = /*#__PURE__*/Object.freeze({
|
|
|
9666
9676
|
VALIDATOR_META_BYTES: VALIDATOR_META_BYTES,
|
|
9667
9677
|
ValidatorData: ValidatorData,
|
|
9668
9678
|
ValidatorStatistics: ValidatorStatistics,
|
|
9679
|
+
accumulationOutputComparator: accumulationOutputComparator,
|
|
9669
9680
|
codecPerCore: codecPerCore,
|
|
9670
9681
|
hashComparator: hashComparator,
|
|
9671
9682
|
ignoreValueWithDefault: ignoreValueWithDefault,
|
|
@@ -9821,7 +9832,7 @@ var serialize;
|
|
|
9821
9832
|
/** C(16): https://graypaper.fluffylabs.dev/#/38c4e62/3b46033b4603?v=0.7.0 */
|
|
9822
9833
|
serialize.accumulationOutputLog = {
|
|
9823
9834
|
key: stateKeys.index(StateKeyIdx.Theta),
|
|
9824
|
-
Codec: codec$1.sequenceVarLen(AccumulationOutput.Codec),
|
|
9835
|
+
Codec: codec$1.sequenceVarLen(AccumulationOutput.Codec).convert((i) => i.array, (o) => SortedArray.fromSortedArray(accumulationOutputComparator, o)),
|
|
9825
9836
|
extract: (s) => s.accumulationOutputLog,
|
|
9826
9837
|
};
|
|
9827
9838
|
/** C(255, s): https://graypaper.fluffylabs.dev/#/85129da/383103383103?v=0.6.3 */
|
|
@@ -17123,7 +17134,7 @@ const fullStateDumpFromJson = (spec) => json.object({
|
|
|
17123
17134
|
statistics: JsonStatisticsData.toStatisticsData(spec, pi),
|
|
17124
17135
|
accumulationQueue: omega,
|
|
17125
17136
|
recentlyAccumulated: tryAsPerEpochBlock(xi.map((x) => HashSet.from(x)), spec),
|
|
17126
|
-
accumulationOutputLog: theta ?? [],
|
|
17137
|
+
accumulationOutputLog: SortedArray.fromArray(accumulationOutputComparator, theta ?? []),
|
|
17127
17138
|
services: new Map(accounts.map((x) => [x.serviceId, x])),
|
|
17128
17139
|
});
|
|
17129
17140
|
});
|