@lodestar/beacon-node 1.42.0-dev.8961934298 → 1.42.0-dev.89ddaaeed2
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 +11 -11
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/debug/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 +13 -1
- package/lib/chain/blocks/importBlock.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/chain.d.ts +3 -2
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +55 -20
- 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/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/interface.d.ts +4 -2
- package/lib/chain/interface.d.ts.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/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/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 +242 -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 +232 -22
- package/lib/network/processor/index.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/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 +17 -14
- package/src/api/impl/debug/index.ts +2 -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 +18 -1
- package/src/chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.ts +53 -12
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +2 -1
- package/src/chain/chain.ts +63 -24
- package/src/chain/emitter.ts +25 -7
- package/src/chain/errors/dataColumnSidecarError.ts +32 -1
- package/src/chain/interface.ts +4 -2
- package/src/chain/seenCache/seenGossipBlockInput.ts +2 -2
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +2 -2
- package/src/chain/validation/dataColumnSidecar.ts +230 -7
- 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 +305 -79
- package/src/network/processor/index.ts +302 -22
- package/src/network/reqresp/types.ts +13 -5
- 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
|
@@ -57,7 +57,11 @@ import {
|
|
|
57
57
|
kzgCommitmentToVersionedHash,
|
|
58
58
|
reconstructBlobs,
|
|
59
59
|
} from "../../../../util/blobs.js";
|
|
60
|
-
import {
|
|
60
|
+
import {
|
|
61
|
+
getBlobKzgCommitments,
|
|
62
|
+
getDataColumnSidecarsFromBlock,
|
|
63
|
+
getGloasDataColumnSidecars,
|
|
64
|
+
} from "../../../../util/dataColumns.js";
|
|
61
65
|
import {isOptimisticBlock} from "../../../../util/forkChoice.js";
|
|
62
66
|
import {kzg} from "../../../../util/kzg.js";
|
|
63
67
|
import {promiseAllMaybeAsync} from "../../../../util/promises.js";
|
|
@@ -99,17 +103,20 @@ export function getBeaconBlockApi({
|
|
|
99
103
|
const fork = config.getForkName(slot);
|
|
100
104
|
const blockRoot = toRootHex(chain.config.getForkTypes(slot).BeaconBlock.hashTreeRoot(signedBlock.message));
|
|
101
105
|
|
|
102
|
-
// TODO GLOAS: handle new BlockInput type
|
|
103
106
|
const blockForImport = chain.seenBlockInputCache.getByBlock({
|
|
104
107
|
block: signedBlock,
|
|
105
108
|
source: BlockInputSource.api,
|
|
106
109
|
seenTimestampSec,
|
|
107
110
|
blockRootHex: blockRoot,
|
|
108
111
|
});
|
|
109
|
-
let blobSidecars: deneb.BlobSidecars, dataColumnSidecars: fulu.
|
|
112
|
+
let blobSidecars: deneb.BlobSidecars, dataColumnSidecars: fulu.DataColumnSidecar[];
|
|
110
113
|
|
|
111
114
|
if (isDenebBlockContents(signedBlockContents)) {
|
|
112
|
-
if (
|
|
115
|
+
if (isForkPostGloas(fork)) {
|
|
116
|
+
// After gloas, data columns are not published with the block but when publishing the execution payload envelope
|
|
117
|
+
blobSidecars = [];
|
|
118
|
+
dataColumnSidecars = [];
|
|
119
|
+
} else if (isForkPostFulu(fork)) {
|
|
113
120
|
const timer = metrics?.peerDas.dataColumnSidecarComputationTime.startTimer();
|
|
114
121
|
// If the block was produced by this node, we will already have computed cells
|
|
115
122
|
// Otherwise, we will compute them from the blobs in this function
|
|
@@ -124,7 +131,7 @@ export function getBeaconBlockApi({
|
|
|
124
131
|
config,
|
|
125
132
|
signedBlock as SignedBeaconBlock<ForkPostFulu>,
|
|
126
133
|
cellsAndProofs
|
|
127
|
-
);
|
|
134
|
+
) as fulu.DataColumnSidecar[];
|
|
128
135
|
timer?.();
|
|
129
136
|
blobSidecars = [];
|
|
130
137
|
} else if (isForkPostDeneb(fork)) {
|
|
@@ -210,7 +217,7 @@ export function getBeaconBlockApi({
|
|
|
210
217
|
if (!blockLocallyProduced) {
|
|
211
218
|
const parentBlock = chain.forkChoice.getBlockDefaultStatus(signedBlock.message.parentRoot);
|
|
212
219
|
if (parentBlock === null) {
|
|
213
|
-
chain.emitter.emit(ChainEvent.
|
|
220
|
+
chain.emitter.emit(ChainEvent.blockUnknownParent, {
|
|
214
221
|
blockInput: blockForImport,
|
|
215
222
|
peer: IDENTITY_PEER_ID,
|
|
216
223
|
source: BlockInputSource.api,
|
|
@@ -305,7 +312,7 @@ export function getBeaconBlockApi({
|
|
|
305
312
|
.processBlock(blockForImport, opts)
|
|
306
313
|
.catch((e) => {
|
|
307
314
|
if (e instanceof BlockError && e.type.code === BlockErrorCode.PARENT_UNKNOWN) {
|
|
308
|
-
chain.emitter.emit(ChainEvent.
|
|
315
|
+
chain.emitter.emit(ChainEvent.blockUnknownParent, {
|
|
309
316
|
blockInput: blockForImport,
|
|
310
317
|
peer: IDENTITY_PEER_ID,
|
|
311
318
|
source: BlockInputSource.api,
|
|
@@ -666,7 +673,7 @@ export function getBeaconBlockApi({
|
|
|
666
673
|
await validateApiExecutionPayloadEnvelope(chain, signedExecutionPayloadEnvelope);
|
|
667
674
|
|
|
668
675
|
const isSelfBuild = envelope.builderIndex === BUILDER_INDEX_SELF_BUILD;
|
|
669
|
-
let dataColumnSidecars: gloas.
|
|
676
|
+
let dataColumnSidecars: gloas.DataColumnSidecar[] = [];
|
|
670
677
|
|
|
671
678
|
if (isSelfBuild) {
|
|
672
679
|
// For self-builds, construct and publish data column sidecars from cached block production data
|
|
@@ -691,7 +698,7 @@ export function getBeaconBlockApi({
|
|
|
691
698
|
),
|
|
692
699
|
}));
|
|
693
700
|
|
|
694
|
-
dataColumnSidecars =
|
|
701
|
+
dataColumnSidecars = getGloasDataColumnSidecars(slot, envelope.beaconBlockRoot, cellsAndProofs);
|
|
695
702
|
timer?.();
|
|
696
703
|
}
|
|
697
704
|
} else {
|
|
@@ -788,15 +795,11 @@ export function getBeaconBlockApi({
|
|
|
788
795
|
metrics?.dataColumns.bySource.inc({source: BlockInputSource.api}, dataColumnSidecars.length);
|
|
789
796
|
|
|
790
797
|
if (chain.emitter.listenerCount(routes.events.EventType.dataColumnSidecar)) {
|
|
791
|
-
// TODO GLOAS: revisit this, we likely don't wanna emit KZG commitments anymore
|
|
792
|
-
const cachedResult = chain.blockProductionCache.get(blockRootHex) as ProduceFullGloas | undefined;
|
|
793
|
-
const kzgCommitments = cachedResult?.blobsBundle.commitments.map(toHex) ?? [];
|
|
794
798
|
for (const dataColumnSidecar of dataColumnSidecars) {
|
|
795
799
|
chain.emitter.emit(routes.events.EventType.dataColumnSidecar, {
|
|
796
800
|
blockRoot: blockRootHex,
|
|
797
801
|
slot,
|
|
798
802
|
index: dataColumnSidecar.index,
|
|
799
|
-
kzgCommitments,
|
|
800
803
|
});
|
|
801
804
|
}
|
|
802
805
|
}
|
|
@@ -920,7 +923,7 @@ export function getBeaconBlockApi({
|
|
|
920
923
|
);
|
|
921
924
|
}
|
|
922
925
|
|
|
923
|
-
const blobKzgCommitments = (block
|
|
926
|
+
const blobKzgCommitments = getBlobKzgCommitments(fork, block as SignedBeaconBlock<ForkPostFulu>);
|
|
924
927
|
const blobCount = blobKzgCommitments.length;
|
|
925
928
|
|
|
926
929
|
if (blobCount > 0) {
|
|
@@ -2,7 +2,7 @@ import {routes} from "@lodestar/api";
|
|
|
2
2
|
import {ApplicationMethods} from "@lodestar/api/server";
|
|
3
3
|
import {ExecutionStatus} from "@lodestar/fork-choice";
|
|
4
4
|
import {ForkPostDeneb, ZERO_HASH_HEX, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
|
|
5
|
-
import {BeaconState, DataColumnSidecars, type SignedBeaconBlock, sszTypesFor} from "@lodestar/types";
|
|
5
|
+
import {BeaconState, DataColumnSidecar, DataColumnSidecars, type SignedBeaconBlock, sszTypesFor} from "@lodestar/types";
|
|
6
6
|
import {toRootHex} from "@lodestar/utils";
|
|
7
7
|
import {getBlobKzgCommitments} from "../../../util/dataColumns.js";
|
|
8
8
|
import {isOptimisticBlock} from "../../../util/forkChoice.js";
|
|
@@ -98,7 +98,7 @@ export function getDebugApi({
|
|
|
98
98
|
const fork = config.getForkName(block.message.slot);
|
|
99
99
|
const blockRoot = sszTypesFor(fork).BeaconBlock.hashTreeRoot(block.message);
|
|
100
100
|
|
|
101
|
-
let dataColumnSidecars:
|
|
101
|
+
let dataColumnSidecars: DataColumnSidecar[];
|
|
102
102
|
|
|
103
103
|
const blobCount = isForkPostDeneb(fork)
|
|
104
104
|
? getBlobKzgCommitments(fork, block as SignedBeaconBlock<ForkPostDeneb>).length
|
|
@@ -3,6 +3,7 @@ import {Logger, sleep} from "@lodestar/utils";
|
|
|
3
3
|
import {Metrics} from "../metrics/metrics.js";
|
|
4
4
|
import {DataColumnReconstructionCode, recoverDataColumnSidecars} from "../util/dataColumns.js";
|
|
5
5
|
import {BlockInputColumns} from "./blocks/blockInput/index.js";
|
|
6
|
+
import {PayloadEnvelopeInput} from "./blocks/payloadEnvelopeInput/index.js";
|
|
6
7
|
import {ChainEventEmitter} from "./emitter.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -53,25 +54,25 @@ export class ColumnReconstructionTracker {
|
|
|
53
54
|
this.maxDelayMs = this.config.getSlotComponentDurationMs(RECONSTRUCTION_DELAY_MAX_BPS);
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
triggerColumnReconstruction(
|
|
57
|
+
triggerColumnReconstruction(input: BlockInputColumns | PayloadEnvelopeInput): void {
|
|
57
58
|
if (this.running) {
|
|
58
59
|
return;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
if (this.lastBlockRootHex ===
|
|
62
|
+
if (this.lastBlockRootHex === input.blockRootHex) {
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
// We don't care about the outcome of this call,
|
|
66
67
|
// just that it has been triggered for this block root.
|
|
67
68
|
this.running = true;
|
|
68
|
-
this.lastBlockRootHex =
|
|
69
|
+
this.lastBlockRootHex = input.blockRootHex;
|
|
69
70
|
const delay = this.minDelayMs + Math.random() * (this.maxDelayMs - this.minDelayMs);
|
|
70
71
|
sleep(delay)
|
|
71
72
|
.then(() => {
|
|
72
|
-
const logCtx = {slot:
|
|
73
|
+
const logCtx = {slot: input.slot, root: input.blockRootHex};
|
|
73
74
|
this.logger.debug("Attempting data column sidecar reconstruction", logCtx);
|
|
74
|
-
recoverDataColumnSidecars(
|
|
75
|
+
recoverDataColumnSidecars(input, this.emitter, this.metrics)
|
|
75
76
|
.then((result) => {
|
|
76
77
|
this.metrics?.recoverDataColumnSidecars.reconstructionResult.inc({result});
|
|
77
78
|
this.logger.debug("Data column sidecar reconstruction complete", {...logCtx, result});
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
getDataColumnSidecarsFromExecution,
|
|
12
12
|
} from "../util/execution.js";
|
|
13
13
|
import {IBlockInput, isBlockInputBlobs} from "./blocks/blockInput/index.js";
|
|
14
|
+
import {PayloadEnvelopeInput} from "./blocks/payloadEnvelopeInput/index.js";
|
|
14
15
|
import {ChainEventEmitter} from "./emitter.js";
|
|
15
16
|
|
|
16
17
|
export type GetBlobsTrackerInit = {
|
|
@@ -43,22 +44,22 @@ export class GetBlobsTracker {
|
|
|
43
44
|
this.config = init.config;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
triggerGetBlobs(
|
|
47
|
-
if (this.activeReconstructions.has(
|
|
47
|
+
triggerGetBlobs(input: IBlockInput | PayloadEnvelopeInput, onComplete?: () => void): void {
|
|
48
|
+
if (this.activeReconstructions.has(input.blockRootHex)) {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
if (isBlockInputBlobs(
|
|
52
|
+
if (!(input instanceof PayloadEnvelopeInput) && isBlockInputBlobs(input)) {
|
|
52
53
|
// there is not preallocation for blob sidecars like there is for columns sidecars so no need to
|
|
53
54
|
// store the index for the preallocated buffers
|
|
54
|
-
this.activeReconstructions.add(
|
|
55
|
+
this.activeReconstructions.add(input.blockRootHex);
|
|
55
56
|
callInNextEventLoop(() => {
|
|
56
|
-
const logCtx = {slot:
|
|
57
|
+
const logCtx = {slot: input.slot, root: input.blockRootHex};
|
|
57
58
|
this.logger.verbose("Trigger getBlobsV1 for block", logCtx);
|
|
58
|
-
getBlobSidecarsFromExecution(this.config, this.executionEngine, this.metrics, this.emitter,
|
|
59
|
+
getBlobSidecarsFromExecution(this.config, this.executionEngine, this.metrics, this.emitter, input).finally(
|
|
59
60
|
() => {
|
|
60
61
|
this.logger.verbose("Completed getBlobsV1 for block", logCtx);
|
|
61
|
-
this.activeReconstructions.delete(
|
|
62
|
+
this.activeReconstructions.delete(input.blockRootHex);
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
});
|
|
@@ -72,7 +73,7 @@ export class GetBlobsTracker {
|
|
|
72
73
|
this.blobsAndProofsBuffers[freeIndex] = {inUse: false, buffers: []};
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
const maxBlobs = this.config.getMaxBlobsPerBlock(computeEpochAtSlot(
|
|
76
|
+
const maxBlobs = this.config.getMaxBlobsPerBlock(computeEpochAtSlot(input.slot));
|
|
76
77
|
// double check that there is enough pre-allocated space (blob schedule may have changed since the last use)
|
|
77
78
|
const timer = this.metrics?.peerDas.getBlobsV2PreAllocationTime.startTimer();
|
|
78
79
|
for (let i = 0; i < maxBlobs; i++) {
|
|
@@ -84,22 +85,23 @@ export class GetBlobsTracker {
|
|
|
84
85
|
|
|
85
86
|
// We don't care about the outcome of this call,
|
|
86
87
|
// just that it has been triggered for this block root.
|
|
87
|
-
this.activeReconstructions.add(
|
|
88
|
+
this.activeReconstructions.add(input.blockRootHex);
|
|
88
89
|
this.blobsAndProofsBuffers[freeIndex].inUse = true;
|
|
89
90
|
callInNextEventLoop(() => {
|
|
90
|
-
const logCtx = {slot:
|
|
91
|
+
const logCtx = {slot: input.slot, root: input.blockRootHex};
|
|
91
92
|
this.logger.verbose("Trigger getBlobsV2 for block", logCtx);
|
|
92
93
|
getDataColumnSidecarsFromExecution(
|
|
93
94
|
this.config,
|
|
94
95
|
this.executionEngine,
|
|
95
96
|
this.emitter,
|
|
96
|
-
|
|
97
|
+
input,
|
|
97
98
|
this.metrics,
|
|
98
99
|
this.blobsAndProofsBuffers[freeIndex].buffers
|
|
99
100
|
)
|
|
100
101
|
.then((result) => {
|
|
101
102
|
this.logger.debug("getBlobsV2 result for block", {...logCtx, result});
|
|
102
103
|
this.metrics?.dataColumns.dataColumnEngineResult.inc({result});
|
|
104
|
+
onComplete?.();
|
|
103
105
|
})
|
|
104
106
|
.catch((error) => {
|
|
105
107
|
this.logger.debug("Error during getBlobsV2 for block", logCtx, error as Error);
|
|
@@ -107,7 +109,7 @@ export class GetBlobsTracker {
|
|
|
107
109
|
})
|
|
108
110
|
.finally(() => {
|
|
109
111
|
this.logger.verbose("Completed getBlobsV2 for block", logCtx);
|
|
110
|
-
this.activeReconstructions.delete(
|
|
112
|
+
this.activeReconstructions.delete(input.blockRootHex);
|
|
111
113
|
this.blobsAndProofsBuffers[freeIndex].inUse = false;
|
|
112
114
|
});
|
|
113
115
|
});
|
|
@@ -617,7 +617,7 @@ type BlockInputColumnsState =
|
|
|
617
617
|
* - The block is not yet seen and all required sampled columns are seen
|
|
618
618
|
* - The block is not yet seen and all required sampled columns are not yet seen
|
|
619
619
|
*/
|
|
620
|
-
export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.
|
|
620
|
+
export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.DataColumnSidecar[]> {
|
|
621
621
|
type = DAType.Columns as const;
|
|
622
622
|
|
|
623
623
|
state: BlockInputColumnsState;
|
|
@@ -630,7 +630,7 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
|
|
|
630
630
|
*
|
|
631
631
|
* This is different from `dataPromise` which resolves when all data is available or could become available (e.g. through reconstruction)
|
|
632
632
|
*/
|
|
633
|
-
protected computedDataPromise = createPromise<fulu.
|
|
633
|
+
protected computedDataPromise = createPromise<fulu.DataColumnSidecar[]>();
|
|
634
634
|
|
|
635
635
|
private constructor(
|
|
636
636
|
init: BlockInputInit,
|
|
@@ -854,8 +854,8 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
|
|
|
854
854
|
return this.state.versionedHashes;
|
|
855
855
|
}
|
|
856
856
|
|
|
857
|
-
getCustodyColumns(): fulu.
|
|
858
|
-
const columns: fulu.
|
|
857
|
+
getCustodyColumns(): fulu.DataColumnSidecar[] {
|
|
858
|
+
const columns: fulu.DataColumnSidecar[] = [];
|
|
859
859
|
for (const index of this.custodyColumns) {
|
|
860
860
|
const column = this.columnsCache.get(index);
|
|
861
861
|
if (column) {
|
|
@@ -876,8 +876,8 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
|
|
|
876
876
|
return columns;
|
|
877
877
|
}
|
|
878
878
|
|
|
879
|
-
getSampledColumns(): fulu.
|
|
880
|
-
const columns: fulu.
|
|
879
|
+
getSampledColumns(): fulu.DataColumnSidecar[] {
|
|
880
|
+
const columns: fulu.DataColumnSidecar[] = [];
|
|
881
881
|
for (const index of this.sampledColumns) {
|
|
882
882
|
const column = this.columnsCache.get(index);
|
|
883
883
|
if (column) {
|
|
@@ -891,7 +891,7 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
|
|
|
891
891
|
return [...this.columnsCache.values()];
|
|
892
892
|
}
|
|
893
893
|
|
|
894
|
-
getAllColumns(): fulu.
|
|
894
|
+
getAllColumns(): fulu.DataColumnSidecar[] {
|
|
895
895
|
return this.getAllColumnsWithSource().map(({columnSidecar}) => columnSidecar);
|
|
896
896
|
}
|
|
897
897
|
|
|
@@ -919,7 +919,7 @@ export class BlockInputColumns extends AbstractBlockInput<ForkColumnsDA, fulu.Da
|
|
|
919
919
|
return this.state.hasComputedAllData;
|
|
920
920
|
}
|
|
921
921
|
|
|
922
|
-
waitForComputedAllData(timeout: number, signal?: AbortSignal): Promise<fulu.
|
|
922
|
+
waitForComputedAllData(timeout: number, signal?: AbortSignal): Promise<fulu.DataColumnSidecar[]> {
|
|
923
923
|
if (!this.state.hasComputedAllData) {
|
|
924
924
|
return withTimeout(() => this.computedDataPromise.promise, timeout, signal);
|
|
925
925
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ForkName} from "@lodestar/params";
|
|
2
|
-
import {ColumnIndex,
|
|
2
|
+
import {ColumnIndex, DataColumnSidecar, RootHex, SignedBeaconBlock, Slot, deneb, fulu} from "@lodestar/types";
|
|
3
3
|
import {VersionedHashes} from "../../../execution/index.js";
|
|
4
4
|
|
|
5
5
|
export enum DAType {
|
|
@@ -9,7 +9,7 @@ export enum DAType {
|
|
|
9
9
|
NoData = "no-data",
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export type DAData = null | deneb.BlobSidecars | fulu.
|
|
12
|
+
export type DAData = null | deneb.BlobSidecars | fulu.DataColumnSidecar[];
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Represents were input originated. Blocks and Data can come from different
|
|
@@ -108,9 +108,9 @@ export type MissingColumnMeta = {
|
|
|
108
108
|
export interface IDataColumnsInput {
|
|
109
109
|
readonly slot: Slot;
|
|
110
110
|
readonly blockRootHex: string;
|
|
111
|
-
getCustodyColumns():
|
|
111
|
+
getCustodyColumns(): DataColumnSidecar[];
|
|
112
112
|
hasComputedAllData(): boolean;
|
|
113
|
-
waitForComputedAllData(timeout: number, signal?: AbortSignal): Promise<
|
|
113
|
+
waitForComputedAllData(timeout: number, signal?: AbortSignal): Promise<DataColumnSidecar[]>;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
|
@@ -140,9 +140,10 @@ export async function importBlock(
|
|
|
140
140
|
|
|
141
141
|
// For Gloas blocks, create PayloadEnvelopeInput so it's available for later payload import
|
|
142
142
|
if (fork >= ForkSeq.gloas) {
|
|
143
|
-
this.seenPayloadEnvelopeInputCache.add({
|
|
143
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.add({
|
|
144
144
|
blockRootHex,
|
|
145
145
|
block: block as SignedBeaconBlock<ForkPostGloas>,
|
|
146
|
+
forkName: blockInput.forkName,
|
|
146
147
|
sampledColumns: this.custodyConfig.sampledColumns,
|
|
147
148
|
custodyColumns: this.custodyConfig.custodyColumns,
|
|
148
149
|
timeCreatedSec: fullyVerifiedBlock.seenTimestampSec,
|
|
@@ -153,6 +154,22 @@ export async function importBlock(
|
|
|
153
154
|
source: source.source,
|
|
154
155
|
...(opts.seenTimestampSec !== undefined ? {recvToImport: Date.now() / 1000 - opts.seenTimestampSec} : {}),
|
|
155
156
|
});
|
|
157
|
+
|
|
158
|
+
// Immediately attempt fetch of data columns from execution engine as the bid contains kzg commitments
|
|
159
|
+
// which is all the information we need so there is no reason to delay until execution payload arrives
|
|
160
|
+
// TODO GLOAS: If we want EL retries after this initial attempt, add an explicit retry policy here
|
|
161
|
+
// (for example later in the slot). Do not couple retries to incoming gossip columns.
|
|
162
|
+
this.getBlobsTracker.triggerGetBlobs(payloadInput, () => {
|
|
163
|
+
// TODO GLOAS: come up with a better mechanism to trigger processExecutionPayload after data becomes available,
|
|
164
|
+
// similar to how pre-gloas uses waitForBlockAndAllData with a cutoff timeout and incompleteBlockInput event
|
|
165
|
+
this.processExecutionPayload(payloadInput, {validSignature: true}).catch((e) => {
|
|
166
|
+
this.logger.debug(
|
|
167
|
+
"Error processing execution payload after getBlobs",
|
|
168
|
+
{slot: blockSlot, root: blockRootHex},
|
|
169
|
+
e as Error
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
156
173
|
}
|
|
157
174
|
|
|
158
175
|
this.metrics?.importBlock.bySource.inc({source: source.source});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {NUMBER_OF_COLUMNS} from "@lodestar/params";
|
|
2
|
-
import {ColumnIndex,
|
|
1
|
+
import {ForkName, NUMBER_OF_COLUMNS} from "@lodestar/params";
|
|
2
|
+
import {ColumnIndex, RootHex, Slot, ValidatorIndex, deneb, gloas} from "@lodestar/types";
|
|
3
3
|
import {toRootHex, withTimeout} from "@lodestar/utils";
|
|
4
4
|
import {VersionedHashes} from "../../../execution/index.js";
|
|
5
5
|
import {kzgCommitmentToVersionedHash} from "../../../util/blobs.js";
|
|
6
|
+
import {MissingColumnMeta} from "../blockInput/types.js";
|
|
6
7
|
import {AddPayloadEnvelopeProps, ColumnWithSource, CreateFromBlockProps, SourceMeta} from "./types.js";
|
|
7
8
|
|
|
8
9
|
export type PayloadEnvelopeInputState =
|
|
@@ -59,6 +60,7 @@ function createPromise<T>(): PromiseParts<T> {
|
|
|
59
60
|
export class PayloadEnvelopeInput {
|
|
60
61
|
readonly blockRootHex: RootHex;
|
|
61
62
|
readonly slot: Slot;
|
|
63
|
+
readonly forkName: ForkName;
|
|
62
64
|
readonly proposerIndex: ValidatorIndex;
|
|
63
65
|
readonly bid: gloas.ExecutionPayloadBid;
|
|
64
66
|
readonly versionedHashes: VersionedHashes;
|
|
@@ -71,13 +73,14 @@ export class PayloadEnvelopeInput {
|
|
|
71
73
|
private timeCreatedSec: number;
|
|
72
74
|
|
|
73
75
|
private readonly payloadEnvelopeDataPromise: PromiseParts<gloas.SignedExecutionPayloadEnvelope>;
|
|
74
|
-
private readonly columnsDataPromise: PromiseParts<
|
|
76
|
+
private readonly columnsDataPromise: PromiseParts<gloas.DataColumnSidecar[]>;
|
|
75
77
|
|
|
76
78
|
state: PayloadEnvelopeInputState;
|
|
77
79
|
|
|
78
80
|
private constructor(props: {
|
|
79
81
|
blockRootHex: RootHex;
|
|
80
82
|
slot: Slot;
|
|
83
|
+
forkName: ForkName;
|
|
81
84
|
proposerIndex: ValidatorIndex;
|
|
82
85
|
bid: gloas.ExecutionPayloadBid;
|
|
83
86
|
sampledColumns: ColumnIndex[];
|
|
@@ -86,6 +89,7 @@ export class PayloadEnvelopeInput {
|
|
|
86
89
|
}) {
|
|
87
90
|
this.blockRootHex = props.blockRootHex;
|
|
88
91
|
this.slot = props.slot;
|
|
92
|
+
this.forkName = props.forkName;
|
|
89
93
|
this.proposerIndex = props.proposerIndex;
|
|
90
94
|
this.bid = props.bid;
|
|
91
95
|
this.versionedHashes = props.bid.blobKzgCommitments.map(kzgCommitmentToVersionedHash);
|
|
@@ -112,6 +116,7 @@ export class PayloadEnvelopeInput {
|
|
|
112
116
|
return new PayloadEnvelopeInput({
|
|
113
117
|
blockRootHex: props.blockRootHex,
|
|
114
118
|
slot: props.block.message.slot,
|
|
119
|
+
forkName: props.forkName,
|
|
115
120
|
proposerIndex: props.block.message.proposerIndex,
|
|
116
121
|
bid,
|
|
117
122
|
sampledColumns: props.sampledColumns,
|
|
@@ -173,8 +178,12 @@ export class PayloadEnvelopeInput {
|
|
|
173
178
|
}
|
|
174
179
|
}
|
|
175
180
|
|
|
176
|
-
addColumn(columnWithSource: ColumnWithSource):
|
|
181
|
+
addColumn(columnWithSource: ColumnWithSource): boolean {
|
|
177
182
|
const {columnSidecar, seenTimestampSec} = columnWithSource;
|
|
183
|
+
if (this.columnsCache.has(columnSidecar.index)) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
|
|
178
187
|
this.columnsCache.set(columnSidecar.index, columnWithSource);
|
|
179
188
|
|
|
180
189
|
const sampledColumns = this.getSampledColumns();
|
|
@@ -191,7 +200,7 @@ export class PayloadEnvelopeInput {
|
|
|
191
200
|
sampledColumns.length === this.sampledColumns.length;
|
|
192
201
|
|
|
193
202
|
if (!hasAllData) {
|
|
194
|
-
return;
|
|
203
|
+
return true;
|
|
195
204
|
}
|
|
196
205
|
|
|
197
206
|
if (hasComputedAllData) {
|
|
@@ -217,6 +226,20 @@ export class PayloadEnvelopeInput {
|
|
|
217
226
|
hasComputedAllData: hasComputedAllData || this.state.hasComputedAllData,
|
|
218
227
|
};
|
|
219
228
|
}
|
|
229
|
+
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
hasColumn(index: ColumnIndex): boolean {
|
|
234
|
+
return this.columnsCache.has(index);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
getColumn(index: ColumnIndex): gloas.DataColumnSidecar | undefined {
|
|
238
|
+
return this.columnsCache.get(index)?.columnSidecar;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
getAllColumns(): gloas.DataColumnSidecar[] {
|
|
242
|
+
return [...this.columnsCache.values()].map(({columnSidecar}) => columnSidecar);
|
|
220
243
|
}
|
|
221
244
|
|
|
222
245
|
getVersionedHashes(): VersionedHashes {
|
|
@@ -237,8 +260,8 @@ export class PayloadEnvelopeInput {
|
|
|
237
260
|
return this.state.payloadEnvelopeSource;
|
|
238
261
|
}
|
|
239
262
|
|
|
240
|
-
getSampledColumns(): gloas.
|
|
241
|
-
const columns: gloas.
|
|
263
|
+
getSampledColumns(): gloas.DataColumnSidecar[] {
|
|
264
|
+
const columns: gloas.DataColumnSidecar[] = [];
|
|
242
265
|
for (const index of this.sampledColumns) {
|
|
243
266
|
const column = this.columnsCache.get(index);
|
|
244
267
|
if (column) {
|
|
@@ -259,8 +282,8 @@ export class PayloadEnvelopeInput {
|
|
|
259
282
|
return columns;
|
|
260
283
|
}
|
|
261
284
|
|
|
262
|
-
getCustodyColumns(): gloas.
|
|
263
|
-
const columns: gloas.
|
|
285
|
+
getCustodyColumns(): gloas.DataColumnSidecar[] {
|
|
286
|
+
const columns: gloas.DataColumnSidecar[] = [];
|
|
264
287
|
for (const index of this.custodyColumns) {
|
|
265
288
|
const column = this.columnsCache.get(index);
|
|
266
289
|
if (column) {
|
|
@@ -270,11 +293,29 @@ export class PayloadEnvelopeInput {
|
|
|
270
293
|
return columns;
|
|
271
294
|
}
|
|
272
295
|
|
|
296
|
+
hasAllData(): boolean {
|
|
297
|
+
return this.state.hasAllData;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
getMissingSampledColumnMeta(): MissingColumnMeta {
|
|
301
|
+
if (this.state.hasAllData) {
|
|
302
|
+
return {missing: [], versionedHashes: this.versionedHashes};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const missing: ColumnIndex[] = [];
|
|
306
|
+
for (const index of this.sampledColumns) {
|
|
307
|
+
if (!this.columnsCache.has(index)) {
|
|
308
|
+
missing.push(index);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return {missing, versionedHashes: this.versionedHashes};
|
|
312
|
+
}
|
|
313
|
+
|
|
273
314
|
hasComputedAllData(): boolean {
|
|
274
315
|
return this.state.hasComputedAllData;
|
|
275
316
|
}
|
|
276
317
|
|
|
277
|
-
waitForComputedAllData(timeout: number, signal?: AbortSignal): Promise<
|
|
318
|
+
waitForComputedAllData(timeout: number, signal?: AbortSignal): Promise<gloas.DataColumnSidecar[]> {
|
|
278
319
|
if (this.state.hasComputedAllData) {
|
|
279
320
|
return Promise.resolve(this.getSampledColumns());
|
|
280
321
|
}
|
|
@@ -319,7 +360,7 @@ export class PayloadEnvelopeInput {
|
|
|
319
360
|
hasAllData: boolean;
|
|
320
361
|
hasComputedAllData: boolean;
|
|
321
362
|
isComplete: boolean;
|
|
322
|
-
|
|
363
|
+
receivedColumns: number;
|
|
323
364
|
sampledColumnsCount: number;
|
|
324
365
|
} {
|
|
325
366
|
return {
|
|
@@ -329,7 +370,7 @@ export class PayloadEnvelopeInput {
|
|
|
329
370
|
hasAllData: this.state.hasAllData,
|
|
330
371
|
hasComputedAllData: this.state.hasComputedAllData,
|
|
331
372
|
isComplete: this.isComplete(),
|
|
332
|
-
|
|
373
|
+
receivedColumns: this.columnsCache.size,
|
|
333
374
|
sampledColumnsCount: this.sampledColumns.length,
|
|
334
375
|
};
|
|
335
376
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {ForkPostGloas} from "@lodestar/params";
|
|
1
|
+
import {ForkName, ForkPostGloas} from "@lodestar/params";
|
|
2
2
|
import {ColumnIndex, RootHex, SignedBeaconBlock, gloas} from "@lodestar/types";
|
|
3
3
|
|
|
4
4
|
export enum PayloadEnvelopeInputSource {
|
|
@@ -23,6 +23,7 @@ export type ColumnWithSource = SourceMeta & {
|
|
|
23
23
|
export type CreateFromBlockProps = {
|
|
24
24
|
blockRootHex: RootHex;
|
|
25
25
|
block: SignedBeaconBlock<ForkPostGloas>;
|
|
26
|
+
forkName: ForkName;
|
|
26
27
|
sampledColumns: ColumnIndex[];
|
|
27
28
|
custodyColumns: ColumnIndex[];
|
|
28
29
|
timeCreatedSec: number;
|