@lodestar/beacon-node 1.46.0-dev.e6f04acd82 → 1.46.0-dev.f0f5d069e2
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 +37 -15
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +15 -6
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +3 -3
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.d.ts.map +1 -1
- package/lib/chain/blocks/importExecutionPayload.js +3 -4
- 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 +6 -0
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +31 -25
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/blocks/utils/polarBearBanner.d.ts +2 -0
- package/lib/chain/blocks/utils/polarBearBanner.d.ts.map +1 -0
- package/lib/chain/blocks/utils/polarBearBanner.js +51 -0
- package/lib/chain/blocks/utils/polarBearBanner.js.map +1 -0
- package/lib/chain/blocks/verifyBlock.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlock.js +21 -1
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/chain.d.ts +5 -0
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +50 -0
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +6 -0
- package/lib/chain/emitter.d.ts.map +1 -1
- package/lib/chain/emitter.js +5 -0
- package/lib/chain/emitter.js.map +1 -1
- package/lib/chain/interface.d.ts +2 -0
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/options.d.ts +2 -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 +107 -29
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +6 -6
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.d.ts +20 -4
- package/lib/chain/seenCache/seenBlockProposers.d.ts.map +1 -1
- package/lib/chain/seenCache/seenBlockProposers.js +49 -2
- package/lib/chain/seenCache/seenBlockProposers.js.map +1 -1
- package/lib/chain/validation/block.d.ts +4 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +32 -18
- 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 +21 -16
- package/lib/chain/validation/dataColumnSidecar.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +14 -0
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +38 -0
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/network.d.ts +1 -0
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +11 -1
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +8 -0
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/reqresp/score.d.ts.map +1 -1
- package/lib/network/reqresp/score.js +20 -3
- package/lib/network/reqresp/score.js.map +1 -1
- package/lib/util/clock.d.ts +2 -7
- package/lib/util/clock.d.ts.map +1 -1
- package/lib/util/clock.js +2 -7
- package/lib/util/clock.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +65 -16
- package/src/api/impl/validator/index.ts +19 -6
- package/src/chain/blocks/importBlock.ts +3 -2
- package/src/chain/blocks/importExecutionPayload.ts +8 -4
- package/src/chain/blocks/index.ts +7 -0
- package/src/chain/blocks/utils/chainSegment.ts +35 -28
- package/src/chain/blocks/utils/polarBearBanner.ts +50 -0
- package/src/chain/blocks/verifyBlock.ts +28 -2
- package/src/chain/chain.ts +56 -0
- package/src/chain/emitter.ts +7 -0
- package/src/chain/interface.ts +3 -0
- package/src/chain/options.ts +3 -0
- package/src/chain/prepareNextSlot.ts +140 -39
- package/src/chain/produceBlock/produceBlockBody.ts +11 -6
- package/src/chain/seenCache/seenBlockProposers.ts +72 -5
- package/src/chain/validation/block.ts +41 -19
- package/src/chain/validation/dataColumnSidecar.ts +27 -17
- package/src/metrics/metrics/lodestar.ts +39 -0
- package/src/network/network.ts +16 -1
- package/src/network/processor/gossipHandlers.ts +7 -0
- package/src/network/reqresp/score.ts +22 -3
- package/src/util/clock.ts +2 -7
|
@@ -31,23 +31,40 @@ export function assertLinearChainSegment(
|
|
|
31
31
|
payloadEnvelopes: Map<Slot, PayloadEnvelopeInput> | null,
|
|
32
32
|
parentBlock: ProtoBlock | null
|
|
33
33
|
): ChainSegmentResult {
|
|
34
|
+
if (blocks.length === 0) {
|
|
35
|
+
return {warnings: null};
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
const warnings: OrphanedPayloadEnvelope[] = [];
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
// Starts from the known forkchoice parent's execution hash.
|
|
38
|
-
// - FULL variant (envelope present for slot): advances to envelope.payload.blockHash
|
|
39
|
-
// - EMPTY variant (no envelope for slot): execution hash is unchanged
|
|
40
|
-
let currentExecHash: string | null = parentBlock?.executionPayloadBlockHash ?? null;
|
|
41
|
-
// Checkpoint sync first batch: parent is the anchor PENDING whose executionPayloadBlockHash
|
|
42
|
-
// is the inherited parentBlockHash semantic (= grandparent's payload), not its own payload.
|
|
43
|
-
// If parent's own payload envelope arrives in this batch, advance currentExecHash to that
|
|
44
|
-
// payload's blockHash so the segment validation sees the true EL chain head.
|
|
40
|
+
let parentExecHash: string | null = parentBlock?.executionPayloadBlockHash ?? null;
|
|
45
41
|
if (parentBlock !== null) {
|
|
46
42
|
const parentPayloadInput = payloadEnvelopes?.get(parentBlock.slot);
|
|
47
43
|
if (parentPayloadInput?.hasPayloadEnvelope()) {
|
|
48
|
-
|
|
44
|
+
// Checkpoint-sync first batch: the anchor is stored PENDING with the inherited (grandparent)
|
|
45
|
+
// hash, not its own payload. Its payload envelope is in this batch, so use that blockHash as
|
|
46
|
+
// the real parent EL head.
|
|
47
|
+
parentExecHash = parentPayloadInput.getBlockHashHex();
|
|
49
48
|
}
|
|
50
49
|
}
|
|
50
|
+
|
|
51
|
+
// Track the expected execution payload block hash through the segment, seeded from the FIRST
|
|
52
|
+
// block's own bid
|
|
53
|
+
const firstBlockMessage = blocks[0].getBlock().message;
|
|
54
|
+
let currentExecHash: string | null = isGloasBeaconBlock(firstBlockMessage)
|
|
55
|
+
? toRootHex(firstBlockMessage.body.signedExecutionPayloadBid.message.parentBlockHash)
|
|
56
|
+
: null;
|
|
57
|
+
|
|
58
|
+
// First block must build on the parent's EL head. PARENT_PAYLOAD_UNKNOWN (vs the in-segment
|
|
59
|
+
// NON_LINEAR_PAYLOAD_ROOTS below) tells range sync this is a parent-link problem, not an in-batch one.
|
|
60
|
+
if (parentExecHash !== null && currentExecHash !== null && currentExecHash !== parentExecHash) {
|
|
61
|
+
throw new BlockError(blocks[0].getBlock(), {
|
|
62
|
+
code: BlockErrorCode.PARENT_PAYLOAD_UNKNOWN,
|
|
63
|
+
parentRoot: toRootHex(firstBlockMessage.parentRoot),
|
|
64
|
+
parentBlockHash: currentExecHash,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
51
68
|
// Track the execution hash before the last FULL advancement so we can recover
|
|
52
69
|
// if the next block reveals that envelope was orphaned.
|
|
53
70
|
let prevExecHash: string | null = currentExecHash;
|
|
@@ -76,8 +93,7 @@ export function assertLinearChainSegment(
|
|
|
76
93
|
}
|
|
77
94
|
|
|
78
95
|
if (isGloasBeaconBlock(block.message)) {
|
|
79
|
-
//
|
|
80
|
-
// chain is seeded mid-segment by the first FULL envelope.
|
|
96
|
+
// currentExecHash and prevExecHash are only null for a pre-gloas first block (fork-transition segment); always set post-gloas.
|
|
81
97
|
if (currentExecHash !== null) {
|
|
82
98
|
// Verify the bid's parentBlockHash matches the tracked execution hash.
|
|
83
99
|
// This ensures the block was built on the correct FULL or EMPTY variant of its parent.
|
|
@@ -86,22 +102,13 @@ export function assertLinearChainSegment(
|
|
|
86
102
|
// Maybe the previous slot's FULL envelope was orphaned — try falling back.
|
|
87
103
|
// If even prevExecHash doesn't match, the segment is non-linear.
|
|
88
104
|
if (bidParentHash !== prevExecHash) {
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
throw new BlockError(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
parentRoot: toRootHex(block.message.parentRoot),
|
|
97
|
-
parentBlockHash: bidParentHash,
|
|
98
|
-
}
|
|
99
|
-
: {
|
|
100
|
-
code: BlockErrorCode.NON_LINEAR_PAYLOAD_ROOTS,
|
|
101
|
-
parentBlockHash: bidParentHash,
|
|
102
|
-
expectedBlockHash: currentExecHash,
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
+
// Broken link inside the segment: throw NON_LINEAR_PAYLOAD_ROOTS instead of PARENT_PAYLOAD_UNKNOWN
|
|
106
|
+
// this is important for range sync to handle accordingly
|
|
107
|
+
throw new BlockError(block, {
|
|
108
|
+
code: BlockErrorCode.NON_LINEAR_PAYLOAD_ROOTS,
|
|
109
|
+
parentBlockHash: bidParentHash,
|
|
110
|
+
expectedBlockHash: currentExecHash,
|
|
111
|
+
});
|
|
105
112
|
}
|
|
106
113
|
if (lastFullSlot !== null && payloadEnvelopes !== null) {
|
|
107
114
|
const orphanedInput = payloadEnvelopes.get(lastFullSlot);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const GLOAS_POLAR_BEAR_BANNER = String.raw`
|
|
2
|
+
|
|
3
|
+
__ . .- '%%%░░░░░
|
|
4
|
+
/ '-. , ' '%%%░░░░
|
|
5
|
+
_.--""""--.._; . * .-' '%%%%░░
|
|
6
|
+
\ / _."" .' '-._ ' . '%%%%
|
|
7
|
+
L ."; ; ; '-. . / ' * '""
|
|
8
|
+
Ø / / .' ' ; '. ' ; |
|
|
9
|
+
D / ; e ' ) ( ' ; \ . .' ,:
|
|
10
|
+
E ; : P ( ' ) : '-.\ ' '
|
|
11
|
+
S ; ; B ).( '. '; ' '
|
|
12
|
+
T : : S (/:\) \ :
|
|
13
|
+
A : \ ': / : \ \ '.;
|
|
14
|
+
R \ \ '; \\ // ; ;
|
|
15
|
+
/ \ \ : .' \ \|/ | /
|
|
16
|
+
'>' : ' '.; |
|
|
17
|
+
/ ,' / '. ;/ _\
|
|
18
|
+
;,' ; '. '.; '-.
|
|
19
|
+
;' .' : '. '. / \, \ \ \
|
|
20
|
+
\ :,' : '. '. \ ; ::\_/_/_/::
|
|
21
|
+
~| .-=:.-" -,- "-.,=-.\ ;.; :::; ; ;::
|
|
22
|
+
~|\ |('.' : .')| \: '. :::::::
|
|
23
|
+
~|:\ \\/ : \// ; \ _____
|
|
24
|
+
~~\:\ ■ : .:. : _/ ; \hjw:
|
|
25
|
+
~~~\/ | ; ; ; | \"""
|
|
26
|
+
~~.' ■ : _ _ ; / ; /|~~
|
|
27
|
+
~/ | '. \'; ;'/ .' .' / /:|~~
|
|
28
|
+
| ■ ! : : !_.' / .--::/~~~
|
|
29
|
+
|\___ | '.: :.'/\ ; ____.':|:|/~~~~
|
|
30
|
+
\:::|\ ■ \'_'/ | : : ___/|:::|:'"""~~~~~
|
|
31
|
+
~'""|:\ | ;"^" | ! :__/|::|/""""~~~~~~~~~~
|
|
32
|
+
~~~~\::\_____ .-' | ; |::|/""~~~~~~~~~~~~~~~~
|
|
33
|
+
~~~~~\:|::::|\ / / / / / /"""~~~~~~~~~~~~~~~~~~~~
|
|
34
|
+
~~~~~~\|::::|:'--\_\_\__.'-| ;~~~~~~~~~~~~~~~~~~~~~~~~
|
|
35
|
+
~~~~~~~~""""~\::::::::::::/ .'~~~~~~~~~~~~~<><~~~~~~~~~
|
|
36
|
+
~~~~~~~~~~~~~~""""'"""".-' /~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
37
|
+
~~~~~~~__,------.__.--/ , , , |/--._~~~~~~~~~~~~~~~~~~~~~~~
|
|
38
|
+
~~~~~~/ | . :\| | |v' \__~~~~~~~~~~~~~~~~~~~~
|
|
39
|
+
~~~~~|\ ■ /:\ :::v-;v-':: \_~~~~~~~~~~~~~~~~~~
|
|
40
|
+
~~~~~\:\ / : \ ::::::::: \~~~~~~~~~~~~~~~~~
|
|
41
|
+
~~~~~~\|'-. / : \ /|~~~~~~~~~~~~~~~~
|
|
42
|
+
~~~~~~~~': \ \'. ,'/ ___ ____/:/~~~~~~~~~<><~~~~
|
|
43
|
+
~~~~~~~~~~\|: \ ' / /|:|\ /|:::|/~~~~~~~~~~~~~~~~~
|
|
44
|
+
~~~~~~~~~~~|: \:/ //"""\\ /:/"""~~~~~~~~~~~~~~~~~~~
|
|
45
|
+
~~~><>~~~~~|\ ' //~~~~~\\______/:/~~~~~~~~~~~~~~~~~~~~~~~
|
|
46
|
+
~~~~~~~~~~~'|\____//~~~~~~~\|GLOAS|/~~~~~~~~<><~~~~~~~~~~~~~
|
|
47
|
+
~~~~~~~~~~~~\|:::|/~~~~~~~~~'"""""'~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
48
|
+
~~~~~~~~~~~~~'"""'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
49
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~eth
|
|
50
|
+
`;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import {ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice";
|
|
2
2
|
import {ForkName, ForkSeq, isForkPostFulu} from "@lodestar/params";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
DataAvailabilityStatus,
|
|
5
|
+
IBeaconStateView,
|
|
6
|
+
computeEpochAtSlot,
|
|
7
|
+
signedBlockToSignedHeader,
|
|
8
|
+
} from "@lodestar/state-transition";
|
|
9
|
+
import {IndexedAttestation, Slot, deneb, ssz} from "@lodestar/types";
|
|
10
|
+
import {toRootHex} from "@lodestar/utils";
|
|
5
11
|
import {getBlobKzgCommitments} from "../../util/dataColumns.js";
|
|
6
12
|
import type {BeaconChain} from "../chain.js";
|
|
7
13
|
import {BlockError, BlockErrorCode} from "../errors/index.js";
|
|
@@ -13,6 +19,7 @@ import {ImportBlockOpts} from "./types.js";
|
|
|
13
19
|
import {DENEB_BLOWFISH_BANNER} from "./utils/blowfishBanner.js";
|
|
14
20
|
import {ELECTRA_GIRAFFE_BANNER} from "./utils/giraffeBanner.js";
|
|
15
21
|
import {CAPELLA_OWL_BANNER} from "./utils/ownBanner.js";
|
|
22
|
+
import {GLOAS_POLAR_BEAR_BANNER} from "./utils/polarBearBanner.js";
|
|
16
23
|
import {FULU_ZEBRA_BANNER} from "./utils/zebraBanner.js";
|
|
17
24
|
import {verifyBlocksDataAvailability} from "./verifyBlocksDataAvailability.js";
|
|
18
25
|
import {SegmentExecStatus, verifyBlocksExecutionPayload} from "./verifyBlocksExecutionPayloads.js";
|
|
@@ -203,6 +210,20 @@ export async function verifyBlocksInEpoch(
|
|
|
203
210
|
// maybe chain with the above verifyBlocksSignatures()
|
|
204
211
|
]);
|
|
205
212
|
|
|
213
|
+
if (opts.skipVerifyBlockSignatures !== true) {
|
|
214
|
+
for (const block of blocks) {
|
|
215
|
+
const {slot, proposerIndex} = block.message;
|
|
216
|
+
const signedBlockHeader = signedBlockToSignedHeader(this.config, block);
|
|
217
|
+
const blockRoot = toRootHex(ssz.phase0.BeaconBlockHeader.hashTreeRoot(signedBlockHeader.message));
|
|
218
|
+
this.seenBlockProposers.observeBlockRoot(slot, proposerIndex, blockRoot, signedBlockHeader);
|
|
219
|
+
// Only produce a slashing while importing the block. A block that is verified before it is published
|
|
220
|
+
// must not be treated as equivocation evidence since it may never be seen by the network
|
|
221
|
+
if (opts.verifyOnly !== true && this.seenBlockProposers.isEquivocating(slot, proposerIndex)) {
|
|
222
|
+
this.processProposerEquivocation(slot, proposerIndex);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
206
227
|
if (opts.verifyOnly !== true) {
|
|
207
228
|
const fromForkBoundary = this.config.getForkBoundaryAtEpoch(computeEpochAtSlot(parentBlock.slot));
|
|
208
229
|
const toForkBoundary = this.config.getForkBoundaryAtEpoch(computeEpochAtSlot(lastBlock.message.slot));
|
|
@@ -230,6 +251,11 @@ export async function verifyBlocksInEpoch(
|
|
|
230
251
|
this.logger.info("Activating peerDAS", {epoch: this.config.FULU_FORK_EPOCH});
|
|
231
252
|
break;
|
|
232
253
|
|
|
254
|
+
case ForkName.gloas:
|
|
255
|
+
this.logger.info(GLOAS_POLAR_BEAR_BANNER);
|
|
256
|
+
this.logger.info("Activating ePBS", {epoch: this.config.GLOAS_FORK_EPOCH});
|
|
257
|
+
break;
|
|
258
|
+
|
|
233
259
|
default:
|
|
234
260
|
}
|
|
235
261
|
}
|
package/src/chain/chain.ts
CHANGED
|
@@ -130,6 +130,7 @@ import {CPStateDatastore} from "./stateCache/datastore/types.js";
|
|
|
130
130
|
import {FIFOBlockStateCache} from "./stateCache/fifoBlockStateCache.js";
|
|
131
131
|
import {PersistentCheckpointStateCache} from "./stateCache/persistentCheckpointsCache.js";
|
|
132
132
|
import {CheckpointStateCache} from "./stateCache/types.js";
|
|
133
|
+
import {validateApiProposerSlashing} from "./validation/proposerSlashing.js";
|
|
133
134
|
import {ValidatorMonitor} from "./validatorMonitor.js";
|
|
134
135
|
|
|
135
136
|
/**
|
|
@@ -200,6 +201,8 @@ export class BeaconChain implements IBeaconChain {
|
|
|
200
201
|
readonly seenAggregatedAttestations: SeenAggregatedAttestations;
|
|
201
202
|
readonly seenExecutionPayloadBids = new SeenExecutionPayloadBids();
|
|
202
203
|
readonly seenBlockProposers = new SeenBlockProposers();
|
|
204
|
+
/** Proposer indexes with an in-flight proposer slashing production */
|
|
205
|
+
private readonly producingProposerSlashing = new Set<ValidatorIndex>();
|
|
203
206
|
readonly seenSyncCommitteeMessages = new SeenSyncCommitteeMessages();
|
|
204
207
|
readonly seenContributionAndProof: SeenContributionAndProof;
|
|
205
208
|
readonly seenAttestationDatas: SeenAttestationDatas;
|
|
@@ -1163,6 +1166,59 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1163
1166
|
return this.payloadEnvelopeProcessor.processPayloadEnvelopeJob(payloadInput, opts);
|
|
1164
1167
|
}
|
|
1165
1168
|
|
|
1169
|
+
processProposerEquivocation(blockSlot: Slot, proposerIndex: ValidatorIndex): void {
|
|
1170
|
+
this.produceProposerSlashing(blockSlot, proposerIndex).catch((e) => {
|
|
1171
|
+
this.logger.debug("Error producing proposer slashing", {slot: blockSlot, proposerIndex}, e as Error);
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
/** Produce a proposer slashing from two conflicting signed block headers observed for the same slot and proposer */
|
|
1176
|
+
private async produceProposerSlashing(blockSlot: Slot, proposerIndex: ValidatorIndex): Promise<void> {
|
|
1177
|
+
if (
|
|
1178
|
+
this.opts.disableProposerSlashings === true ||
|
|
1179
|
+
this.opPool.hasSeenProposerSlashing(proposerIndex) ||
|
|
1180
|
+
this.producingProposerSlashing.has(proposerIndex)
|
|
1181
|
+
) {
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
const headers = this.seenBlockProposers.getEquivocationHeaders(blockSlot, proposerIndex);
|
|
1186
|
+
if (headers === null) {
|
|
1187
|
+
return;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
this.producingProposerSlashing.add(proposerIndex);
|
|
1191
|
+
try {
|
|
1192
|
+
const [header1, header2] = headers;
|
|
1193
|
+
// ProposerSlashing uses the bigint variant of the signed block header, see types package for details
|
|
1194
|
+
const proposerSlashing: phase0.ProposerSlashing = {
|
|
1195
|
+
signedHeader1: {
|
|
1196
|
+
message: {...header1.message, slot: BigInt(header1.message.slot)},
|
|
1197
|
+
signature: header1.signature,
|
|
1198
|
+
},
|
|
1199
|
+
signedHeader2: {
|
|
1200
|
+
message: {...header2.message, slot: BigInt(header2.message.slot)},
|
|
1201
|
+
signature: header2.signature,
|
|
1202
|
+
},
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
try {
|
|
1206
|
+
await validateApiProposerSlashing(this, proposerSlashing);
|
|
1207
|
+
} catch (e) {
|
|
1208
|
+
this.logger.debug("Produced proposer slashing is not valid", {slot: blockSlot, proposerIndex}, e as Error);
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
this.opPool.insertProposerSlashing(proposerSlashing);
|
|
1213
|
+
this.emitter.emit(routes.events.EventType.proposerSlashing, proposerSlashing);
|
|
1214
|
+
this.emitter.emit(ChainEvent.publishProposerSlashing, proposerSlashing);
|
|
1215
|
+
this.metrics?.opPool.proposerSlashingsProduced.inc();
|
|
1216
|
+
this.logger.info("Produced proposer slashing from observed equivocation", {slot: blockSlot, proposerIndex});
|
|
1217
|
+
} finally {
|
|
1218
|
+
this.producingProposerSlashing.delete(proposerIndex);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1166
1222
|
getStatus(): Status {
|
|
1167
1223
|
const head = this.forkChoice.getHead();
|
|
1168
1224
|
const finalizedCheckpoint = this.forkChoice.getFinalizedCheckpoint();
|
package/src/chain/emitter.ts
CHANGED
|
@@ -50,6 +50,11 @@ export enum ChainEvent {
|
|
|
50
50
|
* and are ready to be published.
|
|
51
51
|
*/
|
|
52
52
|
publishBlobSidecars = "publishBlobSidecars",
|
|
53
|
+
/**
|
|
54
|
+
* This event signals that a proposer slashing has been produced from an observed equivocation
|
|
55
|
+
* and is ready to be published.
|
|
56
|
+
*/
|
|
57
|
+
publishProposerSlashing = "publishProposerSlashing",
|
|
53
58
|
/**
|
|
54
59
|
* Trigger an update of status so reqresp by peers have current earliestAvailableSlot
|
|
55
60
|
*/
|
|
@@ -110,6 +115,8 @@ export type IChainEvents = ApiEvents & {
|
|
|
110
115
|
|
|
111
116
|
[ChainEvent.publishBlobSidecars]: (sidecars: deneb.BlobSidecar[]) => void;
|
|
112
117
|
|
|
118
|
+
[ChainEvent.publishProposerSlashing]: (proposerSlashing: phase0.ProposerSlashing) => void;
|
|
119
|
+
|
|
113
120
|
[ChainEvent.updateStatus]: () => void;
|
|
114
121
|
|
|
115
122
|
// Sync events that are chain->chain. Initiated from network requests but do not cross the network
|
package/src/chain/interface.ts
CHANGED
|
@@ -262,6 +262,9 @@ export interface IBeaconChain {
|
|
|
262
262
|
/** Process execution payload envelope: verify, import to fork choice, and persist to DB */
|
|
263
263
|
processExecutionPayload(payloadInput: PayloadEnvelopeInput, opts?: ImportPayloadOpts): Promise<void>;
|
|
264
264
|
|
|
265
|
+
/** Produce and publish a proposer slashing from an observed equivocation. Does not throw, only logs errors */
|
|
266
|
+
processProposerEquivocation(blockSlot: Slot, proposerIndex: ValidatorIndex): void;
|
|
267
|
+
|
|
265
268
|
getStatus(): Status;
|
|
266
269
|
|
|
267
270
|
recomputeForkChoiceHead(caller: ForkchoiceCaller): ProtoBlock;
|
package/src/chain/options.ts
CHANGED
|
@@ -37,6 +37,8 @@ export type IChainOptions = BlockProcessOpts &
|
|
|
37
37
|
suggestedFeeRecipient: string;
|
|
38
38
|
graffitiAppend?: boolean;
|
|
39
39
|
maxSkipSlots?: number;
|
|
40
|
+
/** Do not produce proposer slashings from observed equivocations and do not include proposer slashings in produced blocks */
|
|
41
|
+
disableProposerSlashings?: boolean;
|
|
40
42
|
/** Ensure blobs returned by the execution engine are valid */
|
|
41
43
|
sanityCheckExecutionEngineBlobs?: boolean;
|
|
42
44
|
/** Max number of produced blobs by local validators to cache */
|
|
@@ -122,6 +124,7 @@ export const defaultChainOptions: IChainOptions = {
|
|
|
122
124
|
// for gossip block validation, it's unlikely we see a reorg with 32 slots
|
|
123
125
|
// for attestation validation, having this value ensures we don't have to regen states most of the time
|
|
124
126
|
maxSkipSlots: 32,
|
|
127
|
+
disableProposerSlashings: false,
|
|
125
128
|
broadcastValidationStrictness: "warn",
|
|
126
129
|
// should be less than or equal to MIN_SIGNATURE_SETS_TO_BATCH_VERIFY
|
|
127
130
|
// batching too much may block the I/O thread so if useWorker=false, suggest this value to be 32
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
4
|
-
import {ForkPostBellatrix, ForkSeq, SLOTS_PER_EPOCH, isForkPostBellatrix, isForkPostGloas} from "@lodestar/params";
|
|
3
|
+
import {getFinalizedExecutionBlockHash, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
5
4
|
import {
|
|
5
|
+
ForkPostBellatrix,
|
|
6
|
+
ForkSeq,
|
|
7
|
+
SLOTS_PER_EPOCH,
|
|
8
|
+
isForkPostBellatrix,
|
|
9
|
+
isForkPostFulu,
|
|
10
|
+
isForkPostGloas,
|
|
11
|
+
} from "@lodestar/params";
|
|
12
|
+
import {
|
|
13
|
+
GLOAS_PREVERIFY_WINDOW_EPOCHS,
|
|
6
14
|
IBeaconStateView,
|
|
7
15
|
IBeaconStateViewBellatrix,
|
|
16
|
+
MAX_BUILDER_DEPOSITS_PER_SLOT,
|
|
8
17
|
StateHashTreeRootSource,
|
|
9
18
|
computeEpochAtSlot,
|
|
10
19
|
computeTimeAtSlot,
|
|
11
20
|
isStatePostBellatrix,
|
|
21
|
+
isStatePostFulu,
|
|
12
22
|
isStatePostGloas,
|
|
13
23
|
} from "@lodestar/state-transition";
|
|
14
|
-
import {Bytes32, Slot} from "@lodestar/types";
|
|
24
|
+
import {Bytes32, Slot, ValidatorIndex} from "@lodestar/types";
|
|
15
25
|
import {Logger, fromHex, isErrorAborted, sleep} from "@lodestar/utils";
|
|
16
|
-
import {GENESIS_SLOT
|
|
26
|
+
import {GENESIS_SLOT} from "../constants/constants.js";
|
|
17
27
|
import {BuilderStatus} from "../execution/builder/http.js";
|
|
18
28
|
import {Metrics} from "../metrics/index.js";
|
|
19
29
|
import {ClockEvent} from "../util/clock.js";
|
|
@@ -30,6 +40,11 @@ export const PREPARE_NEXT_SLOT_BPS = 6667;
|
|
|
30
40
|
/* We don't want to do more epoch transition than this */
|
|
31
41
|
const PREPARE_EPOCH_LIMIT = 1;
|
|
32
42
|
|
|
43
|
+
/* Fraction of a slot (out of 10_000) the pre-Gloas builder-deposit pre-verify may spend per tick.
|
|
44
|
+
* 2000 = 20% of slot (2.4s on mainnet), within the spare window left after PREPARE_NEXT_SLOT_BPS.
|
|
45
|
+
* Expressed in bps so it scales with slot duration (mainnet vs minimal/devnet). */
|
|
46
|
+
const BUILDER_PREVERIFY_LIMIT_BPS = 2000;
|
|
47
|
+
|
|
33
48
|
/**
|
|
34
49
|
* At Bellatrix, if we are responsible for proposing in next slot, we want to prepare payload
|
|
35
50
|
* 4s before the start of next slot at PREPARE_NEXT_SLOT_BPS of the current slot.
|
|
@@ -110,30 +125,38 @@ export class PrepareNextSlotScheduler {
|
|
|
110
125
|
? this.metrics?.precomputeNextEpochTransition.duration.startTimer()
|
|
111
126
|
: null;
|
|
112
127
|
const start = Date.now();
|
|
128
|
+
let feeRecipient: string | undefined;
|
|
113
129
|
// No need to wait for this or the clock drift
|
|
114
|
-
// Pre Bellatrix: we only do precompute state transition for the last slot of epoch
|
|
115
|
-
// For Bellatrix, we always do the `processSlots()` to prepare payload for the next slot
|
|
116
|
-
const prepareState = await this.chain.regen.getBlockSlotState(
|
|
117
|
-
headBlock,
|
|
118
|
-
prepareSlot,
|
|
119
|
-
// the slot 0 of next epoch will likely use this Previous Root Checkpoint state for state transition so we transfer cache here
|
|
120
|
-
// the resulting state with cache will be cached in Checkpoint State Cache which is used for the upcoming block processing
|
|
121
|
-
// for other slots dontTransferCached=true because we don't run state transition on this state
|
|
122
|
-
{dontTransferCache: !isEpochTransition},
|
|
123
|
-
RegenCaller.precomputeEpoch
|
|
124
|
-
);
|
|
125
|
-
|
|
126
130
|
if (isForkPostBellatrix(fork)) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
let preparedState: IBeaconStateView | undefined;
|
|
132
|
+
|
|
133
|
+
const getProposerIndex = async (): Promise<ValidatorIndex> => {
|
|
134
|
+
if (isForkPostFulu(fork)) {
|
|
135
|
+
// getBeaconProposer covers the current + next epoch; should not throw
|
|
136
|
+
// PROPOSER_EPOCH_MISMATCH here due to the PREPARE_EPOCH_LIMIT check above.
|
|
137
|
+
return this.chain.getHeadState().getBeaconProposer(prepareSlot);
|
|
138
|
+
}
|
|
139
|
+
// the slot 0 of next epoch will likely use this Previous Root Checkpoint state for state transition so we transfer cache here
|
|
140
|
+
// the resulting state with cache will be cached in Checkpoint State Cache which is used for the upcoming block processing
|
|
141
|
+
// for other slots dontTransferCached=true because we don't run state transition on this state
|
|
142
|
+
preparedState = await this.chain.regen.getBlockSlotState(
|
|
143
|
+
headBlock,
|
|
144
|
+
prepareSlot,
|
|
145
|
+
{dontTransferCache: !isEpochTransition},
|
|
146
|
+
RegenCaller.precomputeEpoch
|
|
147
|
+
);
|
|
148
|
+
return preparedState.getBeaconProposer(prepareSlot);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const proposerIndex = await getProposerIndex();
|
|
152
|
+
feeRecipient = this.chain.beaconProposerCache.get(proposerIndex);
|
|
130
153
|
|
|
131
154
|
if (feeRecipient) {
|
|
132
155
|
// If we are proposing next slot, we need to predict if we can proposer-boost-reorg or not
|
|
133
156
|
const proposerHead = this.chain.predictProposerHead(clockSlot);
|
|
134
157
|
const {slot: proposerHeadSlot, blockRoot: proposerHeadRoot} = proposerHead;
|
|
135
158
|
|
|
136
|
-
// If we predict we can reorg,
|
|
159
|
+
// If we predict we can reorg, we build on the proposer head (parent) block instead
|
|
137
160
|
if (proposerHeadRoot !== headRoot || proposerHeadSlot !== headSlot) {
|
|
138
161
|
this.logger.verbose("Weak head detected. May build on parent block instead", {
|
|
139
162
|
proposerHeadSlot,
|
|
@@ -142,13 +165,6 @@ export class PrepareNextSlotScheduler {
|
|
|
142
165
|
headRoot,
|
|
143
166
|
});
|
|
144
167
|
this.metrics?.weakHeadDetected.inc();
|
|
145
|
-
updatedPrepareState = await this.chain.regen.getBlockSlotState(
|
|
146
|
-
proposerHead,
|
|
147
|
-
prepareSlot,
|
|
148
|
-
// only transfer cache if epoch transition because that's the state we will use to stateTransition() the 1st block of epoch
|
|
149
|
-
{dontTransferCache: !isEpochTransition},
|
|
150
|
-
RegenCaller.predictProposerHead
|
|
151
|
-
);
|
|
152
168
|
updatedHead = proposerHead;
|
|
153
169
|
}
|
|
154
170
|
|
|
@@ -165,30 +181,41 @@ export class PrepareNextSlotScheduler {
|
|
|
165
181
|
}
|
|
166
182
|
}
|
|
167
183
|
|
|
168
|
-
|
|
184
|
+
// post-fulu we'll always reach here because preparedState is undefined
|
|
185
|
+
if (preparedState === undefined || updatedHead !== headBlock) {
|
|
186
|
+
preparedState = await this.chain.regen.getBlockSlotState(
|
|
187
|
+
updatedHead,
|
|
188
|
+
prepareSlot,
|
|
189
|
+
// only transfer cache if epoch transition because that's the state we will use to stateTransition() the 1st block of epoch
|
|
190
|
+
{dontTransferCache: !isEpochTransition},
|
|
191
|
+
updatedHead === headBlock ? RegenCaller.precomputeEpoch : RegenCaller.predictProposerHead
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (!isStatePostBellatrix(preparedState)) {
|
|
169
196
|
throw new Error("Expected Bellatrix state for payload attributes");
|
|
170
197
|
}
|
|
171
198
|
|
|
172
199
|
let parentBlockHash: Bytes32;
|
|
173
200
|
// Apply parent payload once here as it's reused by EL prep and SSE emit below
|
|
174
|
-
let stateAfterParentPayload: IBeaconStateViewBellatrix =
|
|
175
|
-
if (isStatePostGloas(
|
|
201
|
+
let stateAfterParentPayload: IBeaconStateViewBellatrix = preparedState;
|
|
202
|
+
if (isStatePostGloas(preparedState)) {
|
|
176
203
|
// Spec: should_build_on_full(store, head, slot) - see produceBlockBody.ts for context.
|
|
177
204
|
if (this.chain.forkChoice.shouldBuildOnFull(updatedHead, prepareSlot)) {
|
|
178
|
-
parentBlockHash =
|
|
205
|
+
parentBlockHash = preparedState.latestExecutionPayloadBid.blockHash;
|
|
179
206
|
// Skip applying parent payload unless we're proposing the next slot or have to emit payload_attributes events
|
|
180
207
|
if (feeRecipient !== undefined || this.chain.opts.emitPayloadAttributes === true) {
|
|
181
208
|
const parentExecutionRequests = await this.chain.getParentExecutionRequests(
|
|
182
209
|
updatedHead.slot,
|
|
183
210
|
updatedHead.blockRoot
|
|
184
211
|
);
|
|
185
|
-
stateAfterParentPayload =
|
|
212
|
+
stateAfterParentPayload = preparedState.withParentPayloadApplied(parentExecutionRequests);
|
|
186
213
|
}
|
|
187
214
|
} else {
|
|
188
|
-
parentBlockHash =
|
|
215
|
+
parentBlockHash = preparedState.latestExecutionPayloadBid.parentBlockHash;
|
|
189
216
|
}
|
|
190
217
|
} else {
|
|
191
|
-
parentBlockHash =
|
|
218
|
+
parentBlockHash = preparedState.latestExecutionPayloadHeader.blockHash;
|
|
192
219
|
}
|
|
193
220
|
|
|
194
221
|
if (feeRecipient) {
|
|
@@ -196,9 +223,8 @@ export class PrepareNextSlotScheduler {
|
|
|
196
223
|
computeTimeAtSlot(this.config, prepareSlot, this.chain.genesisTime) - Date.now() / 1000;
|
|
197
224
|
this.metrics?.blockPayload.payloadAdvancePrepTime.observe(preparationTime);
|
|
198
225
|
|
|
199
|
-
const safeBlockHash = getSafeExecutionBlockHash(this.chain.forkChoice);
|
|
200
|
-
const finalizedBlockHash =
|
|
201
|
-
this.chain.forkChoice.getFinalizedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
|
|
226
|
+
const safeBlockHash = getSafeExecutionBlockHash(this.chain.forkChoice, this.logger);
|
|
227
|
+
const finalizedBlockHash = getFinalizedExecutionBlockHash(this.chain.forkChoice, this.logger);
|
|
202
228
|
|
|
203
229
|
// awaiting here instead of throwing an async call because there is no other task
|
|
204
230
|
// left for scheduler and this gives nice semantics to catch and log errors in the
|
|
@@ -221,7 +247,7 @@ export class PrepareNextSlotScheduler {
|
|
|
221
247
|
});
|
|
222
248
|
}
|
|
223
249
|
|
|
224
|
-
this.computeStateHashTreeRoot(
|
|
250
|
+
this.computeStateHashTreeRoot(preparedState, isEpochTransition);
|
|
225
251
|
|
|
226
252
|
// If emitPayloadAttributes is true emit a SSE payloadAttributes event for
|
|
227
253
|
// every slot. Without the flag, only emit the event if we are proposing in the next slot.
|
|
@@ -239,7 +265,14 @@ export class PrepareNextSlotScheduler {
|
|
|
239
265
|
this.chain.emitter.emit(routes.events.EventType.payloadAttributes, {data, version: fork});
|
|
240
266
|
}
|
|
241
267
|
} else {
|
|
242
|
-
|
|
268
|
+
// Pre-bellatrix only reaches here at an epoch transition to precompute the next epoch state
|
|
269
|
+
const preparedState = await this.chain.regen.getBlockSlotState(
|
|
270
|
+
headBlock,
|
|
271
|
+
prepareSlot,
|
|
272
|
+
{dontTransferCache: !isEpochTransition},
|
|
273
|
+
RegenCaller.precomputeEpoch
|
|
274
|
+
);
|
|
275
|
+
this.computeStateHashTreeRoot(preparedState, isEpochTransition);
|
|
243
276
|
}
|
|
244
277
|
|
|
245
278
|
// assuming there is no reorg, it caches the checkpoint state & helps avoid doing a full state transition in the next slot
|
|
@@ -262,6 +295,74 @@ export class PrepareNextSlotScheduler {
|
|
|
262
295
|
});
|
|
263
296
|
|
|
264
297
|
precomputeEpochTransitionTimer?.();
|
|
298
|
+
|
|
299
|
+
// Nothing more to do on an epoch-transition slot: that precompute already ran a full (>1s)
|
|
300
|
+
// epoch transition, so we don't pile the builder-deposit pre-verify (below) on top of it.
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Pre-verify builder-deposit signatures in the GLOAS_PREVERIFY_WINDOW_EPOCHS epochs leading
|
|
305
|
+
// up to the Gloas fork, off the block-import hot path, so onboardBuildersFromPendingDeposits
|
|
306
|
+
// at the transition is mostly cache hits. Reached only on non-epoch-transition slots (the
|
|
307
|
+
// epoch-transition branch returned above). Runs on the head state — its pendingDeposits are
|
|
308
|
+
// what the fork transition derives from, and its epochCtx holds the shared, app-wide
|
|
309
|
+
// builderDepositSignatureCache.
|
|
310
|
+
const headState = this.chain.getHeadState();
|
|
311
|
+
if (isStatePostFulu(headState)) {
|
|
312
|
+
const gloasEpoch = this.config.GLOAS_FORK_EPOCH;
|
|
313
|
+
const finalizedEpoch = this.chain.forkChoice.getFinalizedCheckpoint().epoch;
|
|
314
|
+
if (finalizedEpoch >= gloasEpoch) {
|
|
315
|
+
// Gloas is finalized — the pre-verify cache has served its purpose; release its memory.
|
|
316
|
+
headState.clearPreGloasBuilderDepositCache();
|
|
317
|
+
} else {
|
|
318
|
+
const clockEpoch = computeEpochAtSlot(clockSlot);
|
|
319
|
+
if (
|
|
320
|
+
ForkSeq[fork] < ForkSeq.gloas && // only before the fork
|
|
321
|
+
clockEpoch >= gloasEpoch - GLOAS_PREVERIFY_WINDOW_EPOCHS && // Infinity when Gloas unscheduled → skip
|
|
322
|
+
clockEpoch < gloasEpoch &&
|
|
323
|
+
// skip when we're the next-slot proposer — don't compete with block-production prep.
|
|
324
|
+
feeRecipient === undefined
|
|
325
|
+
) {
|
|
326
|
+
const maxDurationMs = this.config.getSlotComponentDurationMs(BUILDER_PREVERIFY_LIMIT_BPS);
|
|
327
|
+
const preVerifyTimer = this.metrics?.builderDepositPreVerify.duration.startTimer();
|
|
328
|
+
const result = headState.preVerifyBuilderDepositsPreGloas(MAX_BUILDER_DEPOSITS_PER_SLOT, maxDurationMs);
|
|
329
|
+
preVerifyTimer?.();
|
|
330
|
+
|
|
331
|
+
const preVerifyMetrics = this.metrics?.builderDepositPreVerify;
|
|
332
|
+
if (preVerifyMetrics) {
|
|
333
|
+
preVerifyMetrics.pendingDeposits.set(result.pendingDepositsCount);
|
|
334
|
+
preVerifyMetrics.cachedDeposits.set(result.totalCachedDeposits);
|
|
335
|
+
preVerifyMetrics.scannedDeposits.set(result.scannedPendingDeposits);
|
|
336
|
+
preVerifyMetrics.builderPubkeys.set(result.totalBuilderPubkeys);
|
|
337
|
+
if (result.validBuilderSignaturesCount > 0) {
|
|
338
|
+
preVerifyMetrics.validSignatures.inc({type: "builder"}, result.validBuilderSignaturesCount);
|
|
339
|
+
}
|
|
340
|
+
if (result.validValidatorSignaturesCount > 0) {
|
|
341
|
+
preVerifyMetrics.validSignatures.inc({type: "validator"}, result.validValidatorSignaturesCount);
|
|
342
|
+
}
|
|
343
|
+
if (result.invalidBuilderSignaturesCount > 0) {
|
|
344
|
+
preVerifyMetrics.invalidSignatures.inc({type: "builder"}, result.invalidBuilderSignaturesCount);
|
|
345
|
+
}
|
|
346
|
+
if (result.invalidValidatorSignaturesCount > 0) {
|
|
347
|
+
preVerifyMetrics.invalidSignatures.inc({type: "validator"}, result.invalidValidatorSignaturesCount);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Always log (once per slot, only within the pre-fork window) so devnets show the
|
|
352
|
+
// pre-verify draining even on all-cache-hit ticks.
|
|
353
|
+
this.logger.verbose("PrepareNextSlotScheduler pre-verified deposit signatures", {
|
|
354
|
+
clockSlot,
|
|
355
|
+
validBuilderSignaturesCount: result.validBuilderSignaturesCount,
|
|
356
|
+
invalidBuilderSignaturesCount: result.invalidBuilderSignaturesCount,
|
|
357
|
+
validValidatorSignaturesCount: result.validValidatorSignaturesCount,
|
|
358
|
+
invalidValidatorSignaturesCount: result.invalidValidatorSignaturesCount,
|
|
359
|
+
scannedPendingDeposits: result.scannedPendingDeposits,
|
|
360
|
+
totalCachedDeposits: result.totalCachedDeposits,
|
|
361
|
+
totalBuilderPubkeys: result.totalBuilderPubkeys,
|
|
362
|
+
pendingDepositsCount: result.pendingDepositsCount,
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
265
366
|
}
|
|
266
367
|
} catch (e) {
|
|
267
368
|
if (!isErrorAborted(e) && !isQueueErrorAborted(e)) {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {BitArray} from "@chainsafe/ssz";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
IForkChoice,
|
|
5
|
+
ProtoBlock,
|
|
6
|
+
getFinalizedExecutionBlockHash,
|
|
7
|
+
getSafeExecutionBlockHash,
|
|
8
|
+
} from "@lodestar/fork-choice";
|
|
4
9
|
import {
|
|
5
10
|
BUILDER_INDEX_SELF_BUILD,
|
|
6
11
|
ForkName,
|
|
@@ -265,8 +270,8 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
265
270
|
// TODO GLOAS: support non self-building here, the block type differentiation between
|
|
266
271
|
// full and blinded no longer makes sense in gloas, it might be a good idea to move
|
|
267
272
|
// this into a completely separate function and have pre/post gloas more separated
|
|
268
|
-
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
|
|
269
|
-
const finalizedBlockHash = this.forkChoice.
|
|
273
|
+
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice, this.logger);
|
|
274
|
+
const finalizedBlockHash = getFinalizedExecutionBlockHash(this.forkChoice, this.logger);
|
|
270
275
|
// TODO GLOAS: post-Gloas, proposer feeRecipient is also carried (signed) in
|
|
271
276
|
// ProposerPreferencesPool. Consider using this unified cache instead
|
|
272
277
|
// see https://github.com/ChainSafe/lodestar/issues/9379
|
|
@@ -411,8 +416,8 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
411
416
|
throw new Error("Expected Bellatrix state for execution block production");
|
|
412
417
|
}
|
|
413
418
|
|
|
414
|
-
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
|
|
415
|
-
const finalizedBlockHash = this.forkChoice.
|
|
419
|
+
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice, this.logger);
|
|
420
|
+
const finalizedBlockHash = getFinalizedExecutionBlockHash(this.forkChoice, this.logger);
|
|
416
421
|
const feeRecipient = requestedFeeRecipient ?? this.beaconProposerCache.getOrDefault(proposerIndex);
|
|
417
422
|
const feeRecipientType = requestedFeeRecipient
|
|
418
423
|
? "requested"
|
|
@@ -1037,7 +1042,7 @@ export async function produceCommonBlockBody<T extends BlockType>(
|
|
|
1037
1042
|
graffiti,
|
|
1038
1043
|
// Eth1 data voting is no longer required since electra
|
|
1039
1044
|
eth1Data: currentState.eth1Data,
|
|
1040
|
-
proposerSlashings,
|
|
1045
|
+
proposerSlashings: this.opts.disableProposerSlashings === true ? [] : proposerSlashings,
|
|
1041
1046
|
attesterSlashings,
|
|
1042
1047
|
attestations,
|
|
1043
1048
|
// Since electra, deposits are processed by the execution layer,
|