@lodestar/beacon-node 1.31.0-dev.d4a1f1655e → 1.31.0-dev.d68d5933b8
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/lib/api/impl/beacon/blocks/index.js +2 -0
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/rewards/index.js +3 -0
- package/lib/api/impl/beacon/rewards/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.js +5 -0
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/config/index.d.ts +1 -1
- package/lib/api/impl/config/index.js +5 -0
- package/lib/api/impl/config/index.js.map +1 -1
- package/lib/api/impl/utils.d.ts +9 -0
- package/lib/api/impl/utils.js +23 -0
- package/lib/api/impl/utils.js.map +1 -0
- package/lib/api/impl/validator/index.js +2 -1
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.d.ts +22 -0
- package/lib/chain/archiveStore/historicalState/metrics.js +173 -0
- package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -0
- package/lib/chain/archiveStore/historicalState/types.d.ts +2 -16
- package/lib/chain/archiveStore/historicalState/types.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +3 -163
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts +4 -2
- package/lib/chain/blocks/blockInput/blockInput.js +28 -12
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/blockInput/index.d.ts +1 -0
- package/lib/chain/blocks/blockInput/index.js +1 -0
- package/lib/chain/blocks/blockInput/index.js.map +1 -1
- package/lib/chain/blocks/blockInput/types.d.ts +2 -1
- package/lib/chain/blocks/blockInput/utils.d.ts +9 -0
- package/lib/chain/blocks/blockInput/utils.js +35 -0
- package/lib/chain/blocks/blockInput/utils.js.map +1 -0
- package/lib/chain/blocks/importBlock.d.ts +5 -0
- package/lib/chain/blocks/importBlock.js +27 -2
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/chain.d.ts +2 -0
- package/lib/chain/chain.js +11 -2
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/initState.js +11 -0
- package/lib/chain/initState.js.map +1 -1
- package/lib/chain/interface.d.ts +2 -0
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +20 -14
- package/lib/chain/opPools/aggregatedAttestationPool.js +41 -49
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/syncContributionAndProofPool.d.ts +11 -4
- package/lib/chain/opPools/syncContributionAndProofPool.js +50 -8
- package/lib/chain/opPools/syncContributionAndProofPool.js.map +1 -1
- package/lib/chain/opPools/types.d.ts +1 -1
- package/lib/chain/opPools/types.js +1 -1
- package/lib/chain/opPools/types.js.map +1 -1
- package/lib/chain/seenCache/seenAggregateAndProof.d.ts +3 -3
- package/lib/chain/seenCache/seenAggregateAndProof.js +12 -6
- package/lib/chain/seenCache/seenAggregateAndProof.js.map +1 -1
- package/lib/chain/seenCache/seenBlockInput.d.ts +84 -0
- package/lib/chain/seenCache/seenBlockInput.js +225 -0
- package/lib/chain/seenCache/seenBlockInput.js.map +1 -0
- package/lib/chain/validation/aggregateAndProof.js +2 -2
- package/lib/chain/validation/aggregateAndProof.js.map +1 -1
- package/lib/chain/validation/blobSidecar.js +2 -2
- package/lib/chain/validation/blobSidecar.js.map +1 -1
- package/lib/chain/validation/block.js +2 -2
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +36 -3
- package/lib/metrics/metrics/lodestar.js +71 -4
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/core/types.d.ts +2 -1
- package/lib/network/network.js +3 -3
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/gossipHandlers.js +2 -1
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/package.json +18 -18
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export function createHistoricalStateTransitionMetrics(metricsRegister) {
|
|
2
|
+
return {
|
|
3
|
+
// state transition metrics
|
|
4
|
+
epochTransitionTime: metricsRegister.histogram({
|
|
5
|
+
name: "lodestar_historical_state_stfn_epoch_transition_seconds",
|
|
6
|
+
help: "Time to process a single epoch transition in seconds",
|
|
7
|
+
// Epoch transitions are 100ms on very fast clients, and average 800ms on heavy networks
|
|
8
|
+
buckets: [0.01, 0.05, 0.1, 0.2, 0.5, 0.75, 1, 1.25, 1.5, 3, 10],
|
|
9
|
+
}),
|
|
10
|
+
epochTransitionCommitTime: metricsRegister.histogram({
|
|
11
|
+
name: "lodestar_historical_state_stfn_epoch_transition_commit_seconds",
|
|
12
|
+
help: "Time to call commit after process a single epoch transition in seconds",
|
|
13
|
+
buckets: [0.01, 0.05, 0.1, 0.2, 0.5, 0.75, 1],
|
|
14
|
+
}),
|
|
15
|
+
epochTransitionStepTime: metricsRegister.histogram({
|
|
16
|
+
name: "lodestar_historical_state_stfn_epoch_transition_step_seconds",
|
|
17
|
+
help: "Time to call each step of epoch transition in seconds",
|
|
18
|
+
labelNames: ["step"],
|
|
19
|
+
buckets: [0.01, 0.05, 0.1, 0.2, 0.5, 0.75, 1],
|
|
20
|
+
}),
|
|
21
|
+
processBlockTime: metricsRegister.histogram({
|
|
22
|
+
name: "lodestar_historical_state_stfn_process_block_seconds",
|
|
23
|
+
help: "Time to process a single block in seconds",
|
|
24
|
+
// TODO: Add metrics for each step
|
|
25
|
+
// Block processing can take 5-40ms, 100ms max
|
|
26
|
+
buckets: [0.005, 0.01, 0.02, 0.05, 0.1, 1],
|
|
27
|
+
}),
|
|
28
|
+
processBlockCommitTime: metricsRegister.histogram({
|
|
29
|
+
name: "lodestar_historical_state_stfn_process_block_commit_seconds",
|
|
30
|
+
help: "Time to call commit after process a single block in seconds",
|
|
31
|
+
buckets: [0.005, 0.01, 0.02, 0.05, 0.1, 1],
|
|
32
|
+
}),
|
|
33
|
+
stateHashTreeRootTime: metricsRegister.histogram({
|
|
34
|
+
name: "lodestar_historical_state_stfn_hash_tree_root_seconds",
|
|
35
|
+
help: "Time to compute the hash tree root of a post state in seconds",
|
|
36
|
+
buckets: [0.05, 0.1, 0.2, 0.5, 1, 1.5],
|
|
37
|
+
labelNames: ["source"],
|
|
38
|
+
}),
|
|
39
|
+
numEffectiveBalanceUpdates: metricsRegister.gauge({
|
|
40
|
+
name: "lodestar_historical_state_stfn_num_effective_balance_updates_count",
|
|
41
|
+
help: "Count of effective balance updates in epoch transition",
|
|
42
|
+
}),
|
|
43
|
+
preStateBalancesNodesPopulatedMiss: metricsRegister.gauge({
|
|
44
|
+
name: "lodestar_historical_state_stfn_balances_nodes_populated_miss_total",
|
|
45
|
+
help: "Total count state.balances nodesPopulated is false on stfn",
|
|
46
|
+
labelNames: ["source"],
|
|
47
|
+
}),
|
|
48
|
+
preStateBalancesNodesPopulatedHit: metricsRegister.gauge({
|
|
49
|
+
name: "lodestar_historical_state_stfn_balances_nodes_populated_hit_total",
|
|
50
|
+
help: "Total count state.balances nodesPopulated is true on stfn",
|
|
51
|
+
labelNames: ["source"],
|
|
52
|
+
}),
|
|
53
|
+
preStateValidatorsNodesPopulatedMiss: metricsRegister.gauge({
|
|
54
|
+
name: "lodestar_historical_state_stfn_validators_nodes_populated_miss_total",
|
|
55
|
+
help: "Total count state.validators nodesPopulated is false on stfn",
|
|
56
|
+
labelNames: ["source"],
|
|
57
|
+
}),
|
|
58
|
+
preStateValidatorsNodesPopulatedHit: metricsRegister.gauge({
|
|
59
|
+
name: "lodestar_historical_state_stfn_validators_nodes_populated_hit_total",
|
|
60
|
+
help: "Total count state.validators nodesPopulated is true on stfn",
|
|
61
|
+
labelNames: ["source"],
|
|
62
|
+
}),
|
|
63
|
+
preStateClonedCount: metricsRegister.histogram({
|
|
64
|
+
name: "lodestar_historical_state_stfn_state_cloned_count",
|
|
65
|
+
help: "Histogram of cloned count per state every time state.clone() is called",
|
|
66
|
+
buckets: [1, 2, 5, 10, 50, 250],
|
|
67
|
+
}),
|
|
68
|
+
postStateBalancesNodesPopulatedHit: metricsRegister.gauge({
|
|
69
|
+
name: "lodestar_historical_state_stfn_post_state_balances_nodes_populated_hit_total",
|
|
70
|
+
help: "Total count state.validators nodesPopulated is true on stfn for post state",
|
|
71
|
+
}),
|
|
72
|
+
postStateBalancesNodesPopulatedMiss: metricsRegister.gauge({
|
|
73
|
+
name: "lodestar_historical_state_stfn_post_state_balances_nodes_populated_miss_total",
|
|
74
|
+
help: "Total count state.validators nodesPopulated is false on stfn for post state",
|
|
75
|
+
}),
|
|
76
|
+
postStateValidatorsNodesPopulatedHit: metricsRegister.gauge({
|
|
77
|
+
name: "lodestar_historical_state_stfn_post_state_validators_nodes_populated_hit_total",
|
|
78
|
+
help: "Total count state.validators nodesPopulated is true on stfn for post state",
|
|
79
|
+
}),
|
|
80
|
+
postStateValidatorsNodesPopulatedMiss: metricsRegister.gauge({
|
|
81
|
+
name: "lodestar_historical_state_stfn_post_state_validators_nodes_populated_miss_total",
|
|
82
|
+
help: "Total count state.validators nodesPopulated is false on stfn for post state",
|
|
83
|
+
}),
|
|
84
|
+
newSeenAttestersPerBlock: metricsRegister.gauge({
|
|
85
|
+
name: "lodestar_historical_state_stfn_new_seen_attesters_per_block_total",
|
|
86
|
+
help: "Count of new seen attesters in epoch transition",
|
|
87
|
+
}),
|
|
88
|
+
newSeenAttestersEffectiveBalancePerBlock: metricsRegister.gauge({
|
|
89
|
+
name: "lodestar_historical_state_stfn_new_seen_attesters_effective_balance_per_block_total",
|
|
90
|
+
help: "Total effective balance increment of new seen attesters per block",
|
|
91
|
+
}),
|
|
92
|
+
attestationsPerBlock: metricsRegister.gauge({
|
|
93
|
+
name: "lodestar_historical_state_stfn_attestations_per_block_total",
|
|
94
|
+
help: "Count of attestations per block",
|
|
95
|
+
}),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function createHistoricalStateRegenMetrics(metricsRegister) {
|
|
99
|
+
return {
|
|
100
|
+
...createHistoricalStateTransitionMetrics(metricsRegister),
|
|
101
|
+
// historical state regen metrics
|
|
102
|
+
regenTime: metricsRegister.histogram({
|
|
103
|
+
name: "lodestar_historical_state_regen_time_seconds",
|
|
104
|
+
help: "Time to regenerate a historical state in seconds",
|
|
105
|
+
// Historical state regen can take up to 3h as of Aug 2024
|
|
106
|
+
// 5m, 10m, 30m, 1h, 3h
|
|
107
|
+
buckets: [5 * 60, 10 * 60, 30 * 60, 60 * 60, 180 * 60],
|
|
108
|
+
}),
|
|
109
|
+
loadStateTime: metricsRegister.histogram({
|
|
110
|
+
name: "lodestar_historical_state_load_nearest_state_time_seconds",
|
|
111
|
+
help: "Time to load a nearest historical state from the database in seconds",
|
|
112
|
+
// 30s, 1m, 2m, 4m
|
|
113
|
+
buckets: [30, 60, 120, 240],
|
|
114
|
+
}),
|
|
115
|
+
stateTransitionTime: metricsRegister.histogram({
|
|
116
|
+
name: "lodestar_historical_state_state_transition_time_seconds",
|
|
117
|
+
help: "Time to run state transition to regen historical state in seconds",
|
|
118
|
+
// 5m, 10m, 30m, 1h, 3h
|
|
119
|
+
buckets: [5 * 60, 10 * 60, 30 * 60, 60 * 60, 180 * 60],
|
|
120
|
+
}),
|
|
121
|
+
stateTransitionBlocks: metricsRegister.histogram({
|
|
122
|
+
name: "lodestar_historical_state_state_transition_blocks",
|
|
123
|
+
help: "Count of blocks processed during state transition to regen historical state",
|
|
124
|
+
// given archiveStateEpochFrequency=1024, it could process up to 32768 blocks
|
|
125
|
+
buckets: [10, 100, 1000, 10000, 30000],
|
|
126
|
+
}),
|
|
127
|
+
stateSerializationTime: metricsRegister.histogram({
|
|
128
|
+
name: "lodestar_historical_state_serialization_time_seconds",
|
|
129
|
+
help: "Time to serialize a historical state in seconds",
|
|
130
|
+
buckets: [0.25, 0.5, 1, 2],
|
|
131
|
+
}),
|
|
132
|
+
regenRequestCount: metricsRegister.gauge({
|
|
133
|
+
name: "lodestar_historical_state_request_count",
|
|
134
|
+
help: "Count of total historical state requests",
|
|
135
|
+
}),
|
|
136
|
+
regenSuccessCount: metricsRegister.gauge({
|
|
137
|
+
name: "lodestar_historical_state_success_count",
|
|
138
|
+
help: "Count of successful historical state regen",
|
|
139
|
+
}),
|
|
140
|
+
regenErrorCount: metricsRegister.gauge({
|
|
141
|
+
name: "lodestar_historical_state_error_count",
|
|
142
|
+
help: "Count of failed historical state regen",
|
|
143
|
+
labelNames: ["reason"],
|
|
144
|
+
}),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export function createHistoricalStateQueueMetrics(metricsRegister) {
|
|
148
|
+
return {
|
|
149
|
+
length: metricsRegister.gauge({
|
|
150
|
+
name: "lodestar_historical_state_queue_length",
|
|
151
|
+
help: "Count of total regen queue length",
|
|
152
|
+
}),
|
|
153
|
+
droppedJobs: metricsRegister.gauge({
|
|
154
|
+
name: "lodestar_historical_state_queue_dropped_jobs_total",
|
|
155
|
+
help: "Count of total regen queue dropped jobs",
|
|
156
|
+
}),
|
|
157
|
+
jobTime: metricsRegister.histogram({
|
|
158
|
+
name: "lodestar_historical_state_queue_job_time_seconds",
|
|
159
|
+
help: "Time to process regen queue job in seconds",
|
|
160
|
+
buckets: [0.01, 0.1, 1, 10, 100],
|
|
161
|
+
}),
|
|
162
|
+
jobWaitTime: metricsRegister.histogram({
|
|
163
|
+
name: "lodestar_historical_state_queue_job_wait_time_seconds",
|
|
164
|
+
help: "Time from job added to the regen queue to starting in seconds",
|
|
165
|
+
buckets: [0.01, 0.1, 1, 10, 100],
|
|
166
|
+
}),
|
|
167
|
+
concurrency: metricsRegister.gauge({
|
|
168
|
+
name: "lodestar_historical_state_queue_concurrency",
|
|
169
|
+
help: "Current concurrency of regen queue",
|
|
170
|
+
}),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../../src/chain/archiveStore/historicalState/metrics.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,sCAAsC,CACpD,eAAsC;IAEtC,OAAO;QACL,2BAA2B;QAC3B,mBAAmB,EAAE,eAAe,CAAC,SAAS,CAAC;YAC7C,IAAI,EAAE,yDAAyD;YAC/D,IAAI,EAAE,sDAAsD;YAC5D,wFAAwF;YACxF,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;SAChE,CAAC;QACF,yBAAyB,EAAE,eAAe,CAAC,SAAS,CAAC;YACnD,IAAI,EAAE,gEAAgE;YACtE,IAAI,EAAE,wEAAwE;YAC9E,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;SAC9C,CAAC;QACF,uBAAuB,EAAE,eAAe,CAAC,SAAS,CAA8B;YAC9E,IAAI,EAAE,8DAA8D;YACpE,IAAI,EAAE,uDAAuD;YAC7D,UAAU,EAAE,CAAC,MAAM,CAAC;YACpB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;SAC9C,CAAC;QACF,gBAAgB,EAAE,eAAe,CAAC,SAAS,CAAC;YAC1C,IAAI,EAAE,sDAAsD;YAC5D,IAAI,EAAE,2CAA2C;YACjD,kCAAkC;YAClC,8CAA8C;YAC9C,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;SAC3C,CAAC;QACF,sBAAsB,EAAE,eAAe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AAE,CAAC,QAAQ,CAAC;SACvB,CAAC;KACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,eAAsC;IACtF,OAAO;QACL,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC;YAC5B,IAAI,EAAE,wCAAwC;YAC9C,IAAI,EAAE,mCAAmC;SAC1C,CAAC;QACF,WAAW,EAAE,eAAe,CAAC,KAAK,CAAC;YACjC,IAAI,EAAE,oDAAoD;YAC1D,IAAI,EAAE,yCAAyC;SAChD,CAAC;QACF,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC;YACjC,IAAI,EAAE,kDAAkD;YACxD,IAAI,EAAE,4CAA4C;YAClD,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC;SACjC,CAAC;QACF,WAAW,EAAE,eAAe,CAAC,SAAS,CAAC;YACrC,IAAI,EAAE,uDAAuD;YAC7D,IAAI,EAAE,+DAA+D;YACrE,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC;SACjC,CAAC;QACF,WAAW,EAAE,eAAe,CAAC,KAAK,CAAC;YACjC,IAAI,EAAE,6CAA6C;YACnD,IAAI,EAAE,oCAAoC;SAC3C,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ModuleThread } from "@chainsafe/threads";
|
|
2
|
-
import { BeaconConfig } from "@lodestar/config";
|
|
2
|
+
import { BeaconConfig, SpecJson } from "@lodestar/config";
|
|
3
3
|
import { LoggerNode, LoggerNodeOpts } from "@lodestar/logger/node";
|
|
4
|
-
import { BeaconStateTransitionMetrics } from "@lodestar/state-transition";
|
|
5
|
-
import { Gauge, Histogram } from "@lodestar/utils";
|
|
6
4
|
import { Metrics } from "../../../metrics/index.js";
|
|
7
5
|
export type HistoricalStateRegenInitModules = {
|
|
8
6
|
opts: {
|
|
@@ -18,7 +16,7 @@ export type HistoricalStateRegenModules = HistoricalStateRegenInitModules & {
|
|
|
18
16
|
api: ModuleThread<HistoricalStateWorkerApi>;
|
|
19
17
|
};
|
|
20
18
|
export type HistoricalStateWorkerData = {
|
|
21
|
-
chainConfigJson:
|
|
19
|
+
chainConfigJson: SpecJson;
|
|
22
20
|
genesisValidatorsRoot: Uint8Array;
|
|
23
21
|
genesisTime: number;
|
|
24
22
|
maxConcurrency: number;
|
|
@@ -37,16 +35,4 @@ export declare enum RegenErrorType {
|
|
|
37
35
|
invalidStateRoot = "invalid_state_root",
|
|
38
36
|
blockProcessing = "block_processing"
|
|
39
37
|
}
|
|
40
|
-
export type HistoricalStateRegenMetrics = BeaconStateTransitionMetrics & {
|
|
41
|
-
regenTime: Histogram;
|
|
42
|
-
loadStateTime: Histogram;
|
|
43
|
-
stateTransitionTime: Histogram;
|
|
44
|
-
stateTransitionBlocks: Histogram;
|
|
45
|
-
stateSerializationTime: Histogram;
|
|
46
|
-
regenRequestCount: Gauge;
|
|
47
|
-
regenSuccessCount: Gauge;
|
|
48
|
-
regenErrorCount: Gauge<{
|
|
49
|
-
reason: RegenErrorType;
|
|
50
|
-
}>;
|
|
51
|
-
};
|
|
52
38
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/chain/archiveStore/historicalState/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/chain/archiveStore/historicalState/types.ts"],"names":[],"mappings":"AAoCA,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,0CAAwB,CAAA;IACxB,yDAAuC,CAAA;IACvC,sDAAoC,CAAA;AACtC,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB"}
|
|
@@ -8,6 +8,7 @@ import { BeaconDb } from "../../../db/index.js";
|
|
|
8
8
|
import { RegistryMetricCreator, collectNodeJSMetrics } from "../../../metrics/index.js";
|
|
9
9
|
import { JobFnQueue } from "../../../util/queue/fnQueue.js";
|
|
10
10
|
import { getHistoricalState } from "./getHistoricalState.js";
|
|
11
|
+
import { createHistoricalStateQueueMetrics, createHistoricalStateRegenMetrics, } from "./metrics.js";
|
|
11
12
|
// most of this setup copied from networkCoreWorker.ts
|
|
12
13
|
const workerData = worker.workerData;
|
|
13
14
|
const logger = getNodeLogger(workerData.loggerOpts);
|
|
@@ -22,169 +23,8 @@ let queueMetrics;
|
|
|
22
23
|
if (metricsRegister) {
|
|
23
24
|
const closeMetrics = collectNodeJSMetrics(metricsRegister, "lodestar_historical_state_worker_");
|
|
24
25
|
abortController.signal.addEventListener("abort", closeMetrics, { once: true });
|
|
25
|
-
historicalStateRegenMetrics =
|
|
26
|
-
|
|
27
|
-
epochTransitionTime: metricsRegister.histogram({
|
|
28
|
-
name: "lodestar_historical_state_stfn_epoch_transition_seconds",
|
|
29
|
-
help: "Time to process a single epoch transition in seconds",
|
|
30
|
-
// Epoch transitions are 100ms on very fast clients, and average 800ms on heavy networks
|
|
31
|
-
buckets: [0.01, 0.05, 0.1, 0.2, 0.5, 0.75, 1, 1.25, 1.5, 3, 10],
|
|
32
|
-
}),
|
|
33
|
-
epochTransitionCommitTime: metricsRegister.histogram({
|
|
34
|
-
name: "lodestar_historical_state_stfn_epoch_transition_commit_seconds",
|
|
35
|
-
help: "Time to call commit after process a single epoch transition in seconds",
|
|
36
|
-
buckets: [0.01, 0.05, 0.1, 0.2, 0.5, 0.75, 1],
|
|
37
|
-
}),
|
|
38
|
-
epochTransitionStepTime: metricsRegister.histogram({
|
|
39
|
-
name: "lodestar_historical_state_stfn_epoch_transition_step_seconds",
|
|
40
|
-
help: "Time to call each step of epoch transition in seconds",
|
|
41
|
-
labelNames: ["step"],
|
|
42
|
-
buckets: [0.01, 0.05, 0.1, 0.2, 0.5, 0.75, 1],
|
|
43
|
-
}),
|
|
44
|
-
processBlockTime: metricsRegister.histogram({
|
|
45
|
-
name: "lodestar_historical_state_stfn_process_block_seconds",
|
|
46
|
-
help: "Time to process a single block in seconds",
|
|
47
|
-
// TODO: Add metrics for each step
|
|
48
|
-
// Block processing can take 5-40ms, 100ms max
|
|
49
|
-
buckets: [0.005, 0.01, 0.02, 0.05, 0.1, 1],
|
|
50
|
-
}),
|
|
51
|
-
processBlockCommitTime: metricsRegister.histogram({
|
|
52
|
-
name: "lodestar_historical_state_stfn_process_block_commit_seconds",
|
|
53
|
-
help: "Time to call commit after process a single block in seconds",
|
|
54
|
-
buckets: [0.005, 0.01, 0.02, 0.05, 0.1, 1],
|
|
55
|
-
}),
|
|
56
|
-
stateHashTreeRootTime: metricsRegister.histogram({
|
|
57
|
-
name: "lodestar_historical_state_stfn_hash_tree_root_seconds",
|
|
58
|
-
help: "Time to compute the hash tree root of a post state in seconds",
|
|
59
|
-
buckets: [0.05, 0.1, 0.2, 0.5, 1, 1.5],
|
|
60
|
-
labelNames: ["source"],
|
|
61
|
-
}),
|
|
62
|
-
numEffectiveBalanceUpdates: metricsRegister.gauge({
|
|
63
|
-
name: "lodestar_historical_state_stfn_num_effective_balance_updates_count",
|
|
64
|
-
help: "Count of effective balance updates in epoch transition",
|
|
65
|
-
}),
|
|
66
|
-
preStateBalancesNodesPopulatedMiss: metricsRegister.gauge({
|
|
67
|
-
name: "lodestar_historical_state_stfn_balances_nodes_populated_miss_total",
|
|
68
|
-
help: "Total count state.balances nodesPopulated is false on stfn",
|
|
69
|
-
labelNames: ["source"],
|
|
70
|
-
}),
|
|
71
|
-
preStateBalancesNodesPopulatedHit: metricsRegister.gauge({
|
|
72
|
-
name: "lodestar_historical_state_stfn_balances_nodes_populated_hit_total",
|
|
73
|
-
help: "Total count state.balances nodesPopulated is true on stfn",
|
|
74
|
-
labelNames: ["source"],
|
|
75
|
-
}),
|
|
76
|
-
preStateValidatorsNodesPopulatedMiss: metricsRegister.gauge({
|
|
77
|
-
name: "lodestar_historical_state_stfn_validators_nodes_populated_miss_total",
|
|
78
|
-
help: "Total count state.validators nodesPopulated is false on stfn",
|
|
79
|
-
labelNames: ["source"],
|
|
80
|
-
}),
|
|
81
|
-
preStateValidatorsNodesPopulatedHit: metricsRegister.gauge({
|
|
82
|
-
name: "lodestar_historical_state_stfn_validators_nodes_populated_hit_total",
|
|
83
|
-
help: "Total count state.validators nodesPopulated is true on stfn",
|
|
84
|
-
labelNames: ["source"],
|
|
85
|
-
}),
|
|
86
|
-
preStateClonedCount: metricsRegister.histogram({
|
|
87
|
-
name: "lodestar_historical_state_stfn_state_cloned_count",
|
|
88
|
-
help: "Histogram of cloned count per state every time state.clone() is called",
|
|
89
|
-
buckets: [1, 2, 5, 10, 50, 250],
|
|
90
|
-
}),
|
|
91
|
-
postStateBalancesNodesPopulatedHit: metricsRegister.gauge({
|
|
92
|
-
name: "lodestar_historical_state_stfn_post_state_balances_nodes_populated_hit_total",
|
|
93
|
-
help: "Total count state.validators nodesPopulated is true on stfn for post state",
|
|
94
|
-
}),
|
|
95
|
-
postStateBalancesNodesPopulatedMiss: metricsRegister.gauge({
|
|
96
|
-
name: "lodestar_historical_state_stfn_post_state_balances_nodes_populated_miss_total",
|
|
97
|
-
help: "Total count state.validators nodesPopulated is false on stfn for post state",
|
|
98
|
-
}),
|
|
99
|
-
postStateValidatorsNodesPopulatedHit: metricsRegister.gauge({
|
|
100
|
-
name: "lodestar_historical_state_stfn_post_state_validators_nodes_populated_hit_total",
|
|
101
|
-
help: "Total count state.validators nodesPopulated is true on stfn for post state",
|
|
102
|
-
}),
|
|
103
|
-
postStateValidatorsNodesPopulatedMiss: metricsRegister.gauge({
|
|
104
|
-
name: "lodestar_historical_state_stfn_post_state_validators_nodes_populated_miss_total",
|
|
105
|
-
help: "Total count state.validators nodesPopulated is false on stfn for post state",
|
|
106
|
-
}),
|
|
107
|
-
newSeenAttestersPerBlock: metricsRegister.gauge({
|
|
108
|
-
name: "lodestar_historical_state_stfn_new_seen_attesters_per_block_total",
|
|
109
|
-
help: "Count of new seen attesters in epoch transition",
|
|
110
|
-
}),
|
|
111
|
-
newSeenAttestersEffectiveBalancePerBlock: metricsRegister.gauge({
|
|
112
|
-
name: "lodestar_historical_state_stfn_new_seen_attesters_effective_balance_per_block_total",
|
|
113
|
-
help: "Total effective balance increment of new seen attesters per block",
|
|
114
|
-
}),
|
|
115
|
-
attestationsPerBlock: metricsRegister.gauge({
|
|
116
|
-
name: "lodestar_historical_state_stfn_attestations_per_block_total",
|
|
117
|
-
help: "Count of attestations per block",
|
|
118
|
-
}),
|
|
119
|
-
// historical state regen metrics
|
|
120
|
-
regenTime: metricsRegister.histogram({
|
|
121
|
-
name: "lodestar_historical_state_regen_time_seconds",
|
|
122
|
-
help: "Time to regenerate a historical state in seconds",
|
|
123
|
-
// Historical state regen can take up to 3h as of Aug 2024
|
|
124
|
-
// 5m, 10m, 30m, 1h, 3h
|
|
125
|
-
buckets: [5 * 60, 10 * 60, 30 * 60, 60 * 60, 180 * 60],
|
|
126
|
-
}),
|
|
127
|
-
loadStateTime: metricsRegister.histogram({
|
|
128
|
-
name: "lodestar_historical_state_load_nearest_state_time_seconds",
|
|
129
|
-
help: "Time to load a nearest historical state from the database in seconds",
|
|
130
|
-
// 30s, 1m, 2m, 4m
|
|
131
|
-
buckets: [30, 60, 120, 240],
|
|
132
|
-
}),
|
|
133
|
-
stateTransitionTime: metricsRegister.histogram({
|
|
134
|
-
name: "lodestar_historical_state_state_transition_time_seconds",
|
|
135
|
-
help: "Time to run state transition to regen historical state in seconds",
|
|
136
|
-
// 5m, 10m, 30m, 1h, 3h
|
|
137
|
-
buckets: [5 * 60, 10 * 60, 30 * 60, 60 * 60, 180 * 60],
|
|
138
|
-
}),
|
|
139
|
-
stateTransitionBlocks: metricsRegister.histogram({
|
|
140
|
-
name: "lodestar_historical_state_state_transition_blocks",
|
|
141
|
-
help: "Count of blocks processed during state transition to regen historical state",
|
|
142
|
-
// given archiveStateEpochFrequency=1024, it could process up to 32768 blocks
|
|
143
|
-
buckets: [10, 100, 1000, 10000, 30000],
|
|
144
|
-
}),
|
|
145
|
-
stateSerializationTime: metricsRegister.histogram({
|
|
146
|
-
name: "lodestar_historical_state_serialization_time_seconds",
|
|
147
|
-
help: "Time to serialize a historical state in seconds",
|
|
148
|
-
buckets: [0.25, 0.5, 1, 2],
|
|
149
|
-
}),
|
|
150
|
-
regenRequestCount: metricsRegister.gauge({
|
|
151
|
-
name: "lodestar_historical_state_request_count",
|
|
152
|
-
help: "Count of total historical state requests",
|
|
153
|
-
}),
|
|
154
|
-
regenSuccessCount: metricsRegister.gauge({
|
|
155
|
-
name: "lodestar_historical_state_success_count",
|
|
156
|
-
help: "Count of successful historical state regen",
|
|
157
|
-
}),
|
|
158
|
-
regenErrorCount: metricsRegister.gauge({
|
|
159
|
-
name: "lodestar_historical_state_error_count",
|
|
160
|
-
help: "Count of failed historical state regen",
|
|
161
|
-
labelNames: ["reason"],
|
|
162
|
-
}),
|
|
163
|
-
};
|
|
164
|
-
queueMetrics = {
|
|
165
|
-
length: metricsRegister.gauge({
|
|
166
|
-
name: "lodestar_historical_state_queue_length",
|
|
167
|
-
help: "Count of total regen queue length",
|
|
168
|
-
}),
|
|
169
|
-
droppedJobs: metricsRegister.gauge({
|
|
170
|
-
name: "lodestar_historical_state_queue_dropped_jobs_total",
|
|
171
|
-
help: "Count of total regen queue dropped jobs",
|
|
172
|
-
}),
|
|
173
|
-
jobTime: metricsRegister.histogram({
|
|
174
|
-
name: "lodestar_historical_state_queue_job_time_seconds",
|
|
175
|
-
help: "Time to process regen queue job in seconds",
|
|
176
|
-
buckets: [0.01, 0.1, 1, 10, 100],
|
|
177
|
-
}),
|
|
178
|
-
jobWaitTime: metricsRegister.histogram({
|
|
179
|
-
name: "lodestar_historical_state_queue_job_wait_time_seconds",
|
|
180
|
-
help: "Time from job added to the regen queue to starting in seconds",
|
|
181
|
-
buckets: [0.01, 0.1, 1, 10, 100],
|
|
182
|
-
}),
|
|
183
|
-
concurrency: metricsRegister.gauge({
|
|
184
|
-
name: "lodestar_historical_state_queue_concurrency",
|
|
185
|
-
help: "Current concurrency of regen queue",
|
|
186
|
-
}),
|
|
187
|
-
};
|
|
26
|
+
historicalStateRegenMetrics = createHistoricalStateRegenMetrics(metricsRegister);
|
|
27
|
+
queueMetrics = createHistoricalStateQueueMetrics(metricsRegister);
|
|
188
28
|
}
|
|
189
29
|
const queue = new JobFnQueue({
|
|
190
30
|
maxConcurrency: workerData.maxConcurrency,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../../src/chain/archiveStore/historicalState/worker.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../../src/chain/archiveStore/historicalState/worker.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,2BA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G,IAAI,UAAU,CAC1B;IACE,cAAc,EAAE,UAAU,CAAC,cAAc;IACzC,SAAS,EAAE,UAAU,CAAC,SAAS;IAC/B,MAAM,EAAE,eAAe,CAAC,MAAM;CAC/B,EACD,YAAY,CACb,CAAC;AAEF,MAAM,YAAY,GAAG,IAAI,cAAc,EAAE,CAAC;AAE1C,MAAM,GAAG,GAA6B;IACpC,KAAK,CAAC,KAAK;QACT,eAAe,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IACD,KAAK,CAAC,aAAa;QACjB,OAAO,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;IACD,KAAK,CAAC,kBAAkB,CAAC,IAAI;QAC3B,2BAA2B,EAAE,iBAAiB,CAAC,GAAG,EAAE,CAAC;QAErD,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,IAAI,CAAa,GAAG,EAAE,CACnD,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,2BAA2B,CAAC,CAChF,CAAC;QACF,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAA0B,CAAC;QAElF,2BAA2B,EAAE,iBAAiB,CAAC,GAAG,EAAE,CAAC;QACrD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -3,7 +3,9 @@ import { BlobIndex, ColumnIndex, SignedBeaconBlock, Slot, deneb, fulu } from "@l
|
|
|
3
3
|
import { VersionedHashes } from "../../../execution/index.js";
|
|
4
4
|
import { AddBlob, AddBlock, AddColumn, BlobMeta, BlobWithSource, BlockInputInit, ColumnMeta, ColumnWithSource, CreateBlockInputMeta, DAData, DAType, IBlockInput, LogMetaBasic, LogMetaBlobs, LogMetaColumns, PromiseParts, SourceMeta } from "./types.js";
|
|
5
5
|
export type BlockInput = BlockInputPreData | BlockInputBlobs | BlockInputColumns;
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function isBlockInputPreDeneb(blockInput: IBlockInput): blockInput is BlockInputPreData;
|
|
7
|
+
export declare function isBlockInputBlobs(blockInput: IBlockInput): blockInput is BlockInputBlobs;
|
|
8
|
+
export declare function isBlockInputColumns(blockInput: IBlockInput): blockInput is BlockInputColumns;
|
|
7
9
|
type BlockInputState<F extends ForkName> = {
|
|
8
10
|
hasBlock: false;
|
|
9
11
|
hasAllData: false;
|
|
@@ -25,7 +27,7 @@ type BlockInputState<F extends ForkName> = {
|
|
|
25
27
|
declare abstract class AbstractBlockInput<F extends ForkName = ForkName, TData extends DAData = DAData> implements IBlockInput<F, TData> {
|
|
26
28
|
abstract type: DAType;
|
|
27
29
|
daOutOfRange: boolean;
|
|
28
|
-
|
|
30
|
+
timeCreatedSec: number;
|
|
29
31
|
forkName: ForkName;
|
|
30
32
|
slot: Slot;
|
|
31
33
|
blockRootHex: string;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { fromHex, prettyBytes,
|
|
1
|
+
import { fromHex, prettyBytes, toRootHex, withTimeout } from "@lodestar/utils";
|
|
2
2
|
import { kzgCommitmentToVersionedHash } from "../../../util/blobs.js";
|
|
3
|
-
import { byteArrayEquals } from "../../../util/bytes.js";
|
|
4
3
|
import { BlockInputError, BlockInputErrorCode } from "./errors.js";
|
|
5
4
|
import { DAType, } from "./types.js";
|
|
6
|
-
export function
|
|
5
|
+
export function isBlockInputPreDeneb(blockInput) {
|
|
6
|
+
return blockInput.type === DAType.PreData;
|
|
7
|
+
}
|
|
8
|
+
export function isBlockInputBlobs(blockInput) {
|
|
9
|
+
return blockInput.type === DAType.Blobs;
|
|
10
|
+
}
|
|
11
|
+
export function isBlockInputColumns(blockInput) {
|
|
12
|
+
return blockInput.type === DAType.Columns;
|
|
13
|
+
}
|
|
14
|
+
function createPromise() {
|
|
7
15
|
let resolve;
|
|
8
16
|
let reject;
|
|
9
17
|
const promise = new Promise((_resolve, _reject) => {
|
|
@@ -21,7 +29,7 @@ class AbstractBlockInput {
|
|
|
21
29
|
this.blockPromise = createPromise();
|
|
22
30
|
this.dataPromise = createPromise();
|
|
23
31
|
this.daOutOfRange = init.daOutOfRange;
|
|
24
|
-
this.
|
|
32
|
+
this.timeCreatedSec = init.timeCreated;
|
|
25
33
|
this.forkName = init.forkName;
|
|
26
34
|
this.slot = init.slot;
|
|
27
35
|
this.blockRootHex = init.blockRootHex;
|
|
@@ -58,6 +66,7 @@ class AbstractBlockInput {
|
|
|
58
66
|
return {
|
|
59
67
|
blockRoot: prettyBytes(this.blockRootHex),
|
|
60
68
|
slot: this.slot,
|
|
69
|
+
timeCreatedSec: this.timeCreatedSec,
|
|
61
70
|
};
|
|
62
71
|
}
|
|
63
72
|
getTimeComplete() {
|
|
@@ -102,7 +111,7 @@ export class BlockInputPreData extends AbstractBlockInput {
|
|
|
102
111
|
forkName: props.forkName,
|
|
103
112
|
slot: props.block.message.slot,
|
|
104
113
|
blockRootHex: props.blockRootHex,
|
|
105
|
-
parentRootHex:
|
|
114
|
+
parentRootHex: toRootHex(props.block.message.parentRoot),
|
|
106
115
|
};
|
|
107
116
|
const state = {
|
|
108
117
|
hasBlock: true,
|
|
@@ -149,7 +158,7 @@ export class BlockInputBlobs extends AbstractBlockInput {
|
|
|
149
158
|
forkName: props.forkName,
|
|
150
159
|
slot: props.block.message.slot,
|
|
151
160
|
blockRootHex: props.blockRootHex,
|
|
152
|
-
parentRootHex:
|
|
161
|
+
parentRootHex: toRootHex(props.block.message.parentRoot),
|
|
153
162
|
};
|
|
154
163
|
const blockInput = new BlockInputBlobs(init, state);
|
|
155
164
|
blockInput.blockPromise.resolve(props.block);
|
|
@@ -168,7 +177,7 @@ export class BlockInputBlobs extends AbstractBlockInput {
|
|
|
168
177
|
timeCreated: props.seenTimestampSec,
|
|
169
178
|
forkName: props.forkName,
|
|
170
179
|
blockRootHex: props.blockRootHex,
|
|
171
|
-
parentRootHex:
|
|
180
|
+
parentRootHex: toRootHex(props.blobSidecar.signedBlockHeader.message.parentRoot),
|
|
172
181
|
slot: props.blobSidecar.signedBlockHeader.message.slot,
|
|
173
182
|
};
|
|
174
183
|
const blockInput = new BlockInputBlobs(init, state);
|
|
@@ -184,12 +193,13 @@ export class BlockInputBlobs extends AbstractBlockInput {
|
|
|
184
193
|
return {
|
|
185
194
|
blockRoot: prettyBytes(this.blockRootHex),
|
|
186
195
|
slot: this.slot,
|
|
196
|
+
timeCreatedSec: this.timeCreatedSec,
|
|
187
197
|
expectedBlobs: this.state.hasBlock ? this.state.block.message.body.blobKzgCommitments.length : "unknown",
|
|
188
198
|
receivedBlobs: this.blobsCache.size,
|
|
189
199
|
};
|
|
190
200
|
}
|
|
191
201
|
addBlock({ blockRootHex, block, source }) {
|
|
192
|
-
if (
|
|
202
|
+
if (this.state.hasBlock) {
|
|
193
203
|
throw new BlockInputError({
|
|
194
204
|
code: BlockInputErrorCode.INVALID_CONSTRUCTION,
|
|
195
205
|
blockRoot: this.blockRootHex,
|
|
@@ -215,6 +225,7 @@ export class BlockInputBlobs extends AbstractBlockInput {
|
|
|
215
225
|
const hasAllData = this.blobsCache.size === block.message.body.blobKzgCommitments.length;
|
|
216
226
|
this.state = {
|
|
217
227
|
...this.state,
|
|
228
|
+
hasBlock: true,
|
|
218
229
|
hasAllData,
|
|
219
230
|
block,
|
|
220
231
|
versionedHashes: block.message.body.blobKzgCommitments.map(kzgCommitmentToVersionedHash),
|
|
@@ -311,7 +322,11 @@ export class BlockInputBlobs extends AbstractBlockInput {
|
|
|
311
322
|
}
|
|
312
323
|
}
|
|
313
324
|
function blockAndBlobArePaired(block, blobSidecar) {
|
|
314
|
-
|
|
325
|
+
const blockCommitment = block.message.body.blobKzgCommitments[blobSidecar.index];
|
|
326
|
+
if (!blockCommitment || !blobSidecar.kzgCommitment) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
return Buffer.compare(blockCommitment, blobSidecar.kzgCommitment) === 0;
|
|
315
330
|
}
|
|
316
331
|
function assertBlockAndBlobArePaired(blockRootHex, block, blobSidecar) {
|
|
317
332
|
if (!blockAndBlobArePaired(block, blobSidecar)) {
|
|
@@ -360,7 +375,7 @@ export class BlockInputColumns extends AbstractBlockInput {
|
|
|
360
375
|
timeCreated: props.source.seenTimestampSec,
|
|
361
376
|
forkName: props.forkName,
|
|
362
377
|
blockRootHex: props.blockRootHex,
|
|
363
|
-
parentRootHex:
|
|
378
|
+
parentRootHex: toRootHex(props.block.message.parentRoot),
|
|
364
379
|
slot: props.block.message.slot,
|
|
365
380
|
};
|
|
366
381
|
const blockInput = new BlockInputColumns(init, state, props.sampledColumns, props.custodyColumns);
|
|
@@ -382,7 +397,7 @@ export class BlockInputColumns extends AbstractBlockInput {
|
|
|
382
397
|
timeCreated: props.seenTimestampSec,
|
|
383
398
|
forkName: props.forkName,
|
|
384
399
|
blockRootHex: props.blockRootHex,
|
|
385
|
-
parentRootHex:
|
|
400
|
+
parentRootHex: toRootHex(props.columnSidecar.signedBlockHeader.message.parentRoot),
|
|
386
401
|
slot: props.columnSidecar.signedBlockHeader.message.slot,
|
|
387
402
|
};
|
|
388
403
|
const blockInput = new BlockInputColumns(init, state, props.sampledColumns, props.custodyColumns);
|
|
@@ -395,6 +410,7 @@ export class BlockInputColumns extends AbstractBlockInput {
|
|
|
395
410
|
return {
|
|
396
411
|
blockRoot: prettyBytes(this.blockRootHex),
|
|
397
412
|
slot: this.slot,
|
|
413
|
+
timeCreatedSec: this.timeCreatedSec,
|
|
398
414
|
expectedColumns: this.state.hasBlock && this.state.block.message.body.blobKzgCommitments.length === 0
|
|
399
415
|
? 0
|
|
400
416
|
: this.sampledColumns.length,
|
|
@@ -507,7 +523,7 @@ export class BlockInputColumns extends AbstractBlockInput {
|
|
|
507
523
|
}
|
|
508
524
|
function blockAndColumnArePaired(block, columnSidecar) {
|
|
509
525
|
return (block.message.body.blobKzgCommitments.length === columnSidecar.kzgCommitments.length &&
|
|
510
|
-
block.message.body.blobKzgCommitments.every((commitment, index) =>
|
|
526
|
+
block.message.body.blobKzgCommitments.every((commitment, index) => Buffer.compare(commitment, columnSidecar.kzgCommitments[index])));
|
|
511
527
|
}
|
|
512
528
|
function assertBlockAndColumnArePaired(blockRootHex, block, columnSidecar) {
|
|
513
529
|
if (!blockAndColumnArePaired(block, columnSidecar)) {
|