@lodestar/beacon-node 1.41.0-dev.702f7932c2 → 1.41.0-dev.96f78af84b
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 +121 -3
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.js +8 -8
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/beacon/state/utils.d.ts +3 -4
- package/lib/api/impl/beacon/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +5 -24
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/api/impl/debug/index.d.ts.map +1 -1
- package/lib/api/impl/debug/index.js +5 -2
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/lightclient/index.d.ts.map +1 -1
- package/lib/api/impl/lightclient/index.js +19 -2
- package/lib/api/impl/lightclient/index.js.map +1 -1
- package/lib/api/impl/node/utils.d.ts +1 -1
- package/lib/api/impl/node/utils.d.ts.map +1 -1
- package/lib/api/impl/node/utils.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +104 -6
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +1 -0
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +9 -0
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +5 -6
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +9 -10
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +3 -3
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/utils/archivePayloads.d.ts +7 -0
- package/lib/chain/archiveStore/utils/archivePayloads.d.ts.map +1 -0
- package/lib/chain/archiveStore/utils/archivePayloads.js +10 -0
- package/lib/chain/archiveStore/utils/archivePayloads.js.map +1 -0
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +0 -2
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +2 -1
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +3 -0
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/bls/multithread/index.d.ts +3 -3
- package/lib/chain/bls/multithread/index.d.ts.map +1 -1
- package/lib/chain/bls/multithread/index.js +5 -5
- package/lib/chain/bls/multithread/index.js.map +1 -1
- package/lib/chain/bls/multithread/jobItem.d.ts +2 -2
- package/lib/chain/bls/multithread/jobItem.d.ts.map +1 -1
- package/lib/chain/bls/multithread/jobItem.js +2 -2
- package/lib/chain/bls/multithread/jobItem.js.map +1 -1
- package/lib/chain/bls/singleThread.d.ts +4 -4
- package/lib/chain/bls/singleThread.d.ts.map +1 -1
- package/lib/chain/bls/singleThread.js +4 -4
- package/lib/chain/bls/singleThread.js.map +1 -1
- package/lib/chain/bls/utils.d.ts +2 -2
- package/lib/chain/bls/utils.d.ts.map +1 -1
- package/lib/chain/bls/utils.js +7 -4
- package/lib/chain/bls/utils.js.map +1 -1
- package/lib/chain/chain.d.ts +6 -9
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +32 -16
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +2 -2
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/errors/blockError.d.ts +7 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +2 -0
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/interface.d.ts +4 -6
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +1 -1
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/prepareNextSlot.js +3 -3
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts +10 -2
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +24 -2
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +22 -7
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +110 -10
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/attestation.d.ts.map +1 -1
- package/lib/chain/validation/attestation.js +4 -1
- package/lib/chain/validation/attestation.js.map +1 -1
- package/lib/chain/validation/attesterSlashing.js +1 -1
- package/lib/chain/validation/attesterSlashing.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +27 -3
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts +2 -2
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +2 -1
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +8 -1
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/proposerSlashing.js +1 -1
- package/lib/chain/validation/proposerSlashing.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +1 -1
- package/lib/constants/network.d.ts +2 -1
- package/lib/constants/network.d.ts.map +1 -1
- package/lib/constants/network.js +1 -0
- package/lib/constants/network.js.map +1 -1
- package/lib/db/beacon.d.ts +3 -1
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +5 -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 +3 -1
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.js +1 -2
- package/lib/db/repositories/blockArchive.js.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +2 -2
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecar.d.ts +5 -3
- package/lib/db/repositories/dataColumnSidecar.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecar.js +14 -1
- package/lib/db/repositories/dataColumnSidecar.js.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts +5 -3
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js +14 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
- package/lib/db/repositories/executionPayloadEnvelope.d.ts +19 -0
- package/lib/db/repositories/executionPayloadEnvelope.d.ts.map +1 -0
- package/lib/db/repositories/executionPayloadEnvelope.js +22 -0
- package/lib/db/repositories/executionPayloadEnvelope.js.map +1 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts +18 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.d.ts.map +1 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js +28 -0
- package/lib/db/repositories/executionPayloadEnvelopeArchive.js.map +1 -0
- package/lib/db/repositories/index.d.ts +2 -0
- package/lib/db/repositories/index.d.ts.map +1 -1
- package/lib/db/repositories/index.js +2 -0
- package/lib/db/repositories/index.js.map +1 -1
- package/lib/execution/engine/http.d.ts +1 -0
- package/lib/execution/engine/http.d.ts.map +1 -1
- package/lib/execution/engine/http.js +3 -0
- package/lib/execution/engine/http.js.map +1 -1
- package/lib/metrics/metrics/beacon.d.ts +1 -0
- package/lib/metrics/metrics/beacon.d.ts.map +1 -1
- package/lib/metrics/metrics/beacon.js +5 -0
- package/lib/metrics/metrics/beacon.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +8 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +14 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/metrics/metrics.d.ts.map +1 -1
- package/lib/metrics/metrics.js +8 -3
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/monitoring/service.d.ts +2 -2
- package/lib/monitoring/service.d.ts.map +1 -1
- package/lib/monitoring/service.js +3 -2
- package/lib/monitoring/service.js.map +1 -1
- package/lib/network/core/networkCore.d.ts +3 -3
- package/lib/network/core/networkCore.d.ts.map +1 -1
- package/lib/network/core/networkCore.js.map +1 -1
- package/lib/network/core/networkCoreWorkerHandler.d.ts +3 -3
- package/lib/network/core/networkCoreWorkerHandler.d.ts.map +1 -1
- package/lib/network/core/types.d.ts +2 -2
- package/lib/network/core/types.d.ts.map +1 -1
- package/lib/network/events.d.ts +2 -1
- package/lib/network/events.d.ts.map +1 -1
- package/lib/network/events.js.map +1 -1
- package/lib/network/gossip/encoding.d.ts +3 -3
- package/lib/network/gossip/encoding.d.ts.map +1 -1
- package/lib/network/gossip/encoding.js.map +1 -1
- package/lib/network/gossip/gossipsub.d.ts +13 -4
- package/lib/network/gossip/gossipsub.d.ts.map +1 -1
- package/lib/network/gossip/gossipsub.js +47 -20
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/gossip/interface.d.ts +6 -6
- package/lib/network/gossip/interface.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.d.ts +1 -1
- package/lib/network/gossip/scoringParameters.d.ts.map +1 -1
- package/lib/network/gossip/scoringParameters.js +1 -1
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +114 -65
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +2 -2
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/interface.d.ts +6 -5
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/libp2p/index.d.ts +1 -1
- package/lib/network/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +7 -2
- package/lib/network/libp2p/index.js.map +1 -1
- package/lib/network/network.d.ts +5 -4
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +10 -1
- package/lib/network/network.js.map +1 -1
- package/lib/network/options.d.ts.map +1 -1
- package/lib/network/options.js +3 -0
- package/lib/network/options.js.map +1 -1
- package/lib/network/peers/datastore.d.ts +7 -5
- package/lib/network/peers/datastore.d.ts.map +1 -1
- package/lib/network/peers/datastore.js +10 -10
- package/lib/network/peers/datastore.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts +11 -0
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +148 -53
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/peers/utils/prioritizePeers.d.ts +3 -3
- package/lib/network/peers/utils/prioritizePeers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +5 -1
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js +1 -1
- package/lib/network/processor/types.d.ts +1 -1
- package/lib/network/processor/types.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js +7 -1
- package/lib/network/reqresp/handlers/lightClientUpdatesByRange.js.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +0 -1
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/network/util.js +2 -2
- package/lib/network/util.js.map +1 -1
- package/lib/node/nodejs.d.ts +3 -5
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +6 -4
- package/lib/node/nodejs.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +3 -9
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +4 -4
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/util/blobs.d.ts +2 -2
- package/lib/util/blobs.d.ts.map +1 -1
- package/lib/util/blobs.js.map +1 -1
- package/lib/util/dataColumns.d.ts +15 -2
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +40 -5
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/multifork.d.ts +8 -0
- package/lib/util/multifork.d.ts.map +1 -1
- package/lib/util/multifork.js +37 -0
- package/lib/util/multifork.js.map +1 -1
- package/lib/util/serializedCache.d.ts +5 -0
- package/lib/util/serializedCache.d.ts.map +1 -1
- package/lib/util/serializedCache.js +5 -0
- package/lib/util/serializedCache.js.map +1 -1
- package/package.json +38 -41
- package/src/api/impl/beacon/blocks/index.ts +145 -2
- package/src/api/impl/beacon/state/index.ts +8 -8
- package/src/api/impl/beacon/state/utils.ts +15 -29
- package/src/api/impl/debug/index.ts +8 -5
- package/src/api/impl/lightclient/index.ts +19 -2
- package/src/api/impl/node/utils.ts +3 -3
- package/src/api/impl/validator/index.ts +127 -5
- package/src/chain/archiveStore/archiveStore.ts +10 -0
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +10 -11
- package/src/chain/archiveStore/historicalState/worker.ts +3 -3
- package/src/chain/archiveStore/utils/archivePayloads.ts +15 -0
- package/src/chain/blocks/importBlock.ts +0 -3
- package/src/chain/blocks/index.ts +2 -1
- package/src/chain/blocks/writeBlockInputToDb.ts +3 -0
- package/src/chain/bls/multithread/index.ts +7 -7
- package/src/chain/bls/multithread/jobItem.ts +3 -3
- package/src/chain/bls/singleThread.ts +5 -5
- package/src/chain/bls/utils.ts +8 -5
- package/src/chain/chain.ts +51 -26
- package/src/chain/emitter.ts +2 -2
- package/src/chain/errors/blockError.ts +4 -1
- package/src/chain/interface.ts +4 -11
- package/src/chain/lightClient/index.ts +4 -1
- package/src/chain/options.ts +1 -0
- package/src/chain/prepareNextSlot.ts +5 -5
- package/src/chain/produceBlock/computeNewStateRoot.ts +35 -3
- package/src/chain/produceBlock/produceBlockBody.ts +163 -13
- package/src/chain/validation/attestation.ts +4 -1
- package/src/chain/validation/attesterSlashing.ts +1 -1
- package/src/chain/validation/block.ts +32 -4
- package/src/chain/validation/dataColumnSidecar.ts +2 -5
- package/src/chain/validation/executionPayloadEnvelope.ts +2 -1
- package/src/chain/validation/payloadAttestationMessage.ts +10 -2
- package/src/chain/validation/proposerSlashing.ts +1 -1
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +1 -1
- package/src/constants/network.ts +1 -0
- package/src/db/beacon.ts +8 -0
- package/src/db/buckets.ts +3 -0
- package/src/db/interface.ts +5 -0
- package/src/db/repositories/blockArchive.ts +1 -2
- package/src/db/repositories/dataColumnSidecar.ts +18 -3
- package/src/db/repositories/dataColumnSidecarArchive.ts +18 -3
- package/src/db/repositories/executionPayloadEnvelope.ts +26 -0
- package/src/db/repositories/executionPayloadEnvelopeArchive.ts +32 -0
- package/src/db/repositories/index.ts +2 -0
- package/src/execution/engine/http.ts +3 -0
- package/src/metrics/metrics/beacon.ts +5 -0
- package/src/metrics/metrics/lodestar.ts +14 -0
- package/src/metrics/metrics.ts +8 -3
- package/src/monitoring/service.ts +3 -2
- package/src/network/core/networkCore.ts +3 -3
- package/src/network/core/networkCoreWorkerHandler.ts +3 -3
- package/src/network/core/types.ts +2 -2
- package/src/network/events.ts +2 -1
- package/src/network/gossip/encoding.ts +3 -3
- package/src/network/gossip/gossipsub.ts +86 -25
- package/src/network/gossip/interface.ts +6 -6
- package/src/network/gossip/scoringParameters.ts +4 -4
- package/src/network/gossip/topic.ts +2 -1
- package/src/network/interface.ts +7 -4
- package/src/network/libp2p/index.ts +8 -3
- package/src/network/network.ts +24 -6
- package/src/network/options.ts +3 -0
- package/src/network/peers/datastore.ts +13 -10
- package/src/network/peers/peerManager.ts +175 -54
- package/src/network/peers/utils/prioritizePeers.ts +3 -3
- package/src/network/processor/gossipHandlers.ts +7 -1
- package/src/network/processor/gossipValidatorFn.ts +1 -1
- package/src/network/processor/types.ts +1 -1
- package/src/network/reqresp/handlers/lightClientUpdatesByRange.ts +6 -1
- package/src/network/reqresp/score.ts +0 -1
- package/src/network/util.ts +2 -2
- package/src/node/nodejs.ts +8 -9
- package/src/sync/utils/downloadByRange.ts +3 -15
- package/src/sync/utils/downloadByRoot.ts +5 -11
- package/src/util/blobs.ts +3 -3
- package/src/util/dataColumns.ts +54 -5
- package/src/util/multifork.ts +45 -0
- package/src/util/serializedCache.ts +5 -0
- package/src/util/workerEvents.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializedCache.js","sourceRoot":"","sources":["../../src/util/serializedCache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAC1B,GAAG,GAAgC,IAAI,OAAO,EAAE,CAAC;IAEjD,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,UAAsB;QACrC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAChC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"serializedCache.js","sourceRoot":"","sources":["../../src/util/serializedCache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAC1B,GAAG,GAAgC,IAAI,OAAO,EAAE,CAAC;IAEjD,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,UAAsB;QACrC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,IAAI,CAAC,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.41.0-dev.
|
|
14
|
+
"version": "1.41.0-dev.96f78af84b",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -110,10 +110,9 @@
|
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@chainsafe/as-sha256": "^1.2.0",
|
|
112
112
|
"@chainsafe/blst": "^2.2.0",
|
|
113
|
-
"@chainsafe/discv5": "^
|
|
114
|
-
"@chainsafe/enr": "^
|
|
115
|
-
"@chainsafe/libp2p-
|
|
116
|
-
"@chainsafe/libp2p-noise": "^16.1.5",
|
|
113
|
+
"@chainsafe/discv5": "^12.0.0",
|
|
114
|
+
"@chainsafe/enr": "^6.0.0",
|
|
115
|
+
"@chainsafe/libp2p-noise": "^17.0.0",
|
|
117
116
|
"@chainsafe/persistent-merkle-tree": "^1.2.1",
|
|
118
117
|
"@chainsafe/prometheus-gc-stats": "^1.0.0",
|
|
119
118
|
"@chainsafe/pubkey-index-map": "^3.0.0",
|
|
@@ -125,39 +124,38 @@
|
|
|
125
124
|
"@fastify/cors": "^10.0.1",
|
|
126
125
|
"@fastify/swagger": "^9.0.0",
|
|
127
126
|
"@fastify/swagger-ui": "^5.0.1",
|
|
128
|
-
"@libp2p/bootstrap": "^
|
|
129
|
-
"@libp2p/crypto": "^5.
|
|
130
|
-
"@libp2p/
|
|
131
|
-
"@libp2p/
|
|
132
|
-
"@libp2p/
|
|
133
|
-
"@libp2p/
|
|
134
|
-
"@libp2p/
|
|
135
|
-
"@libp2p/
|
|
136
|
-
"@libp2p/
|
|
137
|
-
"@
|
|
138
|
-
"@lodestar/
|
|
139
|
-
"@lodestar/
|
|
140
|
-
"@lodestar/
|
|
141
|
-
"@lodestar/
|
|
142
|
-
"@lodestar/
|
|
143
|
-
"@lodestar/
|
|
144
|
-
"@lodestar/
|
|
145
|
-
"@lodestar/
|
|
146
|
-
"@lodestar/
|
|
147
|
-
"@lodestar/
|
|
148
|
-
"@lodestar/
|
|
149
|
-
"@
|
|
150
|
-
"
|
|
151
|
-
"datastore-
|
|
152
|
-
"datastore-
|
|
127
|
+
"@libp2p/bootstrap": "^12.0.11",
|
|
128
|
+
"@libp2p/crypto": "^5.1.13",
|
|
129
|
+
"@libp2p/gossipsub": "^15.0.12",
|
|
130
|
+
"@libp2p/identify": "^4.0.10",
|
|
131
|
+
"@libp2p/interface": "^3.1.0",
|
|
132
|
+
"@libp2p/mdns": "^12.0.11",
|
|
133
|
+
"@libp2p/mplex": "^12.0.11",
|
|
134
|
+
"@libp2p/peer-id": "^6.0.4",
|
|
135
|
+
"@libp2p/prometheus-metrics": "^5.0.10",
|
|
136
|
+
"@libp2p/tcp": "^11.0.10",
|
|
137
|
+
"@lodestar/api": "^1.41.0-dev.96f78af84b",
|
|
138
|
+
"@lodestar/config": "^1.41.0-dev.96f78af84b",
|
|
139
|
+
"@lodestar/db": "^1.41.0-dev.96f78af84b",
|
|
140
|
+
"@lodestar/fork-choice": "^1.41.0-dev.96f78af84b",
|
|
141
|
+
"@lodestar/light-client": "^1.41.0-dev.96f78af84b",
|
|
142
|
+
"@lodestar/logger": "^1.41.0-dev.96f78af84b",
|
|
143
|
+
"@lodestar/params": "^1.41.0-dev.96f78af84b",
|
|
144
|
+
"@lodestar/reqresp": "^1.41.0-dev.96f78af84b",
|
|
145
|
+
"@lodestar/state-transition": "^1.41.0-dev.96f78af84b",
|
|
146
|
+
"@lodestar/types": "^1.41.0-dev.96f78af84b",
|
|
147
|
+
"@lodestar/utils": "^1.41.0-dev.96f78af84b",
|
|
148
|
+
"@lodestar/validator": "^1.41.0-dev.96f78af84b",
|
|
149
|
+
"@multiformats/multiaddr": "^13.0.1",
|
|
150
|
+
"datastore-core": "^11.0.2",
|
|
151
|
+
"datastore-fs": "^11.0.2",
|
|
152
|
+
"datastore-level": "^12.0.2",
|
|
153
153
|
"deepmerge": "^4.3.1",
|
|
154
154
|
"fastify": "^5.7.4",
|
|
155
|
-
"interface-datastore": "^
|
|
156
|
-
"it-all": "^3.0.4",
|
|
157
|
-
"it-pipe": "^3.0.1",
|
|
155
|
+
"interface-datastore": "^9.0.2",
|
|
158
156
|
"jwt-simple": "0.5.6",
|
|
159
|
-
"libp2p": "
|
|
160
|
-
"multiformats": "^
|
|
157
|
+
"libp2p": "3.1.3",
|
|
158
|
+
"multiformats": "^13.4.2",
|
|
161
159
|
"prom-client": "^15.1.0",
|
|
162
160
|
"qs": "^6.11.1",
|
|
163
161
|
"strict-event-emitter-types": "^2.0.0",
|
|
@@ -167,14 +165,13 @@
|
|
|
167
165
|
},
|
|
168
166
|
"devDependencies": {
|
|
169
167
|
"@chainsafe/swap-or-not-shuffle": "^1.2.1",
|
|
170
|
-
"@libp2p/interface-internal": "^
|
|
171
|
-
"@libp2p/logger": "^
|
|
172
|
-
"@
|
|
168
|
+
"@libp2p/interface-internal": "^3.0.10",
|
|
169
|
+
"@libp2p/logger": "^6.2.2",
|
|
170
|
+
"@libp2p/utils": "^7.0.10",
|
|
171
|
+
"@lodestar/spec-test-util": "^1.41.0-dev.96f78af84b",
|
|
173
172
|
"@types/js-yaml": "^4.0.5",
|
|
174
173
|
"@types/qs": "^6.9.7",
|
|
175
174
|
"@types/tmp": "^0.2.3",
|
|
176
|
-
"it-drain": "^3.0.3",
|
|
177
|
-
"it-pair": "^2.0.6",
|
|
178
175
|
"js-yaml": "^4.1.0",
|
|
179
176
|
"rewiremock": "^3.14.5",
|
|
180
177
|
"rimraf": "^4.4.1",
|
|
@@ -188,5 +185,5 @@
|
|
|
188
185
|
"beacon",
|
|
189
186
|
"blockchain"
|
|
190
187
|
],
|
|
191
|
-
"gitHead": "
|
|
188
|
+
"gitHead": "dcfa128a0a200089e3202b92999624bfb8a7fa41"
|
|
192
189
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ApiError, ApplicationMethods} from "@lodestar/api/server";
|
|
3
3
|
import {
|
|
4
|
+
BUILDER_INDEX_SELF_BUILD,
|
|
4
5
|
ForkPostBellatrix,
|
|
5
6
|
ForkPostFulu,
|
|
6
7
|
ForkPreGloas,
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
WithOptionalBytes,
|
|
28
29
|
deneb,
|
|
29
30
|
fulu,
|
|
31
|
+
gloas,
|
|
30
32
|
isDenebBlockContents,
|
|
31
33
|
sszTypesFor,
|
|
32
34
|
} from "@lodestar/types";
|
|
@@ -42,6 +44,7 @@ import {
|
|
|
42
44
|
ProduceFullBellatrix,
|
|
43
45
|
ProduceFullDeneb,
|
|
44
46
|
ProduceFullFulu,
|
|
47
|
+
ProduceFullGloas,
|
|
45
48
|
} from "../../../../chain/produceBlock/index.js";
|
|
46
49
|
import {validateGossipBlock} from "../../../../chain/validation/block.js";
|
|
47
50
|
import {OpSource} from "../../../../chain/validatorMonitor.js";
|
|
@@ -51,7 +54,7 @@ import {
|
|
|
51
54
|
kzgCommitmentToVersionedHash,
|
|
52
55
|
reconstructBlobs,
|
|
53
56
|
} from "../../../../util/blobs.js";
|
|
54
|
-
import {getDataColumnSidecarsFromBlock} from "../../../../util/dataColumns.js";
|
|
57
|
+
import {getDataColumnSidecarsForGloas, getDataColumnSidecarsFromBlock} from "../../../../util/dataColumns.js";
|
|
55
58
|
import {isOptimisticBlock} from "../../../../util/forkChoice.js";
|
|
56
59
|
import {kzg} from "../../../../util/kzg.js";
|
|
57
60
|
import {promiseAllMaybeAsync} from "../../../../util/promises.js";
|
|
@@ -93,6 +96,7 @@ export function getBeaconBlockApi({
|
|
|
93
96
|
const fork = config.getForkName(slot);
|
|
94
97
|
const blockRoot = toRootHex(chain.config.getForkTypes(slot).BeaconBlock.hashTreeRoot(signedBlock.message));
|
|
95
98
|
|
|
99
|
+
// TODO GLOAS: handle new BlockInput type
|
|
96
100
|
const blockForImport = chain.seenBlockInputCache.getByBlock({
|
|
97
101
|
block: signedBlock,
|
|
98
102
|
source: BlockInputSource.api,
|
|
@@ -309,7 +313,9 @@ export function getBeaconBlockApi({
|
|
|
309
313
|
];
|
|
310
314
|
const sentPeersArr = await promiseAllMaybeAsync<number | void>(publishPromises);
|
|
311
315
|
|
|
312
|
-
if (
|
|
316
|
+
if (isForkPostGloas(fork)) {
|
|
317
|
+
// After gloas, data columns are not published with the block but when publishing the execution payload envelope
|
|
318
|
+
} else if (isForkPostFulu(fork)) {
|
|
313
319
|
let columnsPublishedWithZeroPeers = 0;
|
|
314
320
|
// sent peers per topic are logged in network.publishGossip(), here we only track metrics for it
|
|
315
321
|
// starting from fulu, we have to push to 128 subnets so need to make sure we have enough sent peers per topic
|
|
@@ -632,6 +638,143 @@ export function getBeaconBlockApi({
|
|
|
632
638
|
await publishBlock(args, context, opts);
|
|
633
639
|
},
|
|
634
640
|
|
|
641
|
+
async publishExecutionPayloadEnvelope({signedExecutionPayloadEnvelope}) {
|
|
642
|
+
const seenTimestampSec = Date.now() / 1000;
|
|
643
|
+
const envelope = signedExecutionPayloadEnvelope.message;
|
|
644
|
+
const slot = envelope.slot;
|
|
645
|
+
const fork = config.getForkName(slot);
|
|
646
|
+
const blockRootHex = toRootHex(envelope.beaconBlockRoot);
|
|
647
|
+
|
|
648
|
+
if (!isForkPostGloas(fork)) {
|
|
649
|
+
throw new ApiError(400, `publishExecutionPayloadEnvelope not supported for pre-gloas fork=${fork}`);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// TODO GLOAS: review checks, do we want to implement `broadcast_validation`?
|
|
653
|
+
const block = chain.forkChoice.getBlockHex(blockRootHex);
|
|
654
|
+
if (block === null) {
|
|
655
|
+
throw new ApiError(404, `Block not found for beacon block root ${blockRootHex}`);
|
|
656
|
+
}
|
|
657
|
+
if (block.slot !== slot) {
|
|
658
|
+
throw new ApiError(400, `Envelope slot ${slot} does not match block slot ${block.slot}`);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
const isSelfBuild = envelope.builderIndex === BUILDER_INDEX_SELF_BUILD;
|
|
662
|
+
let dataColumnSidecars: gloas.DataColumnSidecars = [];
|
|
663
|
+
|
|
664
|
+
if (isSelfBuild) {
|
|
665
|
+
// For self-builds, construct and publish data column sidecars from cached block production data
|
|
666
|
+
const cachedResult = chain.blockProductionCache.get(blockRootHex) as ProduceFullGloas | undefined;
|
|
667
|
+
if (cachedResult === undefined) {
|
|
668
|
+
throw new ApiError(404, `No cached block production result found for block root ${blockRootHex}`);
|
|
669
|
+
}
|
|
670
|
+
if (!isForkPostGloas(cachedResult.fork)) {
|
|
671
|
+
throw new ApiError(400, `Cached block production result is for pre-gloas fork=${cachedResult.fork}`);
|
|
672
|
+
}
|
|
673
|
+
if (cachedResult.type !== BlockType.Full) {
|
|
674
|
+
throw new ApiError(400, "Cached block production result is not full block");
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
if (cachedResult.cells && cachedResult.blobsBundle.commitments.length > 0) {
|
|
678
|
+
const cellsAndProofs = cachedResult.cells.map((rowCells, rowIndex) => ({
|
|
679
|
+
cells: rowCells,
|
|
680
|
+
proofs: cachedResult.blobsBundle.proofs.slice(
|
|
681
|
+
rowIndex * NUMBER_OF_COLUMNS,
|
|
682
|
+
(rowIndex + 1) * NUMBER_OF_COLUMNS
|
|
683
|
+
),
|
|
684
|
+
}));
|
|
685
|
+
|
|
686
|
+
dataColumnSidecars = getDataColumnSidecarsForGloas(slot, envelope.beaconBlockRoot, cellsAndProofs);
|
|
687
|
+
}
|
|
688
|
+
} else {
|
|
689
|
+
// TODO GLOAS: will this api be used by builders or only for self-building?
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// TODO GLOAS: Verify execution payload envelope signature
|
|
693
|
+
// For self-builds, the proposer signs with their own validator key
|
|
694
|
+
// For external builders, verify using the builder's registered pubkey
|
|
695
|
+
// Use verify_execution_payload_envelope_signature(state, signed_envelope)
|
|
696
|
+
|
|
697
|
+
// TODO GLOAS: Process execution payload via state transition
|
|
698
|
+
// Call process_execution_payload(state, signed_envelope, execution_engine)
|
|
699
|
+
|
|
700
|
+
// TODO GLOAS: Update fork choice with the execution payload
|
|
701
|
+
// Call on_execution_payload(store, signed_envelope) to update fork choice state
|
|
702
|
+
|
|
703
|
+
// TODO GLOAS: Add envelope and data columns to block input via seenBlockInputCache
|
|
704
|
+
// and trigger block import (Gloas block import requires both beacon block and envelope)
|
|
705
|
+
|
|
706
|
+
const valLogMeta = {
|
|
707
|
+
slot,
|
|
708
|
+
blockRoot: blockRootHex,
|
|
709
|
+
builderIndex: envelope.builderIndex,
|
|
710
|
+
isSelfBuild,
|
|
711
|
+
dataColumns: dataColumnSidecars.length,
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
// If called near a slot boundary (e.g. late in slot N-1), hold briefly so gossip aligns with slot N.
|
|
715
|
+
const msToBlockSlot = computeTimeAtSlot(config, slot, chain.genesisTime) * 1000 - Date.now();
|
|
716
|
+
if (msToBlockSlot <= MAX_API_CLOCK_DISPARITY_MS && msToBlockSlot > 0) {
|
|
717
|
+
await sleep(msToBlockSlot);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
|
|
721
|
+
metrics?.gossipExecutionPayloadEnvelope.elapsedTimeTillReceived.observe({source: OpSource.api}, delaySec);
|
|
722
|
+
|
|
723
|
+
chain.logger.info("Publishing execution payload envelope", valLogMeta);
|
|
724
|
+
|
|
725
|
+
// Publish envelope and data columns
|
|
726
|
+
const publishPromises = [
|
|
727
|
+
// Gossip the signed execution payload envelope first
|
|
728
|
+
() => network.publishSignedExecutionPayloadEnvelope(signedExecutionPayloadEnvelope),
|
|
729
|
+
// For self-builds, publish all data column sidecars
|
|
730
|
+
...dataColumnSidecars.map((dataColumnSidecar) => () => network.publishDataColumnSidecar(dataColumnSidecar)),
|
|
731
|
+
];
|
|
732
|
+
|
|
733
|
+
const sentPeersArr = await promiseAllMaybeAsync<number | void>(publishPromises);
|
|
734
|
+
|
|
735
|
+
// Track metrics for data column publishing
|
|
736
|
+
if (dataColumnSidecars.length > 0) {
|
|
737
|
+
let columnsPublishedWithZeroPeers = 0;
|
|
738
|
+
// Skip first entry (envelope), track data columns
|
|
739
|
+
for (let i = 1; i < sentPeersArr.length; i++) {
|
|
740
|
+
const sentPeers = sentPeersArr[i] as number;
|
|
741
|
+
metrics?.dataColumns.sentPeersPerSubnet.observe(sentPeers);
|
|
742
|
+
if (sentPeers === 0) {
|
|
743
|
+
columnsPublishedWithZeroPeers++;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
if (columnsPublishedWithZeroPeers > 0) {
|
|
747
|
+
chain.logger.warn("Published data columns to 0 peers, increased risk of reorg", {
|
|
748
|
+
slot,
|
|
749
|
+
blockRoot: blockRootHex,
|
|
750
|
+
columns: columnsPublishedWithZeroPeers,
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
metrics?.dataColumns.bySource.inc({source: BlockInputSource.api}, dataColumnSidecars.length);
|
|
755
|
+
|
|
756
|
+
if (chain.emitter.listenerCount(routes.events.EventType.dataColumnSidecar)) {
|
|
757
|
+
// TODO GLOAS: revisit this, we likely don't wanna emit KZG commitments anymore
|
|
758
|
+
const cachedResult = chain.blockProductionCache.get(blockRootHex) as ProduceFullGloas | undefined;
|
|
759
|
+
const kzgCommitments = cachedResult?.blobsBundle.commitments.map(toHex) ?? [];
|
|
760
|
+
for (const dataColumnSidecar of dataColumnSidecars) {
|
|
761
|
+
chain.emitter.emit(routes.events.EventType.dataColumnSidecar, {
|
|
762
|
+
blockRoot: blockRootHex,
|
|
763
|
+
slot,
|
|
764
|
+
index: dataColumnSidecar.index,
|
|
765
|
+
kzgCommitments,
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
chain.logger.info("Published execution payload envelope", {
|
|
772
|
+
...valLogMeta,
|
|
773
|
+
delaySec,
|
|
774
|
+
sentPeers: (sentPeersArr[0] as number) ?? 0,
|
|
775
|
+
});
|
|
776
|
+
},
|
|
777
|
+
|
|
635
778
|
async getBlobSidecars({blockId, indices}) {
|
|
636
779
|
assertUniqueItems(indices, "Duplicate indices provided");
|
|
637
780
|
|
|
@@ -95,14 +95,14 @@ export function getBeaconStateApi({
|
|
|
95
95
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
96
96
|
const currentEpoch = getCurrentEpoch(state);
|
|
97
97
|
const {validators, balances} = state; // Get the validators sub tree once for all the loop
|
|
98
|
-
const {
|
|
98
|
+
const {pubkeyCache} = chain;
|
|
99
99
|
|
|
100
100
|
const validatorResponses: routes.beacon.ValidatorResponse[] = [];
|
|
101
101
|
if (validatorIds.length) {
|
|
102
102
|
assertUniqueItems(validatorIds, "Duplicate validator IDs provided");
|
|
103
103
|
|
|
104
104
|
for (const id of validatorIds) {
|
|
105
|
-
const resp = getStateValidatorIndex(id, state,
|
|
105
|
+
const resp = getStateValidatorIndex(id, state, pubkeyCache);
|
|
106
106
|
if (resp.valid) {
|
|
107
107
|
const validatorIndex = resp.validatorIndex;
|
|
108
108
|
const validator = validators.getReadonly(validatorIndex);
|
|
@@ -127,7 +127,7 @@ export function getBeaconStateApi({
|
|
|
127
127
|
if (statuses.length) {
|
|
128
128
|
assertUniqueItems(statuses, "Duplicate statuses provided");
|
|
129
129
|
|
|
130
|
-
const validatorsByStatus = filterStateValidatorsByStatus(statuses, state,
|
|
130
|
+
const validatorsByStatus = filterStateValidatorsByStatus(statuses, state, pubkeyCache, currentEpoch);
|
|
131
131
|
return {
|
|
132
132
|
data: validatorsByStatus,
|
|
133
133
|
meta: {executionOptimistic, finalized},
|
|
@@ -154,7 +154,7 @@ export function getBeaconStateApi({
|
|
|
154
154
|
|
|
155
155
|
async postStateValidatorIdentities({stateId, validatorIds = []}) {
|
|
156
156
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
157
|
-
const {
|
|
157
|
+
const {pubkeyCache} = chain;
|
|
158
158
|
|
|
159
159
|
let validatorIdentities: routes.beacon.ValidatorIdentities;
|
|
160
160
|
|
|
@@ -163,7 +163,7 @@ export function getBeaconStateApi({
|
|
|
163
163
|
|
|
164
164
|
validatorIdentities = [];
|
|
165
165
|
for (const id of validatorIds) {
|
|
166
|
-
const resp = getStateValidatorIndex(id, state,
|
|
166
|
+
const resp = getStateValidatorIndex(id, state, pubkeyCache);
|
|
167
167
|
if (resp.valid) {
|
|
168
168
|
const index = resp.validatorIndex;
|
|
169
169
|
const {pubkey, activationEpoch} = state.validators.getReadonly(index);
|
|
@@ -187,9 +187,9 @@ export function getBeaconStateApi({
|
|
|
187
187
|
|
|
188
188
|
async getStateValidator({stateId, validatorId}) {
|
|
189
189
|
const {state, executionOptimistic, finalized} = await getState(stateId);
|
|
190
|
-
const {
|
|
190
|
+
const {pubkeyCache} = chain;
|
|
191
191
|
|
|
192
|
-
const resp = getStateValidatorIndex(validatorId, state,
|
|
192
|
+
const resp = getStateValidatorIndex(validatorId, state, pubkeyCache);
|
|
193
193
|
if (!resp.valid) {
|
|
194
194
|
throw new ApiError(resp.code, resp.reason);
|
|
195
195
|
}
|
|
@@ -214,7 +214,7 @@ export function getBeaconStateApi({
|
|
|
214
214
|
|
|
215
215
|
const balances: routes.beacon.ValidatorBalance[] = [];
|
|
216
216
|
for (const id of validatorIds) {
|
|
217
|
-
const resp = getStateValidatorIndex(id, state, chain.
|
|
217
|
+
const resp = getStateValidatorIndex(id, state, chain.pubkeyCache);
|
|
218
218
|
|
|
219
219
|
if (resp.valid) {
|
|
220
220
|
balances.push({
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import {PubkeyIndexMap} from "@chainsafe/pubkey-index-map";
|
|
2
1
|
import {routes} from "@lodestar/api";
|
|
3
2
|
import {CheckpointWithHex, IForkChoice} from "@lodestar/fork-choice";
|
|
4
3
|
import {GENESIS_SLOT} from "@lodestar/params";
|
|
5
|
-
import {BeaconStateAllForks, CachedBeaconStateAllForks} from "@lodestar/state-transition";
|
|
6
|
-
import {
|
|
4
|
+
import {BeaconStateAllForks, CachedBeaconStateAllForks, PubkeyCache} from "@lodestar/state-transition";
|
|
5
|
+
import {
|
|
6
|
+
BLSPubkey,
|
|
7
|
+
Epoch,
|
|
8
|
+
RootHex,
|
|
9
|
+
Slot,
|
|
10
|
+
ValidatorIndex,
|
|
11
|
+
getValidatorStatus,
|
|
12
|
+
mapToGeneralStatus,
|
|
13
|
+
phase0,
|
|
14
|
+
} from "@lodestar/types";
|
|
7
15
|
import {fromHex} from "@lodestar/utils";
|
|
8
16
|
import {IBeaconChain} from "../../../../chain/index.js";
|
|
9
17
|
import {ApiError, ValidationError} from "../../errors.js";
|
|
@@ -65,28 +73,6 @@ export async function getStateResponseWithRegen(
|
|
|
65
73
|
return res;
|
|
66
74
|
}
|
|
67
75
|
|
|
68
|
-
type GeneralValidatorStatus = "active" | "pending" | "exited" | "withdrawal";
|
|
69
|
-
|
|
70
|
-
function mapToGeneralStatus(subStatus: routes.beacon.ValidatorStatus): GeneralValidatorStatus {
|
|
71
|
-
switch (subStatus) {
|
|
72
|
-
case "active_ongoing":
|
|
73
|
-
case "active_exiting":
|
|
74
|
-
case "active_slashed":
|
|
75
|
-
return "active";
|
|
76
|
-
case "pending_initialized":
|
|
77
|
-
case "pending_queued":
|
|
78
|
-
return "pending";
|
|
79
|
-
case "exited_slashed":
|
|
80
|
-
case "exited_unslashed":
|
|
81
|
-
return "exited";
|
|
82
|
-
case "withdrawal_possible":
|
|
83
|
-
case "withdrawal_done":
|
|
84
|
-
return "withdrawal";
|
|
85
|
-
default:
|
|
86
|
-
throw new Error(`Unknown substatus: ${subStatus}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
76
|
export function toValidatorResponse(
|
|
91
77
|
index: ValidatorIndex,
|
|
92
78
|
validator: phase0.Validator,
|
|
@@ -104,7 +90,7 @@ export function toValidatorResponse(
|
|
|
104
90
|
export function filterStateValidatorsByStatus(
|
|
105
91
|
statuses: string[],
|
|
106
92
|
state: BeaconStateAllForks,
|
|
107
|
-
|
|
93
|
+
pubkeyCache: PubkeyCache,
|
|
108
94
|
currentEpoch: Epoch
|
|
109
95
|
): routes.beacon.ValidatorResponse[] {
|
|
110
96
|
const responses: routes.beacon.ValidatorResponse[] = [];
|
|
@@ -115,7 +101,7 @@ export function filterStateValidatorsByStatus(
|
|
|
115
101
|
const validatorStatus = getValidatorStatus(validator, currentEpoch);
|
|
116
102
|
const generalStatus = mapToGeneralStatus(validatorStatus);
|
|
117
103
|
|
|
118
|
-
const resp = getStateValidatorIndex(validator.pubkey, state,
|
|
104
|
+
const resp = getStateValidatorIndex(validator.pubkey, state, pubkeyCache);
|
|
119
105
|
if (resp.valid && (statusSet.has(validatorStatus) || statusSet.has(generalStatus))) {
|
|
120
106
|
responses.push(
|
|
121
107
|
toValidatorResponse(resp.validatorIndex, validator, state.balances.get(resp.validatorIndex), currentEpoch)
|
|
@@ -132,7 +118,7 @@ type StateValidatorIndexResponse =
|
|
|
132
118
|
export function getStateValidatorIndex(
|
|
133
119
|
id: routes.beacon.ValidatorId | BLSPubkey,
|
|
134
120
|
state: BeaconStateAllForks,
|
|
135
|
-
|
|
121
|
+
pubkeyCache: PubkeyCache
|
|
136
122
|
): StateValidatorIndexResponse {
|
|
137
123
|
if (typeof id === "string") {
|
|
138
124
|
// mutate `id` and fallthrough to below
|
|
@@ -160,7 +146,7 @@ export function getStateValidatorIndex(
|
|
|
160
146
|
}
|
|
161
147
|
|
|
162
148
|
// typeof id === Uint8Array
|
|
163
|
-
const validatorIndex =
|
|
149
|
+
const validatorIndex = pubkeyCache.getIndex(id);
|
|
164
150
|
if (validatorIndex === null) {
|
|
165
151
|
return {valid: false, code: 404, reason: "Validator pubkey not found in state"};
|
|
166
152
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
3
3
|
import {ExecutionStatus} from "@lodestar/fork-choice";
|
|
4
|
-
import {ZERO_HASH_HEX, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
|
|
5
|
-
import {BeaconState,
|
|
4
|
+
import {ForkPostDeneb, ZERO_HASH_HEX, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
|
|
5
|
+
import {BeaconState, DataColumnSidecars, type SignedBeaconBlock, sszTypesFor} from "@lodestar/types";
|
|
6
6
|
import {toRootHex} from "@lodestar/utils";
|
|
7
|
+
import {getBlobKzgCommitments} from "../../../util/dataColumns.js";
|
|
7
8
|
import {isOptimisticBlock} from "../../../util/forkChoice.js";
|
|
8
9
|
import {getStateSlotFromBytes} from "../../../util/multifork.js";
|
|
9
10
|
import {getBlockResponse} from "../beacon/blocks/utils.js";
|
|
@@ -96,10 +97,10 @@ export function getDebugApi({
|
|
|
96
97
|
const fork = config.getForkName(block.message.slot);
|
|
97
98
|
const blockRoot = sszTypesFor(fork).BeaconBlock.hashTreeRoot(block.message);
|
|
98
99
|
|
|
99
|
-
let dataColumnSidecars:
|
|
100
|
+
let dataColumnSidecars: DataColumnSidecars;
|
|
100
101
|
|
|
101
102
|
const blobCount = isForkPostDeneb(fork)
|
|
102
|
-
? (block
|
|
103
|
+
? getBlobKzgCommitments(fork, block as SignedBeaconBlock<ForkPostDeneb>).length
|
|
103
104
|
: 0;
|
|
104
105
|
|
|
105
106
|
if (isForkPostFulu(fork) && blobCount > 0) {
|
|
@@ -115,7 +116,9 @@ export function getDebugApi({
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
return {
|
|
118
|
-
data:
|
|
119
|
+
data: (indices
|
|
120
|
+
? dataColumnSidecars.filter(({index}) => indices.includes(index))
|
|
121
|
+
: dataColumnSidecars) as DataColumnSidecars,
|
|
119
122
|
meta: {
|
|
120
123
|
executionOptimistic,
|
|
121
124
|
finalized,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
3
3
|
import {MAX_REQUEST_LIGHT_CLIENT_COMMITTEE_HASHES, MAX_REQUEST_LIGHT_CLIENT_UPDATES} from "@lodestar/params";
|
|
4
|
+
import type {LightClientUpdate} from "@lodestar/types";
|
|
4
5
|
import {fromHex} from "@lodestar/utils";
|
|
6
|
+
import {LightClientServerError, LightClientServerErrorCode} from "../../../chain/errors/lightClientError.js";
|
|
5
7
|
import {assertLightClientServer} from "../../../node/utils/lightclient.js";
|
|
6
8
|
import {ApiModules} from "../types.js";
|
|
7
9
|
// TODO: Import from lightclient/server package
|
|
@@ -16,8 +18,23 @@ export function getLightclientApi({
|
|
|
16
18
|
assertLightClientServer(lightClientServer);
|
|
17
19
|
|
|
18
20
|
const maxAllowedCount = Math.min(MAX_REQUEST_LIGHT_CLIENT_UPDATES, count);
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
+
const updates: LightClientUpdate[] = [];
|
|
22
|
+
for (let i = 0; i < maxAllowedCount; i++) {
|
|
23
|
+
try {
|
|
24
|
+
const update = await lightClientServer.getUpdate(startPeriod + i);
|
|
25
|
+
updates.push(update);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
if ((e as LightClientServerError).type?.code === LightClientServerErrorCode.RESOURCE_UNAVAILABLE) {
|
|
28
|
+
// Period not available, if we already have results, stop to preserve
|
|
29
|
+
// consecutive order. If not, skip and try the next period.
|
|
30
|
+
if (updates.length > 0) break;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
// Unexpected error
|
|
34
|
+
throw e;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
21
38
|
return {
|
|
22
39
|
data: updates,
|
|
23
40
|
meta: {versions: updates.map((update) => config.getForkName(update.attestedHeader.beacon.slot))},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Connection,
|
|
1
|
+
import type {Connection, ConnectionStatus} from "@libp2p/interface";
|
|
2
2
|
import {routes} from "@lodestar/api";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -24,7 +24,7 @@ export function formatNodePeer(peerIdStr: string, connections: Connection[]): ro
|
|
|
24
24
|
* - Otherwise, the first closed connection
|
|
25
25
|
*/
|
|
26
26
|
export function getRelevantConnection(connections: Connection[]): Connection | null {
|
|
27
|
-
const byStatus = new Map<
|
|
27
|
+
const byStatus = new Map<ConnectionStatus, Connection>();
|
|
28
28
|
for (const conn of connections) {
|
|
29
29
|
if (conn.status === "open") return conn;
|
|
30
30
|
if (!byStatus.has(conn.status)) byStatus.set(conn.status, conn);
|
|
@@ -37,7 +37,7 @@ export function getRelevantConnection(connections: Connection[]): Connection | n
|
|
|
37
37
|
* Map libp2p connection status to the API's peer state notation
|
|
38
38
|
* @param status
|
|
39
39
|
*/
|
|
40
|
-
function getPeerState(status:
|
|
40
|
+
function getPeerState(status: ConnectionStatus): routes.node.PeerState {
|
|
41
41
|
switch (status) {
|
|
42
42
|
case "open":
|
|
43
43
|
return "connected";
|