@lodestar/beacon-node 1.40.0 → 1.41.0-dev.05994293f5
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/node/index.d.ts +1 -1
- package/lib/api/impl/node/index.d.ts.map +1 -1
- package/lib/api/impl/node/index.js +18 -1
- package/lib/api/impl/node/index.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +7 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +2 -0
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +27 -3
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +2 -1
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/execution/engine/interface.d.ts +3 -25
- package/lib/execution/engine/interface.d.ts.map +1 -1
- package/lib/execution/engine/interface.js +2 -20
- package/lib/execution/engine/interface.js.map +1 -1
- package/lib/metrics/metrics.d.ts.map +1 -1
- package/lib/metrics/metrics.js +8 -3
- package/lib/metrics/metrics.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +1 -2
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRange.js +3 -9
- package/lib/sync/utils/downloadByRange.js.map +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts +1 -1
- package/lib/sync/utils/downloadByRoot.d.ts.map +1 -1
- package/lib/sync/utils/downloadByRoot.js +4 -4
- package/lib/sync/utils/downloadByRoot.js.map +1 -1
- package/lib/util/dataColumns.d.ts +5 -0
- package/lib/util/dataColumns.d.ts.map +1 -1
- package/lib/util/dataColumns.js +13 -5
- package/lib/util/dataColumns.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/node/index.ts +22 -1
- package/src/chain/errors/blockError.ts +4 -1
- package/src/chain/validation/block.ts +32 -4
- package/src/chain/validation/executionPayloadEnvelope.ts +2 -1
- package/src/chain/validation/payloadAttestationMessage.ts +1 -1
- package/src/execution/engine/interface.ts +3 -27
- package/src/metrics/metrics.ts +8 -3
- package/src/sync/utils/downloadByRange.ts +3 -15
- package/src/sync/utils/downloadByRoot.ts +5 -11
- package/src/util/dataColumns.ts +18 -5
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {
|
|
3
|
-
ForkPostDeneb,
|
|
4
|
-
ForkPostFulu,
|
|
5
|
-
ForkPreFulu,
|
|
6
|
-
ForkPreGloas,
|
|
7
|
-
isForkPostFulu,
|
|
8
|
-
isForkPostGloas,
|
|
9
|
-
} from "@lodestar/params";
|
|
2
|
+
import {ForkPostDeneb, ForkPostFulu, ForkPreFulu, isForkPostFulu} from "@lodestar/params";
|
|
10
3
|
import {SignedBeaconBlock, Slot, deneb, fulu, phase0} from "@lodestar/types";
|
|
11
4
|
import {LodestarError, Logger, byteArrayEquals, fromHex, prettyPrintIndices, toRootHex} from "@lodestar/utils";
|
|
12
5
|
import {
|
|
@@ -20,6 +13,7 @@ import {SeenBlockInput} from "../../chain/seenCache/seenGossipBlockInput.js";
|
|
|
20
13
|
import {validateBlockBlobSidecars} from "../../chain/validation/blobSidecar.js";
|
|
21
14
|
import {validateBlockDataColumnSidecars} from "../../chain/validation/dataColumnSidecar.js";
|
|
22
15
|
import {INetwork} from "../../network/index.js";
|
|
16
|
+
import {getBlobKzgCommitments} from "../../util/dataColumns.js";
|
|
23
17
|
import {PeerIdStr} from "../../util/peerId.js";
|
|
24
18
|
import {WarnResult} from "../../util/wrapError.js";
|
|
25
19
|
|
|
@@ -695,13 +689,7 @@ export async function validateColumnsByRangeResponse(
|
|
|
695
689
|
dataFork: dataSlot ? config.getForkName(dataSlot) : "unknown",
|
|
696
690
|
});
|
|
697
691
|
}
|
|
698
|
-
|
|
699
|
-
// TODO GLOAS: Post-gloas's blobKzgCommitments is not in beacon block body. Need to source it from somewhere else.
|
|
700
|
-
// if block without columns is passed default to zero and throw below
|
|
701
|
-
blobCount = 0;
|
|
702
|
-
} else {
|
|
703
|
-
blobCount = (block as SignedBeaconBlock<ForkPostFulu & ForkPreGloas>).message.body.blobKzgCommitments.length;
|
|
704
|
-
}
|
|
692
|
+
blobCount = getBlobKzgCommitments(forkName, block as SignedBeaconBlock<ForkPostFulu>).length;
|
|
705
693
|
|
|
706
694
|
if (columnSidecars.length === 0) {
|
|
707
695
|
if (!blobCount) {
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ForkPostFulu,
|
|
6
|
-
ForkPreFulu,
|
|
7
|
-
ForkPreGloas,
|
|
8
|
-
isForkPostDeneb,
|
|
9
|
-
isForkPostFulu,
|
|
10
|
-
} from "@lodestar/params";
|
|
11
|
-
import {BeaconBlockBody, BlobIndex, ColumnIndex, SignedBeaconBlock, Slot, deneb, fulu} from "@lodestar/types";
|
|
3
|
+
import {ForkPostDeneb, ForkPostFulu, ForkPreFulu, isForkPostDeneb, isForkPostFulu} from "@lodestar/params";
|
|
4
|
+
import {BlobIndex, ColumnIndex, SignedBeaconBlock, Slot, deneb, fulu} from "@lodestar/types";
|
|
12
5
|
import {LodestarError, byteArrayEquals, fromHex, prettyPrintIndices, toHex, toRootHex} from "@lodestar/utils";
|
|
13
6
|
import {isBlockInputBlobs, isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
|
|
14
7
|
import {BlockInputSource, IBlockInput} from "../../chain/blocks/blockInput/types.js";
|
|
@@ -19,6 +12,7 @@ import {validateBlockDataColumnSidecars} from "../../chain/validation/dataColumn
|
|
|
19
12
|
import {INetwork} from "../../network/interface.js";
|
|
20
13
|
import {PeerSyncMeta} from "../../network/peers/peersData.js";
|
|
21
14
|
import {prettyPrintPeerIdStr} from "../../network/util.js";
|
|
15
|
+
import {getBlobKzgCommitments} from "../../util/dataColumns.js";
|
|
22
16
|
import {PeerIdStr} from "../../util/peerId.js";
|
|
23
17
|
import {WarnResult} from "../../util/wrapError.js";
|
|
24
18
|
import {
|
|
@@ -378,14 +372,14 @@ export async function fetchAndValidateColumns({
|
|
|
378
372
|
chain,
|
|
379
373
|
network,
|
|
380
374
|
peerMeta,
|
|
375
|
+
forkName,
|
|
381
376
|
block,
|
|
382
377
|
blockRoot,
|
|
383
378
|
missing,
|
|
384
379
|
}: FetchByRootAndValidateColumnsProps): Promise<WarnResult<fulu.DataColumnSidecars, DownloadByRootError>> {
|
|
385
380
|
const {peerId: peerIdStr} = peerMeta;
|
|
386
381
|
const slot = block.message.slot;
|
|
387
|
-
|
|
388
|
-
const blobCount = (block.message.body as BeaconBlockBody<ForkPostFulu & ForkPreGloas>).blobKzgCommitments.length;
|
|
382
|
+
const blobCount = getBlobKzgCommitments(forkName, block).length;
|
|
389
383
|
if (blobCount === 0) {
|
|
390
384
|
return {result: [], warnings: null};
|
|
391
385
|
}
|
package/src/util/dataColumns.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ForkPreGloas,
|
|
9
9
|
KZG_COMMITMENTS_GINDEX,
|
|
10
10
|
NUMBER_OF_COLUMNS,
|
|
11
|
+
isForkPostGloas,
|
|
11
12
|
} from "@lodestar/params";
|
|
12
13
|
import {signedBlockToSignedHeader} from "@lodestar/state-transition";
|
|
13
14
|
import {
|
|
@@ -19,6 +20,7 @@ import {
|
|
|
19
20
|
SignedBeaconBlockHeader,
|
|
20
21
|
deneb,
|
|
21
22
|
fulu,
|
|
23
|
+
gloas,
|
|
22
24
|
ssz,
|
|
23
25
|
} from "@lodestar/types";
|
|
24
26
|
import {bytesToBigInt} from "@lodestar/utils";
|
|
@@ -261,6 +263,20 @@ export async function getCellsAndProofs(
|
|
|
261
263
|
return blobsAndProofs;
|
|
262
264
|
}
|
|
263
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Get blob KZG commitments from a signed block, handling the different locations
|
|
268
|
+
* in pre-Gloas (directly in block body) vs post-Gloas (in execution payload bid).
|
|
269
|
+
*/
|
|
270
|
+
export function getBlobKzgCommitments(
|
|
271
|
+
fork: ForkName,
|
|
272
|
+
signedBlock: SignedBeaconBlock<ForkPostFulu>
|
|
273
|
+
): deneb.KZGCommitment[] {
|
|
274
|
+
if (isForkPostGloas(fork)) {
|
|
275
|
+
return (signedBlock as gloas.SignedBeaconBlock).message.body.signedExecutionPayloadBid.message.blobKzgCommitments;
|
|
276
|
+
}
|
|
277
|
+
return (signedBlock.message.body as BeaconBlockBody<ForkPostFulu & ForkPreGloas>).blobKzgCommitments;
|
|
278
|
+
}
|
|
279
|
+
|
|
264
280
|
/**
|
|
265
281
|
* Given a signed block header and the commitments, inclusion proof, cells/proofs associated with
|
|
266
282
|
* each blob in the block, assemble the sidecars which can be distributed to peers.
|
|
@@ -310,16 +326,13 @@ export function getDataColumnSidecarsFromBlock(
|
|
|
310
326
|
signedBlock: SignedBeaconBlock<ForkPostFulu>,
|
|
311
327
|
cellsAndKzgProofs: {cells: Uint8Array[]; proofs: Uint8Array[]}[]
|
|
312
328
|
): fulu.DataColumnSidecars {
|
|
313
|
-
|
|
314
|
-
const blobKzgCommitments = (signedBlock
|
|
315
|
-
.blobKzgCommitments;
|
|
329
|
+
const fork = config.getForkName(signedBlock.message.slot);
|
|
330
|
+
const blobKzgCommitments = getBlobKzgCommitments(fork, signedBlock);
|
|
316
331
|
|
|
317
332
|
// No need to create data column sidecars if there are no blobs
|
|
318
333
|
if (blobKzgCommitments.length === 0) {
|
|
319
334
|
return [];
|
|
320
335
|
}
|
|
321
|
-
|
|
322
|
-
const fork = config.getForkName(signedBlock.message.slot);
|
|
323
336
|
const signedBlockHeader = signedBlockToSignedHeader(config, signedBlock);
|
|
324
337
|
|
|
325
338
|
const kzgCommitmentsInclusionProof = computePostFuluKzgCommitmentsInclusionProof(fork, signedBlock.message.body);
|