@lodestar/beacon-node 1.48.0-dev.e9c9b8835d → 1.48.0-dev.fd70e5fc15
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 +2 -16
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- 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 +0 -10
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- 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 +4 -26
- 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.js +0 -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 +15 -15
- 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 +8 -20
- package/src/chain/errors/dataColumnSidecarError.ts +8 -24
- package/src/chain/errors/executionPayloadEnvelope.ts +2 -14
- package/src/chain/interface.ts +2 -2
- package/src/chain/prepareNextSlot.ts +16 -16
- package/src/chain/validation/block.ts +4 -26
- package/src/chain/validation/dataColumnSidecar.ts +14 -47
- package/src/chain/validation/executionPayloadEnvelope.ts +0 -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,6 @@
|
|
|
1
|
-
import {ForkPostDeneb,
|
|
1
|
+
import {ForkPostDeneb, isForkPostDeneb} from "@lodestar/params";
|
|
2
2
|
import {SignedBeaconBlock} from "@lodestar/types";
|
|
3
|
-
import {toRootHex} from "@lodestar/utils";
|
|
3
|
+
import {fromHex, toRootHex} from "@lodestar/utils";
|
|
4
4
|
import {getBlobKzgCommitments} from "../../util/dataColumns.js";
|
|
5
5
|
import {BeaconChain} from "../chain.js";
|
|
6
6
|
import {IBlockInput, IDataColumnsInput, isBlockInputBlobs, isBlockInputColumns} from "./blockInput/index.js";
|
|
@@ -76,6 +76,7 @@ async function writeBlockAndBlobsToDb(this: BeaconChain, blockInput: IBlockInput
|
|
|
76
76
|
*/
|
|
77
77
|
export async function writeDataColumnsToDb(this: BeaconChain, blockInput: IDataColumnsInput): Promise<void> {
|
|
78
78
|
const {slot, blockRootHex} = blockInput;
|
|
79
|
+
const blockRoot = fromHex(blockRootHex);
|
|
79
80
|
|
|
80
81
|
if (!blockInput.hasComputedAllData()) {
|
|
81
82
|
// Supernodes may only have a subset of the data columns by the time the block begins to be imported
|
|
@@ -88,19 +89,25 @@ export async function writeDataColumnsToDb(this: BeaconChain, blockInput: IDataC
|
|
|
88
89
|
|
|
89
90
|
const {custodyColumns} = this.custodyConfig;
|
|
90
91
|
const dataColumnSidecars = blockInput.getCustodyColumns();
|
|
91
|
-
const dataColumnSidecarType = this.config.getForkTypes<ForkPostFulu>(slot).DataColumnSidecar;
|
|
92
92
|
|
|
93
|
-
const
|
|
93
|
+
const binaryPuts: {key: number; value: Uint8Array}[] = [];
|
|
94
|
+
const nonbinaryPuts = [];
|
|
94
95
|
for (const dataColumnSidecar of dataColumnSidecars) {
|
|
96
|
+
// skip reserializing column if we already have it
|
|
95
97
|
const serialized = this.serializedCache.get(dataColumnSidecar);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
if (serialized) {
|
|
99
|
+
binaryPuts.push({key: dataColumnSidecar.index, value: serialized});
|
|
100
|
+
} else {
|
|
101
|
+
nonbinaryPuts.push(dataColumnSidecar);
|
|
102
|
+
}
|
|
100
103
|
}
|
|
101
|
-
await this.db.dataColumns.putManyBinary({slot, blockRoot: blockRootHex}, binaryColumns);
|
|
102
104
|
|
|
103
|
-
|
|
105
|
+
await Promise.all([
|
|
106
|
+
this.db.dataColumnSidecar.putManyBinary(blockRoot, binaryPuts),
|
|
107
|
+
this.db.dataColumnSidecar.putMany(blockRoot, nonbinaryPuts),
|
|
108
|
+
]);
|
|
109
|
+
|
|
110
|
+
this.logger.debug("Persisted dataColumnSidecars to hot DB", {
|
|
104
111
|
slot,
|
|
105
112
|
root: blockRootHex,
|
|
106
113
|
dataColumnSidecars: dataColumnSidecars.length,
|
package/src/chain/chain.ts
CHANGED
|
@@ -268,7 +268,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
268
268
|
db,
|
|
269
269
|
dbName,
|
|
270
270
|
dataDir,
|
|
271
|
-
dataColumnDir,
|
|
272
271
|
logger,
|
|
273
272
|
processShutdownCallback,
|
|
274
273
|
clock,
|
|
@@ -286,7 +285,6 @@ export class BeaconChain implements IBeaconChain {
|
|
|
286
285
|
db: IBeaconDb;
|
|
287
286
|
dbName: string;
|
|
288
287
|
dataDir: string;
|
|
289
|
-
dataColumnDir?: string;
|
|
290
288
|
logger: Logger;
|
|
291
289
|
processShutdownCallback: ProcessShutdownCallback;
|
|
292
290
|
/** Used for testing to supply fake clock */
|
|
@@ -507,12 +505,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
507
505
|
|
|
508
506
|
this.archiveStore = new ArchiveStore(
|
|
509
507
|
{db, chain: this, logger: logger as LoggerNode, metrics},
|
|
510
|
-
{
|
|
511
|
-
...opts,
|
|
512
|
-
dbName,
|
|
513
|
-
dataColumnDir: dataColumnDir ?? path.join(dataDir, "data_columns"),
|
|
514
|
-
anchorState: {finalizedCheckpoint: anchorState.finalizedCheckpoint},
|
|
515
|
-
},
|
|
508
|
+
{...opts, dbName, anchorState: {finalizedCheckpoint: anchorState.finalizedCheckpoint}},
|
|
516
509
|
signal
|
|
517
510
|
);
|
|
518
511
|
|
|
@@ -976,15 +969,12 @@ export class BeaconChain implements IBeaconChain {
|
|
|
976
969
|
|
|
977
970
|
async getDataColumnSidecars(blockSlot: Slot, blockRootHex: string): Promise<DataColumnSidecar[]> {
|
|
978
971
|
const fork = this.config.getForkName(blockSlot);
|
|
979
|
-
const sidecarsByIndex = new Map<number, DataColumnSidecar>();
|
|
980
972
|
|
|
981
973
|
if (isForkPostGloas(fork)) {
|
|
982
974
|
// After gloas, columns are tracked in PayloadEnvelopeInput
|
|
983
975
|
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
984
976
|
if (payloadInput) {
|
|
985
|
-
|
|
986
|
-
sidecarsByIndex.set(sidecar.index, sidecar);
|
|
987
|
-
}
|
|
977
|
+
return payloadInput.getAllColumns();
|
|
988
978
|
}
|
|
989
979
|
} else {
|
|
990
980
|
// Before gloas, columns are tracked in BlockInput
|
|
@@ -993,17 +983,16 @@ export class BeaconChain implements IBeaconChain {
|
|
|
993
983
|
if (!isBlockInputColumns(blockInput)) {
|
|
994
984
|
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
995
985
|
}
|
|
996
|
-
|
|
997
|
-
sidecarsByIndex.set(sidecar.index, sidecar);
|
|
998
|
-
}
|
|
986
|
+
return blockInput.getAllColumns();
|
|
999
987
|
}
|
|
1000
988
|
}
|
|
1001
989
|
|
|
1002
|
-
|
|
1003
|
-
|
|
990
|
+
const sidecarsUnfinalized = await this.db.dataColumnSidecar.values(fromHex(blockRootHex));
|
|
991
|
+
if (sidecarsUnfinalized.length > 0) {
|
|
992
|
+
return sidecarsUnfinalized;
|
|
1004
993
|
}
|
|
1005
|
-
|
|
1006
|
-
return
|
|
994
|
+
const sidecarsFinalized = await this.db.dataColumnSidecarArchive.values(blockSlot);
|
|
995
|
+
return sidecarsFinalized;
|
|
1007
996
|
}
|
|
1008
997
|
|
|
1009
998
|
async getSerializedDataColumnSidecars(
|
|
@@ -1012,25 +1001,22 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1012
1001
|
indices: number[]
|
|
1013
1002
|
): Promise<(Uint8Array | undefined)[]> {
|
|
1014
1003
|
const fork = this.config.getForkName(blockSlot);
|
|
1015
|
-
const dataColumnSidecars: (Uint8Array | undefined)[] = indices.map(() => undefined);
|
|
1016
1004
|
|
|
1017
1005
|
if (isForkPostGloas(fork)) {
|
|
1018
1006
|
// After gloas, columns are tracked in PayloadEnvelopeInput
|
|
1019
1007
|
const payloadInput = this.seenPayloadEnvelopeInputCache.get(blockRootHex);
|
|
1020
1008
|
if (payloadInput) {
|
|
1021
|
-
|
|
1022
|
-
const index = indices[i];
|
|
1009
|
+
return indices.map((index) => {
|
|
1023
1010
|
const sidecar = payloadInput.getColumn(index);
|
|
1024
1011
|
if (!sidecar) {
|
|
1025
|
-
|
|
1012
|
+
return undefined;
|
|
1026
1013
|
}
|
|
1027
1014
|
const serialized = this.serializedCache.get(sidecar);
|
|
1028
1015
|
if (serialized) {
|
|
1029
|
-
|
|
1030
|
-
} else {
|
|
1031
|
-
dataColumnSidecars[i] = sszTypesFor(fork as ForkPostGloas).DataColumnSidecar.serialize(sidecar);
|
|
1016
|
+
return serialized;
|
|
1032
1017
|
}
|
|
1033
|
-
|
|
1018
|
+
return sszTypesFor(fork as ForkPostGloas).DataColumnSidecar.serialize(sidecar);
|
|
1019
|
+
});
|
|
1034
1020
|
}
|
|
1035
1021
|
} else {
|
|
1036
1022
|
// Before gloas, columns are tracked in BlockInput
|
|
@@ -1039,42 +1025,26 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1039
1025
|
if (!isBlockInputColumns(blockInput)) {
|
|
1040
1026
|
throw new Error(`Expected block input to have columns: slot=${blockSlot} root=${blockRootHex}`);
|
|
1041
1027
|
}
|
|
1042
|
-
|
|
1043
|
-
const index = indices[i];
|
|
1028
|
+
return indices.map((index) => {
|
|
1044
1029
|
const sidecar = blockInput.getColumn(index);
|
|
1045
1030
|
if (!sidecar) {
|
|
1046
|
-
|
|
1031
|
+
return undefined;
|
|
1047
1032
|
}
|
|
1048
1033
|
const serialized = this.serializedCache.get(sidecar);
|
|
1049
1034
|
if (serialized) {
|
|
1050
|
-
|
|
1051
|
-
} else {
|
|
1052
|
-
dataColumnSidecars[i] = sszTypesFor(blockInput.forkName as ForkPostFulu).DataColumnSidecar.serialize(
|
|
1053
|
-
sidecar
|
|
1054
|
-
);
|
|
1035
|
+
return serialized;
|
|
1055
1036
|
}
|
|
1056
|
-
|
|
1037
|
+
return sszTypesFor(blockInput.forkName as ForkPostFulu).DataColumnSidecar.serialize(sidecar);
|
|
1038
|
+
});
|
|
1057
1039
|
}
|
|
1058
1040
|
}
|
|
1059
1041
|
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
if (missingPositions.length > 0) {
|
|
1065
|
-
const persistedSidecars = await this.db.dataColumns.getManyBinary(
|
|
1066
|
-
{slot: blockSlot, blockRoot: blockRootHex},
|
|
1067
|
-
missingPositions.map((position) => indices[position])
|
|
1068
|
-
);
|
|
1069
|
-
for (let i = 0; i < missingPositions.length; i++) {
|
|
1070
|
-
const sidecar = persistedSidecars[i];
|
|
1071
|
-
if (sidecar !== undefined) {
|
|
1072
|
-
dataColumnSidecars[missingPositions[i]] = sidecar;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1042
|
+
const sidecarsUnfinalized = await this.db.dataColumnSidecar.getManyBinary(fromHex(blockRootHex), indices);
|
|
1043
|
+
if (sidecarsUnfinalized.some((sidecar) => sidecar != null)) {
|
|
1044
|
+
return sidecarsUnfinalized;
|
|
1075
1045
|
}
|
|
1076
|
-
|
|
1077
|
-
return
|
|
1046
|
+
const sidecarsFinalized = await this.db.dataColumnSidecarArchive.getManyBinary(blockSlot, indices);
|
|
1047
|
+
return sidecarsFinalized;
|
|
1078
1048
|
}
|
|
1079
1049
|
|
|
1080
1050
|
async produceCommonBlockBody(blockAttributes: BlockAttributes): Promise<CommonBlockBody> {
|
|
@@ -1417,15 +1387,10 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1417
1387
|
const slot = data.slot;
|
|
1418
1388
|
if (isBlindedBeaconBlock(data)) {
|
|
1419
1389
|
const sszType = this.config.getPostBellatrixForkTypes(slot).BlindedBeaconBlock;
|
|
1420
|
-
void this.persistSszObject(
|
|
1421
|
-
"BlindedBeaconBlock",
|
|
1422
|
-
sszType.serialize(data),
|
|
1423
|
-
toRootHex(sszType.hashTreeRoot(data)),
|
|
1424
|
-
suffix
|
|
1425
|
-
);
|
|
1390
|
+
void this.persistSszObject("BlindedBeaconBlock", sszType.serialize(data), sszType.hashTreeRoot(data), suffix);
|
|
1426
1391
|
} else {
|
|
1427
1392
|
const sszType = this.config.getForkTypes(slot).BeaconBlock;
|
|
1428
|
-
void this.persistSszObject("BeaconBlock", sszType.serialize(data),
|
|
1393
|
+
void this.persistSszObject("BeaconBlock", sszType.serialize(data), sszType.hashTreeRoot(data), suffix);
|
|
1429
1394
|
}
|
|
1430
1395
|
}
|
|
1431
1396
|
|
|
@@ -1446,39 +1411,33 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1446
1411
|
this.persistSszObject(
|
|
1447
1412
|
`SignedBeaconBlock_slot_${blockSlot}`,
|
|
1448
1413
|
blockType.serialize(block),
|
|
1449
|
-
|
|
1414
|
+
blockType.hashTreeRoot(block),
|
|
1450
1415
|
`${logStr}_block`
|
|
1451
1416
|
),
|
|
1452
1417
|
this.persistSszObject(
|
|
1453
1418
|
`preState_slot_${preState.slot}_BeaconState`,
|
|
1454
1419
|
preState.serialize(),
|
|
1455
|
-
|
|
1420
|
+
preState.hashTreeRoot(),
|
|
1456
1421
|
`${logStr}_pre_state`
|
|
1457
1422
|
),
|
|
1458
1423
|
this.persistSszObject(
|
|
1459
1424
|
`postState_slot_${postState.slot}_BeaconState`,
|
|
1460
1425
|
postState.serialize(),
|
|
1461
|
-
|
|
1426
|
+
postState.hashTreeRoot(),
|
|
1462
1427
|
`${logStr}_post_state`
|
|
1463
1428
|
),
|
|
1464
1429
|
]);
|
|
1465
1430
|
}
|
|
1466
1431
|
|
|
1467
|
-
persistInvalidSszValue<T>(type: Type<T>, sszObject: T, suffix?: string
|
|
1432
|
+
persistInvalidSszValue<T>(type: Type<T>, sszObject: T, suffix?: string): void {
|
|
1468
1433
|
if (this.opts.persistInvalidSszObjects) {
|
|
1469
|
-
void this.persistSszObject(
|
|
1470
|
-
type.typeName,
|
|
1471
|
-
type.serialize(sszObject),
|
|
1472
|
-
// in SignedBeaconBlock case, we want to use BeaconBlock root instead
|
|
1473
|
-
rootHex ?? toRootHex(type.hashTreeRoot(sszObject)),
|
|
1474
|
-
suffix
|
|
1475
|
-
);
|
|
1434
|
+
void this.persistSszObject(type.typeName, type.serialize(sszObject), type.hashTreeRoot(sszObject), suffix);
|
|
1476
1435
|
}
|
|
1477
1436
|
}
|
|
1478
1437
|
|
|
1479
|
-
persistInvalidSszBytes(typeName: string, sszBytes: Uint8Array,
|
|
1438
|
+
persistInvalidSszBytes(typeName: string, sszBytes: Uint8Array, suffix?: string): void {
|
|
1480
1439
|
if (this.opts.persistInvalidSszObjects) {
|
|
1481
|
-
void this.persistSszObject(typeName, sszBytes,
|
|
1440
|
+
void this.persistSszObject(typeName, sszBytes, sszBytes, suffix);
|
|
1482
1441
|
}
|
|
1483
1442
|
}
|
|
1484
1443
|
|
|
@@ -1609,14 +1568,14 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1609
1568
|
return {state: blockState, stateId: "block_state_any_epoch", shouldWarn: true};
|
|
1610
1569
|
}
|
|
1611
1570
|
|
|
1612
|
-
private async persistSszObject(prefix: string, bytes: Uint8Array,
|
|
1571
|
+
private async persistSszObject(prefix: string, bytes: Uint8Array, root: Uint8Array, logStr?: string): Promise<void> {
|
|
1613
1572
|
const now = new Date();
|
|
1614
1573
|
// yyyy-MM-dd
|
|
1615
1574
|
const dateStr = now.toISOString().split("T")[0];
|
|
1616
1575
|
|
|
1617
1576
|
// by default store to lodestar_archive of current dir
|
|
1618
1577
|
const dirpath = path.join(this.opts.persistInvalidSszObjectsDir ?? "invalid_ssz_objects", dateStr);
|
|
1619
|
-
const filepath = path.join(dirpath, `${prefix}_${
|
|
1578
|
+
const filepath = path.join(dirpath, `${prefix}_${toRootHex(root)}.ssz`);
|
|
1620
1579
|
|
|
1621
1580
|
await ensureDir(dirpath);
|
|
1622
1581
|
|
|
@@ -120,9 +120,9 @@ export type BlockErrorType =
|
|
|
120
120
|
| {code: BlockErrorCode.ALREADY_KNOWN; root: RootHex}
|
|
121
121
|
| {code: BlockErrorCode.REPEAT_PROPOSAL; proposerIndex: ValidatorIndex; root: RootHex}
|
|
122
122
|
| {code: BlockErrorCode.BLOCK_SLOT_LIMIT_REACHED}
|
|
123
|
-
| {code: BlockErrorCode.INCORRECT_PROPOSER;
|
|
124
|
-
| {code: BlockErrorCode.PROPOSAL_SIGNATURE_INVALID;
|
|
125
|
-
| {code: BlockErrorCode.UNKNOWN_PROPOSER;
|
|
123
|
+
| {code: BlockErrorCode.INCORRECT_PROPOSER; proposerIndex: ValidatorIndex}
|
|
124
|
+
| {code: BlockErrorCode.PROPOSAL_SIGNATURE_INVALID; blockSlot: Slot}
|
|
125
|
+
| {code: BlockErrorCode.UNKNOWN_PROPOSER; proposerIndex: ValidatorIndex}
|
|
126
126
|
| {code: BlockErrorCode.INVALID_SIGNATURE; state: IBeaconStateView}
|
|
127
127
|
| {
|
|
128
128
|
code: BlockErrorCode.INVALID_STATE_ROOT;
|
|
@@ -132,7 +132,7 @@ export type BlockErrorType =
|
|
|
132
132
|
postState: IBeaconStateView;
|
|
133
133
|
}
|
|
134
134
|
| {code: BlockErrorCode.NOT_FINALIZED_DESCENDANT; parentRoot: RootHex}
|
|
135
|
-
| {code: BlockErrorCode.NOT_LATER_THAN_PARENT;
|
|
135
|
+
| {code: BlockErrorCode.NOT_LATER_THAN_PARENT; parentSlot: Slot; slot: Slot}
|
|
136
136
|
| {code: BlockErrorCode.NON_LINEAR_PARENT_ROOTS}
|
|
137
137
|
| {code: BlockErrorCode.NON_LINEAR_SLOTS}
|
|
138
138
|
| {code: BlockErrorCode.ENVELOPE_BLOCK_ROOT_MISMATCH; envelopeBlockRoot: RootHex; blockRoot: RootHex}
|
|
@@ -140,7 +140,7 @@ export type BlockErrorType =
|
|
|
140
140
|
| {code: BlockErrorCode.BEACON_CHAIN_ERROR; error: Error}
|
|
141
141
|
| {code: BlockErrorCode.KNOWN_BAD_BLOCK}
|
|
142
142
|
| {code: BlockErrorCode.BLACKLISTED_BLOCK}
|
|
143
|
-
| {code: BlockErrorCode.INCORRECT_TIMESTAMP;
|
|
143
|
+
| {code: BlockErrorCode.INCORRECT_TIMESTAMP; timestamp: number; expectedTimestamp: number}
|
|
144
144
|
| {code: BlockErrorCode.TOO_MUCH_GAS_USED; gasUsed: number; gasLimit: number}
|
|
145
145
|
| {code: BlockErrorCode.SAME_PARENT_HASH; blockHash: RootHex}
|
|
146
146
|
| {code: BlockErrorCode.TRANSACTIONS_TOO_BIG; size: number; max: number}
|
|
@@ -151,21 +151,9 @@ export type BlockErrorType =
|
|
|
151
151
|
errorMessage: string;
|
|
152
152
|
}
|
|
153
153
|
| {code: BlockErrorCode.DATA_UNAVAILABLE}
|
|
154
|
-
| {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
root: RootHex;
|
|
158
|
-
blobKzgCommitmentsLen: number;
|
|
159
|
-
commitmentLimit: number;
|
|
160
|
-
}
|
|
161
|
-
| {
|
|
162
|
-
code: BlockErrorCode.BID_PARENT_ROOT_MISMATCH;
|
|
163
|
-
slot: Slot;
|
|
164
|
-
root: RootHex;
|
|
165
|
-
bidParentRoot: RootHex;
|
|
166
|
-
blockParentRoot: RootHex;
|
|
167
|
-
}
|
|
168
|
-
| {code: BlockErrorCode.NON_ZERO_DEPOSITS; slot: Slot; root: RootHex; count: number}
|
|
154
|
+
| {code: BlockErrorCode.TOO_MANY_KZG_COMMITMENTS; blobKzgCommitmentsLen: number; commitmentLimit: number}
|
|
155
|
+
| {code: BlockErrorCode.BID_PARENT_ROOT_MISMATCH; bidParentRoot: RootHex; blockParentRoot: RootHex}
|
|
156
|
+
| {code: BlockErrorCode.NON_ZERO_DEPOSITS; count: number}
|
|
169
157
|
| {code: BlockErrorCode.PARENT_EXECUTION_INVALID; parentRoot: RootHex}
|
|
170
158
|
| {code: BlockErrorCode.PARENT_PAYLOAD_UNKNOWN; parentRoot: RootHex; parentBlockHash: RootHex}
|
|
171
159
|
| {code: BlockErrorCode.NON_LINEAR_PAYLOAD_ROOTS; parentBlockHash: RootHex; expectedBlockHash: RootHex};
|
|
@@ -47,12 +47,10 @@ export enum DataColumnSidecarErrorCode {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export type DataColumnSidecarErrorType =
|
|
50
|
-
| {code: DataColumnSidecarErrorCode.INVALID_INDEX; slot: Slot;
|
|
51
|
-
| {code: DataColumnSidecarErrorCode.NO_COMMITMENTS; slot: Slot;
|
|
50
|
+
| {code: DataColumnSidecarErrorCode.INVALID_INDEX; slot: Slot; columnIndex: number}
|
|
51
|
+
| {code: DataColumnSidecarErrorCode.NO_COMMITMENTS; slot: Slot; columnIndex: number}
|
|
52
52
|
| {
|
|
53
53
|
code: DataColumnSidecarErrorCode.MISMATCHED_LENGTHS;
|
|
54
|
-
slot: Slot;
|
|
55
|
-
root: RootHex;
|
|
56
54
|
columnLength: number;
|
|
57
55
|
commitmentsLength: number;
|
|
58
56
|
proofsLength: number;
|
|
@@ -63,17 +61,10 @@ export type DataColumnSidecarErrorType =
|
|
|
63
61
|
columnIndex: number;
|
|
64
62
|
fork: ForkName;
|
|
65
63
|
}
|
|
66
|
-
| {
|
|
67
|
-
code: DataColumnSidecarErrorCode.INVALID_SUBNET;
|
|
68
|
-
slot: Slot;
|
|
69
|
-
root: RootHex;
|
|
70
|
-
columnIndex: number;
|
|
71
|
-
gossipSubnet: SubnetID;
|
|
72
|
-
}
|
|
64
|
+
| {code: DataColumnSidecarErrorCode.INVALID_SUBNET; columnIndex: number; gossipSubnet: SubnetID}
|
|
73
65
|
| {
|
|
74
66
|
code: DataColumnSidecarErrorCode.TOO_MANY_KZG_COMMITMENTS;
|
|
75
67
|
slot: number;
|
|
76
|
-
root: RootHex;
|
|
77
68
|
columnIndex: number;
|
|
78
69
|
count: number;
|
|
79
70
|
limit: number;
|
|
@@ -94,12 +85,12 @@ export type DataColumnSidecarErrorType =
|
|
|
94
85
|
| {
|
|
95
86
|
code: DataColumnSidecarErrorCode.PROPOSAL_SIGNATURE_INVALID;
|
|
96
87
|
slot: Slot;
|
|
97
|
-
|
|
88
|
+
blockRoot: RootHex;
|
|
98
89
|
index: number;
|
|
99
90
|
}
|
|
100
|
-
| {code: DataColumnSidecarErrorCode.NOT_LATER_THAN_PARENT;
|
|
101
|
-
| {code: DataColumnSidecarErrorCode.INCLUSION_PROOF_INVALID; slot: Slot;
|
|
102
|
-
| {code: DataColumnSidecarErrorCode.INVALID_KZG_PROOF; slot: Slot;
|
|
91
|
+
| {code: DataColumnSidecarErrorCode.NOT_LATER_THAN_PARENT; parentSlot: Slot; slot: Slot}
|
|
92
|
+
| {code: DataColumnSidecarErrorCode.INCLUSION_PROOF_INVALID; slot: Slot; columnIndex: number}
|
|
93
|
+
| {code: DataColumnSidecarErrorCode.INVALID_KZG_PROOF; slot: Slot; columnIndex: number}
|
|
103
94
|
| {code: DataColumnSidecarErrorCode.INCORRECT_SIDECAR_COUNT; slot: number; expected: number; actual: number}
|
|
104
95
|
| {
|
|
105
96
|
code: DataColumnSidecarErrorCode.INCORRECT_BLOCK;
|
|
@@ -115,7 +106,6 @@ export type DataColumnSidecarErrorType =
|
|
|
115
106
|
}
|
|
116
107
|
| {
|
|
117
108
|
code: DataColumnSidecarErrorCode.INCORRECT_SIDECAR_SLOT;
|
|
118
|
-
root: RootHex;
|
|
119
109
|
columnIndex: number;
|
|
120
110
|
expected: Slot;
|
|
121
111
|
actual: Slot;
|
|
@@ -137,13 +127,7 @@ export type DataColumnSidecarErrorType =
|
|
|
137
127
|
actual: number;
|
|
138
128
|
}
|
|
139
129
|
| {code: DataColumnSidecarErrorCode.INVALID_KZG_PROOF_BATCH; slot: number; reason: string}
|
|
140
|
-
| {
|
|
141
|
-
code: DataColumnSidecarErrorCode.INCORRECT_PROPOSER;
|
|
142
|
-
slot: Slot;
|
|
143
|
-
root: RootHex;
|
|
144
|
-
actualProposerIndex: number;
|
|
145
|
-
expectedProposerIndex: number;
|
|
146
|
-
}
|
|
130
|
+
| {code: DataColumnSidecarErrorCode.INCORRECT_PROPOSER; actualProposerIndex: number; expectedProposerIndex: number}
|
|
147
131
|
| {code: DataColumnSidecarErrorCode.PAYLOAD_ENVELOPE_INPUT_MISSING; slot: Slot; blockRoot: RootHex};
|
|
148
132
|
|
|
149
133
|
export class DataColumnSidecarGossipError extends GossipActionError<DataColumnSidecarErrorType> {}
|
|
@@ -26,35 +26,23 @@ export type ExecutionPayloadEnvelopeErrorType =
|
|
|
26
26
|
slot: Slot;
|
|
27
27
|
}
|
|
28
28
|
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_BLOCK; blockRoot: RootHex}
|
|
29
|
-
| {
|
|
30
|
-
code: ExecutionPayloadEnvelopeErrorCode.SLOT_MISMATCH;
|
|
31
|
-
slot: Slot;
|
|
32
|
-
root: RootHex;
|
|
33
|
-
envelopeSlot: Slot;
|
|
34
|
-
blockSlot: Slot;
|
|
35
|
-
}
|
|
29
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.SLOT_MISMATCH; envelopeSlot: Slot; blockSlot: Slot}
|
|
36
30
|
| {
|
|
37
31
|
code: ExecutionPayloadEnvelopeErrorCode.BUILDER_INDEX_MISMATCH;
|
|
38
|
-
slot: Slot;
|
|
39
|
-
root: RootHex;
|
|
40
32
|
envelopeBuilderIndex: BuilderIndex;
|
|
41
33
|
bidBuilderIndex: BuilderIndex | null;
|
|
42
34
|
}
|
|
43
35
|
| {
|
|
44
36
|
code: ExecutionPayloadEnvelopeErrorCode.BLOCK_HASH_MISMATCH;
|
|
45
|
-
slot: Slot;
|
|
46
|
-
root: RootHex;
|
|
47
37
|
envelopeBlockHash: RootHex;
|
|
48
38
|
bidBlockHash: RootHex | null;
|
|
49
39
|
}
|
|
50
40
|
| {
|
|
51
41
|
code: ExecutionPayloadEnvelopeErrorCode.EXECUTION_REQUESTS_ROOT_MISMATCH;
|
|
52
|
-
slot: Slot;
|
|
53
|
-
root: RootHex;
|
|
54
42
|
envelopeRequestsRoot: RootHex;
|
|
55
43
|
bidRequestsRoot: RootHex;
|
|
56
44
|
}
|
|
57
|
-
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE
|
|
45
|
+
| {code: ExecutionPayloadEnvelopeErrorCode.INVALID_SIGNATURE}
|
|
58
46
|
| {code: ExecutionPayloadEnvelopeErrorCode.PAYLOAD_ENVELOPE_INPUT_MISSING; blockRoot: RootHex};
|
|
59
47
|
|
|
60
48
|
export class ExecutionPayloadEnvelopeError extends GossipActionError<ExecutionPayloadEnvelopeErrorType> {}
|
package/src/chain/interface.ts
CHANGED
|
@@ -290,8 +290,8 @@ export interface IBeaconChain {
|
|
|
290
290
|
postState: IBeaconStateView,
|
|
291
291
|
block: SignedBeaconBlock
|
|
292
292
|
): Promise<void>;
|
|
293
|
-
persistInvalidSszValue<T>(type: Type<T>, sszObject: T, suffix?: string
|
|
294
|
-
persistInvalidSszBytes(type: string, sszBytes: Uint8Array,
|
|
293
|
+
persistInvalidSszValue<T>(type: Type<T>, sszObject: T | Uint8Array, suffix?: string): void;
|
|
294
|
+
persistInvalidSszBytes(type: string, sszBytes: Uint8Array, suffix?: string): void;
|
|
295
295
|
regenStateForAttestationVerification(
|
|
296
296
|
attEpoch: Epoch,
|
|
297
297
|
shufflingDependentRoot: RootHex,
|
|
@@ -243,22 +243,6 @@ export class PrepareNextSlotScheduler {
|
|
|
243
243
|
parentBlockHash = preparedState.latestExecutionPayloadHeader.blockHash;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
// If emitPayloadAttributes is true emit a SSE payloadAttributes event for
|
|
247
|
-
// every slot. Without the flag, only emit the event if we are proposing in the next slot.
|
|
248
|
-
if (
|
|
249
|
-
(feeRecipient || this.chain.opts.emitPayloadAttributes === true) &&
|
|
250
|
-
this.chain.emitter.listenerCount(routes.events.EventType.payloadAttributes)
|
|
251
|
-
) {
|
|
252
|
-
const data = getPayloadAttributesForSSE(fork as ForkPostBellatrix, this.chain, {
|
|
253
|
-
prepareState: stateAfterParentPayload,
|
|
254
|
-
prepareSlot,
|
|
255
|
-
parentBlockRoot: fromHex(updatedHead.blockRoot),
|
|
256
|
-
parentBlockHash,
|
|
257
|
-
feeRecipient: feeRecipient ?? "0x0000000000000000000000000000000000000000",
|
|
258
|
-
});
|
|
259
|
-
this.chain.emitter.emit(routes.events.EventType.payloadAttributes, {data, version: fork});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
246
|
if (feeRecipient) {
|
|
263
247
|
const preparationTime =
|
|
264
248
|
computeTimeAtSlot(this.config, prepareSlot, this.chain.genesisTime) - Date.now() / 1000;
|
|
@@ -289,6 +273,22 @@ export class PrepareNextSlotScheduler {
|
|
|
289
273
|
}
|
|
290
274
|
|
|
291
275
|
this.computeStateHashTreeRoot(preparedState, isEpochTransition);
|
|
276
|
+
|
|
277
|
+
// If emitPayloadAttributes is true emit a SSE payloadAttributes event for
|
|
278
|
+
// every slot. Without the flag, only emit the event if we are proposing in the next slot.
|
|
279
|
+
if (
|
|
280
|
+
(feeRecipient || this.chain.opts.emitPayloadAttributes === true) &&
|
|
281
|
+
this.chain.emitter.listenerCount(routes.events.EventType.payloadAttributes)
|
|
282
|
+
) {
|
|
283
|
+
const data = getPayloadAttributesForSSE(fork as ForkPostBellatrix, this.chain, {
|
|
284
|
+
prepareState: stateAfterParentPayload,
|
|
285
|
+
prepareSlot,
|
|
286
|
+
parentBlockRoot: fromHex(updatedHead.blockRoot),
|
|
287
|
+
parentBlockHash,
|
|
288
|
+
feeRecipient: feeRecipient ?? "0x0000000000000000000000000000000000000000",
|
|
289
|
+
});
|
|
290
|
+
this.chain.emitter.emit(routes.events.EventType.payloadAttributes, {data, version: fork});
|
|
291
|
+
}
|
|
292
292
|
} else {
|
|
293
293
|
// Pre-bellatrix only reaches here at an epoch transition to precompute the next epoch state
|
|
294
294
|
const preparedState = await this.chain.regen.getBlockSlotState(
|
|
@@ -134,9 +134,8 @@ export async function validateGossipBlock(
|
|
|
134
134
|
if (parentBlock.slot >= blockSlot) {
|
|
135
135
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
136
136
|
code: BlockErrorCode.NOT_LATER_THAN_PARENT,
|
|
137
|
-
slot: blockSlot,
|
|
138
|
-
root: blockRoot,
|
|
139
137
|
parentSlot: parentBlock.slot,
|
|
138
|
+
slot: blockSlot,
|
|
140
139
|
});
|
|
141
140
|
}
|
|
142
141
|
|
|
@@ -151,8 +150,6 @@ export async function validateGossipBlock(
|
|
|
151
150
|
if (blobKzgCommitmentsLen > maxBlobsPerBlock) {
|
|
152
151
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
153
152
|
code: BlockErrorCode.TOO_MANY_KZG_COMMITMENTS,
|
|
154
|
-
slot: blockSlot,
|
|
155
|
-
root: blockRoot,
|
|
156
153
|
blobKzgCommitmentsLen,
|
|
157
154
|
commitmentLimit: maxBlobsPerBlock,
|
|
158
155
|
});
|
|
@@ -170,8 +167,6 @@ export async function validateGossipBlock(
|
|
|
170
167
|
if (blobKzgCommitmentsLen > maxBlobsPerBlock) {
|
|
171
168
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
172
169
|
code: BlockErrorCode.TOO_MANY_KZG_COMMITMENTS,
|
|
173
|
-
slot: blockSlot,
|
|
174
|
-
root: blockRoot,
|
|
175
170
|
blobKzgCommitmentsLen,
|
|
176
171
|
commitmentLimit: maxBlobsPerBlock,
|
|
177
172
|
});
|
|
@@ -181,8 +176,6 @@ export async function validateGossipBlock(
|
|
|
181
176
|
if (!byteArrayEquals(bid.parentBlockRoot, block.parentRoot)) {
|
|
182
177
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
183
178
|
code: BlockErrorCode.BID_PARENT_ROOT_MISMATCH,
|
|
184
|
-
slot: blockSlot,
|
|
185
|
-
root: blockRoot,
|
|
186
179
|
bidParentRoot: toRootHex(bid.parentBlockRoot),
|
|
187
180
|
blockParentRoot: parentRoot,
|
|
188
181
|
});
|
|
@@ -192,8 +185,6 @@ export async function validateGossipBlock(
|
|
|
192
185
|
if (body.deposits.length !== 0) {
|
|
193
186
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
194
187
|
code: BlockErrorCode.NON_ZERO_DEPOSITS,
|
|
195
|
-
slot: blockSlot,
|
|
196
|
-
root: blockRoot,
|
|
197
188
|
count: body.deposits.length,
|
|
198
189
|
});
|
|
199
190
|
}
|
|
@@ -258,8 +249,6 @@ export async function validateGossipBlock(
|
|
|
258
249
|
if (executionPayload.timestamp !== computeTimeAtSlot(config, blockSlot, chain.genesisTime)) {
|
|
259
250
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
260
251
|
code: BlockErrorCode.INCORRECT_TIMESTAMP,
|
|
261
|
-
slot: blockSlot,
|
|
262
|
-
root: blockRoot,
|
|
263
252
|
timestamp: executionPayload.timestamp,
|
|
264
253
|
expectedTimestamp,
|
|
265
254
|
});
|
|
@@ -269,12 +258,7 @@ export async function validateGossipBlock(
|
|
|
269
258
|
|
|
270
259
|
// [REJECT] The proposer index is a valid validator index
|
|
271
260
|
if (proposerIndex >= state.validatorCount) {
|
|
272
|
-
throw new BlockGossipError(GossipAction.REJECT, {
|
|
273
|
-
code: BlockErrorCode.UNKNOWN_PROPOSER,
|
|
274
|
-
slot: blockSlot,
|
|
275
|
-
root: blockRoot,
|
|
276
|
-
proposerIndex,
|
|
277
|
-
});
|
|
261
|
+
throw new BlockGossipError(GossipAction.REJECT, {code: BlockErrorCode.UNKNOWN_PROPOSER, proposerIndex});
|
|
278
262
|
}
|
|
279
263
|
|
|
280
264
|
// [REJECT] The proposer signature, signed_beacon_block.signature, is valid with respect to the proposer_index pubkey.
|
|
@@ -286,12 +270,7 @@ export async function validateGossipBlock(
|
|
|
286
270
|
// shuffling, the block MAY be queued for later processing while proposers for the block's branch are calculated --
|
|
287
271
|
// in such a case do not REJECT, instead IGNORE this message.
|
|
288
272
|
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
|
-
});
|
|
273
|
+
throw new BlockGossipError(GossipAction.REJECT, {code: BlockErrorCode.INCORRECT_PROPOSER, proposerIndex});
|
|
295
274
|
}
|
|
296
275
|
|
|
297
276
|
// Simple implementation of a pending block queue. Keeping the block here recycles the queue logic, and keeps the
|
|
@@ -336,8 +315,7 @@ export async function verifyBlockProposerSignature(
|
|
|
336
315
|
if (!(await chain.bls.verifySignatureSets([signatureSet], {verifyOnMainThread: opts.verifyOnMainThread ?? true}))) {
|
|
337
316
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
338
317
|
code: BlockErrorCode.PROPOSAL_SIGNATURE_INVALID,
|
|
339
|
-
|
|
340
|
-
root: blockRoot,
|
|
318
|
+
blockSlot,
|
|
341
319
|
});
|
|
342
320
|
}
|
|
343
321
|
|