@lodestar/beacon-node 1.42.0-dev.eec18d0609 → 1.42.0-dev.f403d99def
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 +31 -11
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +4 -0
- package/lib/api/impl/beacon/pool/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 +13 -10
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/debug/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +4 -0
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +9 -3
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts +2 -1
- package/lib/chain/ColumnReconstructionTracker.d.ts.map +1 -1
- package/lib/chain/ColumnReconstructionTracker.js +5 -5
- package/lib/chain/ColumnReconstructionTracker.js.map +1 -1
- package/lib/chain/GetBlobsTracker.d.ts +2 -1
- package/lib/chain/GetBlobsTracker.d.ts.map +1 -1
- package/lib/chain/GetBlobsTracker.js +14 -12
- package/lib/chain/GetBlobsTracker.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts +5 -5
- 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/blockInput/types.d.ts +4 -4
- package/lib/chain/blocks/blockInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +19 -5
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +14 -5
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.js +1 -1
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts +14 -6
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js +33 -2
- package/lib/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js.map +1 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts +2 -1
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/blocks/types.d.ts +3 -3
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +3 -2
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +4 -2
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/chain.d.ts +4 -2
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +77 -28
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +29 -7
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +12 -3
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +11 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +4 -0
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.d.ts +31 -1
- package/lib/chain/errors/dataColumnSidecarError.d.ts.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.js +7 -0
- package/lib/chain/errors/dataColumnSidecarError.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +10 -8
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +5 -2
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/lightClient/index.d.ts +2 -2
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +7 -0
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +5 -2
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.d.ts +2 -2
- package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.js +2 -2
- package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +7 -1
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts +3 -3
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +8 -8
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +5 -5
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +23 -4
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +2 -2
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +2 -2
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +27 -5
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts +11 -4
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +184 -5
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +7 -4
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +6 -1
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +4 -1
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/syncCommittee.js +4 -0
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +4 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +3 -3
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/db/buckets.d.ts +2 -2
- package/lib/db/buckets.d.ts.map +1 -1
- package/lib/db/buckets.js +2 -2
- package/lib/db/buckets.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.map +1 -1
- package/lib/db/repositories/dataColumnSidecar.js +4 -2
- package/lib/db/repositories/dataColumnSidecar.js.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.d.ts.map +1 -1
- package/lib/db/repositories/dataColumnSidecarArchive.js +4 -2
- package/lib/db/repositories/dataColumnSidecarArchive.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +20 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +33 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/interface.d.ts +3 -2
- package/lib/network/interface.d.ts.map +1 -1
- package/lib/network/network.d.ts +3 -2
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +3 -0
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/extractSlotRootFns.d.ts +1 -1
- package/lib/network/processor/extractSlotRootFns.d.ts.map +1 -1
- package/lib/network/processor/extractSlotRootFns.js +25 -5
- package/lib/network/processor/extractSlotRootFns.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +246 -66
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts +11 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +234 -22
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js +2 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +2 -0
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +2 -2
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js +7 -3
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +6 -0
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts +2 -2
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +7 -3
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +2 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +3 -8
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
- package/lib/network/reqresp/types.d.ts +3 -3
- package/lib/network/reqresp/types.d.ts.map +1 -1
- package/lib/network/reqresp/types.js +9 -3
- package/lib/network/reqresp/types.js.map +1 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +4 -1
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/notifier.d.ts.map +1 -1
- package/lib/node/notifier.js +2 -2
- package/lib/node/notifier.js.map +1 -1
- package/lib/sync/unknownBlock.js +2 -2
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts +3 -3
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +4 -2
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +3 -3
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +10 -5
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/util/blobs.d.ts +3 -3
- package/lib/util/blobs.d.ts.map +1 -1
- package/lib/util/blobs.js +21 -10
- package/lib/util/blobs.js.map +1 -1
- package/lib/util/dataColumns.d.ts +18 -11
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +51 -17
- package/lib/util/dataColumns.js.map +1 -1
- package/lib/util/execution.d.ts +6 -2
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +49 -25
- package/lib/util/execution.js.map +1 -1
- package/lib/util/sszBytes.d.ts +25 -1
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +189 -2
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +46 -14
- package/src/api/impl/beacon/pool/index.ts +4 -0
- package/src/api/impl/beacon/state/index.ts +15 -15
- package/src/api/impl/debug/index.ts +2 -2
- package/src/api/impl/lodestar/index.ts +4 -0
- package/src/api/impl/validator/index.ts +9 -2
- package/src/chain/ColumnReconstructionTracker.ts +6 -5
- package/src/chain/GetBlobsTracker.ts +14 -12
- package/src/chain/blocks/blockInput/blockInput.ts +8 -8
- package/src/chain/blocks/blockInput/types.ts +4 -4
- package/src/chain/blocks/importBlock.ts +29 -8
- package/src/chain/blocks/importExecutionPayload.ts +15 -5
- package/src/chain/blocks/index.ts +1 -1
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +53 -12
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +2 -1
- package/src/chain/blocks/types.ts +3 -3
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +2 -1
- package/src/chain/blocks/verifyBlocksSignatures.ts +9 -2
- package/src/chain/chain.ts +93 -32
- package/src/chain/emitter.ts +25 -7
- package/src/chain/errors/blockError.ts +7 -1
- package/src/chain/errors/dataColumnSidecarError.ts +32 -1
- package/src/chain/forkChoice/index.ts +11 -8
- package/src/chain/interface.ts +9 -2
- package/src/chain/lightClient/index.ts +15 -3
- package/src/chain/opPools/aggregatedAttestationPool.ts +6 -1
- package/src/chain/opPools/executionPayloadBidPool.ts +3 -3
- package/src/chain/prepareNextSlot.ts +8 -0
- package/src/chain/produceBlock/computeNewStateRoot.ts +11 -10
- package/src/chain/produceBlock/produceBlockBody.ts +40 -10
- package/src/chain/seenCache/seenGossipBlockInput.ts +2 -2
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +2 -2
- package/src/chain/validation/block.ts +30 -7
- package/src/chain/validation/dataColumnSidecar.ts +230 -7
- package/src/chain/validation/executionPayloadBid.ts +7 -3
- package/src/chain/validation/executionPayloadEnvelope.ts +10 -1
- package/src/chain/validation/payloadAttestationMessage.ts +4 -0
- package/src/chain/validation/syncCommittee.ts +5 -1
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +5 -1
- package/src/chain/validatorMonitor.ts +3 -2
- package/src/db/buckets.ts +2 -2
- package/src/db/repositories/dataColumnSidecar.ts +4 -2
- package/src/db/repositories/dataColumnSidecarArchive.ts +4 -2
- package/src/metrics/metrics/lodestar.ts +34 -0
- package/src/network/interface.ts +3 -2
- package/src/network/network.ts +7 -4
- package/src/network/processor/extractSlotRootFns.ts +32 -6
- package/src/network/processor/gossipHandlers.ts +310 -79
- package/src/network/processor/index.ts +304 -22
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +3 -1
- package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +3 -0
- package/src/network/reqresp/handlers/blobSidecarsByRange.ts +15 -3
- package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +11 -0
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +19 -3
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +3 -1
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +3 -12
- package/src/network/reqresp/types.ts +13 -5
- package/src/node/nodejs.ts +5 -2
- package/src/node/notifier.ts +7 -2
- package/src/sync/unknownBlock.ts +3 -3
- package/src/sync/utils/downloadByRange.ts +9 -7
- package/src/sync/utils/downloadByRoot.ts +16 -12
- package/src/util/blobs.ts +35 -15
- package/src/util/dataColumns.ts +69 -25
- package/src/util/execution.ts +49 -30
- package/src/util/sszBytes.ts +245 -3
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {Type} from "@chainsafe/ssz";
|
|
2
2
|
import {BeaconConfig} from "@lodestar/config";
|
|
3
|
-
import {ForkName, ForkPostAltair, isForkPostAltair} from "@lodestar/params";
|
|
3
|
+
import {ForkName, ForkPostAltair, ForkPostFulu, isForkPostAltair, isForkPostFulu} from "@lodestar/params";
|
|
4
4
|
import {Protocol, ProtocolHandler, ReqRespRequest} from "@lodestar/reqresp";
|
|
5
5
|
import {
|
|
6
|
+
DataColumnSidecar,
|
|
6
7
|
LightClientBootstrap,
|
|
7
8
|
LightClientFinalityUpdate,
|
|
8
9
|
LightClientOptimisticUpdate,
|
|
@@ -83,8 +84,8 @@ type ResponseBodyByMethod = {
|
|
|
83
84
|
[ReqRespMethod.BeaconBlocksByRoot]: SignedBeaconBlock;
|
|
84
85
|
[ReqRespMethod.BlobSidecarsByRange]: deneb.BlobSidecar;
|
|
85
86
|
[ReqRespMethod.BlobSidecarsByRoot]: deneb.BlobSidecar;
|
|
86
|
-
[ReqRespMethod.DataColumnSidecarsByRange]:
|
|
87
|
-
[ReqRespMethod.DataColumnSidecarsByRoot]:
|
|
87
|
+
[ReqRespMethod.DataColumnSidecarsByRange]: DataColumnSidecar;
|
|
88
|
+
[ReqRespMethod.DataColumnSidecarsByRoot]: DataColumnSidecar;
|
|
88
89
|
[ReqRespMethod.ExecutionPayloadEnvelopesByRoot]: gloas.SignedExecutionPayloadEnvelope;
|
|
89
90
|
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: gloas.SignedExecutionPayloadEnvelope;
|
|
90
91
|
|
|
@@ -146,8 +147,8 @@ export const responseSszTypeByMethod: {[K in ReqRespMethod]: ResponseTypeGetter<
|
|
|
146
147
|
[ReqRespMethod.LightClientBootstrap]: (fork) => sszTypesFor(onlyPostAltairFork(fork)).LightClientBootstrap,
|
|
147
148
|
[ReqRespMethod.LightClientUpdatesByRange]: (fork) => sszTypesFor(onlyPostAltairFork(fork)).LightClientUpdate,
|
|
148
149
|
[ReqRespMethod.LightClientFinalityUpdate]: (fork) => sszTypesFor(onlyPostAltairFork(fork)).LightClientFinalityUpdate,
|
|
149
|
-
[ReqRespMethod.DataColumnSidecarsByRange]: () =>
|
|
150
|
-
[ReqRespMethod.DataColumnSidecarsByRoot]: () =>
|
|
150
|
+
[ReqRespMethod.DataColumnSidecarsByRange]: (fork) => sszTypesFor(onlyPostFuluFork(fork)).DataColumnSidecar,
|
|
151
|
+
[ReqRespMethod.DataColumnSidecarsByRoot]: (fork) => sszTypesFor(onlyPostFuluFork(fork)).DataColumnSidecar,
|
|
151
152
|
[ReqRespMethod.ExecutionPayloadEnvelopesByRoot]: () => ssz.gloas.SignedExecutionPayloadEnvelope,
|
|
152
153
|
[ReqRespMethod.ExecutionPayloadEnvelopesByRange]: () => ssz.gloas.SignedExecutionPayloadEnvelope,
|
|
153
154
|
[ReqRespMethod.LightClientOptimisticUpdate]: (fork) =>
|
|
@@ -161,6 +162,13 @@ function onlyPostAltairFork(fork: ForkName): ForkPostAltair {
|
|
|
161
162
|
throw Error(`Not a post-altair fork ${fork}`);
|
|
162
163
|
}
|
|
163
164
|
|
|
165
|
+
function onlyPostFuluFork(fork: ForkName): ForkPostFulu {
|
|
166
|
+
if (isForkPostFulu(fork)) {
|
|
167
|
+
return fork;
|
|
168
|
+
}
|
|
169
|
+
throw Error(`Not a post-fulu fork ${fork}`);
|
|
170
|
+
}
|
|
171
|
+
|
|
164
172
|
export type RequestTypedContainer = {
|
|
165
173
|
[K in ReqRespMethod]: {method: K; body: RequestBodyByMethod[K]};
|
|
166
174
|
}[ReqRespMethod];
|
package/src/node/nodejs.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {BeaconApiMethods} from "@lodestar/api/beacon/server";
|
|
|
6
6
|
import {BeaconConfig} from "@lodestar/config";
|
|
7
7
|
import type {LoggerNode} from "@lodestar/logger/node";
|
|
8
8
|
import {ZERO_HASH_HEX} from "@lodestar/params";
|
|
9
|
-
import {IBeaconStateView, PubkeyCache} from "@lodestar/state-transition";
|
|
9
|
+
import {IBeaconStateView, PubkeyCache, isStatePostBellatrix} from "@lodestar/state-transition";
|
|
10
10
|
import {phase0} from "@lodestar/types";
|
|
11
11
|
import {sleep, toRootHex} from "@lodestar/utils";
|
|
12
12
|
import {ProcessShutdownCallback} from "@lodestar/validator";
|
|
@@ -221,7 +221,10 @@ export class BeaconNode {
|
|
|
221
221
|
|
|
222
222
|
let executionEngineOpts = opts.executionEngine;
|
|
223
223
|
if (opts.executionEngine.mode === "mock") {
|
|
224
|
-
const eth1BlockHash =
|
|
224
|
+
const eth1BlockHash =
|
|
225
|
+
isStatePostBellatrix(anchorState) && anchorState.isExecutionStateType
|
|
226
|
+
? toRootHex(anchorState.latestBlockHash)
|
|
227
|
+
: undefined;
|
|
225
228
|
executionEngineOpts = {
|
|
226
229
|
...opts.executionEngine,
|
|
227
230
|
genesisBlockHash: ZERO_HASH_HEX,
|
package/src/node/notifier.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
2
|
import {ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice";
|
|
3
3
|
import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
IBeaconStateView,
|
|
6
|
+
computeEpochAtSlot,
|
|
7
|
+
computeStartSlotAtEpoch,
|
|
8
|
+
isStatePostBellatrix,
|
|
9
|
+
} from "@lodestar/state-transition";
|
|
5
10
|
import {Epoch} from "@lodestar/types";
|
|
6
11
|
import {ErrorAborted, Logger, prettyBytes, prettyBytesShort, sleep} from "@lodestar/utils";
|
|
7
12
|
import {IBeaconChain} from "../chain/index.js";
|
|
@@ -165,7 +170,7 @@ function getHeadExecutionInfo(
|
|
|
165
170
|
const executionStatusStr = headInfo.executionStatus.toLowerCase();
|
|
166
171
|
|
|
167
172
|
// Add execution status to notifier only if head is on/post bellatrix
|
|
168
|
-
if (headState.isExecutionStateType) {
|
|
173
|
+
if (isStatePostBellatrix(headState) && headState.isExecutionStateType) {
|
|
169
174
|
if (headState.isMergeTransitionComplete) {
|
|
170
175
|
const executionPayloadHashInfo =
|
|
171
176
|
headInfo.executionStatus !== ExecutionStatus.PreMerge ? headInfo.executionPayloadBlockHash : "empty";
|
package/src/sync/unknownBlock.ts
CHANGED
|
@@ -115,7 +115,7 @@ export class BlockInputSync {
|
|
|
115
115
|
this.logger.verbose("BlockInputSync enabled.");
|
|
116
116
|
this.chain.emitter.on(ChainEvent.unknownBlockRoot, this.onUnknownBlockRoot);
|
|
117
117
|
this.chain.emitter.on(ChainEvent.incompleteBlockInput, this.onIncompleteBlockInput);
|
|
118
|
-
this.chain.emitter.on(ChainEvent.
|
|
118
|
+
this.chain.emitter.on(ChainEvent.blockUnknownParent, this.onUnknownParent);
|
|
119
119
|
this.network.events.on(NetworkEvent.peerConnected, this.onPeerConnected);
|
|
120
120
|
this.network.events.on(NetworkEvent.peerDisconnected, this.onPeerDisconnected);
|
|
121
121
|
this.subscribedToNetworkEvents = true;
|
|
@@ -126,7 +126,7 @@ export class BlockInputSync {
|
|
|
126
126
|
this.logger.verbose("BlockInputSync disabled.");
|
|
127
127
|
this.chain.emitter.off(ChainEvent.unknownBlockRoot, this.onUnknownBlockRoot);
|
|
128
128
|
this.chain.emitter.off(ChainEvent.incompleteBlockInput, this.onIncompleteBlockInput);
|
|
129
|
-
this.chain.emitter.off(ChainEvent.
|
|
129
|
+
this.chain.emitter.off(ChainEvent.blockUnknownParent, this.onUnknownParent);
|
|
130
130
|
this.network.events.off(NetworkEvent.peerConnected, this.onPeerConnected);
|
|
131
131
|
this.network.events.off(NetworkEvent.peerDisconnected, this.onPeerDisconnected);
|
|
132
132
|
this.subscribedToNetworkEvents = false;
|
|
@@ -171,7 +171,7 @@ export class BlockInputSync {
|
|
|
171
171
|
/**
|
|
172
172
|
* Process an unknownBlockParent event and register the block in `pendingBlocks` Map.
|
|
173
173
|
*/
|
|
174
|
-
private onUnknownParent = (data: ChainEventData[ChainEvent.
|
|
174
|
+
private onUnknownParent = (data: ChainEventData[ChainEvent.blockUnknownParent]): void => {
|
|
175
175
|
try {
|
|
176
176
|
this.addByRootHex(data.blockInput.parentRootHex, data.peer);
|
|
177
177
|
this.addByBlockInput(data.blockInput, data.peer);
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "../../chain/blocks/blockInput/index.js";
|
|
12
12
|
import {SeenBlockInput} from "../../chain/seenCache/seenGossipBlockInput.js";
|
|
13
13
|
import {validateBlockBlobSidecars} from "../../chain/validation/blobSidecar.js";
|
|
14
|
-
import {
|
|
14
|
+
import {validateFuluBlockDataColumnSidecars} from "../../chain/validation/dataColumnSidecar.js";
|
|
15
15
|
import {BeaconMetrics} from "../../metrics/metrics/beacon.js";
|
|
16
16
|
import {INetwork} from "../../network/index.js";
|
|
17
17
|
import {getBlobKzgCommitments} from "../../util/dataColumns.js";
|
|
@@ -27,7 +27,7 @@ export type DownloadByRangeRequests = {
|
|
|
27
27
|
export type DownloadByRangeResponses = {
|
|
28
28
|
blocks?: SignedBeaconBlock[];
|
|
29
29
|
blobSidecars?: deneb.BlobSidecars;
|
|
30
|
-
columnSidecars?: fulu.
|
|
30
|
+
columnSidecars?: fulu.DataColumnSidecar[];
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export type DownloadAndCacheByRangeProps = DownloadByRangeRequests & {
|
|
@@ -58,7 +58,7 @@ export type ValidatedBlobSidecars = {
|
|
|
58
58
|
|
|
59
59
|
export type ValidatedColumnSidecars = {
|
|
60
60
|
blockRoot: Uint8Array;
|
|
61
|
-
columnSidecars: fulu.
|
|
61
|
+
columnSidecars: fulu.DataColumnSidecar[];
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
export type ValidatedResponses = {
|
|
@@ -245,7 +245,7 @@ export async function requestByRange({
|
|
|
245
245
|
}): Promise<DownloadByRangeResponses> {
|
|
246
246
|
let blocks: undefined | SignedBeaconBlock[];
|
|
247
247
|
let blobSidecars: undefined | deneb.BlobSidecars;
|
|
248
|
-
let columnSidecars: undefined | fulu.
|
|
248
|
+
let columnSidecars: undefined | fulu.DataColumnSidecar[];
|
|
249
249
|
|
|
250
250
|
const requests: Promise<unknown>[] = [];
|
|
251
251
|
|
|
@@ -268,7 +268,7 @@ export async function requestByRange({
|
|
|
268
268
|
if (columnsRequest) {
|
|
269
269
|
requests.push(
|
|
270
270
|
network.sendDataColumnSidecarsByRange(peerIdStr, columnsRequest).then((columnResponse) => {
|
|
271
|
-
columnSidecars = columnResponse;
|
|
271
|
+
columnSidecars = columnResponse as fulu.DataColumnSidecar[];
|
|
272
272
|
})
|
|
273
273
|
);
|
|
274
274
|
}
|
|
@@ -615,11 +615,13 @@ export async function validateColumnsByRangeResponse(
|
|
|
615
615
|
config: ChainForkConfig,
|
|
616
616
|
request: fulu.DataColumnSidecarsByRangeRequest,
|
|
617
617
|
blocks: ValidatedBlock[],
|
|
618
|
-
columnSidecars: fulu.
|
|
618
|
+
columnSidecars: fulu.DataColumnSidecar[],
|
|
619
619
|
peerDasMetrics?: BeaconMetrics["peerDas"] | null
|
|
620
620
|
): Promise<WarnResult<ValidatedColumnSidecars[], DownloadByRangeError>> {
|
|
621
621
|
const warnings: DownloadByRangeError[] = [];
|
|
622
622
|
|
|
623
|
+
// TODO GLOAS: Extend by range column sync to support gloas.DataColumnSidecar and
|
|
624
|
+
// validate against the block bid commitments instead of the fulu signed header shape
|
|
623
625
|
const seenColumns = new Map<Slot, Map<number, fulu.DataColumnSidecar>>();
|
|
624
626
|
let currentSlot = -1;
|
|
625
627
|
let currentIndex = -1;
|
|
@@ -767,7 +769,7 @@ export async function validateColumnsByRangeResponse(
|
|
|
767
769
|
}
|
|
768
770
|
|
|
769
771
|
validationPromises.push(
|
|
770
|
-
|
|
772
|
+
validateFuluBlockDataColumnSidecars(
|
|
771
773
|
null, // do not pass chain here so we do not validate header signature
|
|
772
774
|
slot,
|
|
773
775
|
blockRoot,
|
|
@@ -8,7 +8,7 @@ import {BlockInputSource, IBlockInput} from "../../chain/blocks/blockInput/types
|
|
|
8
8
|
import {ChainEventEmitter} from "../../chain/emitter.js";
|
|
9
9
|
import {IBeaconChain} from "../../chain/interface.js";
|
|
10
10
|
import {validateBlockBlobSidecars} from "../../chain/validation/blobSidecar.js";
|
|
11
|
-
import {
|
|
11
|
+
import {validateFuluBlockDataColumnSidecars} from "../../chain/validation/dataColumnSidecar.js";
|
|
12
12
|
import {INetwork} from "../../network/interface.js";
|
|
13
13
|
import {PeerSyncMeta} from "../../network/peers/peersData.js";
|
|
14
14
|
import {prettyPrintPeerIdStr} from "../../network/util.js";
|
|
@@ -52,7 +52,7 @@ export type FetchByRootAndValidateColumnsProps = FetchByRootCoreProps & {
|
|
|
52
52
|
export type FetchByRootResponses = {
|
|
53
53
|
block: SignedBeaconBlock;
|
|
54
54
|
blobSidecars?: deneb.BlobSidecars;
|
|
55
|
-
columnSidecars?: fulu.
|
|
55
|
+
columnSidecars?: fulu.DataColumnSidecar[];
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
export type DownloadByRootProps = FetchByRootCoreProps & {
|
|
@@ -213,7 +213,7 @@ export async function fetchByRoot({
|
|
|
213
213
|
}: FetchByRootProps): Promise<WarnResult<FetchByRootResponses, DownloadByRootError>> {
|
|
214
214
|
let block: SignedBeaconBlock;
|
|
215
215
|
let blobSidecars: deneb.BlobSidecars | undefined;
|
|
216
|
-
let columnSidecarResult: WarnResult<fulu.
|
|
216
|
+
let columnSidecarResult: WarnResult<fulu.DataColumnSidecar[], DownloadByRootError> | undefined;
|
|
217
217
|
const {peerId: peerIdStr} = peerMeta;
|
|
218
218
|
|
|
219
219
|
if (isPendingBlockInput(cacheItem)) {
|
|
@@ -376,7 +376,7 @@ export async function fetchAndValidateColumns({
|
|
|
376
376
|
block,
|
|
377
377
|
blockRoot,
|
|
378
378
|
missing,
|
|
379
|
-
}: FetchByRootAndValidateColumnsProps): Promise<WarnResult<fulu.
|
|
379
|
+
}: FetchByRootAndValidateColumnsProps): Promise<WarnResult<fulu.DataColumnSidecar[], DownloadByRootError>> {
|
|
380
380
|
const {peerId: peerIdStr} = peerMeta;
|
|
381
381
|
const slot = block.message.slot;
|
|
382
382
|
const blobCount = getBlobKzgCommitments(forkName, block).length;
|
|
@@ -387,9 +387,11 @@ export async function fetchAndValidateColumns({
|
|
|
387
387
|
const blockRootHex = toRootHex(blockRoot);
|
|
388
388
|
const peerColumns = new Set(peerMeta.custodyColumns ?? []);
|
|
389
389
|
const requestedColumns = missing.filter((c) => peerColumns.has(c));
|
|
390
|
-
|
|
390
|
+
// TODO GLOAS: Extend by root column sync to support gloas.DataColumnSidecar and
|
|
391
|
+
// validate against block bid commitments instead of the fulu signed header shape
|
|
392
|
+
const columnSidecars = (await network.sendDataColumnSidecarsByRoot(peerIdStr, [
|
|
391
393
|
{blockRoot, columns: requestedColumns},
|
|
392
|
-
]);
|
|
394
|
+
])) as fulu.DataColumnSidecar[];
|
|
393
395
|
|
|
394
396
|
const warnings: DownloadByRootError[] = [];
|
|
395
397
|
|
|
@@ -440,7 +442,8 @@ export async function fetchAndValidateColumns({
|
|
|
440
442
|
);
|
|
441
443
|
}
|
|
442
444
|
|
|
443
|
-
|
|
445
|
+
// TODO GLOAS: Swap to fork-aware column validation once post-gloas by-root sync is implemented
|
|
446
|
+
await validateFuluBlockDataColumnSidecars(chain, slot, blockRoot, blobCount, columnSidecars, chain?.metrics?.peerDas);
|
|
444
447
|
|
|
445
448
|
return {result: columnSidecars, warnings: warnings.length > 0 ? warnings : null};
|
|
446
449
|
}
|
|
@@ -451,11 +454,12 @@ export async function fetchColumnsByRoot({
|
|
|
451
454
|
peerMeta,
|
|
452
455
|
blockRoot,
|
|
453
456
|
missing,
|
|
454
|
-
}: Pick<
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
}: Pick<FetchByRootAndValidateColumnsProps, "network" | "peerMeta" | "blockRoot" | "missing">): Promise<
|
|
458
|
+
fulu.DataColumnSidecar[]
|
|
459
|
+
> {
|
|
460
|
+
return (await network.sendDataColumnSidecarsByRoot(peerMeta.peerId, [
|
|
461
|
+
{blockRoot, columns: missing},
|
|
462
|
+
])) as fulu.DataColumnSidecar[];
|
|
459
463
|
}
|
|
460
464
|
|
|
461
465
|
export enum DownloadByRootErrorCode {
|
package/src/util/blobs.ts
CHANGED
|
@@ -13,7 +13,17 @@ import {
|
|
|
13
13
|
VERSIONED_HASH_VERSION_KZG,
|
|
14
14
|
} from "@lodestar/params";
|
|
15
15
|
import {signedBlockToSignedHeader} from "@lodestar/state-transition";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
BeaconBlockBody,
|
|
18
|
+
DataColumnSidecar,
|
|
19
|
+
SSZTypesFor,
|
|
20
|
+
SignedBeaconBlock,
|
|
21
|
+
deneb,
|
|
22
|
+
fulu,
|
|
23
|
+
gloas,
|
|
24
|
+
isGloasDataColumnSidecar,
|
|
25
|
+
ssz,
|
|
26
|
+
} from "@lodestar/types";
|
|
17
27
|
import {kzg} from "./kzg.js";
|
|
18
28
|
|
|
19
29
|
type VersionHash = Uint8Array;
|
|
@@ -71,8 +81,8 @@ export function getBlobSidecars(
|
|
|
71
81
|
* See https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/fulu/das-core.md#recover_matrix
|
|
72
82
|
*/
|
|
73
83
|
export async function dataColumnMatrixRecovery(
|
|
74
|
-
partialSidecars: Map<number,
|
|
75
|
-
): Promise<
|
|
84
|
+
partialSidecars: Map<number, DataColumnSidecar>
|
|
85
|
+
): Promise<DataColumnSidecar[] | null> {
|
|
76
86
|
const columnCount = partialSidecars.size;
|
|
77
87
|
if (columnCount < NUMBER_OF_COLUMNS / 2) {
|
|
78
88
|
// We don't have enough columns to recover
|
|
@@ -92,7 +102,7 @@ export async function dataColumnMatrixRecovery(
|
|
|
92
102
|
// should not happen because we check the size of the cache before this
|
|
93
103
|
throw new Error("No data column found in cache to recover from");
|
|
94
104
|
}
|
|
95
|
-
const blobCount = firstDataColumn.
|
|
105
|
+
const blobCount = firstDataColumn.column.length;
|
|
96
106
|
|
|
97
107
|
const fullColumns: Array<Uint8Array[]> = Array.from(
|
|
98
108
|
{length: NUMBER_OF_COLUMNS},
|
|
@@ -121,7 +131,7 @@ export async function dataColumnMatrixRecovery(
|
|
|
121
131
|
}
|
|
122
132
|
}
|
|
123
133
|
|
|
124
|
-
const result:
|
|
134
|
+
const result: DataColumnSidecar[] = new Array(NUMBER_OF_COLUMNS);
|
|
125
135
|
|
|
126
136
|
for (let columnIndex = 0; columnIndex < NUMBER_OF_COLUMNS; columnIndex++) {
|
|
127
137
|
let sidecar = partialSidecars.get(columnIndex);
|
|
@@ -131,14 +141,24 @@ export async function dataColumnMatrixRecovery(
|
|
|
131
141
|
continue;
|
|
132
142
|
}
|
|
133
143
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
if (isGloasDataColumnSidecar(firstDataColumn)) {
|
|
145
|
+
sidecar = {
|
|
146
|
+
index: columnIndex,
|
|
147
|
+
column: fullColumns[columnIndex],
|
|
148
|
+
kzgProofs: Array.from({length: blobCount}, (_, rowIndex) => blobProofs[rowIndex][columnIndex]),
|
|
149
|
+
slot: firstDataColumn.slot,
|
|
150
|
+
beaconBlockRoot: firstDataColumn.beaconBlockRoot,
|
|
151
|
+
} satisfies gloas.DataColumnSidecar;
|
|
152
|
+
} else {
|
|
153
|
+
sidecar = {
|
|
154
|
+
index: columnIndex,
|
|
155
|
+
column: fullColumns[columnIndex],
|
|
156
|
+
kzgCommitments: firstDataColumn.kzgCommitments,
|
|
157
|
+
kzgProofs: Array.from({length: blobCount}, (_, rowIndex) => blobProofs[rowIndex][columnIndex]),
|
|
158
|
+
signedBlockHeader: firstDataColumn.signedBlockHeader,
|
|
159
|
+
kzgCommitmentsInclusionProof: firstDataColumn.kzgCommitmentsInclusionProof,
|
|
160
|
+
} satisfies fulu.DataColumnSidecar;
|
|
161
|
+
}
|
|
142
162
|
result[columnIndex] = sidecar;
|
|
143
163
|
}
|
|
144
164
|
|
|
@@ -149,7 +169,7 @@ export async function dataColumnMatrixRecovery(
|
|
|
149
169
|
* Reconstruct blobs from a set of data columns, at least 50%+ of all the columns
|
|
150
170
|
* must be provided to allow to reconstruct the full data matrix
|
|
151
171
|
*/
|
|
152
|
-
export async function reconstructBlobs(sidecars:
|
|
172
|
+
export async function reconstructBlobs(sidecars: DataColumnSidecar[], indices?: number[]): Promise<deneb.Blobs> {
|
|
153
173
|
if (sidecars.length < NUMBER_OF_COLUMNS / 2) {
|
|
154
174
|
throw Error(
|
|
155
175
|
`Expected at least ${NUMBER_OF_COLUMNS / 2} data columns to reconstruct blobs, received ${sidecars.length}`
|
|
@@ -188,7 +208,7 @@ export async function reconstructBlobs(sidecars: DataColumnSidecars, indices?: n
|
|
|
188
208
|
* Recover cells for specific blob indices from a set of data columns
|
|
189
209
|
*/
|
|
190
210
|
async function recoverBlobCells(
|
|
191
|
-
partialSidecars:
|
|
211
|
+
partialSidecars: DataColumnSidecar[],
|
|
192
212
|
blobIndices: number[]
|
|
193
213
|
): Promise<Map<number, fulu.Cell[]> | null> {
|
|
194
214
|
const columnCount = partialSidecars.length;
|
package/src/util/dataColumns.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
BeaconBlockBody,
|
|
17
17
|
ColumnIndex,
|
|
18
18
|
CustodyIndex,
|
|
19
|
+
DataColumnSidecar,
|
|
19
20
|
Root,
|
|
20
21
|
SSZTypesFor,
|
|
21
22
|
SignedBeaconBlock,
|
|
@@ -24,11 +25,13 @@ import {
|
|
|
24
25
|
deneb,
|
|
25
26
|
fulu,
|
|
26
27
|
gloas,
|
|
28
|
+
isGloasDataColumnSidecar,
|
|
27
29
|
ssz,
|
|
28
30
|
} from "@lodestar/types";
|
|
29
31
|
import {bytesToBigInt} from "@lodestar/utils";
|
|
30
32
|
import {BlockInputColumns} from "../chain/blocks/blockInput/blockInput.js";
|
|
31
33
|
import {BlockInputSource} from "../chain/blocks/blockInput/types.js";
|
|
34
|
+
import {PayloadEnvelopeInput, PayloadEnvelopeInputSource} from "../chain/blocks/payloadEnvelopeInput/index.js";
|
|
32
35
|
import {ChainEvent, ChainEventEmitter} from "../chain/emitter.js";
|
|
33
36
|
import {Metrics} from "../metrics/metrics.js";
|
|
34
37
|
import {NodeId} from "../network/subnets/index.js";
|
|
@@ -287,17 +290,17 @@ export function getBlobKzgCommitments(
|
|
|
287
290
|
* SPEC FUNCTION
|
|
288
291
|
* https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/fulu/validator.md#get_data_column_sidecars
|
|
289
292
|
*/
|
|
290
|
-
export function
|
|
293
|
+
export function getFuluDataColumnSidecars(
|
|
291
294
|
signedBlockHeader: SignedBeaconBlockHeader,
|
|
292
295
|
kzgCommitments: deneb.KZGCommitment[],
|
|
293
296
|
kzgCommitmentsInclusionProof: fulu.KzgCommitmentsInclusionProof,
|
|
294
297
|
cellsAndKzgProofs: {cells: Uint8Array[]; proofs: Uint8Array[]}[]
|
|
295
|
-
): fulu.
|
|
298
|
+
): fulu.DataColumnSidecar[] {
|
|
296
299
|
if (cellsAndKzgProofs.length !== kzgCommitments.length) {
|
|
297
300
|
throw Error("Invalid cellsAndKzgProofs length for getDataColumnSidecars");
|
|
298
301
|
}
|
|
299
302
|
|
|
300
|
-
const sidecars: fulu.
|
|
303
|
+
const sidecars: fulu.DataColumnSidecar[] = [];
|
|
301
304
|
for (let columnIndex = 0; columnIndex < NUMBER_OF_COLUMNS; columnIndex++) {
|
|
302
305
|
const columnCells = [];
|
|
303
306
|
const columnProofs = [];
|
|
@@ -322,13 +325,14 @@ export function getDataColumnSidecars(
|
|
|
322
325
|
* block, assemble the sidecars which can be distributed to peers.
|
|
323
326
|
*
|
|
324
327
|
* SPEC FUNCTION
|
|
325
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/fulu/validator.md#get_data_column_sidecars_from_block
|
|
328
|
+
* fulu: https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/fulu/validator.md#get_data_column_sidecars_from_block
|
|
329
|
+
* gloas: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.3/specs/gloas/builder.md#modified-get_data_column_sidecars_from_block
|
|
326
330
|
*/
|
|
327
331
|
export function getDataColumnSidecarsFromBlock(
|
|
328
332
|
config: ChainForkConfig,
|
|
329
333
|
signedBlock: SignedBeaconBlock<ForkPostFulu>,
|
|
330
334
|
cellsAndKzgProofs: {cells: Uint8Array[]; proofs: Uint8Array[]}[]
|
|
331
|
-
):
|
|
335
|
+
): DataColumnSidecar[] {
|
|
332
336
|
const fork = config.getForkName(signedBlock.message.slot);
|
|
333
337
|
const blobKzgCommitments = getBlobKzgCommitments(fork, signedBlock);
|
|
334
338
|
|
|
@@ -336,11 +340,21 @@ export function getDataColumnSidecarsFromBlock(
|
|
|
336
340
|
if (blobKzgCommitments.length === 0) {
|
|
337
341
|
return [];
|
|
338
342
|
}
|
|
339
|
-
const signedBlockHeader = signedBlockToSignedHeader(config, signedBlock);
|
|
340
343
|
|
|
344
|
+
if (isForkPostGloas(fork)) {
|
|
345
|
+
const beaconBlockRoot = config.getForkTypes(signedBlock.message.slot).BeaconBlock.hashTreeRoot(signedBlock.message);
|
|
346
|
+
return getGloasDataColumnSidecars(signedBlock.message.slot, beaconBlockRoot, cellsAndKzgProofs);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const signedBlockHeader = signedBlockToSignedHeader(config, signedBlock);
|
|
341
350
|
const kzgCommitmentsInclusionProof = computePostFuluKzgCommitmentsInclusionProof(fork, signedBlock.message.body);
|
|
342
351
|
|
|
343
|
-
return
|
|
352
|
+
return getFuluDataColumnSidecars(
|
|
353
|
+
signedBlockHeader,
|
|
354
|
+
blobKzgCommitments,
|
|
355
|
+
kzgCommitmentsInclusionProof,
|
|
356
|
+
cellsAndKzgProofs
|
|
357
|
+
);
|
|
344
358
|
}
|
|
345
359
|
|
|
346
360
|
/**
|
|
@@ -348,13 +362,18 @@ export function getDataColumnSidecarsFromBlock(
|
|
|
348
362
|
* to the commitments it contains, assemble all sidecars for distribution to peers.
|
|
349
363
|
*
|
|
350
364
|
* SPEC FUNCTION
|
|
351
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/fulu/validator.md#get_data_column_sidecars_from_column_sidecar
|
|
365
|
+
* fulu: https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/fulu/validator.md#get_data_column_sidecars_from_column_sidecar
|
|
366
|
+
* gloas: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.3/specs/gloas/validator.md#modified-get_data_column_sidecars_from_column_sidecar
|
|
352
367
|
*/
|
|
353
368
|
export function getDataColumnSidecarsFromColumnSidecar(
|
|
354
|
-
sidecar:
|
|
369
|
+
sidecar: DataColumnSidecar,
|
|
355
370
|
cellsAndKzgProofs: {cells: Uint8Array[]; proofs: Uint8Array[]}[]
|
|
356
|
-
):
|
|
357
|
-
|
|
371
|
+
): DataColumnSidecar[] {
|
|
372
|
+
if (isGloasDataColumnSidecar(sidecar)) {
|
|
373
|
+
return getGloasDataColumnSidecars(sidecar.slot, sidecar.beaconBlockRoot, cellsAndKzgProofs);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return getFuluDataColumnSidecars(
|
|
358
377
|
sidecar.signedBlockHeader,
|
|
359
378
|
sidecar.kzgCommitments,
|
|
360
379
|
sidecar.kzgCommitmentsInclusionProof,
|
|
@@ -362,21 +381,32 @@ export function getDataColumnSidecarsFromColumnSidecar(
|
|
|
362
381
|
);
|
|
363
382
|
}
|
|
364
383
|
|
|
384
|
+
export function getDataColumnSidecarSlot(sidecar: DataColumnSidecar): Slot {
|
|
385
|
+
if (isGloasDataColumnSidecar(sidecar)) {
|
|
386
|
+
return sidecar.slot;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return sidecar.signedBlockHeader.message.slot;
|
|
390
|
+
}
|
|
391
|
+
|
|
365
392
|
/**
|
|
366
393
|
* In Gloas, data column sidecars have a simplified structure with `slot` and `beaconBlockRoot`
|
|
367
394
|
* instead of `signedBlockHeader`, `kzgCommitments`, and `kzgCommitmentsInclusionProof`.
|
|
395
|
+
*
|
|
396
|
+
* SPEC FUNCTION
|
|
397
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.3/specs/gloas/builder.md#modified-get_data_column_sidecars
|
|
368
398
|
*/
|
|
369
|
-
export function
|
|
399
|
+
export function getGloasDataColumnSidecars(
|
|
370
400
|
slot: Slot,
|
|
371
401
|
beaconBlockRoot: Root,
|
|
372
402
|
cellsAndKzgProofs: {cells: Uint8Array[]; proofs: Uint8Array[]}[]
|
|
373
|
-
): gloas.
|
|
403
|
+
): gloas.DataColumnSidecar[] {
|
|
374
404
|
// No need to create data column sidecars if there are no blobs
|
|
375
405
|
if (cellsAndKzgProofs.length === 0) {
|
|
376
406
|
return [];
|
|
377
407
|
}
|
|
378
408
|
|
|
379
|
-
const sidecars: gloas.
|
|
409
|
+
const sidecars: gloas.DataColumnSidecar[] = [];
|
|
380
410
|
for (let columnIndex = 0; columnIndex < NUMBER_OF_COLUMNS; columnIndex++) {
|
|
381
411
|
const column: Uint8Array[] = [];
|
|
382
412
|
const kzgProofs: Uint8Array[] = [];
|
|
@@ -399,11 +429,11 @@ export function getDataColumnSidecarsForGloas(
|
|
|
399
429
|
* If we receive more than half of NUMBER_OF_COLUMNS (64) we should recover all remaining columns
|
|
400
430
|
*/
|
|
401
431
|
export async function recoverDataColumnSidecars(
|
|
402
|
-
|
|
432
|
+
input: BlockInputColumns | PayloadEnvelopeInput,
|
|
403
433
|
emitter: ChainEventEmitter,
|
|
404
434
|
metrics: Metrics | null
|
|
405
435
|
): Promise<DataColumnReconstructionCode> {
|
|
406
|
-
const existingColumns =
|
|
436
|
+
const existingColumns = input.getAllColumns();
|
|
407
437
|
const columnCount = existingColumns.length;
|
|
408
438
|
if (columnCount >= NUMBER_OF_COLUMNS) {
|
|
409
439
|
// We have all columns
|
|
@@ -416,7 +446,7 @@ export async function recoverDataColumnSidecars(
|
|
|
416
446
|
}
|
|
417
447
|
|
|
418
448
|
metrics?.recoverDataColumnSidecars.custodyBeforeReconstruction.set(columnCount);
|
|
419
|
-
const partialSidecars = new Map<number,
|
|
449
|
+
const partialSidecars = new Map<number, DataColumnSidecar>();
|
|
420
450
|
for (const columnSidecar of existingColumns) {
|
|
421
451
|
// the more columns we put, the slower the recover
|
|
422
452
|
if (partialSidecars.size >= NUMBER_OF_COLUMNS / 2) {
|
|
@@ -434,7 +464,7 @@ export async function recoverDataColumnSidecars(
|
|
|
434
464
|
return DataColumnReconstructionCode.NullReturned;
|
|
435
465
|
}
|
|
436
466
|
|
|
437
|
-
if (
|
|
467
|
+
if (input.getAllColumns().length === NUMBER_OF_COLUMNS) {
|
|
438
468
|
// either gossip or getBlobsV2 resolved availability while we were recovering
|
|
439
469
|
metrics?.dataColumns.alreadyAdded.inc(fullSidecars.length);
|
|
440
470
|
return DataColumnReconstructionCode.SuccessLate;
|
|
@@ -450,13 +480,27 @@ export async function recoverDataColumnSidecars(
|
|
|
450
480
|
// the node MAY delete the DataColumnSidecar if it is not part of the node's custody requirement.
|
|
451
481
|
const sidecarsToPublish = [];
|
|
452
482
|
for (const columnSidecar of fullSidecars) {
|
|
453
|
-
if (!
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
483
|
+
if (!input.hasColumn(columnSidecar.index)) {
|
|
484
|
+
if (input instanceof PayloadEnvelopeInput) {
|
|
485
|
+
if (!isGloasDataColumnSidecar(columnSidecar)) {
|
|
486
|
+
throw new Error(`Expected gloas DataColumnSidecar for block ${input.blockRootHex}`);
|
|
487
|
+
}
|
|
488
|
+
input.addColumn({
|
|
489
|
+
columnSidecar,
|
|
490
|
+
seenTimestampSec: Date.now() / 1000,
|
|
491
|
+
source: PayloadEnvelopeInputSource.recovery,
|
|
492
|
+
});
|
|
493
|
+
} else {
|
|
494
|
+
if (isGloasDataColumnSidecar(columnSidecar)) {
|
|
495
|
+
throw new Error(`Expected fulu DataColumnSidecar for block ${input.blockRootHex}`);
|
|
496
|
+
}
|
|
497
|
+
input.addColumn({
|
|
498
|
+
blockRootHex: input.blockRootHex,
|
|
499
|
+
columnSidecar,
|
|
500
|
+
seenTimestampSec: Date.now() / 1000,
|
|
501
|
+
source: BlockInputSource.recovery,
|
|
502
|
+
});
|
|
503
|
+
}
|
|
460
504
|
sidecarsToPublish.push(columnSidecar);
|
|
461
505
|
}
|
|
462
506
|
}
|