@lodestar/beacon-node 1.42.0-dev.7df0e2c8fa → 1.42.0-dev.8300b502a6
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 +24 -12
- 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/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +1 -0
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts +3 -3
- package/lib/chain/archiveStore/historicalState/getHistoricalState.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js +6 -4
- package/lib/chain/archiveStore/historicalState/getHistoricalState.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts +2 -2
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +1 -0
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/types.d.ts +2 -0
- package/lib/chain/archiveStore/historicalState/types.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/types.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +1 -4
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/archiveStore/interface.d.ts +1 -0
- package/lib/chain/archiveStore/interface.d.ts.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 +34 -20
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts +10 -8
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +86 -49
- package/lib/chain/blocks/importExecutionPayload.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/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 +20 -14
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts +2 -2
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +4 -3
- 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 +3 -2
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +68 -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 +6 -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/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 +4 -2
- package/lib/chain/interface.d.ts.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/options.d.ts +1 -0
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +1 -0
- package/lib/chain/options.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 +14 -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/libp2p/index.d.ts.map +1 -1
- package/lib/network/libp2p/index.js +19 -13
- package/lib/network/libp2p/index.js.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/options.d.ts.map +1 -1
- package/lib/network/options.js +7 -2
- package/lib/network/options.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 +260 -73
- 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/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 +32 -15
- 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/archiveStore/archiveStore.ts +1 -0
- package/src/chain/archiveStore/historicalState/getHistoricalState.ts +6 -5
- package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +2 -1
- package/src/chain/archiveStore/historicalState/types.ts +2 -0
- package/src/chain/archiveStore/historicalState/worker.ts +1 -5
- package/src/chain/archiveStore/interface.ts +1 -0
- package/src/chain/blocks/blockInput/blockInput.ts +8 -8
- package/src/chain/blocks/blockInput/types.ts +4 -4
- package/src/chain/blocks/importBlock.ts +45 -23
- package/src/chain/blocks/importExecutionPayload.ts +94 -53
- package/src/chain/blocks/index.ts +2 -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 +25 -14
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +6 -5
- package/src/chain/blocks/verifyBlocksSignatures.ts +9 -2
- package/src/chain/chain.ts +77 -32
- package/src/chain/emitter.ts +25 -7
- package/src/chain/errors/blockError.ts +4 -1
- package/src/chain/errors/dataColumnSidecarError.ts +32 -1
- package/src/chain/forkChoice/index.ts +11 -8
- package/src/chain/interface.ts +4 -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/options.ts +2 -0
- 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 +15 -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/libp2p/index.ts +21 -15
- package/src/network/network.ts +7 -4
- package/src/network/options.ts +7 -2
- package/src/network/processor/extractSlotRootFns.ts +32 -6
- package/src/network/processor/gossipHandlers.ts +325 -86
- package/src/network/processor/index.ts +304 -22
- 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
|
-
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {
|
|
2
|
+
import {BlockExecutionStatus, PayloadExecutionStatus} from "@lodestar/fork-choice";
|
|
3
3
|
import {ForkSeq} from "@lodestar/params";
|
|
4
4
|
import {DataAvailabilityStatus, IBeaconStateView, computeEpochAtSlot} from "@lodestar/state-transition";
|
|
5
5
|
import type {IndexedAttestation, Slot, fulu} from "@lodestar/types";
|
|
@@ -88,24 +88,35 @@ export type ImportBlockOpts = {
|
|
|
88
88
|
seenTimestampSec?: number;
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
* A wrapper around a `SignedBeaconBlock` that indicates that this block is fully verified and ready to import
|
|
93
|
-
*/
|
|
94
|
-
export type FullyVerifiedBlock = {
|
|
91
|
+
type FullyVerifiedBlockBase = {
|
|
95
92
|
blockInput: IBlockInput;
|
|
96
|
-
|
|
93
|
+
postBlockState: IBeaconStateView;
|
|
97
94
|
parentBlockSlot: Slot;
|
|
98
95
|
proposerBalanceDelta: number;
|
|
99
|
-
/**
|
|
100
|
-
* If the execution payload couldnt be verified because of EL syncing status,
|
|
101
|
-
* used in optimistic sync or for merge block
|
|
102
|
-
*/
|
|
103
|
-
executionStatus: MaybeValidExecutionStatus;
|
|
104
96
|
dataAvailabilityStatus: DataAvailabilityStatus;
|
|
105
|
-
/**
|
|
106
|
-
* Pre-computed indexed attestations from signature verification to avoid duplicate work
|
|
107
|
-
*/
|
|
97
|
+
/** Pre-computed indexed attestations from signature verification to avoid duplicate work */
|
|
108
98
|
indexedAttestations: IndexedAttestation[];
|
|
109
99
|
/** Seen timestamp seconds */
|
|
110
100
|
seenTimestampSec: number;
|
|
111
101
|
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* A wrapper around a `SignedBeaconBlock` that indicates that this block is fully verified and ready to import.
|
|
105
|
+
*
|
|
106
|
+
* Discriminated union on `postPayloadState`:
|
|
107
|
+
* - `null` → block has no pre-verified envelope; `executionStatus` is any `BlockExecutionStatus`
|
|
108
|
+
* - non-null → envelope was pre-verified during state transition; `executionStatus` is narrowed to
|
|
109
|
+
* `Valid | Syncing` (matching what `forkChoice.onExecutionPayload` expects)
|
|
110
|
+
*/
|
|
111
|
+
export type FullyVerifiedBlock = FullyVerifiedBlockBase &
|
|
112
|
+
(
|
|
113
|
+
| {
|
|
114
|
+
postPayloadState: null;
|
|
115
|
+
/** If the execution payload couldn't be verified because of EL syncing status, used in optimistic sync or for merge block */
|
|
116
|
+
executionStatus: BlockExecutionStatus;
|
|
117
|
+
}
|
|
118
|
+
| {
|
|
119
|
+
postPayloadState: IBeaconStateView;
|
|
120
|
+
executionStatus: PayloadExecutionStatus;
|
|
121
|
+
}
|
|
122
|
+
);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {
|
|
3
|
+
BlockExecutionStatus,
|
|
3
4
|
ExecutionStatus,
|
|
4
5
|
IForkChoice,
|
|
5
6
|
LVHInvalidResponse,
|
|
6
7
|
LVHValidResponse,
|
|
7
|
-
MaybeValidExecutionStatus,
|
|
8
8
|
ProtoBlock,
|
|
9
9
|
} from "@lodestar/fork-choice";
|
|
10
10
|
import {ForkSeq} from "@lodestar/params";
|
|
11
|
-
import {IBeaconStateView, isExecutionBlockBodyType} from "@lodestar/state-transition";
|
|
11
|
+
import {IBeaconStateView, isExecutionBlockBodyType, isStatePostBellatrix} from "@lodestar/state-transition";
|
|
12
12
|
import {bellatrix, electra} from "@lodestar/types";
|
|
13
13
|
import {ErrorAborted, Logger, toRootHex} from "@lodestar/utils";
|
|
14
14
|
import {ExecutionPayloadStatus, IExecutionEngine} from "../../execution/engine/interface.js";
|
|
@@ -33,7 +33,7 @@ type ExecAbortType = {blockIndex: number; execError: BlockError};
|
|
|
33
33
|
export type SegmentExecStatus =
|
|
34
34
|
| {
|
|
35
35
|
execAborted: null;
|
|
36
|
-
executionStatuses:
|
|
36
|
+
executionStatuses: BlockExecutionStatus[];
|
|
37
37
|
executionTime: number;
|
|
38
38
|
}
|
|
39
39
|
| {execAborted: ExecAbortType; invalidSegmentLVH?: LVHInvalidResponse};
|
|
@@ -62,7 +62,7 @@ export async function verifyBlocksExecutionPayload(
|
|
|
62
62
|
signal: AbortSignal,
|
|
63
63
|
opts: BlockProcessOpts & ImportBlockOpts
|
|
64
64
|
): Promise<SegmentExecStatus> {
|
|
65
|
-
const executionStatuses:
|
|
65
|
+
const executionStatuses: BlockExecutionStatus[] = [];
|
|
66
66
|
const recvToValLatency = Date.now() / 1000 - (opts.seenTimestampSec ?? Date.now() / 1000);
|
|
67
67
|
const lastBlock = blockInputs.at(-1);
|
|
68
68
|
|
|
@@ -103,7 +103,7 @@ export async function verifyBlocksExecutionPayload(
|
|
|
103
103
|
return getSegmentErrorResponse({verifyResponse, blockIndex}, parentBlock, blockInputs);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
// If we are here then its because executionStatus is one of
|
|
106
|
+
// If we are here then its because executionStatus is one of BlockExecutionStatus
|
|
107
107
|
const {executionStatus} = verifyResponse;
|
|
108
108
|
executionStatuses.push(executionStatus);
|
|
109
109
|
}
|
|
@@ -152,6 +152,7 @@ export async function verifyBlockExecutionPayload(
|
|
|
152
152
|
|
|
153
153
|
/** Not null if execution is enabled */
|
|
154
154
|
const executionPayloadEnabled =
|
|
155
|
+
isStatePostBellatrix(preState0) &&
|
|
155
156
|
preState0.isExecutionStateType &&
|
|
156
157
|
isExecutionBlockBodyType(block.message.body) &&
|
|
157
158
|
preState0.isExecutionEnabled(block.message)
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
IBeaconStateView,
|
|
4
|
+
SyncCommitteeCacheEmpty,
|
|
5
|
+
getBlockSignatureSets,
|
|
6
|
+
isStatePostAltair,
|
|
7
|
+
} from "@lodestar/state-transition";
|
|
3
8
|
import {IndexedAttestation, SignedBeaconBlock} from "@lodestar/types";
|
|
4
9
|
import {Logger} from "@lodestar/utils";
|
|
5
10
|
import {Metrics} from "../../metrics/metrics.js";
|
|
@@ -27,7 +32,9 @@ export async function verifyBlocksSignatures(
|
|
|
27
32
|
): Promise<{verifySignaturesTime: number}> {
|
|
28
33
|
const isValidPromises: Promise<boolean>[] = [];
|
|
29
34
|
const recvToValLatency = Date.now() / 1000 - (opts.seenTimestampSec ?? Date.now() / 1000);
|
|
30
|
-
const currentSyncCommitteeIndexed = preState0
|
|
35
|
+
const currentSyncCommitteeIndexed = isStatePostAltair(preState0)
|
|
36
|
+
? preState0.currentSyncCommitteeIndexed
|
|
37
|
+
: new SyncCommitteeCacheEmpty();
|
|
31
38
|
|
|
32
39
|
// Verifies signatures after running state transition, so all SyncCommittee signed roots are known at this point.
|
|
33
40
|
// We must ensure block.slot <= state.slot before running getAllBlockSignatureSets().
|
package/src/chain/chain.ts
CHANGED
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
BUILDER_INDEX_SELF_BUILD,
|
|
16
16
|
EFFECTIVE_BALANCE_INCREMENT,
|
|
17
17
|
type ForkPostFulu,
|
|
18
|
+
type ForkPostGloas,
|
|
18
19
|
GENESIS_SLOT,
|
|
19
20
|
SLOTS_PER_EPOCH,
|
|
20
|
-
isForkPostElectra,
|
|
21
21
|
isForkPostGloas,
|
|
22
22
|
} from "@lodestar/params";
|
|
23
23
|
import {
|
|
@@ -29,12 +29,15 @@ import {
|
|
|
29
29
|
computeEpochAtSlot,
|
|
30
30
|
computeStartSlotAtEpoch,
|
|
31
31
|
getEffectiveBalancesFromStateBytes,
|
|
32
|
+
isStatePostAltair,
|
|
33
|
+
isStatePostElectra,
|
|
34
|
+
isStatePostGloas,
|
|
32
35
|
} from "@lodestar/state-transition";
|
|
33
36
|
import {
|
|
34
37
|
BeaconBlock,
|
|
35
38
|
BlindedBeaconBlock,
|
|
36
39
|
BlindedBeaconBlockBody,
|
|
37
|
-
|
|
40
|
+
DataColumnSidecar,
|
|
38
41
|
Epoch,
|
|
39
42
|
Root,
|
|
40
43
|
RootHex,
|
|
@@ -97,7 +100,7 @@ import {
|
|
|
97
100
|
} from "./opPools/index.js";
|
|
98
101
|
import {IChainOptions} from "./options.js";
|
|
99
102
|
import {PrepareNextSlotScheduler} from "./prepareNextSlot.js";
|
|
100
|
-
import {
|
|
103
|
+
import {computeNewStateRoot, computePayloadEnvelopeStateRoot} from "./produceBlock/computeNewStateRoot.js";
|
|
101
104
|
import {AssembledBlockType, BlockType, ProduceFullGloas, ProduceResult} from "./produceBlock/index.js";
|
|
102
105
|
import {BlockAttributes, produceBlockBody, produceCommonBlockBody} from "./produceBlock/produceBlockBody.js";
|
|
103
106
|
import {QueuedStateRegenerator, RegenCaller} from "./regen/index.js";
|
|
@@ -504,7 +507,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
504
507
|
}
|
|
505
508
|
|
|
506
509
|
seenBlock(blockRoot: RootHex): boolean {
|
|
507
|
-
return this.seenBlockInputCache.
|
|
510
|
+
return this.seenBlockInputCache.hasBlock(blockRoot) || this.forkChoice.hasBlockHexUnsafe(blockRoot);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
seenPayloadEnvelope(blockRoot: RootHex): boolean {
|
|
514
|
+
return this.seenPayloadEnvelopeInputCache.hasPayload(blockRoot) || this.forkChoice.hasPayloadHexUnsafe(blockRoot);
|
|
508
515
|
}
|
|
509
516
|
|
|
510
517
|
regenCanAcceptWork(): boolean {
|
|
@@ -873,20 +880,32 @@ export class BeaconChain implements IBeaconChain {
|
|
|
873
880
|
);
|
|
874
881
|
}
|
|
875
882
|
|
|
876
|
-
async getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
883
|
+
async getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<DataColumnSidecar[]> {
|
|
884
|
+
const fork = this.config.getForkName(blockSlot);
|
|
885
|
+
|
|
886
|
+
if (isForkPostGloas(fork)) {
|
|
887
|
+
// After gloas, columns are tracked in PayloadEnvelopeInput
|
|
888
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
889
|
+
if (payloadInput) {
|
|
890
|
+
return payloadInput.getAllColumns();
|
|
891
|
+
}
|
|
892
|
+
} else {
|
|
893
|
+
// Before gloas, columns are tracked in BlockInput
|
|
894
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
895
|
+
if (blockInput) {
|
|
896
|
+
if (!isBlockInputColumns(blockInput)) {
|
|
897
|
+
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
898
|
+
}
|
|
899
|
+
return blockInput.getAllColumns();
|
|
881
900
|
}
|
|
882
|
-
return blockInput.getAllColumns();
|
|
883
901
|
}
|
|
902
|
+
|
|
884
903
|
const sidecarsUnfinalized = await this.db.dataColumnSidecar.values(fromHex(blockRootHex));
|
|
885
904
|
if (sidecarsUnfinalized.length > 0) {
|
|
886
|
-
return sidecarsUnfinalized
|
|
905
|
+
return sidecarsUnfinalized;
|
|
887
906
|
}
|
|
888
907
|
const sidecarsFinalized = await this.db.dataColumnSidecarArchive.values(blockSlot);
|
|
889
|
-
return sidecarsFinalized
|
|
908
|
+
return sidecarsFinalized;
|
|
890
909
|
}
|
|
891
910
|
|
|
892
911
|
async getSerializedDataColumnSidecars(
|
|
@@ -894,23 +913,45 @@ export class BeaconChain implements IBeaconChain {
|
|
|
894
913
|
blockRootHex: string,
|
|
895
914
|
indices: number[]
|
|
896
915
|
): Promise<(Uint8Array | undefined)[]> {
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
916
|
+
const fork = this.config.getForkName(blockSlot);
|
|
917
|
+
|
|
918
|
+
if (isForkPostGloas(fork)) {
|
|
919
|
+
// After gloas, columns are tracked in PayloadEnvelopeInput
|
|
920
|
+
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
921
|
+
if (payloadInput) {
|
|
922
|
+
return indices.map((index) => {
|
|
923
|
+
const sidecar = payloadInput.getColumn(index);
|
|
924
|
+
if (!sidecar) {
|
|
925
|
+
return undefined;
|
|
926
|
+
}
|
|
927
|
+
const serialized = this.serializedCache.get(sidecar);
|
|
928
|
+
if (serialized) {
|
|
929
|
+
return serialized;
|
|
930
|
+
}
|
|
931
|
+
return sszTypesFor(fork as ForkPostGloas).DataColumnSidecar.serialize(sidecar);
|
|
932
|
+
});
|
|
901
933
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
if (serialized) {
|
|
909
|
-
return serialized;
|
|
934
|
+
} else {
|
|
935
|
+
// Before gloas, columns are tracked in BlockInput
|
|
936
|
+
const blockInput = this.seenBlockInputCache.get(blockRootHex);
|
|
937
|
+
if (blockInput) {
|
|
938
|
+
if (!isBlockInputColumns(blockInput)) {
|
|
939
|
+
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
910
940
|
}
|
|
911
|
-
return
|
|
912
|
-
|
|
941
|
+
return indices.map((index) => {
|
|
942
|
+
const sidecar = blockInput.getColumn(index);
|
|
943
|
+
if (!sidecar) {
|
|
944
|
+
return undefined;
|
|
945
|
+
}
|
|
946
|
+
const serialized = this.serializedCache.get(sidecar);
|
|
947
|
+
if (serialized) {
|
|
948
|
+
return serialized;
|
|
949
|
+
}
|
|
950
|
+
return sszTypesFor(blockInput.forkName as ForkPostFulu).DataColumnSidecar.serialize(sidecar);
|
|
951
|
+
});
|
|
952
|
+
}
|
|
913
953
|
}
|
|
954
|
+
|
|
914
955
|
const sidecarsUnfinalized = await this.db.dataColumnSidecar.getManyBinary(fromHex(blockRootHex), indices);
|
|
915
956
|
if (sidecarsUnfinalized.some((sidecar) => sidecar != null)) {
|
|
916
957
|
return sidecarsUnfinalized;
|
|
@@ -1013,7 +1054,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1013
1054
|
body,
|
|
1014
1055
|
} as AssembledBlockType<T>;
|
|
1015
1056
|
|
|
1016
|
-
const {newStateRoot, proposerReward,
|
|
1057
|
+
const {newStateRoot, proposerReward, postBlockState} = computeNewStateRoot(this.metrics, state, block);
|
|
1017
1058
|
block.stateRoot = newStateRoot;
|
|
1018
1059
|
const blockRoot =
|
|
1019
1060
|
produceResult.type === BlockType.Full
|
|
@@ -1037,8 +1078,11 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1037
1078
|
slot,
|
|
1038
1079
|
stateRoot: ZERO_HASH,
|
|
1039
1080
|
};
|
|
1040
|
-
|
|
1041
|
-
|
|
1081
|
+
if (!isStatePostGloas(postBlockState)) {
|
|
1082
|
+
throw Error(`Expected gloas+ post-state for execution payload envelope, got fork=${postBlockState.forkName}`);
|
|
1083
|
+
}
|
|
1084
|
+
const payloadEnvelopeStateRoot = computePayloadEnvelopeStateRoot(this.metrics, postBlockState, envelope);
|
|
1085
|
+
gloasResult.payloadEnvelopeStateRoot = payloadEnvelopeStateRoot;
|
|
1042
1086
|
}
|
|
1043
1087
|
|
|
1044
1088
|
// Track the produced block for consensus broadcast validations, later validation, etc.
|
|
@@ -1365,9 +1409,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1365
1409
|
metrics.chain.blacklistedBlocks.set(this.blacklistedBlocks.size);
|
|
1366
1410
|
|
|
1367
1411
|
const headState = this.getHeadState();
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
if (isForkPostElectra(fork)) {
|
|
1412
|
+
if (isStatePostElectra(headState)) {
|
|
1371
1413
|
metrics.pendingDeposits.set(headState.pendingDepositsCount);
|
|
1372
1414
|
metrics.pendingPartialWithdrawals.set(headState.pendingPartialWithdrawalsCount);
|
|
1373
1415
|
metrics.pendingConsolidations.set(headState.pendingConsolidationsCount);
|
|
@@ -1614,6 +1656,9 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1614
1656
|
}
|
|
1615
1657
|
|
|
1616
1658
|
preState = preState.processSlots(block.slot); // Dial preState's slot to block.slot
|
|
1659
|
+
if (!isStatePostAltair(preState)) {
|
|
1660
|
+
throw new Error("Sync committee rewards are not supported before Altair");
|
|
1661
|
+
}
|
|
1617
1662
|
|
|
1618
1663
|
return preState.computeSyncCommitteeRewards(block, validatorIds ?? []);
|
|
1619
1664
|
}
|
package/src/chain/emitter.ts
CHANGED
|
@@ -3,7 +3,8 @@ import {StrictEventEmitter} from "strict-event-emitter-types";
|
|
|
3
3
|
import {routes} from "@lodestar/api";
|
|
4
4
|
import {CheckpointWithPayloadStatus} from "@lodestar/fork-choice";
|
|
5
5
|
import {IBeaconStateView} from "@lodestar/state-transition";
|
|
6
|
-
import {
|
|
6
|
+
import {DataColumnSidecar, RootHex, deneb, phase0} from "@lodestar/types";
|
|
7
|
+
import {SignedExecutionPayloadEnvelope} from "@lodestar/types/gloas";
|
|
7
8
|
import {PeerIdStr} from "../util/peerId.js";
|
|
8
9
|
import {BlockInputSource, IBlockInput} from "./blocks/blockInput/types.js";
|
|
9
10
|
|
|
@@ -54,13 +55,22 @@ export enum ChainEvent {
|
|
|
54
55
|
*/
|
|
55
56
|
updateStatus = "updateStatus",
|
|
56
57
|
/**
|
|
57
|
-
* Trigger
|
|
58
|
+
* Trigger BlockInputSync to find parent of a SignedBeaconBlock received
|
|
59
|
+
* Post-gloas, missing parent could be a SignedBeaconBlock and/or a SignedExecutionPayloadEnvelope
|
|
58
60
|
*/
|
|
59
|
-
|
|
61
|
+
blockUnknownParent = "blockUnknownParent",
|
|
60
62
|
/**
|
|
61
|
-
* Trigger BlockInputSync
|
|
63
|
+
* Trigger BlockInputSync to find a SignedBeaconBlock given a SignedExecutionPayloadEnvelop received
|
|
64
|
+
*/
|
|
65
|
+
envelopeUnknownBlock = "envelopeUnknownBlock",
|
|
66
|
+
/**
|
|
67
|
+
* Trigger BlockInputSync to find a SignedBeaconBlock with specified block root.
|
|
62
68
|
*/
|
|
63
69
|
unknownBlockRoot = "unknownBlockRoot",
|
|
70
|
+
/**
|
|
71
|
+
* Trigger BlockInputSync to find a SignedExecutionPayloadEnvelope with specified block root.
|
|
72
|
+
*/
|
|
73
|
+
unknownEnvelopeBlockRoot = "unknownEnvelopeBlockRoot",
|
|
64
74
|
/**
|
|
65
75
|
* Trigger BlockInputSync for blocks that are partially received via gossip but are not complete by time the
|
|
66
76
|
* cut-off window passes for waiting on gossip
|
|
@@ -75,9 +85,15 @@ export type ReorgEventData = routes.events.EventData[routes.events.EventType.cha
|
|
|
75
85
|
type ApiEvents = {[K in routes.events.EventType]: (data: routes.events.EventData[K]) => void};
|
|
76
86
|
|
|
77
87
|
export type ChainEventData = {
|
|
78
|
-
[ChainEvent.
|
|
88
|
+
[ChainEvent.blockUnknownParent]: {blockInput: IBlockInput; peer: PeerIdStr; source: BlockInputSource};
|
|
89
|
+
[ChainEvent.envelopeUnknownBlock]: {
|
|
90
|
+
envelope: SignedExecutionPayloadEnvelope;
|
|
91
|
+
peer?: PeerIdStr;
|
|
92
|
+
source: BlockInputSource;
|
|
93
|
+
};
|
|
79
94
|
[ChainEvent.unknownBlockRoot]: {rootHex: RootHex; peer?: PeerIdStr; source: BlockInputSource};
|
|
80
95
|
[ChainEvent.incompleteBlockInput]: {blockInput: IBlockInput; peer: PeerIdStr; source: BlockInputSource};
|
|
96
|
+
[ChainEvent.unknownEnvelopeBlockRoot]: {rootHex: RootHex; peer?: PeerIdStr; source: BlockInputSource};
|
|
81
97
|
};
|
|
82
98
|
|
|
83
99
|
export type IChainEvents = ApiEvents & {
|
|
@@ -88,7 +104,7 @@ export type IChainEvents = ApiEvents & {
|
|
|
88
104
|
|
|
89
105
|
[ChainEvent.updateTargetCustodyGroupCount]: (targetGroupCount: number) => void;
|
|
90
106
|
|
|
91
|
-
[ChainEvent.publishDataColumns]: (sidecars:
|
|
107
|
+
[ChainEvent.publishDataColumns]: (sidecars: DataColumnSidecar[]) => void;
|
|
92
108
|
|
|
93
109
|
[ChainEvent.publishBlobSidecars]: (sidecars: deneb.BlobSidecar[]) => void;
|
|
94
110
|
|
|
@@ -96,9 +112,11 @@ export type IChainEvents = ApiEvents & {
|
|
|
96
112
|
|
|
97
113
|
// Sync events that are chain->chain. Initiated from network requests but do not cross the network
|
|
98
114
|
// barrier so are considered ChainEvent(s).
|
|
99
|
-
[ChainEvent.
|
|
115
|
+
[ChainEvent.blockUnknownParent]: (data: ChainEventData[ChainEvent.blockUnknownParent]) => void;
|
|
116
|
+
[ChainEvent.envelopeUnknownBlock]: (data: ChainEventData[ChainEvent.envelopeUnknownBlock]) => void;
|
|
100
117
|
[ChainEvent.unknownBlockRoot]: (data: ChainEventData[ChainEvent.unknownBlockRoot]) => void;
|
|
101
118
|
[ChainEvent.incompleteBlockInput]: (data: ChainEventData[ChainEvent.incompleteBlockInput]) => void;
|
|
119
|
+
[ChainEvent.unknownEnvelopeBlockRoot]: (data: ChainEventData[ChainEvent.unknownEnvelopeBlockRoot]) => void;
|
|
102
120
|
};
|
|
103
121
|
|
|
104
122
|
/**
|
|
@@ -70,6 +70,8 @@ export enum BlockErrorCode {
|
|
|
70
70
|
TOO_MANY_KZG_COMMITMENTS = "BLOCK_ERROR_TOO_MANY_KZG_COMMITMENTS",
|
|
71
71
|
/** Bid parent block root does not match block parent root */
|
|
72
72
|
BID_PARENT_ROOT_MISMATCH = "BLOCK_ERROR_BID_PARENT_ROOT_MISMATCH",
|
|
73
|
+
/** The block's parent execution payload (defined by bid.parent_block_hash) has not been seen */
|
|
74
|
+
PARENT_PAYLOAD_UNKNOWN = "BLOCK_ERROR_PARENT_PAYLOAD_UNKNOWN",
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
type ExecutionErrorStatus = Exclude<
|
|
@@ -114,7 +116,8 @@ export type BlockErrorType =
|
|
|
114
116
|
| {code: BlockErrorCode.EXECUTION_ENGINE_ERROR; execStatus: ExecutionErrorStatus; errorMessage: string}
|
|
115
117
|
| {code: BlockErrorCode.DATA_UNAVAILABLE}
|
|
116
118
|
| {code: BlockErrorCode.TOO_MANY_KZG_COMMITMENTS; blobKzgCommitmentsLen: number; commitmentLimit: number}
|
|
117
|
-
| {code: BlockErrorCode.BID_PARENT_ROOT_MISMATCH; bidParentRoot: RootHex; blockParentRoot: RootHex}
|
|
119
|
+
| {code: BlockErrorCode.BID_PARENT_ROOT_MISMATCH; bidParentRoot: RootHex; blockParentRoot: RootHex}
|
|
120
|
+
| {code: BlockErrorCode.PARENT_PAYLOAD_UNKNOWN; parentBlockHash: RootHex};
|
|
118
121
|
|
|
119
122
|
export class BlockGossipError extends GossipActionError<BlockErrorType> {}
|
|
120
123
|
|