@lodestar/beacon-node 1.50.0-dev.fd4f342a40 → 1.50.0-dev.fe4e7408b4
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.d.ts.map +1 -1
- package/lib/api/impl/beacon/blocks/index.js +13 -3
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/index.js +13 -0
- package/lib/api/impl/beacon/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/index.js +28 -6
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +26 -18
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts +1 -0
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +65 -4
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +5 -0
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +14 -24
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +2 -2
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +5 -7
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/types.d.ts +2 -2
- package/lib/chain/archiveStore/historicalState/types.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/interface.d.ts +1 -1
- package/lib/chain/archiveStore/interface.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js +2 -1
- package/lib/chain/archiveStore/utils/pruneHistory.js.map +1 -1
- package/lib/chain/beaconProposerCache.d.ts +6 -0
- package/lib/chain/beaconProposerCache.d.ts.map +1 -1
- package/lib/chain/beaconProposerCache.js +16 -0
- package/lib/chain/beaconProposerCache.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +14 -8
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +7 -7
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts +2 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js +5 -4
- package/lib/chain/blocks/verifyBlocksStateTransitionOnly.js.map +1 -1
- package/lib/chain/chain.d.ts +10 -5
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +102 -33
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +7 -1
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +5 -0
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/errors/envelopeReconstructionError.d.ts +5 -0
- package/lib/chain/errors/envelopeReconstructionError.d.ts.map +1 -1
- package/lib/chain/errors/envelopeReconstructionError.js +2 -0
- package/lib/chain/errors/envelopeReconstructionError.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +2 -0
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +6 -3
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts +4 -2
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +30 -8
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/opPool.d.ts.map +1 -1
- package/lib/chain/opPools/opPool.js +1 -23
- package/lib/chain/opPools/opPool.js.map +1 -1
- package/lib/chain/opPools/proposerPreferencesPool.d.ts +8 -4
- package/lib/chain/opPools/proposerPreferencesPool.d.ts.map +1 -1
- package/lib/chain/opPools/proposerPreferencesPool.js +27 -12
- package/lib/chain/opPools/proposerPreferencesPool.js.map +1 -1
- package/lib/chain/opPools/utils.d.ts +11 -0
- package/lib/chain/opPools/utils.d.ts.map +1 -1
- package/lib/chain/opPools/utils.js +22 -0
- package/lib/chain/opPools/utils.js.map +1 -1
- package/lib/chain/options.d.ts +2 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +11 -3
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +8 -0
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +48 -34
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/regen/regen.d.ts +2 -0
- package/lib/chain/regen/regen.d.ts.map +1 -1
- package/lib/chain/regen/regen.js +10 -4
- package/lib/chain/regen/regen.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts +7 -0
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +22 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +3 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +13 -13
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/shufflingCache.d.ts +18 -8
- package/lib/chain/shufflingCache.d.ts.map +1 -1
- package/lib/chain/shufflingCache.js +72 -18
- package/lib/chain/shufflingCache.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +5 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +64 -54
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/db/beacon.d.ts +4 -1
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +6 -1
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/buckets.d.ts +3 -1
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +2 -0
- package/lib/db/buckets.js.map +1 -1
- package/lib/db/interface.d.ts +4 -1
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.js +2 -2
- package/lib/db/repositories/blockArchive.js.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +3 -3
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.js +1 -2
- package/lib/db/repositories/blockArchiveIndex.js.map +1 -1
- package/lib/db/repositories/earliestAvailableSlot.d.ts +11 -0
- package/lib/db/repositories/earliestAvailableSlot.d.ts.map +1 -0
- package/lib/db/repositories/earliestAvailableSlot.js +19 -0
- package/lib/db/repositories/earliestAvailableSlot.js.map +1 -0
- package/lib/db/repositories/index.d.ts +1 -0
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +1 -0
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/db/repositories/proposerPreferences.d.ts +14 -0
- package/lib/db/repositories/proposerPreferences.d.ts.map +1 -0
- package/lib/db/repositories/proposerPreferences.js +21 -0
- package/lib/db/repositories/proposerPreferences.js.map +1 -0
- package/lib/execution/engine/blobVersionedHashes.d.ts +9 -0
- package/lib/execution/engine/blobVersionedHashes.d.ts.map +1 -0
- package/lib/execution/engine/blobVersionedHashes.js +74 -0
- package/lib/execution/engine/blobVersionedHashes.js.map +1 -0
- package/lib/execution/engine/disabled.d.ts +0 -2
- package/lib/execution/engine/disabled.d.ts.map +1 -1
- package/lib/execution/engine/disabled.js +0 -6
- package/lib/execution/engine/disabled.js.map +1 -1
- package/lib/execution/engine/http.d.ts +46 -16
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +236 -213
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/execution/engine/index.d.ts +3 -2
- package/lib/execution/engine/index.d.ts.map +1 -1
- package/lib/execution/engine/index.js +33 -8
- package/lib/execution/engine/index.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +2 -4
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/jsonRpcTransport.d.ts +25 -0
- package/lib/execution/engine/jsonRpcTransport.d.ts.map +1 -0
- package/lib/execution/engine/jsonRpcTransport.js +158 -0
- package/lib/execution/engine/jsonRpcTransport.js.map +1 -0
- package/lib/execution/engine/mock.d.ts +0 -2
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +0 -8
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/execution/engine/restHttpClient.d.ts +71 -0
- package/lib/execution/engine/restHttpClient.d.ts.map +1 -0
- package/lib/execution/engine/restHttpClient.js +201 -0
- package/lib/execution/engine/restHttpClient.js.map +1 -0
- package/lib/execution/engine/restTransport.d.ts +46 -0
- package/lib/execution/engine/restTransport.d.ts.map +1 -0
- package/lib/execution/engine/restTransport.js +399 -0
- package/lib/execution/engine/restTransport.js.map +1 -0
- package/lib/execution/engine/sszTypes.d.ts +1261 -0
- package/lib/execution/engine/sszTypes.d.ts.map +1 -0
- package/lib/execution/engine/sszTypes.js +216 -0
- package/lib/execution/engine/sszTypes.js.map +1 -0
- package/lib/execution/engine/transport.d.ts +39 -0
- package/lib/execution/engine/transport.d.ts.map +1 -0
- package/lib/execution/engine/transport.js +2 -0
- package/lib/execution/engine/transport.js.map +1 -0
- package/lib/execution/engine/types.d.ts +2 -8
- package/lib/execution/engine/types.d.ts.map +1 -1
- package/lib/execution/engine/types.js +24 -57
- package/lib/execution/engine/types.js.map +1 -1
- package/lib/execution/engine/utils.d.ts.map +1 -1
- package/lib/execution/engine/utils.js +9 -2
- package/lib/execution/engine/utils.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +10 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +22 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/metrics.d.ts +7 -3
- package/lib/metrics/metrics.d.ts.map +1 -1
- package/lib/metrics/metrics.js +4 -4
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/network/core/events.d.ts +5 -1
- package/lib/network/core/events.d.ts.map +1 -1
- package/lib/network/core/events.js +8 -0
- package/lib/network/core/events.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +0 -14
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +60 -64
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.js +3 -3
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
- package/lib/node/nodejs.d.ts +3 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +27 -4
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/options.d.ts +3 -2
- package/lib/node/options.d.ts.map +1 -1
- package/lib/node/options.js +2 -2
- package/lib/node/options.js.map +1 -1
- package/lib/sync/range/batch.d.ts +11 -5
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +21 -17
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/sync/range/chain.d.ts +4 -4
- package/lib/sync/range/chain.d.ts.map +1 -1
- package/lib/sync/range/chain.js +12 -6
- package/lib/sync/range/chain.js.map +1 -1
- package/lib/sync/range/range.d.ts.map +1 -1
- package/lib/sync/range/range.js +25 -11
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +5 -2
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +44 -20
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +38 -14
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +84 -39
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/util/asyncIterableToEvents.d.ts +10 -2
- package/lib/util/asyncIterableToEvents.d.ts.map +1 -1
- package/lib/util/asyncIterableToEvents.js +29 -3
- package/lib/util/asyncIterableToEvents.js.map +1 -1
- package/lib/util/execution.d.ts +9 -11
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +5 -1
- package/lib/util/execution.js.map +1 -1
- package/lib/util/metadata.d.ts.map +1 -1
- package/lib/util/metadata.js +2 -1
- package/lib/util/metadata.js.map +1 -1
- package/lib/util/sszBytes.d.ts +2 -2
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +21 -14
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +18 -17
- package/src/api/impl/beacon/blocks/index.ts +17 -7
- package/src/api/impl/beacon/index.ts +15 -0
- package/src/api/impl/beacon/state/index.ts +43 -6
- package/src/api/impl/debug/index.ts +28 -19
- package/src/api/impl/validator/index.ts +81 -7
- package/src/chain/archiveStore/archiveStore.ts +19 -25
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +5 -7
- package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +1 -1
- package/src/chain/archiveStore/historicalState/types.ts +2 -2
- package/src/chain/archiveStore/historicalState/worker.ts +1 -2
- package/src/chain/archiveStore/interface.ts +1 -1
- package/src/chain/archiveStore/utils/pruneHistory.ts +4 -1
- package/src/chain/beaconProposerCache.ts +19 -1
- package/src/chain/blocks/blockInput/blockInput.ts +1 -1
- package/src/chain/blocks/importBlock.ts +17 -7
- package/src/chain/blocks/verifyBlock.ts +8 -6
- package/src/chain/blocks/verifyBlocksStateTransitionOnly.ts +6 -3
- package/src/chain/chain.ts +132 -35
- package/src/chain/emitter.ts +7 -1
- package/src/chain/errors/envelopeReconstructionError.ts +3 -0
- package/src/chain/forkChoice/index.ts +2 -0
- package/src/chain/interface.ts +7 -3
- package/src/chain/opPools/aggregatedAttestationPool.ts +34 -10
- package/src/chain/opPools/opPool.ts +1 -31
- package/src/chain/opPools/proposerPreferencesPool.ts +34 -11
- package/src/chain/opPools/utils.ts +31 -0
- package/src/chain/options.ts +3 -3
- package/src/chain/prepareNextSlot.ts +15 -3
- package/src/chain/produceBlock/computeNewStateRoot.ts +10 -3
- package/src/chain/produceBlock/produceBlockBody.ts +78 -39
- package/src/chain/regen/regen.ts +12 -4
- package/src/chain/seenCache/seenGossipBlockInput.ts +25 -1
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +20 -13
- package/src/chain/shufflingCache.ts +84 -22
- package/src/chain/validatorMonitor.ts +75 -57
- package/src/db/beacon.ts +6 -0
- package/src/db/buckets.ts +2 -0
- package/src/db/interface.ts +4 -0
- package/src/db/repositories/blockArchive.ts +2 -2
- package/src/db/repositories/blockArchiveIndex.ts +2 -3
- package/src/db/repositories/earliestAvailableSlot.ts +19 -0
- package/src/db/repositories/index.ts +1 -0
- package/src/db/repositories/proposerPreferences.ts +23 -0
- package/src/execution/engine/blobVersionedHashes.ts +72 -0
- package/src/execution/engine/disabled.ts +0 -8
- package/src/execution/engine/http.ts +304 -300
- package/src/execution/engine/index.ts +41 -7
- package/src/execution/engine/interface.ts +2 -6
- package/src/execution/engine/jsonRpcTransport.ts +247 -0
- package/src/execution/engine/mock.ts +1 -19
- package/src/execution/engine/restHttpClient.ts +269 -0
- package/src/execution/engine/restTransport.ts +544 -0
- package/src/execution/engine/sszTypes.ts +354 -0
- package/src/execution/engine/transport.ts +61 -0
- package/src/execution/engine/types.ts +34 -84
- package/src/execution/engine/utils.ts +12 -2
- package/src/metrics/metrics/lodestar.ts +23 -0
- package/src/metrics/metrics.ts +21 -6
- package/src/network/core/events.ts +16 -1
- package/src/network/processor/gossipHandlers.ts +91 -77
- package/src/network/processor/index.ts +3 -3
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +1 -1
- package/src/node/nodejs.ts +35 -3
- package/src/node/options.ts +10 -1
- package/src/sync/range/batch.ts +25 -19
- package/src/sync/range/chain.ts +15 -8
- package/src/sync/range/range.ts +26 -12
- package/src/sync/unknownBlock.ts +57 -21
- package/src/sync/utils/downloadByRange.ts +123 -58
- package/src/util/asyncIterableToEvents.ts +44 -5
- package/src/util/execution.ts +16 -8
- package/src/util/metadata.ts +2 -1
- package/src/util/sszBytes.ts +25 -12
|
@@ -123,6 +123,11 @@ export type ValidatorMonitorOpts = {
|
|
|
123
123
|
validatorMonitorLogs?: boolean;
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
+
export type NativeValidatorMonitor = {
|
|
127
|
+
registerLocalValidator(index: ValidatorIndex): void;
|
|
128
|
+
unregisterLocalValidator(index: ValidatorIndex): void;
|
|
129
|
+
};
|
|
130
|
+
|
|
126
131
|
export const defaultValidatorMonitorOpts: ValidatorMonitorOpts = {
|
|
127
132
|
validatorMonitorLogs: false,
|
|
128
133
|
};
|
|
@@ -296,7 +301,8 @@ export function createValidatorMonitor(
|
|
|
296
301
|
config: ChainForkConfig,
|
|
297
302
|
genesisTime: number,
|
|
298
303
|
logger: Logger,
|
|
299
|
-
opts: ValidatorMonitorOpts
|
|
304
|
+
opts: ValidatorMonitorOpts,
|
|
305
|
+
nativeValidatorMonitor: NativeValidatorMonitor | null = null
|
|
300
306
|
): ValidatorMonitor {
|
|
301
307
|
const logLevel = opts.validatorMonitorLogs ? LogLevel.info : LogLevel.debug;
|
|
302
308
|
const log: LogHandler = (message: string, context?: LogData) => {
|
|
@@ -327,18 +333,23 @@ export function createValidatorMonitor(
|
|
|
327
333
|
}));
|
|
328
334
|
|
|
329
335
|
let lastRegisteredStatusEpoch = -1;
|
|
336
|
+
let lastAttestationSummaryEpoch = -1;
|
|
330
337
|
|
|
331
338
|
// Track validator additions/removals per epoch for logging
|
|
332
339
|
const addedValidatorsInEpoch: Set<ValidatorIndex> = new Set();
|
|
333
340
|
const removedValidatorsInEpoch: Set<ValidatorIndex> = new Set();
|
|
334
341
|
|
|
335
|
-
const
|
|
342
|
+
const shouldRegisterStateDerivedMetrics = nativeValidatorMonitor === null;
|
|
343
|
+
const validatorMonitorMetrics = metricsRegister
|
|
344
|
+
? createValidatorMonitorMetrics(metricsRegister, shouldRegisterStateDerivedMetrics)
|
|
345
|
+
: null;
|
|
336
346
|
|
|
337
347
|
const validatorMonitor: ValidatorMonitor = {
|
|
338
348
|
registerLocalValidator(index) {
|
|
339
349
|
const isNewValidator = !validators.has(index);
|
|
340
350
|
validators.getOrDefault(index).lastRegisteredTimeMs = Date.now();
|
|
341
351
|
if (isNewValidator) {
|
|
352
|
+
nativeValidatorMonitor?.registerLocalValidator(index);
|
|
342
353
|
addedValidatorsInEpoch.add(index);
|
|
343
354
|
}
|
|
344
355
|
},
|
|
@@ -366,7 +377,7 @@ export function createValidatorMonitor(
|
|
|
366
377
|
// Track total balance instead of per-validator balance to reduce metric cardinality
|
|
367
378
|
let totalBalance = 0;
|
|
368
379
|
|
|
369
|
-
for (const
|
|
380
|
+
for (const index of validators.keys()) {
|
|
370
381
|
// We subtract two from the state of the epoch that generated these summaries.
|
|
371
382
|
//
|
|
372
383
|
// - One to account for it being the previous epoch.
|
|
@@ -380,68 +391,29 @@ export function createValidatorMonitor(
|
|
|
380
391
|
);
|
|
381
392
|
|
|
382
393
|
if (summary.isPrevSourceAttester) {
|
|
383
|
-
validatorMonitorMetrics?.prevEpochOnChainSourceAttesterHit
|
|
394
|
+
validatorMonitorMetrics?.prevEpochOnChainSourceAttesterHit?.inc();
|
|
384
395
|
} else {
|
|
385
|
-
validatorMonitorMetrics?.prevEpochOnChainSourceAttesterMiss
|
|
396
|
+
validatorMonitorMetrics?.prevEpochOnChainSourceAttesterMiss?.inc();
|
|
386
397
|
}
|
|
387
398
|
if (summary.isPrevHeadAttester) {
|
|
388
|
-
validatorMonitorMetrics?.prevEpochOnChainHeadAttesterHit
|
|
399
|
+
validatorMonitorMetrics?.prevEpochOnChainHeadAttesterHit?.inc();
|
|
389
400
|
} else {
|
|
390
|
-
validatorMonitorMetrics?.prevEpochOnChainHeadAttesterMiss
|
|
401
|
+
validatorMonitorMetrics?.prevEpochOnChainHeadAttesterMiss?.inc();
|
|
391
402
|
}
|
|
392
403
|
if (summary.isPrevTargetAttester) {
|
|
393
|
-
validatorMonitorMetrics?.prevEpochOnChainTargetAttesterHit
|
|
404
|
+
validatorMonitorMetrics?.prevEpochOnChainTargetAttesterHit?.inc();
|
|
394
405
|
} else {
|
|
395
|
-
validatorMonitorMetrics?.prevEpochOnChainTargetAttesterMiss
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
const prevEpochSummary = monitoredValidator.summaries.get(previousEpoch);
|
|
399
|
-
const attestationCorrectHead = prevEpochSummary?.attestationCorrectHead;
|
|
400
|
-
if (attestationCorrectHead !== null && attestationCorrectHead !== undefined) {
|
|
401
|
-
if (attestationCorrectHead) {
|
|
402
|
-
validatorMonitorMetrics?.prevOnChainAttesterCorrectHead.inc();
|
|
403
|
-
} else {
|
|
404
|
-
validatorMonitorMetrics?.prevOnChainAttesterIncorrectHead.inc();
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
const attestationMinBlockInclusionDistance = prevEpochSummary?.attestationMinBlockInclusionDistance;
|
|
409
|
-
const inclusionDistance =
|
|
410
|
-
attestationMinBlockInclusionDistance != null && attestationMinBlockInclusionDistance > 0
|
|
411
|
-
? // altair, attestation is not missed
|
|
412
|
-
attestationMinBlockInclusionDistance
|
|
413
|
-
: summary.inclusionDistance
|
|
414
|
-
? // phase0, this is from the state transition
|
|
415
|
-
summary.inclusionDistance
|
|
416
|
-
: null;
|
|
417
|
-
|
|
418
|
-
if (inclusionDistance !== null) {
|
|
419
|
-
validatorMonitorMetrics?.prevEpochOnChainInclusionDistance.observe(inclusionDistance);
|
|
420
|
-
validatorMonitorMetrics?.prevEpochOnChainAttesterHit.inc();
|
|
421
|
-
} else {
|
|
422
|
-
validatorMonitorMetrics?.prevEpochOnChainAttesterMiss.inc();
|
|
406
|
+
validatorMonitorMetrics?.prevEpochOnChainTargetAttesterMiss?.inc();
|
|
423
407
|
}
|
|
424
408
|
|
|
425
409
|
const balance = balances?.[index];
|
|
426
410
|
if (balance !== undefined) {
|
|
427
411
|
totalBalance += balance;
|
|
428
412
|
}
|
|
429
|
-
|
|
430
|
-
if (!summary.isPrevSourceAttester || !summary.isPrevTargetAttester || !summary.isPrevHeadAttester) {
|
|
431
|
-
log("Failed attestation in previous epoch", {
|
|
432
|
-
validator: index,
|
|
433
|
-
prevEpoch: currentEpoch - 1,
|
|
434
|
-
isPrevSourceAttester: summary.isPrevSourceAttester,
|
|
435
|
-
isPrevHeadAttester: summary.isPrevHeadAttester,
|
|
436
|
-
isPrevTargetAttester: summary.isPrevTargetAttester,
|
|
437
|
-
// inclusionDistance is not available in summary since altair
|
|
438
|
-
inclusionDistance,
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
413
|
}
|
|
442
414
|
|
|
443
415
|
if (balances !== undefined) {
|
|
444
|
-
validatorMonitorMetrics?.prevEpochOnChainBalance
|
|
416
|
+
validatorMonitorMetrics?.prevEpochOnChainBalance?.set(totalBalance);
|
|
445
417
|
}
|
|
446
418
|
},
|
|
447
419
|
|
|
@@ -732,6 +704,7 @@ export function createValidatorMonitor(
|
|
|
732
704
|
// Prune validators not seen in a while
|
|
733
705
|
for (const [index, validator] of validators.entries()) {
|
|
734
706
|
if (Date.now() - validator.lastRegisteredTimeMs > retainRegisteredValidatorsMs) {
|
|
707
|
+
nativeValidatorMonitor?.unregisterLocalValidator(index);
|
|
735
708
|
validators.delete(index);
|
|
736
709
|
removedValidatorsInEpoch.add(index);
|
|
737
710
|
}
|
|
@@ -767,6 +740,38 @@ export function createValidatorMonitor(
|
|
|
767
740
|
return;
|
|
768
741
|
}
|
|
769
742
|
|
|
743
|
+
// On-chain attestation summary of prevEpoch. Reads only the epoch summaries filled by
|
|
744
|
+
// registerAttestationInBlock(), so it works with both TS and native state transition.
|
|
745
|
+
if (prevEpoch > lastAttestationSummaryEpoch) {
|
|
746
|
+
lastAttestationSummaryEpoch = prevEpoch;
|
|
747
|
+
|
|
748
|
+
for (const monitoredValidator of validators.values()) {
|
|
749
|
+
const prevEpochSummary = monitoredValidator.summaries.get(prevEpoch);
|
|
750
|
+
const attestationCorrectHead = prevEpochSummary?.attestationCorrectHead;
|
|
751
|
+
if (attestationCorrectHead !== null && attestationCorrectHead !== undefined) {
|
|
752
|
+
if (attestationCorrectHead) {
|
|
753
|
+
validatorMonitorMetrics?.prevOnChainAttesterCorrectHead.inc();
|
|
754
|
+
} else {
|
|
755
|
+
validatorMonitorMetrics?.prevOnChainAttesterIncorrectHead.inc();
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
const attestationMinBlockInclusionDistance = prevEpochSummary?.attestationMinBlockInclusionDistance;
|
|
760
|
+
const inclusionDistance =
|
|
761
|
+
attestationMinBlockInclusionDistance != null && attestationMinBlockInclusionDistance > 0
|
|
762
|
+
? // altair, attestation is not missed
|
|
763
|
+
attestationMinBlockInclusionDistance
|
|
764
|
+
: null;
|
|
765
|
+
|
|
766
|
+
if (inclusionDistance !== null) {
|
|
767
|
+
validatorMonitorMetrics?.prevEpochOnChainInclusionDistance.observe(inclusionDistance);
|
|
768
|
+
validatorMonitorMetrics?.prevEpochOnChainAttesterHit.inc();
|
|
769
|
+
} else {
|
|
770
|
+
validatorMonitorMetrics?.prevEpochOnChainAttesterMiss.inc();
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
770
775
|
const rootCache = new RootHexCache(headState);
|
|
771
776
|
|
|
772
777
|
if (isStatePostAltair(headState)) {
|
|
@@ -784,6 +789,17 @@ export function createValidatorMonitor(
|
|
|
784
789
|
epoch: prevEpoch,
|
|
785
790
|
summary,
|
|
786
791
|
});
|
|
792
|
+
|
|
793
|
+
if (!flags.timelySource || !flags.timelyTarget || !flags.timelyHead) {
|
|
794
|
+
log("Failed attestation in previous epoch", {
|
|
795
|
+
validator: index,
|
|
796
|
+
prevEpoch,
|
|
797
|
+
isPrevSourceAttester: flags.timelySource,
|
|
798
|
+
isPrevHeadAttester: flags.timelyHead,
|
|
799
|
+
isPrevTargetAttester: flags.timelyTarget,
|
|
800
|
+
inclusionDistance: validator.summaries.get(prevEpoch)?.attestationMinBlockInclusionDistance ?? null,
|
|
801
|
+
});
|
|
802
|
+
}
|
|
787
803
|
}
|
|
788
804
|
}
|
|
789
805
|
|
|
@@ -1198,7 +1214,9 @@ export class RootHexCache {
|
|
|
1198
1214
|
}
|
|
1199
1215
|
}
|
|
1200
1216
|
|
|
1201
|
-
function createValidatorMonitorMetrics(register: RegistryMetricCreator) {
|
|
1217
|
+
function createValidatorMonitorMetrics(register: RegistryMetricCreator, registerStateDerivedMetrics = true) {
|
|
1218
|
+
const stateDerivedRegister = registerStateDerivedMetrics ? register : null;
|
|
1219
|
+
|
|
1202
1220
|
return {
|
|
1203
1221
|
validatorsConnected: register.gauge({
|
|
1204
1222
|
name: "validator_monitor_validators",
|
|
@@ -1217,7 +1235,7 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator) {
|
|
|
1217
1235
|
}),
|
|
1218
1236
|
|
|
1219
1237
|
// Validator Monitor Metrics (per-epoch summaries)
|
|
1220
|
-
prevEpochOnChainBalance:
|
|
1238
|
+
prevEpochOnChainBalance: stateDerivedRegister?.gauge({
|
|
1221
1239
|
name: "validator_monitor_prev_epoch_on_chain_balance",
|
|
1222
1240
|
help: "Total balance of all monitored validators after an epoch",
|
|
1223
1241
|
}),
|
|
@@ -1229,19 +1247,19 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator) {
|
|
|
1229
1247
|
name: "validator_monitor_prev_epoch_on_chain_attester_miss_total",
|
|
1230
1248
|
help: "Incremented if validator's submitted attestation is not included in any blocks",
|
|
1231
1249
|
}),
|
|
1232
|
-
prevEpochOnChainSourceAttesterHit:
|
|
1250
|
+
prevEpochOnChainSourceAttesterHit: stateDerivedRegister?.gauge({
|
|
1233
1251
|
name: "validator_monitor_prev_epoch_on_chain_source_attester_hit_total",
|
|
1234
1252
|
help: "Incremented if the validator is flagged as a previous epoch source attester during per epoch processing",
|
|
1235
1253
|
}),
|
|
1236
|
-
prevEpochOnChainSourceAttesterMiss:
|
|
1254
|
+
prevEpochOnChainSourceAttesterMiss: stateDerivedRegister?.gauge({
|
|
1237
1255
|
name: "validator_monitor_prev_epoch_on_chain_source_attester_miss_total",
|
|
1238
1256
|
help: "Incremented if the validator is not flagged as a previous epoch source attester during per epoch processing",
|
|
1239
1257
|
}),
|
|
1240
|
-
prevEpochOnChainHeadAttesterHit:
|
|
1258
|
+
prevEpochOnChainHeadAttesterHit: stateDerivedRegister?.gauge({
|
|
1241
1259
|
name: "validator_monitor_prev_epoch_on_chain_head_attester_hit_total",
|
|
1242
1260
|
help: "Incremented if the validator is flagged as a previous epoch head attester during per epoch processing",
|
|
1243
1261
|
}),
|
|
1244
|
-
prevEpochOnChainHeadAttesterMiss:
|
|
1262
|
+
prevEpochOnChainHeadAttesterMiss: stateDerivedRegister?.gauge({
|
|
1245
1263
|
name: "validator_monitor_prev_epoch_on_chain_head_attester_miss_total",
|
|
1246
1264
|
help: "Incremented if the validator is not flagged as a previous epoch head attester during per epoch processing",
|
|
1247
1265
|
}),
|
|
@@ -1253,11 +1271,11 @@ function createValidatorMonitorMetrics(register: RegistryMetricCreator) {
|
|
|
1253
1271
|
name: "validator_monitor_prev_epoch_on_chain_attester_incorrect_head_total",
|
|
1254
1272
|
help: "Total count of times a validator votes incorrect head",
|
|
1255
1273
|
}),
|
|
1256
|
-
prevEpochOnChainTargetAttesterHit:
|
|
1274
|
+
prevEpochOnChainTargetAttesterHit: stateDerivedRegister?.gauge({
|
|
1257
1275
|
name: "validator_monitor_prev_epoch_on_chain_target_attester_hit_total",
|
|
1258
1276
|
help: "Incremented if the validator is flagged as a previous epoch target attester during per epoch processing",
|
|
1259
1277
|
}),
|
|
1260
|
-
prevEpochOnChainTargetAttesterMiss:
|
|
1278
|
+
prevEpochOnChainTargetAttesterMiss: stateDerivedRegister?.gauge({
|
|
1261
1279
|
name: "validator_monitor_prev_epoch_on_chain_target_attester_miss_total",
|
|
1262
1280
|
help: "Incremented if the validator is not flagged as a previous epoch target attester during per epoch processing",
|
|
1263
1281
|
}),
|
package/src/db/beacon.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {FlatFileStore} from "./flatFileStore/flatFileStore.js";
|
|
|
8
8
|
import type {FlatFileStoreMetrics} from "./flatFileStore/metrics.js";
|
|
9
9
|
import {IBeaconDb} from "./interface.js";
|
|
10
10
|
import {CheckpointStateRepository} from "./repositories/checkpointState.js";
|
|
11
|
+
import {EarliestAvailableSlotRepository} from "./repositories/earliestAvailableSlot.js";
|
|
11
12
|
import {
|
|
12
13
|
AttesterSlashingRepository,
|
|
13
14
|
BLSToExecutionChangeRepository,
|
|
@@ -21,6 +22,7 @@ import {
|
|
|
21
22
|
DataColumnSidecarRepository,
|
|
22
23
|
ExecutionPayloadEnvelopeArchiveRepository,
|
|
23
24
|
ExecutionPayloadEnvelopeRepository,
|
|
25
|
+
ProposerPreferencesRepository,
|
|
24
26
|
ProposerSlashingRepository,
|
|
25
27
|
StateArchiveRepository,
|
|
26
28
|
SyncCommitteeRepository,
|
|
@@ -48,9 +50,11 @@ export class BeaconDb implements IBeaconDb {
|
|
|
48
50
|
|
|
49
51
|
stateArchive: StateArchiveRepository;
|
|
50
52
|
checkpointState: CheckpointStateRepository;
|
|
53
|
+
earliestAvailableSlot: EarliestAvailableSlotRepository;
|
|
51
54
|
|
|
52
55
|
voluntaryExit: VoluntaryExitRepository;
|
|
53
56
|
proposerSlashing: ProposerSlashingRepository;
|
|
57
|
+
proposerPreferences: ProposerPreferencesRepository;
|
|
54
58
|
attesterSlashing: AttesterSlashingRepository;
|
|
55
59
|
blsToExecutionChange: BLSToExecutionChangeRepository;
|
|
56
60
|
|
|
@@ -83,9 +87,11 @@ export class BeaconDb implements IBeaconDb {
|
|
|
83
87
|
|
|
84
88
|
this.stateArchive = new StateArchiveRepository(config, db);
|
|
85
89
|
this.checkpointState = new CheckpointStateRepository(config, db);
|
|
90
|
+
this.earliestAvailableSlot = new EarliestAvailableSlotRepository(db);
|
|
86
91
|
this.voluntaryExit = new VoluntaryExitRepository(config, db);
|
|
87
92
|
this.blsToExecutionChange = new BLSToExecutionChangeRepository(config, db);
|
|
88
93
|
this.proposerSlashing = new ProposerSlashingRepository(config, db);
|
|
94
|
+
this.proposerPreferences = new ProposerPreferencesRepository(config, db);
|
|
89
95
|
this.attesterSlashing = new AttesterSlashingRepository(config, db);
|
|
90
96
|
|
|
91
97
|
// lightclient
|
package/src/db/buckets.ts
CHANGED
|
@@ -72,6 +72,8 @@ export enum Bucket {
|
|
|
72
72
|
|
|
73
73
|
gloas_executionPayloadEnvelope = 59, // GLOAS BeaconBlockRoot -> SignedExecutionPayloadEnvelope
|
|
74
74
|
gloas_executionPayloadEnvelopeArchive = 60, // GLOAS Slot -> SignedExecutionPayloadEnvelope, or 0x00 + SignedExecutionPayloadHeaderEnvelope
|
|
75
|
+
earliestAvailableSlot = 61, // singleton -> Slot
|
|
76
|
+
gloas_proposerPreferences = 62, // Slot || DependentRoot -> SignedProposerPreferences
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
export function getBucketNameByValue<T extends Bucket>(enumValue: T): keyof typeof Bucket {
|
package/src/db/interface.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {Slot} from "@lodestar/types";
|
|
|
3
3
|
import type {IDataColumnStore} from "./dataColumnStore.js";
|
|
4
4
|
import type {FlatFileStoreMetrics} from "./flatFileStore/metrics.js";
|
|
5
5
|
import {CheckpointStateRepository} from "./repositories/checkpointState.js";
|
|
6
|
+
import {EarliestAvailableSlotRepository} from "./repositories/earliestAvailableSlot.js";
|
|
6
7
|
import {
|
|
7
8
|
AttesterSlashingRepository,
|
|
8
9
|
BLSToExecutionChangeRepository,
|
|
@@ -16,6 +17,7 @@ import {
|
|
|
16
17
|
DataColumnSidecarRepository,
|
|
17
18
|
ExecutionPayloadEnvelopeArchiveRepository,
|
|
18
19
|
ExecutionPayloadEnvelopeRepository,
|
|
20
|
+
ProposerPreferencesRepository,
|
|
19
21
|
ProposerSlashingRepository,
|
|
20
22
|
StateArchiveRepository,
|
|
21
23
|
SyncCommitteeRepository,
|
|
@@ -46,10 +48,12 @@ export interface IBeaconDb {
|
|
|
46
48
|
stateArchive: StateArchiveRepository;
|
|
47
49
|
// checkpoint states
|
|
48
50
|
checkpointState: CheckpointStateRepository;
|
|
51
|
+
earliestAvailableSlot: EarliestAvailableSlotRepository;
|
|
49
52
|
|
|
50
53
|
// op pool
|
|
51
54
|
voluntaryExit: VoluntaryExitRepository;
|
|
52
55
|
proposerSlashing: ProposerSlashingRepository;
|
|
56
|
+
proposerPreferences: ProposerPreferencesRepository;
|
|
53
57
|
attesterSlashing: AttesterSlashingRepository;
|
|
54
58
|
blsToExecutionChange: BLSToExecutionChangeRepository;
|
|
55
59
|
|
|
@@ -184,7 +184,7 @@ export class BlockArchiveRepository extends Repository<Slot, SignedBeaconBlock>
|
|
|
184
184
|
async remove(value: SignedBeaconBlock): Promise<void> {
|
|
185
185
|
await Promise.all([
|
|
186
186
|
super.remove(value),
|
|
187
|
-
deleteRootIndex(this.db, this.config.getForkTypes(value.message.slot).
|
|
187
|
+
deleteRootIndex(this.db, this.config.getForkTypes(value.message.slot).BeaconBlock, value),
|
|
188
188
|
deleteParentRootIndex(this.db, value),
|
|
189
189
|
]);
|
|
190
190
|
}
|
|
@@ -193,7 +193,7 @@ export class BlockArchiveRepository extends Repository<Slot, SignedBeaconBlock>
|
|
|
193
193
|
await Promise.all([
|
|
194
194
|
super.batchRemove(values),
|
|
195
195
|
...values.map((value) =>
|
|
196
|
-
deleteRootIndex(this.db, this.config.getForkTypes(value.message.slot).
|
|
196
|
+
deleteRootIndex(this.db, this.config.getForkTypes(value.message.slot).BeaconBlock, value)
|
|
197
197
|
),
|
|
198
198
|
...values.map((value) => deleteParentRootIndex(this.db, value)),
|
|
199
199
|
]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Db, encodeKey} from "@lodestar/db";
|
|
2
2
|
import {ForkAll} from "@lodestar/params";
|
|
3
|
-
import {Root, SSZTypesFor, SignedBeaconBlock, Slot
|
|
3
|
+
import {Root, SSZTypesFor, SignedBeaconBlock, Slot} from "@lodestar/types";
|
|
4
4
|
import {Bucket, getBucketNameByValue} from "../buckets.js";
|
|
5
5
|
|
|
6
6
|
export const rootIndexBucketId = getBucketNameByValue(Bucket.index_blockArchiveRootIndex);
|
|
@@ -16,10 +16,9 @@ export async function getParentRootIndex(db: Db, parentRoot: Root): Promise<Uint
|
|
|
16
16
|
|
|
17
17
|
export async function deleteRootIndex(
|
|
18
18
|
db: Db,
|
|
19
|
-
|
|
19
|
+
beaconBlockType: SSZTypesFor<ForkAll, "BeaconBlock">,
|
|
20
20
|
block: SignedBeaconBlock
|
|
21
21
|
): Promise<void> {
|
|
22
|
-
const beaconBlockType = (signedBeaconBlockType as typeof ssz.phase0.SignedBeaconBlock).fields.message;
|
|
23
22
|
return db.delete(getRootIndexKey(beaconBlockType.hashTreeRoot(block.message)), {bucketId: rootIndexBucketId});
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {Db, encodeKey} from "@lodestar/db";
|
|
2
|
+
import {Slot, ssz} from "@lodestar/types";
|
|
3
|
+
import {Bucket, getBucketNameByValue} from "../buckets.js";
|
|
4
|
+
|
|
5
|
+
export class EarliestAvailableSlotRepository {
|
|
6
|
+
private readonly key = encodeKey(Bucket.earliestAvailableSlot, 0);
|
|
7
|
+
private readonly opts = {bucketId: getBucketNameByValue(Bucket.earliestAvailableSlot)};
|
|
8
|
+
|
|
9
|
+
constructor(private readonly db: Db) {}
|
|
10
|
+
|
|
11
|
+
async get(): Promise<Slot | null> {
|
|
12
|
+
const bytes = await this.db.get(this.key, this.opts);
|
|
13
|
+
return bytes === null ? null : ssz.Slot.deserialize(bytes);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async set(slot: Slot): Promise<void> {
|
|
17
|
+
await this.db.put(this.key, ssz.Slot.serialize(slot), this.opts);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -18,6 +18,7 @@ export {BestLightClientUpdateRepository} from "./lightclientBestUpdate.js";
|
|
|
18
18
|
export {CheckpointHeaderRepository} from "./lightclientCheckpointHeader.js";
|
|
19
19
|
export {SyncCommitteeRepository} from "./lightclientSyncCommittee.js";
|
|
20
20
|
export {SyncCommitteeWitnessRepository} from "./lightclientSyncCommitteeWitness.js";
|
|
21
|
+
export {ProposerPreferencesRepository} from "./proposerPreferences.js";
|
|
21
22
|
export {ProposerSlashingRepository} from "./proposerSlashing.js";
|
|
22
23
|
export {StateArchiveRepository} from "./stateArchive.js";
|
|
23
24
|
export {VoluntaryExitRepository} from "./voluntaryExit.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
+
import {Db, Repository} from "@lodestar/db";
|
|
3
|
+
import {gloas, ssz} from "@lodestar/types";
|
|
4
|
+
import {intToBytes} from "@lodestar/utils";
|
|
5
|
+
import {Bucket, getBucketNameByValue} from "../buckets.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* SignedProposerPreferences indexed by proposal slot and dependent root
|
|
9
|
+
*
|
|
10
|
+
* Added via gossip or api
|
|
11
|
+
* Removed once the proposal slot has passed
|
|
12
|
+
*/
|
|
13
|
+
export class ProposerPreferencesRepository extends Repository<Uint8Array, gloas.SignedProposerPreferences> {
|
|
14
|
+
constructor(config: ChainForkConfig, db: Db) {
|
|
15
|
+
const bucket = Bucket.gloas_proposerPreferences;
|
|
16
|
+
super(config, db, bucket, ssz.gloas.SignedProposerPreferences, getBucketNameByValue(bucket));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getId(value: gloas.SignedProposerPreferences): Uint8Array {
|
|
20
|
+
const {proposalSlot, dependentRoot} = value.message;
|
|
21
|
+
return Buffer.concat([intToBytes(proposalSlot, 8, "be"), dependentRoot]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {byteArrayEquals} from "@lodestar/utils";
|
|
2
|
+
import {VersionedHashes} from "./interface.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Preserve Deneb's is_valid_versioned_hashes check when the REST envelope omits expected hashes.
|
|
6
|
+
* EIP-4844 encodes blob_versioned_hashes at index 10 of the signed type-3 transaction's RLP list.
|
|
7
|
+
* Skip unrelated fields without decoding or copying them, including untrusted nested access lists.
|
|
8
|
+
* The EL remains responsible for the other transaction validity checks.
|
|
9
|
+
*/
|
|
10
|
+
export function isValidBlobVersionedHashes(transactions: Uint8Array[], expected: VersionedHashes): boolean {
|
|
11
|
+
let index = 0;
|
|
12
|
+
for (const transaction of transactions) {
|
|
13
|
+
if (transaction.length === 0) return false;
|
|
14
|
+
if (transaction[0] !== 0x03) continue;
|
|
15
|
+
|
|
16
|
+
const outer = readRlpItem(transaction, 1, transaction.length);
|
|
17
|
+
if (!outer?.isList || outer.end !== transaction.length) return false;
|
|
18
|
+
|
|
19
|
+
let offset = outer.start;
|
|
20
|
+
for (let fieldIndex = 0; fieldIndex < 14; fieldIndex++) {
|
|
21
|
+
const field = readRlpItem(transaction, offset, outer.end);
|
|
22
|
+
if (field === null) return false;
|
|
23
|
+
if (fieldIndex === 10) {
|
|
24
|
+
if (!field.isList) return false;
|
|
25
|
+
// A canonical RLP-encoded Bytes32 is exactly the 0xa0 prefix followed by 32 bytes.
|
|
26
|
+
const count = (field.end - field.start) / 33;
|
|
27
|
+
if (!Number.isInteger(count) || index + count > expected.length) return false;
|
|
28
|
+
for (let hashOffset = field.start; hashOffset < field.end; hashOffset += 33) {
|
|
29
|
+
if (
|
|
30
|
+
transaction[hashOffset] !== 0xa0 ||
|
|
31
|
+
!byteArrayEquals(transaction.subarray(hashOffset + 1, hashOffset + 33), expected[index])
|
|
32
|
+
) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
index++;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
offset = field.end;
|
|
39
|
+
}
|
|
40
|
+
if (offset !== outer.end) return false;
|
|
41
|
+
}
|
|
42
|
+
return index === expected.length;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Read one RLP item's boundaries without descending into lists. */
|
|
46
|
+
function readRlpItem(
|
|
47
|
+
bytes: Uint8Array,
|
|
48
|
+
offset: number,
|
|
49
|
+
limit: number
|
|
50
|
+
): {start: number; end: number; isList: boolean} | null {
|
|
51
|
+
if (offset >= limit) return null;
|
|
52
|
+
const prefix = bytes[offset];
|
|
53
|
+
if (prefix < 0x80) return {start: offset, end: offset + 1, isList: false};
|
|
54
|
+
|
|
55
|
+
const isList = prefix >= 0xc0;
|
|
56
|
+
const lengthCode = prefix - (isList ? 0xc0 : 0x80);
|
|
57
|
+
let start = offset + 1;
|
|
58
|
+
let length = lengthCode;
|
|
59
|
+
if (lengthCode > 55) {
|
|
60
|
+
const lengthBytes = lengthCode - 55;
|
|
61
|
+
start += lengthBytes;
|
|
62
|
+
if (start > limit || bytes[offset + 1] === 0) return null;
|
|
63
|
+
length = 0;
|
|
64
|
+
for (let i = offset + 1; i < start; i++) {
|
|
65
|
+
length = length * 256 + bytes[i];
|
|
66
|
+
}
|
|
67
|
+
if (length <= 55) return null;
|
|
68
|
+
}
|
|
69
|
+
if (length > limit - start) return null;
|
|
70
|
+
if (!isList && length === 1 && bytes[start] < 0x80) return null;
|
|
71
|
+
return {start, end: start + length, isList};
|
|
72
|
+
}
|
|
@@ -21,18 +21,10 @@ export class ExecutionEngineDisabled implements IExecutionEngine {
|
|
|
21
21
|
throw Error("Execution engine disabled");
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
getPayloadBodiesByHash(): Promise<never> {
|
|
25
|
-
throw Error("Execution engine disabled");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
24
|
getPayloadBodiesByHashV2(): Promise<never> {
|
|
29
25
|
throw Error("Execution engine disabled");
|
|
30
26
|
}
|
|
31
27
|
|
|
32
|
-
getPayloadBodiesByRange(): Promise<never> {
|
|
33
|
-
throw Error("Execution engine disabled");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
28
|
getBlobs(): Promise<never> {
|
|
37
29
|
throw Error("Execution engine disabled");
|
|
38
30
|
}
|