@typeberry/lib 0.5.4-9233977 → 0.5.4-b101fe6
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/package.json +1 -1
- package/packages/core/utils/compatibility.d.ts +0 -1
- package/packages/core/utils/compatibility.d.ts.map +1 -1
- package/packages/core/utils/compatibility.js +1 -2
- package/packages/core/utils/compatibility.test.js +6 -10
- package/packages/jam/database-lmdb/states.test.js +3 -5
- package/packages/jam/jam-host-calls/accumulate/bless.d.ts.map +1 -1
- package/packages/jam/jam-host-calls/accumulate/bless.js +6 -10
- package/packages/jam/jam-host-calls/accumulate/bless.test.js +32 -72
- package/packages/jam/jam-host-calls/accumulate/new.d.ts.map +1 -1
- package/packages/jam/jam-host-calls/accumulate/new.js +2 -4
- package/packages/jam/jam-host-calls/accumulate/new.test.js +4 -5
- package/packages/jam/jam-host-calls/general/fetch.d.ts +1 -57
- package/packages/jam/jam-host-calls/general/fetch.d.ts.map +1 -1
- package/packages/jam/jam-host-calls/general/fetch.js +6 -29
- package/packages/jam/jam-host-calls/general/fetch.test.js +2 -58
- package/packages/jam/state/privileged-services.d.ts +1 -1
- package/packages/jam/state/privileged-services.d.ts.map +1 -1
- package/packages/jam/state/privileged-services.js +1 -6
- package/packages/jam/state/service.d.ts +1 -1
- package/packages/jam/state/service.d.ts.map +1 -1
- package/packages/jam/state/statistics.d.ts +0 -8
- package/packages/jam/state/statistics.d.ts.map +1 -1
- package/packages/jam/state/statistics.js +14 -44
- package/packages/jam/state/statistics.test.js +1 -8
- package/packages/jam/state/test.utils.d.ts +1 -1
- package/packages/jam/state/test.utils.d.ts.map +1 -1
- package/packages/jam/state/test.utils.js +4 -22
- package/packages/jam/state-json/accounts.d.ts +10 -0
- package/packages/jam/state-json/accounts.d.ts.map +1 -1
- package/packages/jam/state-json/accounts.js +47 -19
- package/packages/jam/state-json/dump.d.ts.map +1 -1
- package/packages/jam/state-json/dump.js +5 -9
- package/packages/jam/state-json/dump.test.js +2 -10
- package/packages/jam/state-json/statistics.d.ts +1 -1
- package/packages/jam/state-json/statistics.d.ts.map +1 -1
- package/packages/jam/state-json/statistics.js +1 -13
- package/packages/jam/state-merkleization/in-memory-state-codec.d.ts +0 -2
- package/packages/jam/state-merkleization/in-memory-state-codec.d.ts.map +1 -1
- package/packages/jam/state-merkleization/serialize.d.ts +4 -4
- package/packages/jam/state-merkleization/serialize.d.ts.map +1 -1
- package/packages/jam/state-merkleization/serialize.js +5 -8
- package/packages/jam/state-merkleization/serialized-state-view.d.ts.map +1 -1
- package/packages/jam/state-merkleization/state-entries.test.js +1 -7
- package/packages/jam/transition/accumulate/accumulate-state.d.ts +1 -2
- package/packages/jam/transition/accumulate/accumulate-state.d.ts.map +1 -1
- package/packages/jam/transition/accumulate/accumulate-utils.d.ts.map +1 -1
- package/packages/jam/transition/accumulate/accumulate-utils.js +2 -6
- package/packages/jam/transition/accumulate/accumulate-utils.test.js +2 -4
- package/packages/jam/transition/accumulate/accumulate.d.ts.map +1 -1
- package/packages/jam/transition/accumulate/accumulate.js +11 -20
- package/packages/jam/transition/accumulate/index.d.ts +0 -1
- package/packages/jam/transition/accumulate/index.d.ts.map +1 -1
- package/packages/jam/transition/accumulate/index.js +0 -1
- package/packages/jam/transition/chain-stf.d.ts +3 -5
- package/packages/jam/transition/chain-stf.d.ts.map +1 -1
- package/packages/jam/transition/chain-stf.js +5 -29
- package/packages/jam/transition/externalities/accumulate-externalities.d.ts.map +1 -1
- package/packages/jam/transition/externalities/accumulate-externalities.js +22 -49
- package/packages/jam/transition/externalities/accumulate-externalities.test.js +8 -72
- package/packages/jam/transition/externalities/fetch-externalities.d.ts +3 -22
- package/packages/jam/transition/externalities/fetch-externalities.d.ts.map +1 -1
- package/packages/jam/transition/externalities/fetch-externalities.js +3 -55
- package/packages/jam/transition/externalities/fetch-externalities.test.js +199 -112
- package/packages/jam/transition/statistics.d.ts +0 -7
- package/packages/jam/transition/statistics.d.ts.map +1 -1
- package/packages/jam/transition/statistics.js +2 -11
- package/packages/jam/transition/statistics.test.js +0 -40
- package/packages/jam/transition/accumulate/deferred-transfers.d.ts +0 -36
- package/packages/jam/transition/accumulate/deferred-transfers.d.ts.map +0 -1
- package/packages/jam/transition/accumulate/deferred-transfers.js +0 -94
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { tryAsPerValidator, tryAsServiceGas } from "#@typeberry/block";
|
|
2
2
|
import { json } from "#@typeberry/json-parser";
|
|
3
|
-
import { tryAsU32 } from "#@typeberry/numbers";
|
|
4
3
|
import { CoreStatistics, ServiceStatistics, StatisticsData, tryAsPerCore, ValidatorStatistics } from "#@typeberry/state";
|
|
5
|
-
import { Compatibility, GpVersion } from "#@typeberry/utils";
|
|
6
4
|
export class JsonValidatorStatistics {
|
|
7
5
|
static fromJson = json.object({
|
|
8
6
|
blocks: "number",
|
|
@@ -71,13 +69,7 @@ class JsonServiceStatistics {
|
|
|
71
69
|
extrinsic_count: "number",
|
|
72
70
|
accumulate_count: "number",
|
|
73
71
|
accumulate_gas_used: json.fromBigInt(tryAsServiceGas),
|
|
74
|
-
|
|
75
|
-
? {}
|
|
76
|
-
: {
|
|
77
|
-
on_transfers_count: "number",
|
|
78
|
-
on_transfers_gas_used: json.fromBigInt(tryAsServiceGas),
|
|
79
|
-
}),
|
|
80
|
-
}, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, on_transfers_count, on_transfers_gas_used, }) => {
|
|
72
|
+
}, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, }) => {
|
|
81
73
|
return ServiceStatistics.create({
|
|
82
74
|
providedCount: provided_count,
|
|
83
75
|
providedSize: provided_size,
|
|
@@ -89,8 +81,6 @@ class JsonServiceStatistics {
|
|
|
89
81
|
extrinsicCount: extrinsic_count,
|
|
90
82
|
accumulateCount: accumulate_count,
|
|
91
83
|
accumulateGasUsed: accumulate_gas_used,
|
|
92
|
-
onTransfersCount: on_transfers_count ?? tryAsU32(0),
|
|
93
|
-
onTransfersGasUsed: on_transfers_gas_used ?? tryAsServiceGas(0),
|
|
94
84
|
});
|
|
95
85
|
});
|
|
96
86
|
provided_count;
|
|
@@ -103,8 +93,6 @@ class JsonServiceStatistics {
|
|
|
103
93
|
extrinsic_count;
|
|
104
94
|
accumulate_count;
|
|
105
95
|
accumulate_gas_used;
|
|
106
|
-
on_transfers_count;
|
|
107
|
-
on_transfers_gas_used;
|
|
108
96
|
}
|
|
109
97
|
export const serviceStatisticsEntryFromJson = {
|
|
110
98
|
id: "number",
|
|
@@ -177,8 +177,6 @@ export declare const inMemoryStateCodec: (spec: ChainSpec) => Descriptor<InMemor
|
|
|
177
177
|
exports: Descriptor<import("@typeberry/numbers").U16, import("@typeberry/numbers").U32>;
|
|
178
178
|
accumulateCount: Descriptor<import("@typeberry/numbers").U32, import("@typeberry/numbers").U32>;
|
|
179
179
|
accumulateGasUsed: Descriptor<bigint & import("@typeberry/numbers").WithBytesRepresentation<8> & import("@typeberry/utils").WithOpaque<"ServiceGas[u64]">, bigint & import("@typeberry/numbers").WithBytesRepresentation<8> & import("@typeberry/utils").WithOpaque<"ServiceGas[u64]">>;
|
|
180
|
-
onTransfersCount: Descriptor<import("@typeberry/numbers").U32, import("@typeberry/numbers").U32>;
|
|
181
|
-
onTransfersGasUsed: Descriptor<bigint & import("@typeberry/numbers").WithBytesRepresentation<8> & import("@typeberry/utils").WithOpaque<"ServiceGas[u64]">, bigint & import("@typeberry/numbers").WithBytesRepresentation<8> & import("@typeberry/utils").WithOpaque<"ServiceGas[u64]">>;
|
|
182
180
|
}>>>;
|
|
183
181
|
}>>;
|
|
184
182
|
accumulationQueue: Descriptor<import("@typeberry/state").AccumulationQueue, import("@typeberry/codec").SequenceView<readonly import("@typeberry/state").NotYetAccumulatedReport[], import("@typeberry/codec").SequenceView<import("@typeberry/state").NotYetAccumulatedReport, import("@typeberry/codec").ViewOf<import("@typeberry/state").NotYetAccumulatedReport, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-state-codec.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/state-merkleization/in-memory-state-codec.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,0BAA0B,EAAuB,MAAM,iCAAiC,CAAC;AACvG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,KAAK,WAAW,EAAS,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAe,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKnD,OAAO,EACL,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAElB,WAAW,EAEX,aAAa,EACd,MAAM,kBAAkB,CAAC;AAU1B,wCAAwC;AACxC,eAAO,MAAM,QAAQ,GAAI,CAAC,EACxB,OAAO,UAAU,CAAC,CAAC,CAAC,EACpB,YAAY,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,EAC9B,8BAgBG,0BAA0B,CAAC,CAAC,CAAM,KACpC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CA0C3B,CAAC;AA2CF,cAAM,gBAAiB,SAAQ,eAAe;IAC5C,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;;;;QAQT;IAEH,OAAO;IAIP,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC;CAGjE;AAED,eAAO,MAAM,kBAAkB,GAAI,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"in-memory-state-codec.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/state-merkleization/in-memory-state-codec.ts"],"names":[],"mappings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qD/C,CAAC"}
|
|
@@ -50,7 +50,7 @@ export declare namespace serialize {
|
|
|
50
50
|
const recentlyAccumulated: StateCodec<State["recentlyAccumulated"], ReturnType<StateView["recentlyAccumulatedView"]>>;
|
|
51
51
|
/** C(16): https://graypaper.fluffylabs.dev/#/38c4e62/3b46033b4603?v=0.7.0 */
|
|
52
52
|
const accumulationOutputLog: StateCodec<State["accumulationOutputLog"]>;
|
|
53
|
-
/** C(255, s): https://graypaper.fluffylabs.dev/#/
|
|
53
|
+
/** C(255, s): https://graypaper.fluffylabs.dev/#/ab2cdbd/3b7d033b7d03?v=0.7.2 */
|
|
54
54
|
const serviceData: (serviceId: ServiceId) => {
|
|
55
55
|
key: import("@typeberry/hash").OpaqueHash & import("@typeberry/utils").WithOpaque<"stateKey">;
|
|
56
56
|
Codec: Descriptor<ServiceAccountInfo, import("@typeberry/codec").ViewOf<ServiceAccountInfo, {
|
|
@@ -66,17 +66,17 @@ export declare namespace serialize {
|
|
|
66
66
|
parentService: Descriptor<number & import("@typeberry/numbers").WithBytesRepresentation<4> & import("@typeberry/utils").WithOpaque<"ServiceId[u32]">, Bytes<4>>;
|
|
67
67
|
}>>;
|
|
68
68
|
};
|
|
69
|
-
/** https://graypaper.fluffylabs.dev/#/
|
|
69
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bac033bac03?v=0.7.2 */
|
|
70
70
|
const serviceStorage: (blake2b: Blake2b, serviceId: ServiceId, key: StorageKey) => {
|
|
71
71
|
key: import("@typeberry/hash").OpaqueHash & import("@typeberry/utils").WithOpaque<"stateKey">;
|
|
72
72
|
Codec: Descriptor<BytesBlob, BytesBlob>;
|
|
73
73
|
};
|
|
74
|
-
/** https://graypaper.fluffylabs.dev/#/
|
|
74
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bc9033bc903?v=0.7.2 */
|
|
75
75
|
const servicePreimages: (blake2b: Blake2b, serviceId: ServiceId, hash: PreimageHash) => {
|
|
76
76
|
key: import("@typeberry/hash").OpaqueHash & import("@typeberry/utils").WithOpaque<"stateKey">;
|
|
77
77
|
Codec: Descriptor<BytesBlob, BytesBlob>;
|
|
78
78
|
};
|
|
79
|
-
/** https://graypaper.fluffylabs.dev/#/
|
|
79
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bea033b0904?v=0.7.2 */
|
|
80
80
|
const serviceLookupHistory: (blake2b: Blake2b, serviceId: ServiceId, hash: PreimageHash, len: U32) => {
|
|
81
81
|
key: import("@typeberry/hash").OpaqueHash & import("@typeberry/utils").WithOpaque<"stateKey">;
|
|
82
82
|
Codec: Descriptor<readonly U32[], import("@typeberry/codec").SequenceView<U32, Bytes<4>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/state-merkleization/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAS,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAML,eAAe,EAGf,YAAY,EACZ,KAAK,gBAAgB,EACrB,kBAAkB,EAClB,KAAK,KAAK,EACV,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,UAAU,EAEhB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../../../packages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AAiB,EAAE,UAAU,CACxC,KAAK,CAAC,mBAAmB,CAAC,EAC1B,UAAU,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC,CAK/C,CAAC;IAEF,6EAA6E;IACtE,MAAM,mBAAmB,EAAE,UAAU,CAC1C,KAAK,CAAC,qBAAqB,CAAC,EAC5B,UAAU,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC,CAKjD,CAAC;IAEF,6EAA6E;IACtE,MAAM,qBAAqB,EAAE,UAAU,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAO5E,CAAC;IAEF,iFAAiF;IAC1E,MAAM,WAAW,GAAI,WAAW,SAAS;;;;;;;;;;;;;;KAG9C,CAAC;IAEH,sEAAsE;IAC/D,MAAM,cAAc,GAAI,SAAS,OAAO,EAAE,WAAW,SAAS,EAAE,KAAK,UAAU;;;KAGpF,CAAC;IAEH,sEAAsE;IAC/D,MAAM,gBAAgB,GAAI,SAAS,OAAO,EAAE,WAAW,SAAS,EAAE,MAAM,YAAY;;;KAGzF,CAAC;IAEH,sEAAsE;IAC/D,MAAM,oBAAoB,GAAI,SAAS,OAAO,EAAE,WAAW,SAAS,EAAE,MAAM,YAAY,EAAE,KAAK,GAAG;;;KAGvG,CAAC;CACJ;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,kCAMrB,CAAC"}
|
|
@@ -7,7 +7,6 @@ import { accumulationQueueCodec, authPoolsCodec, authQueuesCodec, availabilityAs
|
|
|
7
7
|
import { AccumulationOutput, accumulationOutputComparator } from "#@typeberry/state/accumulation-output.js";
|
|
8
8
|
import { recentlyAccumulatedCodec } from "#@typeberry/state/recently-accumulated.js";
|
|
9
9
|
import { SafroleData } from "#@typeberry/state/safrole-data.js";
|
|
10
|
-
import { Compatibility, GpVersion } from "#@typeberry/utils";
|
|
11
10
|
import { StateKeyIdx, stateKeys } from "./keys.js";
|
|
12
11
|
/** Serialization for particular state entries. */
|
|
13
12
|
export var serialize;
|
|
@@ -116,24 +115,22 @@ export var serialize;
|
|
|
116
115
|
Codec: codec.sequenceVarLen(AccumulationOutput.Codec).convert((i) => i.array, (o) => SortedArray.fromSortedArray(accumulationOutputComparator, o)),
|
|
117
116
|
extract: (s) => s.accumulationOutputLog,
|
|
118
117
|
};
|
|
119
|
-
/** C(255, s): https://graypaper.fluffylabs.dev/#/
|
|
118
|
+
/** C(255, s): https://graypaper.fluffylabs.dev/#/ab2cdbd/3b7d033b7d03?v=0.7.2 */
|
|
120
119
|
serialize.serviceData = (serviceId) => ({
|
|
121
120
|
key: stateKeys.serviceInfo(serviceId),
|
|
122
|
-
Codec:
|
|
123
|
-
? codecWithVersion(ServiceAccountInfo.Codec)
|
|
124
|
-
: ServiceAccountInfo.Codec,
|
|
121
|
+
Codec: codecWithVersion(ServiceAccountInfo.Codec),
|
|
125
122
|
});
|
|
126
|
-
/** https://graypaper.fluffylabs.dev/#/
|
|
123
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bac033bac03?v=0.7.2 */
|
|
127
124
|
serialize.serviceStorage = (blake2b, serviceId, key) => ({
|
|
128
125
|
key: stateKeys.serviceStorage(blake2b, serviceId, key),
|
|
129
126
|
Codec: dumpCodec,
|
|
130
127
|
});
|
|
131
|
-
/** https://graypaper.fluffylabs.dev/#/
|
|
128
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bc9033bc903?v=0.7.2 */
|
|
132
129
|
serialize.servicePreimages = (blake2b, serviceId, hash) => ({
|
|
133
130
|
key: stateKeys.servicePreimage(blake2b, serviceId, hash),
|
|
134
131
|
Codec: dumpCodec,
|
|
135
132
|
});
|
|
136
|
-
/** https://graypaper.fluffylabs.dev/#/
|
|
133
|
+
/** https://graypaper.fluffylabs.dev/#/ab2cdbd/3bea033b0904?v=0.7.2 */
|
|
137
134
|
serialize.serviceLookupHistory = (blake2b, serviceId, hash, len) => ({
|
|
138
135
|
key: stateKeys.serviceLookupHistory(blake2b, serviceId, hash, len),
|
|
139
136
|
Codec: codec.readonlyArray(codec.sequenceVarLen(codec.u32)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialized-state-view.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/state-merkleization/serialized-state-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG1C;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,GAAG,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC;CACtC;AAED,qBAAa,mBAAmB,CAAC,CAAC,SAAS,sBAAsB,CAAE,YAAW,SAAS;IAEnF,OAAO,CAAC,QAAQ,CAAC,IAAI;IACd,OAAO,EAAE,CAAC;IACjB,oDAAoD;IACpD,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAJT,IAAI,EAAE,SAAS,EACzB,OAAO,EAAE,CAAC;IACjB,oDAAoD;IACnC,oBAAoB,EAAE,SAAS,EAAE,EACjC,SAAS,EAAE,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC;IAG/D,OAAO,CAAC,YAAY;IAoBpB,0BAA0B,IAAI,2BAA2B;IAIzD,2BAA2B,IAAI,YAAY,CAAC,aAAa,EAAE,iBAAiB,CAAC;IAI7E,wBAAwB,IAAI,YAAY,CAAC,aAAa,EAAE,iBAAiB,CAAC;IAI1E,yBAAyB,IAAI,YAAY,CAAC,aAAa,EAAE,iBAAiB,CAAC;IAI3E,aAAa,IAAI,YAAY,CAAC,iBAAiB,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAI9E,cAAc,IAAI,YAAY,CAAC,kBAAkB,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAIhF,gBAAgB,IAAI,gBAAgB;IAIpC,cAAc,IAAI,kBAAkB;IAIpC,qBAAqB,IAAI,qBAAqB;IAI9C,uBAAuB,IAAI,uBAAuB;IAIlD,eAAe,IAAI,eAAe;IAIlC,kBAAkB,CAAC,EAAE,EAAE,SAAS,GAAG,sBAAsB,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"serialized-state-view.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/state-merkleization/serialized-state-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,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BAAkB,CAAC,EAAE,EAAE,SAAS,GAAG,sBAAsB,GAAG,IAAI;CAYjE"}
|
|
@@ -6,7 +6,6 @@ import { tinyChainSpec } from "#@typeberry/config";
|
|
|
6
6
|
import { Blake2b, HASH_SIZE, TRUNCATED_HASH_SIZE } from "#@typeberry/hash";
|
|
7
7
|
import { tryAsPerCore } from "#@typeberry/state/common.js";
|
|
8
8
|
import { TEST_STATE, TEST_STATE_ROOT, testState } from "#@typeberry/state/test.utils.js";
|
|
9
|
-
import { Compatibility, GpVersion } from "#@typeberry/utils";
|
|
10
9
|
import { serializeStateUpdate } from "./serialize-state-update.js";
|
|
11
10
|
import { SerializedState } from "./serialized-state.js";
|
|
12
11
|
import { StateEntries } from "./state-entries.js";
|
|
@@ -43,12 +42,7 @@ describe("State Serialization", () => {
|
|
|
43
42
|
// check the value
|
|
44
43
|
const state = SerializedState.fromStateEntries(spec, blake2b, serialized);
|
|
45
44
|
assert.deepStrictEqual(state.authPools, authPools);
|
|
46
|
-
const expectedRoot =
|
|
47
|
-
fallback: "0xcf33ddfb0987283f7614652d7eb4d3509e5efd93466a4b28ab4865cc912a66e1",
|
|
48
|
-
versions: {
|
|
49
|
-
[GpVersion.V0_7_1]: "0xf1dff0f8d8d5470aa6fc381d07e644f5b2f7a32bf06a7cf1dc664fe4b6298402",
|
|
50
|
-
},
|
|
51
|
-
});
|
|
45
|
+
const expectedRoot = "0xf1dff0f8d8d5470aa6fc381d07e644f5b2f7a32bf06a7cf1dc664fe4b6298402";
|
|
52
46
|
assert.strictEqual(serialized.getRootHash(blake2b).toString(), expectedRoot);
|
|
53
47
|
});
|
|
54
48
|
});
|
|
@@ -2,7 +2,7 @@ import type { EntropyHash, ServiceId, TimeSlot } from "#@typeberry/block";
|
|
|
2
2
|
import type { WorkReport } from "#@typeberry/block/work-report.js";
|
|
3
3
|
import type { SortedArray } from "#@typeberry/collections";
|
|
4
4
|
import type { OpaqueHash } from "#@typeberry/hash";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ServiceStateUpdate } from "#@typeberry/jam-host-calls";
|
|
6
6
|
import type { AccumulationOutput, State } from "#@typeberry/state";
|
|
7
7
|
import type { CountAndGasUsed } from "../statistics.js";
|
|
8
8
|
/** `G_A`: The gas allocated to invoke a work-report’s Accumulation logic. */
|
|
@@ -22,7 +22,6 @@ export type AccumulateStateUpdate = Pick<State, "timeslot"> & Partial<Pick<State
|
|
|
22
22
|
export type AccumulateResult = {
|
|
23
23
|
stateUpdate: AccumulateStateUpdate;
|
|
24
24
|
accumulationStatistics: Map<ServiceId, CountAndGasUsed>;
|
|
25
|
-
pendingTransfers: PendingTransfer[];
|
|
26
25
|
accumulationOutputLog: SortedArray<AccumulationOutput>;
|
|
27
26
|
};
|
|
28
27
|
//# sourceMappingURL=accumulate-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accumulate-state.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"accumulate-state.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,YAAc,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG;IAC5B,4BAA4B;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,2CAA2C;IAC3C,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,6DAA6D;IAC7D,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,KAAK,EACH,UAAU,GACV,yBAAyB,GACzB,YAAY,GACZ,YAAY,GACZ,qBAAqB,GACrB,mBAAmB,GACnB,oBAAoB,CACvB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,GACzD,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,mBAAmB,CAAC,CAAC,GACjE,kBAAkB,CAAC;AAErB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,qBAAqB,CAAC;IACnC,sBAAsB,EAAE,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IACxD,qBAAqB,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;CACxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accumulate-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAkB,MAAM,kBAAkB,CAAC;AAEnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"accumulate-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAkB,MAAM,kBAAkB,CAAC;AAEnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,iBAAiB,CAAC;AAG1D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAQnE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAGpF;AAED,KAAK,kBAAkB,GAAG;IACxB,oCAAoC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe;IACf,OAAO,EAAE,WAAW,CAAC;IACrB,sCAAsC;IACtC,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAQF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,kBAAkB,EACpD,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,GACf,SAAS,CAeX"}
|
|
@@ -4,7 +4,6 @@ import { codec, Encoder } from "#@typeberry/codec";
|
|
|
4
4
|
import { HashSet } from "#@typeberry/collections";
|
|
5
5
|
import { HASH_SIZE } from "#@typeberry/hash";
|
|
6
6
|
import { leBytesAsU32 } from "#@typeberry/numbers";
|
|
7
|
-
import { Compatibility, GpVersion } from "#@typeberry/utils";
|
|
8
7
|
/**
|
|
9
8
|
* A function that removes duplicates but does not change order - it keeps the first occurence.
|
|
10
9
|
*/
|
|
@@ -44,9 +43,6 @@ export function generateNextServiceId({ serviceId, entropy, timeslot }, chainSpe
|
|
|
44
43
|
}, chainSpec);
|
|
45
44
|
const result = blake2b.hashBytes(encoded).raw.subarray(0, 4);
|
|
46
45
|
const number = leBytesAsU32(result) >>> 0;
|
|
47
|
-
const mod =
|
|
48
|
-
|
|
49
|
-
: 2 ** 32 - 2 ** 9;
|
|
50
|
-
const offset = Compatibility.isGreaterOrEqual(GpVersion.V0_7_1) ? MIN_PUBLIC_SERVICE_INDEX : 2 ** 8;
|
|
51
|
-
return tryAsServiceId((number % mod) + offset);
|
|
46
|
+
const mod = 2 ** 32 - MIN_PUBLIC_SERVICE_INDEX - 2 ** 8;
|
|
47
|
+
return tryAsServiceId((number % mod) + MIN_PUBLIC_SERVICE_INDEX);
|
|
52
48
|
}
|
|
@@ -10,7 +10,7 @@ import { FixedSizeArray, HashSet } from "#@typeberry/collections";
|
|
|
10
10
|
import { tinyChainSpec } from "#@typeberry/config";
|
|
11
11
|
import { Blake2b, HASH_SIZE } from "#@typeberry/hash";
|
|
12
12
|
import { tryAsU16, tryAsU32 } from "#@typeberry/numbers";
|
|
13
|
-
import {
|
|
13
|
+
import { deepEqual } from "#@typeberry/utils";
|
|
14
14
|
import { generateNextServiceId, getWorkPackageHashes, uniquePreserveOrder } from "./accumulate-utils.js";
|
|
15
15
|
let blake2b;
|
|
16
16
|
before(async () => {
|
|
@@ -78,9 +78,7 @@ describe("accumulate-utils", () => {
|
|
|
78
78
|
const serviceId = tryAsServiceId(5);
|
|
79
79
|
const entropy = Bytes.fill(HASH_SIZE, 4).asOpaque();
|
|
80
80
|
const timeslot = tryAsTimeSlot(6);
|
|
81
|
-
const expectedServiceId =
|
|
82
|
-
? tryAsServiceId(2596254713)
|
|
83
|
-
: tryAsServiceId(2596189433);
|
|
81
|
+
const expectedServiceId = tryAsServiceId(2596254713);
|
|
84
82
|
const result = generateNextServiceId({ serviceId, entropy, timeslot }, tinyChainSpec, blake2b);
|
|
85
83
|
assert.strictEqual(result, expectedServiceId);
|
|
86
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accumulate.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,KAAK,OAAO,EAA8B,MAAM,iBAAiB,CAAC;AAiB3E,OAAO,EAAyC,MAAM,EAAa,MAAM,kBAAkB,CAAC;AAM5F,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAGrB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AA2B3D,qBAAa,UAAU;aAEH,SAAS,EAAE,SAAS;aACpB,OAAO,EAAE,OAAO;aAChB,KAAK,EAAE,eAAe;aACtB,OAAO,EAAE,iBAAiB;gBAH1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,iBAAiB;IAO5C;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAkB7B;;;;OAIG;YACW,uBAAuB;
|
|
1
|
+
{"version":3,"file":"accumulate.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/accumulate.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,KAAK,OAAO,EAA8B,MAAM,iBAAiB,CAAC;AAiB3E,OAAO,EAAyC,MAAM,EAAa,MAAM,kBAAkB,CAAC;AAM5F,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAGrB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AA2B3D,qBAAa,UAAU;aAEH,SAAS,EAAE,SAAS;aACpB,OAAO,EAAE,OAAO;aAChB,KAAK,EAAE,eAAe;aACtB,OAAO,EAAE,iBAAiB;gBAH1B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,iBAAiB;IAO5C;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAkB7B;;;;OAIG;YACW,uBAAuB;IAmGrC;;;;OAIG;YACW,uBAAuB;IAiDrC;;;;;;;OAOG;YACW,4BAA4B;IA8D1C;;;;;;;OAOG;YACW,sBAAsB;IAsEpC,OAAO,CAAC,gBAAgB;IAuCxB,OAAO,CAAC,kBAAkB;IAsB1B;;;;;;;;;OASG;YACW,oBAAoB;IA6ClC;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAkDlC;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAcnB;;;;;;OAMG;IACI,6BAA6B,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO;IAKhE,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;CA0FrH"}
|
|
@@ -86,9 +86,7 @@ export class Accumulate {
|
|
|
86
86
|
}
|
|
87
87
|
const nextServiceId = generateNextServiceId({ serviceId, entropy, timeslot: slot }, this.chainSpec, this.blake2b);
|
|
88
88
|
const partialState = new AccumulateExternalities(this.chainSpec, this.blake2b, updatedState, serviceId, nextServiceId, slot);
|
|
89
|
-
const fetchExternalities =
|
|
90
|
-
? FetchExternalities.createForAccumulate({ entropy, transfers, operands }, this.chainSpec)
|
|
91
|
-
: FetchExternalities.createForPre071Accumulate({ entropy, operands }, this.chainSpec);
|
|
89
|
+
const fetchExternalities = FetchExternalities.createForAccumulate({ entropy, transfers, operands }, this.chainSpec);
|
|
92
90
|
const externalities = {
|
|
93
91
|
partialState,
|
|
94
92
|
serviceExternalities: partialState,
|
|
@@ -137,19 +135,16 @@ export class Accumulate {
|
|
|
137
135
|
async accumulateSingleService(serviceId, transfers, operands, gasCost, slot, entropy, inputStateUpdate) {
|
|
138
136
|
logger.log `Accumulating service ${serviceId}, transfers: ${transfers.length} operands: ${operands.length} at slot: ${slot}`;
|
|
139
137
|
const updatedState = new PartiallyUpdatedState(this.state, inputStateUpdate);
|
|
140
|
-
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
logger.log `Accumulation failed because of overflowing balance ${serviceId}.`;
|
|
148
|
-
return { stateUpdate: null, consumedGas: tryAsServiceGas(0n) };
|
|
149
|
-
}
|
|
150
|
-
const newInfo = ServiceAccountInfo.create({ ...serviceInfo, balance: newBalance.value });
|
|
151
|
-
updatedState.updateServiceInfo(serviceId, newInfo);
|
|
138
|
+
const serviceInfo = updatedState.getServiceInfo(serviceId);
|
|
139
|
+
if (serviceInfo !== null) {
|
|
140
|
+
// update the balance from incoming transfers
|
|
141
|
+
const newBalance = sumU64(serviceInfo.balance, ...transfers.map((item) => item.amount));
|
|
142
|
+
if (newBalance.overflow) {
|
|
143
|
+
logger.log `Accumulation failed because of overflowing balance ${serviceId}.`;
|
|
144
|
+
return { stateUpdate: null, consumedGas: tryAsServiceGas(0n) };
|
|
152
145
|
}
|
|
146
|
+
const newInfo = ServiceAccountInfo.create({ ...serviceInfo, balance: newBalance.value });
|
|
147
|
+
updatedState.updateServiceInfo(serviceId, newInfo);
|
|
153
148
|
}
|
|
154
149
|
const result = await this.pvmAccumulateInvocation(slot, serviceId, transfers, operands, gasCost, entropy, updatedState);
|
|
155
150
|
if (result.isError) {
|
|
@@ -384,7 +379,6 @@ export class Accumulate {
|
|
|
384
379
|
}
|
|
385
380
|
async transition({ reports, slot, entropy }) {
|
|
386
381
|
const statistics = new Map();
|
|
387
|
-
const legacyTransfers = [];
|
|
388
382
|
const yieldedRoots = new Map();
|
|
389
383
|
const accumulateQueue = new AccumulateQueue(this.chainSpec, this.state);
|
|
390
384
|
const toAccumulateImmediately = accumulateQueue.getWorkReportsToAccumulateImmediately(reports);
|
|
@@ -395,9 +389,7 @@ export class Accumulate {
|
|
|
395
389
|
const accumulatableReports = ArrayView.from(toAccumulateImmediately.concat(queue));
|
|
396
390
|
const gasLimit = this.getGasLimit();
|
|
397
391
|
const autoAccumulateServices = this.state.privilegedServices.autoAccumulateServices;
|
|
398
|
-
const { accumulatedReports, gasCost, state, ...rest } =
|
|
399
|
-
? await this.accumulateSequentially(gasLimit, accumulatableReports, [], slot, entropy, statistics, AccumulationStateUpdate.empty(), autoAccumulateServices, yieldedRoots)
|
|
400
|
-
: await this.accumulateSequentiallyLegacy(gasLimit, accumulatableReports, slot, entropy, statistics, AccumulationStateUpdate.empty(), autoAccumulateServices, yieldedRoots, legacyTransfers);
|
|
392
|
+
const { accumulatedReports, gasCost, state, ...rest } = await this.accumulateSequentially(gasLimit, accumulatableReports, [], slot, entropy, statistics, AccumulationStateUpdate.empty(), autoAccumulateServices, yieldedRoots);
|
|
401
393
|
// we can safely ignore top-level gas cost from accSequentially.
|
|
402
394
|
const _gasCost = gasCost;
|
|
403
395
|
assertEmpty(rest);
|
|
@@ -434,7 +426,6 @@ export class Accumulate {
|
|
|
434
426
|
...authQueues,
|
|
435
427
|
},
|
|
436
428
|
accumulationStatistics: statistics,
|
|
437
|
-
pendingTransfers: legacyTransfers,
|
|
438
429
|
accumulationOutputLog: accumulationOutput,
|
|
439
430
|
});
|
|
440
431
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/accumulate/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
|
@@ -7,7 +7,7 @@ import type { SafroleErrorCode, SafroleStateUpdate } from "#@typeberry/safrole/s
|
|
|
7
7
|
import { type SafroleSealError } from "#@typeberry/safrole/safrole-seal.js";
|
|
8
8
|
import type { State, WithStateView } from "#@typeberry/state";
|
|
9
9
|
import { type ErrorResult, Result, type TaggedError } from "#@typeberry/utils";
|
|
10
|
-
import { type ACCUMULATION_ERROR, type AccumulateOptions, type AccumulateStateUpdate
|
|
10
|
+
import { type ACCUMULATION_ERROR, type AccumulateOptions, type AccumulateStateUpdate } from "./accumulate/index.js";
|
|
11
11
|
import { type AssurancesError, type AssurancesStateUpdate } from "./assurances.js";
|
|
12
12
|
import { type AuthorizationStateUpdate } from "./authorization.js";
|
|
13
13
|
import type { TransitionHasher } from "./hasher.js";
|
|
@@ -32,10 +32,9 @@ export declare enum StfErrorKind {
|
|
|
32
32
|
Preimages = 4,
|
|
33
33
|
SafroleSeal = 5,
|
|
34
34
|
Accumulate = 6,
|
|
35
|
-
|
|
36
|
-
Offenders = 8
|
|
35
|
+
Offenders = 7
|
|
37
36
|
}
|
|
38
|
-
export type StfError = TaggedError<StfErrorKind.Assurances, AssurancesError> | TaggedError<StfErrorKind.Reports, ReportsError> | TaggedError<StfErrorKind.Disputes, DisputesErrorCode> | TaggedError<StfErrorKind.Safrole, SafroleErrorCode> | TaggedError<StfErrorKind.Preimages, PreimagesErrorCode> | TaggedError<StfErrorKind.SafroleSeal, SafroleSealError> | TaggedError<StfErrorKind.Accumulate, ACCUMULATION_ERROR> | TaggedError<StfErrorKind.
|
|
37
|
+
export type StfError = TaggedError<StfErrorKind.Assurances, AssurancesError> | TaggedError<StfErrorKind.Reports, ReportsError> | TaggedError<StfErrorKind.Disputes, DisputesErrorCode> | TaggedError<StfErrorKind.Safrole, SafroleErrorCode> | TaggedError<StfErrorKind.Preimages, PreimagesErrorCode> | TaggedError<StfErrorKind.SafroleSeal, SafroleSealError> | TaggedError<StfErrorKind.Accumulate, ACCUMULATION_ERROR> | TaggedError<StfErrorKind.Offenders, OFFENDERS_ERROR>;
|
|
39
38
|
export declare const stfError: <Kind extends StfErrorKind, Err extends StfError["error"]>(kind: Kind, nested: ErrorResult<Err>) => Result<Ok, {
|
|
40
39
|
readonly kind: Kind;
|
|
41
40
|
readonly error: Err;
|
|
@@ -55,7 +54,6 @@ export declare class OnChain {
|
|
|
55
54
|
private readonly assurances;
|
|
56
55
|
private readonly accumulate;
|
|
57
56
|
private readonly accumulateOutput;
|
|
58
|
-
private readonly deferredTransfers;
|
|
59
57
|
private readonly preimages;
|
|
60
58
|
private readonly recentHistory;
|
|
61
59
|
private readonly authorization;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-stf.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/transition/chain-stf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAa,UAAU,
|
|
1
|
+
{"version":3,"file":"chain-stf.d.ts","sourceRoot":"","sources":["../../../../../packages/jam/transition/chain-stf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAa,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAInF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAIpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,KAAK,EAAkB,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAe,KAAK,WAAW,EAAe,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAExG,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAiB,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAa,KAAK,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAiB,KAAK,wBAAwB,EAA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9 +5,9 @@ import { Logger } from "#@typeberry/logger";
|
|
|
5
5
|
import { Safrole } from "#@typeberry/safrole";
|
|
6
6
|
import { BandernsatchWasm } from "#@typeberry/safrole/bandersnatch-wasm.js";
|
|
7
7
|
import { SafroleSeal } from "#@typeberry/safrole/safrole-seal.js";
|
|
8
|
-
import { assertEmpty,
|
|
8
|
+
import { assertEmpty, measure, OK, Result } from "#@typeberry/utils";
|
|
9
9
|
import { AccumulateOutput } from "./accumulate/accumulate-output.js";
|
|
10
|
-
import { Accumulate,
|
|
10
|
+
import { Accumulate, } from "./accumulate/index.js";
|
|
11
11
|
import { Assurances } from "./assurances.js";
|
|
12
12
|
import { Authorization } from "./authorization.js";
|
|
13
13
|
import { Preimages } from "./preimages.js";
|
|
@@ -53,8 +53,7 @@ export var StfErrorKind;
|
|
|
53
53
|
StfErrorKind[StfErrorKind["Preimages"] = 4] = "Preimages";
|
|
54
54
|
StfErrorKind[StfErrorKind["SafroleSeal"] = 5] = "SafroleSeal";
|
|
55
55
|
StfErrorKind[StfErrorKind["Accumulate"] = 6] = "Accumulate";
|
|
56
|
-
StfErrorKind[StfErrorKind["
|
|
57
|
-
StfErrorKind[StfErrorKind["Offenders"] = 8] = "Offenders";
|
|
56
|
+
StfErrorKind[StfErrorKind["Offenders"] = 7] = "Offenders";
|
|
58
57
|
})(StfErrorKind || (StfErrorKind = {}));
|
|
59
58
|
export const stfError = (kind, nested) => {
|
|
60
59
|
return Result.taggedError(StfErrorKind, kind, nested);
|
|
@@ -75,8 +74,6 @@ export class OnChain {
|
|
|
75
74
|
// chapter 12: https://graypaper.fluffylabs.dev/#/68eaa1f/159f02159f02?v=0.6.4
|
|
76
75
|
accumulate;
|
|
77
76
|
accumulateOutput;
|
|
78
|
-
// chapter 12.3: https://graypaper.fluffylabs.dev/#/68eaa1f/178203178203?v=0.6.4
|
|
79
|
-
deferredTransfers;
|
|
80
77
|
// chapter 12.4: https://graypaper.fluffylabs.dev/#/68eaa1f/18cc0018cc00?v=0.6.4
|
|
81
78
|
preimages;
|
|
82
79
|
// after accumulation
|
|
@@ -101,7 +98,6 @@ export class OnChain {
|
|
|
101
98
|
this.assurances = new Assurances(chainSpec, state, hasher.blake2b);
|
|
102
99
|
this.accumulate = new Accumulate(chainSpec, hasher.blake2b, state, options);
|
|
103
100
|
this.accumulateOutput = new AccumulateOutput();
|
|
104
|
-
this.deferredTransfers = new DeferredTransfers(chainSpec, hasher.blake2b, state, options.pvm);
|
|
105
101
|
this.preimages = new Preimages(state, hasher.blake2b);
|
|
106
102
|
this.authorization = new Authorization(chainSpec, state);
|
|
107
103
|
}
|
|
@@ -216,29 +212,10 @@ export class OnChain {
|
|
|
216
212
|
if (accumulateResult.isError) {
|
|
217
213
|
return stfError(StfErrorKind.Accumulate, accumulateResult);
|
|
218
214
|
}
|
|
219
|
-
const { stateUpdate: accumulateUpdate, accumulationStatistics,
|
|
215
|
+
const { stateUpdate: accumulateUpdate, accumulationStatistics, accumulationOutputLog, ...accumulateRest } = accumulateResult.ok;
|
|
220
216
|
assertEmpty(accumulateRest);
|
|
221
217
|
const { privilegedServices: maybePrivilegedServices, authQueues: maybeAuthorizationQueues, designatedValidatorData: maybeDesignatedValidatorData, preimages: accumulatePreimages, accumulationQueue, recentlyAccumulated, ...servicesUpdateFromAccumulate } = accumulateUpdate;
|
|
222
|
-
|
|
223
|
-
let servicesUpdate = { ...servicesUpdateFromAccumulate, preimages: accumulatePreimages };
|
|
224
|
-
if (!Compatibility.isGreaterOrEqual(GpVersion.V0_7_1)) {
|
|
225
|
-
const deferredTransfersResult = await this.deferredTransfers.transition({
|
|
226
|
-
entropy: entropy[0],
|
|
227
|
-
pendingTransfers,
|
|
228
|
-
servicesUpdate,
|
|
229
|
-
timeslot: timeSlot,
|
|
230
|
-
});
|
|
231
|
-
if (deferredTransfersResult.isError) {
|
|
232
|
-
return stfError(StfErrorKind.DeferredTransfers, deferredTransfersResult);
|
|
233
|
-
}
|
|
234
|
-
const { servicesUpdate: servicesUpdateFromDeferredTransfers, transferStatistics: transferStatisticsFromDeferredTransfers, ...deferredTransfersRest } = deferredTransfersResult.ok;
|
|
235
|
-
transferStatistics = transferStatisticsFromDeferredTransfers;
|
|
236
|
-
servicesUpdate = servicesUpdateFromDeferredTransfers;
|
|
237
|
-
assertEmpty(deferredTransfersRest);
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
check `${pendingTransfers.length === 0} All transfers should be already accumulated.`;
|
|
241
|
-
}
|
|
218
|
+
const servicesUpdate = { ...servicesUpdateFromAccumulate, preimages: accumulatePreimages };
|
|
242
219
|
const accumulateRoot = await this.accumulateOutput.transition({ accumulationOutputLog });
|
|
243
220
|
// recent history
|
|
244
221
|
const recentHistoryUpdate = this.recentHistory.transition({
|
|
@@ -264,7 +241,6 @@ export class OnChain {
|
|
|
264
241
|
incomingReports: extrinsic.guarantees.map((g) => g.report),
|
|
265
242
|
availableReports,
|
|
266
243
|
accumulationStatistics,
|
|
267
|
-
transferStatistics,
|
|
268
244
|
reporters: reporters,
|
|
269
245
|
currentValidatorData,
|
|
270
246
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accumulate-externalities.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/externalities/accumulate-externalities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EAId,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EACL,uBAAuB,EAEvB,UAAU,EACV,mBAAmB,EACnB,KAAK,OAAO,EACZ,eAAe,EACf,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAEjB,KAAK,cAAc,EAEnB,oBAAoB,EACpB,oBAAoB,EAEpB,KAAK,mBAAmB,EACxB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAsC,KAAK,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,OAAO,EAGZ,kBAAkB,EAClB,KAAK,UAAU,EAGf,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"accumulate-externalities.d.ts","sourceRoot":"","sources":["../../../../../../packages/jam/transition/externalities/accumulate-externalities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EAId,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EACL,uBAAuB,EAEvB,UAAU,EACV,mBAAmB,EACnB,KAAK,OA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