@lodestar/beacon-node 1.48.0-dev.acdde443d2 → 1.48.0-dev.af8bc602aa
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 +4 -4
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/chain/archiveStore/archiveStore.d.ts +0 -1
- package/lib/chain/archiveStore/archiveStore.d.ts.map +1 -1
- package/lib/chain/archiveStore/archiveStore.js +0 -1
- package/lib/chain/archiveStore/archiveStore.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js +0 -1
- package/lib/chain/archiveStore/historicalState/historicalStateRegen.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.js +1 -12
- package/lib/chain/archiveStore/historicalState/metrics.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/types.d.ts +0 -2
- 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/utils/archiveBlocks.d.ts.map +1 -1
- package/lib/chain/archiveStore/utils/archiveBlocks.js +34 -31
- package/lib/chain/archiveStore/utils/archiveBlocks.js.map +1 -1
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +2 -3
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +16 -9
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/chain.d.ts +3 -4
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +35 -60
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +7 -19
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +2 -2
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.d.ts +2 -15
- package/lib/chain/errors/dataColumnSidecarError.d.ts.map +1 -1
- package/lib/chain/errors/dataColumnSidecarError.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +11 -10
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +2 -0
- package/lib/chain/errors/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/interface.d.ts +2 -2
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +13 -13
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +54 -35
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.d.ts.map +1 -1
- package/lib/chain/validation/dataColumnSidecar.js +13 -38
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +29 -10
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/db/beacon.d.ts +5 -14
- package/lib/db/beacon.d.ts.map +1 -1
- package/lib/db/beacon.js +3 -17
- package/lib/db/beacon.js.map +1 -1
- package/lib/db/index.d.ts +0 -1
- package/lib/db/index.d.ts.map +1 -1
- package/lib/db/interface.d.ts +1 -8
- package/lib/db/interface.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.d.ts +1 -8
- package/lib/db/repositories/blockArchive.d.ts.map +1 -1
- package/lib/db/repositories/blockArchive.js +28 -65
- package/lib/db/repositories/blockArchive.js.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts +2 -1
- package/lib/db/repositories/blockArchiveIndex.d.ts.map +1 -1
- package/lib/db/repositories/blockArchiveIndex.js +7 -3
- package/lib/db/repositories/blockArchiveIndex.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +0 -18
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +1 -55
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/monitoring/clientStats.js +1 -1
- package/lib/monitoring/clientStats.js.map +1 -1
- package/lib/network/gossip/encoding.d.ts.map +1 -1
- package/lib/network/gossip/encoding.js +6 -0
- package/lib/network/gossip/encoding.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +1 -2
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +20 -4
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +7 -6
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts +3 -49
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +98 -232
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +91 -112
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js +0 -2
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/protocols.d.ts.map +1 -1
- package/lib/network/reqresp/protocols.js +22 -6
- package/lib/network/reqresp/protocols.js.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.d.ts +1 -2
- package/lib/network/reqresp/utils/dataColumnResponseValidation.d.ts.map +1 -1
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js +9 -14
- package/lib/network/reqresp/utils/dataColumnResponseValidation.js.map +1 -1
- package/lib/node/nodejs.d.ts +1 -2
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +2 -4
- package/lib/node/nodejs.js.map +1 -1
- package/lib/util/sszBytes.d.ts +0 -6
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +1 -1
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +16 -16
- package/src/api/impl/beacon/blocks/index.ts +4 -8
- package/src/chain/archiveStore/archiveStore.ts +1 -6
- package/src/chain/archiveStore/historicalState/historicalStateRegen.ts +0 -1
- package/src/chain/archiveStore/historicalState/metrics.ts +1 -14
- package/src/chain/archiveStore/historicalState/types.ts +0 -2
- package/src/chain/archiveStore/historicalState/worker.ts +1 -4
- package/src/chain/archiveStore/utils/archiveBlocks.ts +39 -34
- package/src/chain/blocks/index.ts +2 -13
- package/src/chain/blocks/writeBlockInputToDb.ts +17 -10
- package/src/chain/chain.ts +34 -75
- package/src/chain/errors/blockError.ts +10 -22
- package/src/chain/errors/dataColumnSidecarError.ts +8 -24
- package/src/chain/errors/executionPayloadEnvelope.ts +11 -14
- package/src/chain/interface.ts +2 -2
- package/src/chain/prepareNextSlot.ts +16 -16
- package/src/chain/validation/block.ts +70 -35
- package/src/chain/validation/dataColumnSidecar.ts +14 -47
- package/src/chain/validation/executionPayloadEnvelope.ts +37 -10
- package/src/db/beacon.ts +6 -33
- package/src/db/index.ts +0 -1
- package/src/db/interface.ts +1 -9
- package/src/db/repositories/blockArchive.ts +30 -89
- package/src/db/repositories/blockArchiveIndex.ts +9 -4
- package/src/metrics/metrics/lodestar.ts +1 -57
- package/src/monitoring/clientStats.ts +1 -1
- package/src/network/gossip/encoding.ts +6 -0
- package/src/network/gossip/topic.ts +25 -3
- package/src/network/processor/gossipHandlers.ts +11 -11
- package/src/network/processor/index.ts +148 -263
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +105 -139
- package/src/network/reqresp/handlers/dataColumnSidecarsByRoot.ts +0 -2
- package/src/network/reqresp/protocols.ts +24 -7
- package/src/network/reqresp/utils/dataColumnResponseValidation.ts +7 -15
- package/src/node/nodejs.ts +1 -6
- package/src/util/sszBytes.ts +1 -1
- package/lib/db/dataColumnStore.d.ts +0 -39
- package/lib/db/dataColumnStore.d.ts.map +0 -1
- package/lib/db/dataColumnStore.js +0 -81
- package/lib/db/dataColumnStore.js.map +0 -1
- package/lib/db/flatFileStore/atomicWrite.d.ts +0 -8
- package/lib/db/flatFileStore/atomicWrite.d.ts.map +0 -1
- package/lib/db/flatFileStore/atomicWrite.js +0 -61
- package/lib/db/flatFileStore/atomicWrite.js.map +0 -1
- package/lib/db/flatFileStore/dcolFormat.d.ts +0 -90
- package/lib/db/flatFileStore/dcolFormat.d.ts.map +0 -1
- package/lib/db/flatFileStore/dcolFormat.js +0 -286
- package/lib/db/flatFileStore/dcolFormat.js.map +0 -1
- package/lib/db/flatFileStore/errors.d.ts +0 -82
- package/lib/db/flatFileStore/errors.d.ts.map +0 -1
- package/lib/db/flatFileStore/errors.js +0 -32
- package/lib/db/flatFileStore/errors.js.map +0 -1
- package/lib/db/flatFileStore/flatFileStore.d.ts +0 -41
- package/lib/db/flatFileStore/flatFileStore.d.ts.map +0 -1
- package/lib/db/flatFileStore/flatFileStore.js +0 -251
- package/lib/db/flatFileStore/flatFileStore.js.map +0 -1
- package/lib/db/flatFileStore/index.d.ts +0 -4
- package/lib/db/flatFileStore/index.d.ts.map +0 -1
- package/lib/db/flatFileStore/index.js +0 -2
- package/lib/db/flatFileStore/index.js.map +0 -1
- package/lib/db/flatFileStore/interface.d.ts +0 -25
- package/lib/db/flatFileStore/interface.d.ts.map +0 -1
- package/lib/db/flatFileStore/interface.js +0 -2
- package/lib/db/flatFileStore/interface.js.map +0 -1
- package/lib/db/flatFileStore/metrics.d.ts +0 -24
- package/lib/db/flatFileStore/metrics.d.ts.map +0 -1
- package/lib/db/flatFileStore/metrics.js +0 -25
- package/lib/db/flatFileStore/metrics.js.map +0 -1
- package/lib/db/flatFileStore/path.d.ts +0 -9
- package/lib/db/flatFileStore/path.d.ts.map +0 -1
- package/lib/db/flatFileStore/path.js +0 -21
- package/lib/db/flatFileStore/path.js.map +0 -1
- package/lib/db/flatFileStore/slotIndex.d.ts +0 -14
- package/lib/db/flatFileStore/slotIndex.d.ts.map +0 -1
- package/lib/db/flatFileStore/slotIndex.js +0 -46
- package/lib/db/flatFileStore/slotIndex.js.map +0 -1
- package/lib/db/flatFileStore/snappy.d.ts +0 -3
- package/lib/db/flatFileStore/snappy.d.ts.map +0 -1
- package/lib/db/flatFileStore/snappy.js +0 -12
- package/lib/db/flatFileStore/snappy.js.map +0 -1
- package/src/db/dataColumnStore.ts +0 -113
- package/src/db/flatFileStore/atomicWrite.ts +0 -65
- package/src/db/flatFileStore/dcolFormat.ts +0 -389
- package/src/db/flatFileStore/errors.ts +0 -53
- package/src/db/flatFileStore/flatFileStore.ts +0 -310
- package/src/db/flatFileStore/index.ts +0 -3
- package/src/db/flatFileStore/interface.ts +0 -21
- package/src/db/flatFileStore/metrics.ts +0 -48
- package/src/db/flatFileStore/path.ts +0 -32
- package/src/db/flatFileStore/slotIndex.ts +0 -56
- package/src/db/flatFileStore/snappy.ts +0 -14
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {ExecutionStatus} from "@lodestar/fork-choice";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ForkName,
|
|
5
|
+
MAX_ATTESTATIONS_ELECTRA,
|
|
6
|
+
MAX_ATTESTER_SLASHINGS_ELECTRA,
|
|
7
|
+
MAX_BLS_TO_EXECUTION_CHANGES,
|
|
8
|
+
MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD,
|
|
9
|
+
MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD,
|
|
10
|
+
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
|
|
11
|
+
MAX_PAYLOAD_ATTESTATIONS,
|
|
12
|
+
MAX_PROPOSER_SLASHINGS,
|
|
13
|
+
MAX_VOLUNTARY_EXITS,
|
|
14
|
+
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
|
|
15
|
+
MIN_SEED_LOOKAHEAD,
|
|
16
|
+
isForkPostBellatrix,
|
|
17
|
+
isForkPostDeneb,
|
|
18
|
+
isForkPostGloas,
|
|
19
|
+
} from "@lodestar/params";
|
|
4
20
|
import {
|
|
5
21
|
computeEpochAtSlot,
|
|
6
22
|
computeStartSlotAtEpoch,
|
|
@@ -134,9 +150,8 @@ export async function validateGossipBlock(
|
|
|
134
150
|
if (parentBlock.slot >= blockSlot) {
|
|
135
151
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
136
152
|
code: BlockErrorCode.NOT_LATER_THAN_PARENT,
|
|
137
|
-
slot: blockSlot,
|
|
138
|
-
root: blockRoot,
|
|
139
153
|
parentSlot: parentBlock.slot,
|
|
154
|
+
slot: blockSlot,
|
|
140
155
|
});
|
|
141
156
|
}
|
|
142
157
|
|
|
@@ -151,8 +166,6 @@ export async function validateGossipBlock(
|
|
|
151
166
|
if (blobKzgCommitmentsLen > maxBlobsPerBlock) {
|
|
152
167
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
153
168
|
code: BlockErrorCode.TOO_MANY_KZG_COMMITMENTS,
|
|
154
|
-
slot: blockSlot,
|
|
155
|
-
root: blockRoot,
|
|
156
169
|
blobKzgCommitmentsLen,
|
|
157
170
|
commitmentLimit: maxBlobsPerBlock,
|
|
158
171
|
});
|
|
@@ -160,8 +173,7 @@ export async function validateGossipBlock(
|
|
|
160
173
|
}
|
|
161
174
|
|
|
162
175
|
if (isForkPostGloas(fork)) {
|
|
163
|
-
const
|
|
164
|
-
const bid = body.signedExecutionPayloadBid.message;
|
|
176
|
+
const bid = (block as gloas.BeaconBlock).body.signedExecutionPayloadBid.message;
|
|
165
177
|
|
|
166
178
|
// [REJECT] The length of KZG commitments is less than or equal to the limitation defined in Consensus Layer
|
|
167
179
|
// -- i.e. validate that len(bid.blob_kzg_commitments) <= max_blobs_per_block
|
|
@@ -170,8 +182,6 @@ export async function validateGossipBlock(
|
|
|
170
182
|
if (blobKzgCommitmentsLen > maxBlobsPerBlock) {
|
|
171
183
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
172
184
|
code: BlockErrorCode.TOO_MANY_KZG_COMMITMENTS,
|
|
173
|
-
slot: blockSlot,
|
|
174
|
-
root: blockRoot,
|
|
175
185
|
blobKzgCommitmentsLen,
|
|
176
186
|
commitmentLimit: maxBlobsPerBlock,
|
|
177
187
|
});
|
|
@@ -181,21 +191,59 @@ export async function validateGossipBlock(
|
|
|
181
191
|
if (!byteArrayEquals(bid.parentBlockRoot, block.parentRoot)) {
|
|
182
192
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
183
193
|
code: BlockErrorCode.BID_PARENT_ROOT_MISMATCH,
|
|
184
|
-
slot: blockSlot,
|
|
185
|
-
root: blockRoot,
|
|
186
194
|
bidParentRoot: toRootHex(bid.parentBlockRoot),
|
|
187
195
|
blockParentRoot: parentRoot,
|
|
188
196
|
});
|
|
189
197
|
}
|
|
190
198
|
|
|
191
|
-
// [REJECT] The block
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
// [REJECT] The counts of `block.body.parent_execution_requests` are within
|
|
200
|
+
// their respective limits -- i.e. validate that
|
|
201
|
+
// `len(block.body.parent_execution_requests.withdrawals) <= MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD`,
|
|
202
|
+
// `len(block.body.parent_execution_requests.consolidations) <= MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD`,
|
|
203
|
+
// `len(block.body.parent_execution_requests.builder_deposits) <= MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD`,
|
|
204
|
+
// and
|
|
205
|
+
// `len(block.body.parent_execution_requests.builder_exits) <= MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD`.
|
|
206
|
+
// [REJECT] The counts of the block body operations are within their respective
|
|
207
|
+
// limits -- i.e. validate that
|
|
208
|
+
// `len(block.body.proposer_slashings) <= MAX_PROPOSER_SLASHINGS`,
|
|
209
|
+
// `len(block.body.attester_slashings) <= MAX_ATTESTER_SLASHINGS_ELECTRA`,
|
|
210
|
+
// `len(block.body.attestations) <= MAX_ATTESTATIONS_ELECTRA`,
|
|
211
|
+
// `len(block.body.deposits) == 0`,
|
|
212
|
+
// `len(block.body.voluntary_exits) <= MAX_VOLUNTARY_EXITS`,
|
|
213
|
+
// `len(block.body.bls_to_execution_changes) <= MAX_BLS_TO_EXECUTION_CHANGES`,
|
|
214
|
+
// and `len(block.body.payload_attestations) <= MAX_PAYLOAD_ATTESTATIONS`.
|
|
215
|
+
const body = (block as gloas.BeaconBlock).body;
|
|
216
|
+
const requests = body.parentExecutionRequests;
|
|
217
|
+
const countLimits: [string, number, number][] = [
|
|
218
|
+
["parentExecutionRequests.withdrawals", requests.withdrawals.length, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD],
|
|
219
|
+
[
|
|
220
|
+
"parentExecutionRequests.consolidations",
|
|
221
|
+
requests.consolidations.length,
|
|
222
|
+
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
|
|
223
|
+
],
|
|
224
|
+
[
|
|
225
|
+
"parentExecutionRequests.builderDeposits",
|
|
226
|
+
requests.builderDeposits.length,
|
|
227
|
+
MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD,
|
|
228
|
+
],
|
|
229
|
+
["parentExecutionRequests.builderExits", requests.builderExits.length, MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD],
|
|
230
|
+
["proposerSlashings", body.proposerSlashings.length, MAX_PROPOSER_SLASHINGS],
|
|
231
|
+
["attesterSlashings", body.attesterSlashings.length, MAX_ATTESTER_SLASHINGS_ELECTRA],
|
|
232
|
+
["attestations", body.attestations.length, MAX_ATTESTATIONS_ELECTRA],
|
|
233
|
+
["deposits", body.deposits.length, 0],
|
|
234
|
+
["voluntaryExits", body.voluntaryExits.length, MAX_VOLUNTARY_EXITS],
|
|
235
|
+
["blsToExecutionChanges", body.blsToExecutionChanges.length, MAX_BLS_TO_EXECUTION_CHANGES],
|
|
236
|
+
["payloadAttestations", body.payloadAttestations.length, MAX_PAYLOAD_ATTESTATIONS],
|
|
237
|
+
];
|
|
238
|
+
for (const [name, count, limit] of countLimits) {
|
|
239
|
+
if (count > limit) {
|
|
240
|
+
throw new BlockGossipError(GossipAction.REJECT, {
|
|
241
|
+
code: BlockErrorCode.TOO_MANY_BLOCK_OPERATIONS,
|
|
242
|
+
name,
|
|
243
|
+
count,
|
|
244
|
+
limit,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
199
247
|
}
|
|
200
248
|
|
|
201
249
|
// TODO GLOAS: [REJECT] The block's execution payload parent (defined by bid.parent_block_hash) passes all validation
|
|
@@ -258,8 +306,6 @@ export async function validateGossipBlock(
|
|
|
258
306
|
if (executionPayload.timestamp !== computeTimeAtSlot(config, blockSlot, chain.genesisTime)) {
|
|
259
307
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
260
308
|
code: BlockErrorCode.INCORRECT_TIMESTAMP,
|
|
261
|
-
slot: blockSlot,
|
|
262
|
-
root: blockRoot,
|
|
263
309
|
timestamp: executionPayload.timestamp,
|
|
264
310
|
expectedTimestamp,
|
|
265
311
|
});
|
|
@@ -269,12 +315,7 @@ export async function validateGossipBlock(
|
|
|
269
315
|
|
|
270
316
|
// [REJECT] The proposer index is a valid validator index
|
|
271
317
|
if (proposerIndex >= state.validatorCount) {
|
|
272
|
-
throw new BlockGossipError(GossipAction.REJECT, {
|
|
273
|
-
code: BlockErrorCode.UNKNOWN_PROPOSER,
|
|
274
|
-
slot: blockSlot,
|
|
275
|
-
root: blockRoot,
|
|
276
|
-
proposerIndex,
|
|
277
|
-
});
|
|
318
|
+
throw new BlockGossipError(GossipAction.REJECT, {code: BlockErrorCode.UNKNOWN_PROPOSER, proposerIndex});
|
|
278
319
|
}
|
|
279
320
|
|
|
280
321
|
// [REJECT] The proposer signature, signed_beacon_block.signature, is valid with respect to the proposer_index pubkey.
|
|
@@ -286,12 +327,7 @@ export async function validateGossipBlock(
|
|
|
286
327
|
// shuffling, the block MAY be queued for later processing while proposers for the block's branch are calculated --
|
|
287
328
|
// in such a case do not REJECT, instead IGNORE this message.
|
|
288
329
|
if (state.getBeaconProposer(blockSlot) !== proposerIndex) {
|
|
289
|
-
throw new BlockGossipError(GossipAction.REJECT, {
|
|
290
|
-
code: BlockErrorCode.INCORRECT_PROPOSER,
|
|
291
|
-
slot: blockSlot,
|
|
292
|
-
root: blockRoot,
|
|
293
|
-
proposerIndex,
|
|
294
|
-
});
|
|
330
|
+
throw new BlockGossipError(GossipAction.REJECT, {code: BlockErrorCode.INCORRECT_PROPOSER, proposerIndex});
|
|
295
331
|
}
|
|
296
332
|
|
|
297
333
|
// Simple implementation of a pending block queue. Keeping the block here recycles the queue logic, and keeps the
|
|
@@ -336,8 +372,7 @@ export async function verifyBlockProposerSignature(
|
|
|
336
372
|
if (!(await chain.bls.verifySignatureSets([signatureSet], {verifyOnMainThread: opts.verifyOnMainThread ?? true}))) {
|
|
337
373
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
338
374
|
code: BlockErrorCode.PROPOSAL_SIGNATURE_INVALID,
|
|
339
|
-
|
|
340
|
-
root: blockRoot,
|
|
375
|
+
blockSlot,
|
|
341
376
|
});
|
|
342
377
|
}
|
|
343
378
|
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
computeStartSlotAtEpoch,
|
|
12
12
|
getBlockHeaderProposerSignatureSetByHeaderSlot,
|
|
13
13
|
} from "@lodestar/state-transition";
|
|
14
|
-
import {DataColumnSidecar, Root,
|
|
14
|
+
import {DataColumnSidecar, Root, Slot, SubnetID, ValidatorIndex, fulu, gloas, ssz} from "@lodestar/types";
|
|
15
15
|
import {byteArrayEquals, toRootHex, verifyMerkleBranch} from "@lodestar/utils";
|
|
16
16
|
import {BeaconMetrics} from "../../metrics/metrics/beacon.js";
|
|
17
17
|
import {Metrics} from "../../metrics/metrics.js";
|
|
@@ -39,14 +39,12 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
39
39
|
const blockRootHex = toRootHex(ssz.phase0.BeaconBlockHeader.hashTreeRoot(blockHeader));
|
|
40
40
|
|
|
41
41
|
// 1) [REJECT] The sidecar is valid as verified by verify_data_column_sidecar
|
|
42
|
-
verifyFuluDataColumnSidecar(chain.config, dataColumnSidecar
|
|
42
|
+
verifyFuluDataColumnSidecar(chain.config, dataColumnSidecar);
|
|
43
43
|
|
|
44
44
|
// 2) [REJECT] The sidecar is for the correct subnet -- i.e. compute_subnet_for_data_column_sidecar(sidecar.index) == subnet_id
|
|
45
45
|
if (computeSubnetForDataColumnSidecar(chain.config, dataColumnSidecar) !== gossipSubnet) {
|
|
46
46
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
47
47
|
code: DataColumnSidecarErrorCode.INVALID_SUBNET,
|
|
48
|
-
slot: blockHeader.slot,
|
|
49
|
-
root: blockRootHex,
|
|
50
48
|
columnIndex: dataColumnSidecar.index,
|
|
51
49
|
gossipSubnet: gossipSubnet,
|
|
52
50
|
});
|
|
@@ -102,9 +100,8 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
102
100
|
if (parentBlock.slot >= blockHeader.slot) {
|
|
103
101
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
104
102
|
code: DataColumnSidecarErrorCode.NOT_LATER_THAN_PARENT,
|
|
105
|
-
slot: blockHeader.slot,
|
|
106
|
-
root: blockRootHex,
|
|
107
103
|
parentSlot: parentBlock.slot,
|
|
104
|
+
slot: blockHeader.slot,
|
|
108
105
|
});
|
|
109
106
|
}
|
|
110
107
|
|
|
@@ -143,8 +140,6 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
143
140
|
if (proposerIndex !== expectedProposerIndex) {
|
|
144
141
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
145
142
|
code: DataColumnSidecarErrorCode.INCORRECT_PROPOSER,
|
|
146
|
-
slot: blockHeader.slot,
|
|
147
|
-
root: blockRootHex,
|
|
148
143
|
actualProposerIndex: proposerIndex,
|
|
149
144
|
expectedProposerIndex,
|
|
150
145
|
});
|
|
@@ -166,9 +161,9 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
166
161
|
) {
|
|
167
162
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
168
163
|
code: DataColumnSidecarErrorCode.PROPOSAL_SIGNATURE_INVALID,
|
|
169
|
-
|
|
170
|
-
root: blockRootHex,
|
|
164
|
+
blockRoot: blockRootHex,
|
|
171
165
|
index: dataColumnSidecar.index,
|
|
166
|
+
slot: blockHeader.slot,
|
|
172
167
|
});
|
|
173
168
|
}
|
|
174
169
|
|
|
@@ -190,8 +185,7 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
190
185
|
if (!valid) {
|
|
191
186
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
192
187
|
code: DataColumnSidecarErrorCode.INCLUSION_PROOF_INVALID,
|
|
193
|
-
slot:
|
|
194
|
-
root: blockRootHex,
|
|
188
|
+
slot: dataColumnSidecar.signedBlockHeader.message.slot,
|
|
195
189
|
columnIndex: dataColumnSidecar.index,
|
|
196
190
|
});
|
|
197
191
|
}
|
|
@@ -210,7 +204,6 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
210
204
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
211
205
|
code: DataColumnSidecarErrorCode.INVALID_KZG_PROOF,
|
|
212
206
|
slot: blockHeader.slot,
|
|
213
|
-
root: blockRootHex,
|
|
214
207
|
columnIndex: dataColumnSidecar.index,
|
|
215
208
|
});
|
|
216
209
|
} finally {
|
|
@@ -247,7 +240,6 @@ export async function validateGossipGloasDataColumnSidecar(
|
|
|
247
240
|
if (block.slot !== dataColumnSidecar.slot) {
|
|
248
241
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
249
242
|
code: DataColumnSidecarErrorCode.INCORRECT_SIDECAR_SLOT,
|
|
250
|
-
root: blockRootHex,
|
|
251
243
|
columnIndex: dataColumnSidecar.index,
|
|
252
244
|
expected: block.slot,
|
|
253
245
|
actual: dataColumnSidecar.slot,
|
|
@@ -256,14 +248,12 @@ export async function validateGossipGloasDataColumnSidecar(
|
|
|
256
248
|
|
|
257
249
|
// [REJECT] The sidecar must pass verify_data_column_sidecar against the block commitments
|
|
258
250
|
const kzgCommitments = payloadInput.getBlobKzgCommitments();
|
|
259
|
-
verifyGloasDataColumnSidecar(dataColumnSidecar, kzgCommitments
|
|
251
|
+
verifyGloasDataColumnSidecar(dataColumnSidecar, kzgCommitments);
|
|
260
252
|
|
|
261
253
|
// [REJECT] The sidecar must be on the correct subnet
|
|
262
254
|
if (computeSubnetForDataColumnSidecar(chain.config, dataColumnSidecar) !== gossipSubnet) {
|
|
263
255
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
264
256
|
code: DataColumnSidecarErrorCode.INVALID_SUBNET,
|
|
265
|
-
slot: dataColumnSidecar.slot,
|
|
266
|
-
root: blockRootHex,
|
|
267
257
|
columnIndex: dataColumnSidecar.index,
|
|
268
258
|
gossipSubnet,
|
|
269
259
|
});
|
|
@@ -282,7 +272,6 @@ export async function validateGossipGloasDataColumnSidecar(
|
|
|
282
272
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
283
273
|
code: DataColumnSidecarErrorCode.INVALID_KZG_PROOF,
|
|
284
274
|
slot: dataColumnSidecar.slot,
|
|
285
|
-
root: blockRootHex,
|
|
286
275
|
columnIndex: dataColumnSidecar.index,
|
|
287
276
|
});
|
|
288
277
|
} finally {
|
|
@@ -294,17 +283,11 @@ export async function validateGossipGloasDataColumnSidecar(
|
|
|
294
283
|
* SPEC FUNCTION
|
|
295
284
|
* https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.4/specs/fulu/p2p-interface.md#verify_data_column_sidecar
|
|
296
285
|
*/
|
|
297
|
-
function verifyFuluDataColumnSidecar(
|
|
298
|
-
config: ChainForkConfig,
|
|
299
|
-
dataColumnSidecar: fulu.DataColumnSidecar,
|
|
300
|
-
blockRootHex: RootHex
|
|
301
|
-
): void {
|
|
302
|
-
const slot = dataColumnSidecar.signedBlockHeader.message.slot;
|
|
286
|
+
function verifyFuluDataColumnSidecar(config: ChainForkConfig, dataColumnSidecar: fulu.DataColumnSidecar): void {
|
|
303
287
|
if (dataColumnSidecar.index >= NUMBER_OF_COLUMNS) {
|
|
304
288
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
305
289
|
code: DataColumnSidecarErrorCode.INVALID_INDEX,
|
|
306
|
-
slot,
|
|
307
|
-
root: blockRootHex,
|
|
290
|
+
slot: dataColumnSidecar.signedBlockHeader.message.slot,
|
|
308
291
|
columnIndex: dataColumnSidecar.index,
|
|
309
292
|
});
|
|
310
293
|
}
|
|
@@ -312,20 +295,18 @@ function verifyFuluDataColumnSidecar(
|
|
|
312
295
|
if (dataColumnSidecar.kzgCommitments.length === 0) {
|
|
313
296
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
314
297
|
code: DataColumnSidecarErrorCode.NO_COMMITMENTS,
|
|
315
|
-
slot,
|
|
316
|
-
root: blockRootHex,
|
|
298
|
+
slot: dataColumnSidecar.signedBlockHeader.message.slot,
|
|
317
299
|
columnIndex: dataColumnSidecar.index,
|
|
318
300
|
});
|
|
319
301
|
}
|
|
320
302
|
|
|
321
|
-
const epoch = computeEpochAtSlot(slot);
|
|
303
|
+
const epoch = computeEpochAtSlot(dataColumnSidecar.signedBlockHeader.message.slot);
|
|
322
304
|
const maxBlobsPerBlock = config.getMaxBlobsPerBlock(epoch);
|
|
323
305
|
|
|
324
306
|
if (dataColumnSidecar.kzgCommitments.length > maxBlobsPerBlock) {
|
|
325
307
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
326
308
|
code: DataColumnSidecarErrorCode.TOO_MANY_KZG_COMMITMENTS,
|
|
327
|
-
slot,
|
|
328
|
-
root: blockRootHex,
|
|
309
|
+
slot: dataColumnSidecar.signedBlockHeader.message.slot,
|
|
329
310
|
columnIndex: dataColumnSidecar.index,
|
|
330
311
|
count: dataColumnSidecar.kzgCommitments.length,
|
|
331
312
|
limit: maxBlobsPerBlock,
|
|
@@ -338,8 +319,6 @@ function verifyFuluDataColumnSidecar(
|
|
|
338
319
|
) {
|
|
339
320
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
340
321
|
code: DataColumnSidecarErrorCode.MISMATCHED_LENGTHS,
|
|
341
|
-
slot,
|
|
342
|
-
root: blockRootHex,
|
|
343
322
|
columnLength: dataColumnSidecar.column.length,
|
|
344
323
|
commitmentsLength: dataColumnSidecar.kzgCommitments.length,
|
|
345
324
|
proofsLength: dataColumnSidecar.kzgProofs.length,
|
|
@@ -351,17 +330,12 @@ function verifyFuluDataColumnSidecar(
|
|
|
351
330
|
* SPEC FUNCTION
|
|
352
331
|
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.3/specs/gloas/p2p-interface.md#modified-verify_data_column_sidecar
|
|
353
332
|
*/
|
|
354
|
-
function verifyGloasDataColumnSidecar(
|
|
355
|
-
dataColumnSidecar: gloas.DataColumnSidecar,
|
|
356
|
-
kzgCommitments: Uint8Array[],
|
|
357
|
-
blockRootHex: RootHex
|
|
358
|
-
): void {
|
|
333
|
+
function verifyGloasDataColumnSidecar(dataColumnSidecar: gloas.DataColumnSidecar, kzgCommitments: Uint8Array[]): void {
|
|
359
334
|
const slot = getDataColumnSidecarSlot(dataColumnSidecar);
|
|
360
335
|
if (dataColumnSidecar.index >= NUMBER_OF_COLUMNS) {
|
|
361
336
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
362
337
|
code: DataColumnSidecarErrorCode.INVALID_INDEX,
|
|
363
338
|
slot,
|
|
364
|
-
root: blockRootHex,
|
|
365
339
|
columnIndex: dataColumnSidecar.index,
|
|
366
340
|
});
|
|
367
341
|
}
|
|
@@ -370,7 +344,6 @@ function verifyGloasDataColumnSidecar(
|
|
|
370
344
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
371
345
|
code: DataColumnSidecarErrorCode.NO_COMMITMENTS,
|
|
372
346
|
slot,
|
|
373
|
-
root: blockRootHex,
|
|
374
347
|
columnIndex: dataColumnSidecar.index,
|
|
375
348
|
});
|
|
376
349
|
}
|
|
@@ -381,8 +354,6 @@ function verifyGloasDataColumnSidecar(
|
|
|
381
354
|
) {
|
|
382
355
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
383
356
|
code: DataColumnSidecarErrorCode.MISMATCHED_LENGTHS,
|
|
384
|
-
slot,
|
|
385
|
-
root: blockRootHex,
|
|
386
357
|
columnLength: dataColumnSidecar.column.length,
|
|
387
358
|
commitmentsLength: kzgCommitments.length,
|
|
388
359
|
proofsLength: dataColumnSidecar.kzgProofs.length,
|
|
@@ -494,8 +465,8 @@ export async function validateFuluBlockDataColumnSidecars(
|
|
|
494
465
|
) {
|
|
495
466
|
throw new DataColumnSidecarValidationError({
|
|
496
467
|
code: DataColumnSidecarErrorCode.PROPOSAL_SIGNATURE_INVALID,
|
|
468
|
+
blockRoot: rootHex,
|
|
497
469
|
slot: blockSlot,
|
|
498
|
-
root: rootHex,
|
|
499
470
|
index: dataColumnSidecars[0].index,
|
|
500
471
|
});
|
|
501
472
|
}
|
|
@@ -528,7 +499,6 @@ export async function validateFuluBlockDataColumnSidecars(
|
|
|
528
499
|
{
|
|
529
500
|
code: DataColumnSidecarErrorCode.INVALID_INDEX,
|
|
530
501
|
slot: blockSlot,
|
|
531
|
-
root: toRootHex(blockRoot),
|
|
532
502
|
columnIndex: columnSidecar.index,
|
|
533
503
|
},
|
|
534
504
|
"DataColumnSidecar has invalid index"
|
|
@@ -573,7 +543,6 @@ export async function validateFuluBlockDataColumnSidecars(
|
|
|
573
543
|
{
|
|
574
544
|
code: DataColumnSidecarErrorCode.INCLUSION_PROOF_INVALID,
|
|
575
545
|
slot: blockSlot,
|
|
576
|
-
root: toRootHex(blockRoot),
|
|
577
546
|
columnIndex: columnSidecar.index,
|
|
578
547
|
},
|
|
579
548
|
"DataColumnSidecar has invalid inclusion proof"
|
|
@@ -654,7 +623,6 @@ export async function validateGloasBlockDataColumnSidecars(
|
|
|
654
623
|
if (columnSidecar.slot !== blockSlot) {
|
|
655
624
|
throw new DataColumnSidecarValidationError({
|
|
656
625
|
code: DataColumnSidecarErrorCode.INCORRECT_SIDECAR_SLOT,
|
|
657
|
-
root: toRootHex(blockRoot),
|
|
658
626
|
columnIndex: columnSidecar.index,
|
|
659
627
|
expected: blockSlot,
|
|
660
628
|
actual: columnSidecar.slot,
|
|
@@ -676,7 +644,6 @@ export async function validateGloasBlockDataColumnSidecars(
|
|
|
676
644
|
{
|
|
677
645
|
code: DataColumnSidecarErrorCode.INVALID_INDEX,
|
|
678
646
|
slot: blockSlot,
|
|
679
|
-
root: toRootHex(blockRoot),
|
|
680
647
|
columnIndex: columnSidecar.index,
|
|
681
648
|
},
|
|
682
649
|
"DataColumnSidecar has invalid index"
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import {PayloadStatus} from "@lodestar/fork-choice";
|
|
2
|
+
import {
|
|
3
|
+
MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD,
|
|
4
|
+
MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD,
|
|
5
|
+
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD,
|
|
6
|
+
MAX_WITHDRAWALS_PER_PAYLOAD,
|
|
7
|
+
MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD,
|
|
8
|
+
} from "@lodestar/params";
|
|
2
9
|
import {
|
|
3
10
|
computeStartSlotAtEpoch,
|
|
4
11
|
getExecutionPayloadEnvelopeSignatureSet,
|
|
@@ -82,8 +89,6 @@ async function validateExecutionPayloadEnvelope(
|
|
|
82
89
|
if (block.slot !== payload.slotNumber) {
|
|
83
90
|
throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
|
|
84
91
|
code: ExecutionPayloadEnvelopeErrorCode.SLOT_MISMATCH,
|
|
85
|
-
slot: payload.slotNumber,
|
|
86
|
-
root: blockRootHex,
|
|
87
92
|
envelopeSlot: payload.slotNumber,
|
|
88
93
|
blockSlot: block.slot,
|
|
89
94
|
});
|
|
@@ -93,8 +98,6 @@ async function validateExecutionPayloadEnvelope(
|
|
|
93
98
|
if (envelope.builderIndex !== payloadInput.getBuilderIndex()) {
|
|
94
99
|
throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
|
|
95
100
|
code: ExecutionPayloadEnvelopeErrorCode.BUILDER_INDEX_MISMATCH,
|
|
96
|
-
slot: payload.slotNumber,
|
|
97
|
-
root: blockRootHex,
|
|
98
101
|
envelopeBuilderIndex: envelope.builderIndex,
|
|
99
102
|
bidBuilderIndex: payloadInput.getBuilderIndex(),
|
|
100
103
|
});
|
|
@@ -104,8 +107,6 @@ async function validateExecutionPayloadEnvelope(
|
|
|
104
107
|
if (toRootHex(payload.blockHash) !== payloadInput.getBlockHashHex()) {
|
|
105
108
|
throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
|
|
106
109
|
code: ExecutionPayloadEnvelopeErrorCode.BLOCK_HASH_MISMATCH,
|
|
107
|
-
slot: payload.slotNumber,
|
|
108
|
-
root: blockRootHex,
|
|
109
110
|
envelopeBlockHash: toRootHex(payload.blockHash),
|
|
110
111
|
bidBlockHash: payloadInput.getBlockHashHex(),
|
|
111
112
|
});
|
|
@@ -116,13 +117,41 @@ async function validateExecutionPayloadEnvelope(
|
|
|
116
117
|
if (!byteArrayEquals(requestsRoot, payloadInput.getBid().executionRequestsRoot)) {
|
|
117
118
|
throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
|
|
118
119
|
code: ExecutionPayloadEnvelopeErrorCode.EXECUTION_REQUESTS_ROOT_MISMATCH,
|
|
119
|
-
slot: payload.slotNumber,
|
|
120
|
-
root: blockRootHex,
|
|
121
120
|
envelopeRequestsRoot: toRootHex(requestsRoot),
|
|
122
121
|
bidRequestsRoot: toRootHex(payloadInput.getBid().executionRequestsRoot),
|
|
123
122
|
});
|
|
124
123
|
}
|
|
125
124
|
|
|
125
|
+
// [REJECT] The counts of `execution_requests` are within their respective limits.
|
|
126
|
+
// New in Gloas:EIP7688 — progressive lists are unbounded at the type level, so bounds
|
|
127
|
+
// are enforced here in gossip validation.
|
|
128
|
+
const {executionRequests} = envelope;
|
|
129
|
+
const requestCountLimits: [string, number, number][] = [
|
|
130
|
+
["withdrawals", executionRequests.withdrawals.length, MAX_WITHDRAWAL_REQUESTS_PER_PAYLOAD],
|
|
131
|
+
["consolidations", executionRequests.consolidations.length, MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD],
|
|
132
|
+
["builderDeposits", executionRequests.builderDeposits.length, MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD],
|
|
133
|
+
["builderExits", executionRequests.builderExits.length, MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD],
|
|
134
|
+
];
|
|
135
|
+
for (const [name, count, limit] of requestCountLimits) {
|
|
136
|
+
if (count > limit) {
|
|
137
|
+
throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
|
|
138
|
+
code: ExecutionPayloadEnvelopeErrorCode.EXECUTION_REQUESTS_COUNT_EXCEEDED,
|
|
139
|
+
name,
|
|
140
|
+
count,
|
|
141
|
+
limit,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// [REJECT] The number of withdrawals is within the limit.
|
|
147
|
+
if (payload.withdrawals.length > MAX_WITHDRAWALS_PER_PAYLOAD) {
|
|
148
|
+
throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
|
|
149
|
+
code: ExecutionPayloadEnvelopeErrorCode.WITHDRAWALS_COUNT_EXCEEDED,
|
|
150
|
+
count: payload.withdrawals.length,
|
|
151
|
+
limit: MAX_WITHDRAWALS_PER_PAYLOAD,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
126
155
|
// Get the block state to verify the builder's signature.
|
|
127
156
|
const blockState = await chain.regen
|
|
128
157
|
.getState(block.stateRoot, RegenCaller.validateGossipPayloadEnvelope)
|
|
@@ -149,8 +178,6 @@ async function validateExecutionPayloadEnvelope(
|
|
|
149
178
|
if (!(await chain.bls.verifySignatureSets([signatureSet], {verifyOnMainThread: true}))) {
|
|
150
179
|
throw new ExecutionPayloadEnvelopeError(GossipAction.REJECT, {
|
|
151
180
|
code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE,
|
|
152
|
-
slot: payload.slotNumber,
|
|
153
|
-
root: blockRootHex,
|
|
154
181
|
});
|
|
155
182
|
}
|
|
156
183
|
}
|
package/src/db/beacon.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {Db, LevelDbControllerMetrics, encodeKey} from "@lodestar/db";
|
|
3
|
-
import {Slot} from "@lodestar/types";
|
|
4
|
-
import {Logger} from "@lodestar/utils";
|
|
5
3
|
import {Bucket} from "./buckets.js";
|
|
6
|
-
import {type IDataColumnStore, LegacyDataColumnStore} from "./dataColumnStore.js";
|
|
7
|
-
import {FlatFileStore} from "./flatFileStore/flatFileStore.js";
|
|
8
|
-
import type {FlatFileStoreMetrics} from "./flatFileStore/metrics.js";
|
|
9
4
|
import {IBeaconDb} from "./interface.js";
|
|
10
5
|
import {CheckpointStateRepository} from "./repositories/checkpointState.js";
|
|
11
6
|
import {
|
|
@@ -29,10 +24,9 @@ import {
|
|
|
29
24
|
VoluntaryExitRepository,
|
|
30
25
|
} from "./repositories/index.js";
|
|
31
26
|
|
|
32
|
-
export type
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
metrics?: FlatFileStoreMetrics | null;
|
|
27
|
+
export type BeaconDbModules = {
|
|
28
|
+
config: ChainForkConfig;
|
|
29
|
+
db: Db;
|
|
36
30
|
};
|
|
37
31
|
|
|
38
32
|
export class BeaconDb implements IBeaconDb {
|
|
@@ -63,14 +57,9 @@ export class BeaconDb implements IBeaconDb {
|
|
|
63
57
|
|
|
64
58
|
backfilledRanges: BackfilledRanges;
|
|
65
59
|
|
|
66
|
-
readonly dataColumns: IDataColumnStore;
|
|
67
|
-
lastLegacyArchiveSlot: Slot | null = null;
|
|
68
|
-
private readonly flatFileStore: FlatFileStore;
|
|
69
|
-
|
|
70
60
|
constructor(
|
|
71
61
|
config: ChainForkConfig,
|
|
72
|
-
protected readonly db: Db
|
|
73
|
-
opts: BeaconDbOpts
|
|
62
|
+
protected readonly db: Db
|
|
74
63
|
) {
|
|
75
64
|
// Warning: If code is ever run in the constructor, must change this stub to not extend 'packages/beacon-node/test/utils/stub/beaconDb.ts' -
|
|
76
65
|
this.block = new BlockRepository(config, db);
|
|
@@ -98,30 +87,14 @@ export class BeaconDb implements IBeaconDb {
|
|
|
98
87
|
this.syncCommitteeWitness = new SyncCommitteeWitnessRepository(config, db);
|
|
99
88
|
|
|
100
89
|
this.backfilledRanges = new BackfilledRanges(config, db);
|
|
101
|
-
|
|
102
|
-
this.flatFileStore = new FlatFileStore(opts.dataColumnDir, config, opts.logger, opts.metrics);
|
|
103
|
-
this.dataColumns = new LegacyDataColumnStore(
|
|
104
|
-
this.flatFileStore,
|
|
105
|
-
this.dataColumnSidecar,
|
|
106
|
-
this.dataColumnSidecarArchive,
|
|
107
|
-
this.blockArchive
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async init(): Promise<void> {
|
|
112
|
-
await this.flatFileStore.init();
|
|
113
|
-
const [lastLegacyKey] = await this.dataColumnSidecarArchive.keys({reverse: true, limit: 1});
|
|
114
|
-
this.lastLegacyArchiveSlot = lastLegacyKey?.prefix ?? null;
|
|
115
90
|
}
|
|
116
91
|
|
|
117
|
-
|
|
118
|
-
await this.flatFileStore.close();
|
|
92
|
+
close(): Promise<void> {
|
|
119
93
|
return this.db.close();
|
|
120
94
|
}
|
|
121
95
|
|
|
122
|
-
setMetrics(metrics: LevelDbControllerMetrics
|
|
96
|
+
setMetrics(metrics: LevelDbControllerMetrics): void {
|
|
123
97
|
this.db.setMetrics(metrics);
|
|
124
|
-
this.flatFileStore.setMetrics(flatFileStoreMetrics);
|
|
125
98
|
}
|
|
126
99
|
|
|
127
100
|
async pruneHotDb(): Promise<void> {
|
package/src/db/index.ts
CHANGED
package/src/db/interface.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import {LevelDbControllerMetrics} from "@lodestar/db";
|
|
2
|
-
import {Slot} from "@lodestar/types";
|
|
3
|
-
import type {IDataColumnStore} from "./dataColumnStore.js";
|
|
4
|
-
import type {FlatFileStoreMetrics} from "./flatFileStore/metrics.js";
|
|
5
2
|
import {CheckpointStateRepository} from "./repositories/checkpointState.js";
|
|
6
3
|
import {
|
|
7
4
|
AttesterSlashingRepository,
|
|
@@ -62,11 +59,6 @@ export interface IBeaconDb {
|
|
|
62
59
|
|
|
63
60
|
backfilledRanges: BackfilledRanges;
|
|
64
61
|
|
|
65
|
-
dataColumns: IDataColumnStore;
|
|
66
|
-
/** Highest legacy column slot at startup; later archival writes the block-root index first. */
|
|
67
|
-
readonly lastLegacyArchiveSlot: Slot | null;
|
|
68
|
-
init(): Promise<void>;
|
|
69
|
-
|
|
70
62
|
pruneHotDb(): Promise<void>;
|
|
71
63
|
|
|
72
64
|
deleteDeprecatedEth1Data(): Promise<void>;
|
|
@@ -74,5 +66,5 @@ export interface IBeaconDb {
|
|
|
74
66
|
/** Close the connection to the db instance and close the db store. */
|
|
75
67
|
close(): Promise<void>;
|
|
76
68
|
/** To inject metrics after CLI initialization */
|
|
77
|
-
setMetrics(metrics: LevelDbControllerMetrics
|
|
69
|
+
setMetrics(metrics: LevelDbControllerMetrics): void;
|
|
78
70
|
}
|