@lodestar/beacon-node 1.42.0 → 1.43.0-dev.aef3645690
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 +20 -0
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/beacon/pool/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/pool/index.js +4 -0
- package/lib/api/impl/beacon/pool/index.js.map +1 -1
- package/lib/api/impl/beacon/state/index.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/index.js +13 -10
- package/lib/api/impl/beacon/state/index.js.map +1 -1
- package/lib/api/impl/lodestar/attesterSlashing.d.ts +8 -0
- package/lib/api/impl/lodestar/attesterSlashing.d.ts.map +1 -0
- package/lib/api/impl/lodestar/attesterSlashing.js +29 -0
- package/lib/api/impl/lodestar/attesterSlashing.js.map +1 -0
- package/lib/api/impl/lodestar/index.d.ts.map +1 -1
- package/lib/api/impl/lodestar/index.js +39 -0
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +9 -3
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +6 -4
- 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 +14 -5
- package/lib/chain/blocks/importExecutionPayload.js.map +1 -1
- package/lib/chain/blocks/index.js +1 -1
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +3 -3
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js +3 -2
- package/lib/chain/blocks/verifyBlocksExecutionPayloads.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksSignatures.js +4 -2
- package/lib/chain/blocks/verifyBlocksSignatures.js.map +1 -1
- package/lib/chain/chain.d.ts +2 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +22 -8
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/blockError.d.ts +11 -1
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +4 -0
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/forkChoice/index.d.ts.map +1 -1
- package/lib/chain/forkChoice/index.js +10 -8
- package/lib/chain/forkChoice/index.js.map +1 -1
- package/lib/chain/interface.d.ts +2 -1
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/interface.js.map +1 -1
- package/lib/chain/lightClient/index.d.ts +2 -2
- package/lib/chain/lightClient/index.d.ts.map +1 -1
- package/lib/chain/lightClient/index.js +7 -0
- package/lib/chain/lightClient/index.js.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +5 -2
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.d.ts +2 -2
- package/lib/chain/opPools/executionPayloadBidPool.d.ts.map +1 -1
- package/lib/chain/opPools/executionPayloadBidPool.js +2 -2
- package/lib/chain/opPools/executionPayloadBidPool.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +7 -1
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts +3 -3
- package/lib/chain/produceBlock/computeNewStateRoot.d.ts.map +1 -1
- package/lib/chain/produceBlock/computeNewStateRoot.js +8 -8
- package/lib/chain/produceBlock/computeNewStateRoot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts +5 -5
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +23 -4
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +27 -5
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +7 -4
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +6 -1
- package/lib/chain/validation/executionPayloadEnvelope.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.d.ts.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +4 -1
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/chain/validation/syncCommittee.d.ts.map +1 -1
- package/lib/chain/validation/syncCommittee.js +4 -0
- package/lib/chain/validation/syncCommittee.js.map +1 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js +4 -1
- package/lib/chain/validation/syncCommitteeContributionAndProof.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +3 -3
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +4 -0
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js +2 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js +2 -0
- package/lib/network/reqresp/handlers/beaconBlocksByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts +2 -2
- package/lib/network/reqresp/handlers/blobSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js +7 -3
- package/lib/network/reqresp/handlers/blobSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js +6 -0
- package/lib/network/reqresp/handlers/blobSidecarsByRoot.js.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts +2 -2
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js +7 -3
- package/lib/network/reqresp/handlers/dataColumnSidecarsByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js +2 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRange.js.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.d.ts.map +1 -1
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js +3 -8
- package/lib/network/reqresp/handlers/executionPayloadEnvelopesByRoot.js.map +1 -1
- package/lib/node/nodejs.d.ts.map +1 -1
- package/lib/node/nodejs.js +4 -1
- package/lib/node/nodejs.js.map +1 -1
- package/lib/node/notifier.d.ts.map +1 -1
- package/lib/node/notifier.js +2 -2
- package/lib/node/notifier.js.map +1 -1
- package/package.json +15 -15
- package/src/api/impl/beacon/blocks/index.ts +29 -0
- package/src/api/impl/beacon/pool/index.ts +4 -0
- package/src/api/impl/beacon/state/index.ts +15 -15
- package/src/api/impl/lodestar/attesterSlashing.ts +43 -0
- package/src/api/impl/lodestar/index.ts +51 -1
- package/src/api/impl/validator/index.ts +9 -2
- package/src/chain/blocks/importBlock.ts +11 -7
- package/src/chain/blocks/importExecutionPayload.ts +15 -5
- package/src/chain/blocks/index.ts +1 -1
- package/src/chain/blocks/types.ts +3 -3
- package/src/chain/blocks/verifyBlocksExecutionPayloads.ts +2 -1
- package/src/chain/blocks/verifyBlocksSignatures.ts +9 -2
- package/src/chain/chain.ts +30 -8
- package/src/chain/errors/blockError.ts +7 -1
- package/src/chain/forkChoice/index.ts +11 -8
- package/src/chain/interface.ts +5 -0
- package/src/chain/lightClient/index.ts +15 -3
- package/src/chain/opPools/aggregatedAttestationPool.ts +6 -1
- package/src/chain/opPools/executionPayloadBidPool.ts +3 -3
- package/src/chain/prepareNextSlot.ts +8 -0
- package/src/chain/produceBlock/computeNewStateRoot.ts +11 -10
- package/src/chain/produceBlock/produceBlockBody.ts +40 -10
- package/src/chain/validation/block.ts +30 -7
- package/src/chain/validation/executionPayloadBid.ts +7 -3
- package/src/chain/validation/executionPayloadEnvelope.ts +10 -1
- package/src/chain/validation/payloadAttestationMessage.ts +4 -0
- package/src/chain/validation/syncCommittee.ts +5 -1
- package/src/chain/validation/syncCommitteeContributionAndProof.ts +5 -1
- package/src/chain/validatorMonitor.ts +3 -2
- package/src/network/processor/gossipHandlers.ts +5 -0
- package/src/network/reqresp/handlers/beaconBlocksByRange.ts +3 -1
- package/src/network/reqresp/handlers/beaconBlocksByRoot.ts +3 -0
- package/src/network/reqresp/handlers/blobSidecarsByRange.ts +15 -3
- package/src/network/reqresp/handlers/blobSidecarsByRoot.ts +11 -0
- package/src/network/reqresp/handlers/dataColumnSidecarsByRange.ts +19 -3
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRange.ts +3 -1
- package/src/network/reqresp/handlers/executionPayloadEnvelopesByRoot.ts +3 -12
- package/src/node/nodejs.ts +5 -2
- package/src/node/notifier.ts +7 -2
|
@@ -14,7 +14,16 @@ import {
|
|
|
14
14
|
isForkPostBellatrix,
|
|
15
15
|
isForkPostGloas,
|
|
16
16
|
} from "@lodestar/params";
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
G2_POINT_AT_INFINITY,
|
|
19
|
+
IBeaconStateView,
|
|
20
|
+
type IBeaconStateViewBellatrix,
|
|
21
|
+
computeTimeAtSlot,
|
|
22
|
+
isParentBlockFull,
|
|
23
|
+
isStatePostBellatrix,
|
|
24
|
+
isStatePostCapella,
|
|
25
|
+
isStatePostGloas,
|
|
26
|
+
} from "@lodestar/state-transition";
|
|
18
27
|
import {
|
|
19
28
|
BLSPubkey,
|
|
20
29
|
BLSSignature,
|
|
@@ -103,11 +112,11 @@ export type ProduceFullGloas = {
|
|
|
103
112
|
blobsBundle: BlobsBundle<ForkPostGloas>;
|
|
104
113
|
cells: fulu.Cell[][];
|
|
105
114
|
/**
|
|
106
|
-
* Cached envelope state root computed during block production.
|
|
115
|
+
* Cached payload envelope state root computed during block production.
|
|
107
116
|
* This is the state root after running `processExecutionPayloadEnvelope` on the
|
|
108
117
|
* post-block state, and later used to construct the `ExecutionPayloadEnvelope`.
|
|
109
118
|
*/
|
|
110
|
-
|
|
119
|
+
payloadEnvelopeStateRoot: Root;
|
|
111
120
|
};
|
|
112
121
|
export type ProduceFullFulu = {
|
|
113
122
|
type: BlockType.Full;
|
|
@@ -191,6 +200,10 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
191
200
|
this.logger.verbose("Producing beacon block body", logMeta);
|
|
192
201
|
|
|
193
202
|
if (isForkPostGloas(fork)) {
|
|
203
|
+
if (!isStatePostGloas(currentState)) {
|
|
204
|
+
throw new Error("Expected Gloas state for Gloas block production");
|
|
205
|
+
}
|
|
206
|
+
|
|
194
207
|
// TODO GLOAS: support non self-building here, the block type differentiation between
|
|
195
208
|
// full and blinded no longer makes sense in gloas, it might be a good idea to move
|
|
196
209
|
// this into a completely separate function and have pre/post gloas more separated
|
|
@@ -297,6 +310,10 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
297
310
|
shouldOverrideBuilder,
|
|
298
311
|
});
|
|
299
312
|
} else if (isForkPostBellatrix(fork)) {
|
|
313
|
+
if (!isStatePostBellatrix(currentState)) {
|
|
314
|
+
throw new Error("Expected Bellatrix state for execution block production");
|
|
315
|
+
}
|
|
316
|
+
|
|
300
317
|
const safeBlockHash = getSafeExecutionBlockHash(this.forkChoice);
|
|
301
318
|
const finalizedBlockHash = this.forkChoice.getFinalizedBlock().executionPayloadBlockHash ?? ZERO_HASH_HEX;
|
|
302
319
|
const feeRecipient = requestedFeeRecipient ?? this.beaconProposerCache.getOrDefault(proposerIndex);
|
|
@@ -598,7 +615,7 @@ export async function prepareExecutionPayload(
|
|
|
598
615
|
parentBlockRoot: Root,
|
|
599
616
|
safeBlockHash: RootHex,
|
|
600
617
|
finalizedBlockHash: RootHex,
|
|
601
|
-
state:
|
|
618
|
+
state: IBeaconStateViewBellatrix,
|
|
602
619
|
suggestedFeeRecipient: string
|
|
603
620
|
): Promise<{prepType: PayloadPreparationType; payloadId: PayloadId}> {
|
|
604
621
|
const parentHash = state.latestBlockHash;
|
|
@@ -666,7 +683,7 @@ async function prepareExecutionPayloadHeader(
|
|
|
666
683
|
config: ChainForkConfig;
|
|
667
684
|
},
|
|
668
685
|
fork: ForkPostBellatrix,
|
|
669
|
-
state:
|
|
686
|
+
state: IBeaconStateViewBellatrix,
|
|
670
687
|
proposerPubKey: BLSPubkey
|
|
671
688
|
): Promise<{
|
|
672
689
|
header: ExecutionPayloadHeader;
|
|
@@ -693,7 +710,7 @@ export function getPayloadAttributesForSSE(
|
|
|
693
710
|
prepareSlot,
|
|
694
711
|
parentBlockRoot,
|
|
695
712
|
feeRecipient,
|
|
696
|
-
}: {prepareState:
|
|
713
|
+
}: {prepareState: IBeaconStateViewBellatrix; prepareSlot: Slot; parentBlockRoot: Root; feeRecipient: string}
|
|
697
714
|
): SSEPayloadAttributes {
|
|
698
715
|
const parentHash = prepareState.latestBlockHash;
|
|
699
716
|
const payloadAttributes = preparePayloadAttributes(fork, chain, {
|
|
@@ -736,7 +753,7 @@ function preparePayloadAttributes(
|
|
|
736
753
|
parentBlockRoot,
|
|
737
754
|
feeRecipient,
|
|
738
755
|
}: {
|
|
739
|
-
prepareState:
|
|
756
|
+
prepareState: IBeaconStateViewBellatrix;
|
|
740
757
|
prepareSlot: Slot;
|
|
741
758
|
parentBlockRoot: Root;
|
|
742
759
|
feeRecipient: string;
|
|
@@ -751,9 +768,22 @@ function preparePayloadAttributes(
|
|
|
751
768
|
};
|
|
752
769
|
|
|
753
770
|
if (ForkSeq[fork] >= ForkSeq.capella) {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
771
|
+
if (!isStatePostCapella(prepareState)) {
|
|
772
|
+
throw new Error("Expected Capella state for withdrawals");
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
if (isStatePostGloas(prepareState) && !isParentBlockFull(prepareState)) {
|
|
776
|
+
// When the parent block is empty, state.payloadExpectedWithdrawals holds a batch
|
|
777
|
+
// already deducted from CL balances but never credited on the EL (the envelope
|
|
778
|
+
// was not delivered). The next payload must carry those same withdrawals to
|
|
779
|
+
// restore CL/EL consistency, otherwise validators permanently lose that balance.
|
|
780
|
+
(payloadAttributes as capella.SSEPayloadAttributes["payloadAttributes"]).withdrawals =
|
|
781
|
+
prepareState.payloadExpectedWithdrawals;
|
|
782
|
+
} else {
|
|
783
|
+
// withdrawals logic is now fork aware as it changes on electra fork post capella
|
|
784
|
+
(payloadAttributes as capella.SSEPayloadAttributes["payloadAttributes"]).withdrawals =
|
|
785
|
+
prepareState.getExpectedWithdrawals().expectedWithdrawals;
|
|
786
|
+
}
|
|
757
787
|
}
|
|
758
788
|
|
|
759
789
|
if (ForkSeq[fork] >= ForkSeq.deneb) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
+
import {ExecutionStatus} from "@lodestar/fork-choice";
|
|
2
3
|
import {ForkName, isForkPostBellatrix, isForkPostDeneb, isForkPostGloas} from "@lodestar/params";
|
|
3
4
|
import {
|
|
4
5
|
computeEpochAtSlot,
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
computeTimeAtSlot,
|
|
7
8
|
getBlockProposerSignatureSet,
|
|
8
9
|
isExecutionBlockBodyType,
|
|
10
|
+
isStatePostBellatrix,
|
|
9
11
|
} from "@lodestar/state-transition";
|
|
10
12
|
import {SignedBeaconBlock, deneb, gloas, isGloasBeaconBlock} from "@lodestar/types";
|
|
11
13
|
import {byteArrayEquals, sleep, toRootHex} from "@lodestar/utils";
|
|
@@ -70,12 +72,7 @@ export async function validateGossipBlock(
|
|
|
70
72
|
// [REJECT] The current finalized_checkpoint is an ancestor of block -- i.e.
|
|
71
73
|
// get_ancestor(store, block.parent_root, compute_start_slot_at_epoch(store.finalized_checkpoint.epoch)) == store.finalized_checkpoint.root
|
|
72
74
|
const parentRoot = toRootHex(block.parentRoot);
|
|
73
|
-
const parentBlock =
|
|
74
|
-
? chain.forkChoice.getBlockHexAndBlockHash(
|
|
75
|
-
parentRoot,
|
|
76
|
-
toRootHex(block.body.signedExecutionPayloadBid.message.parentBlockHash)
|
|
77
|
-
)
|
|
78
|
-
: chain.forkChoice.getBlockHexDefaultStatus(parentRoot);
|
|
75
|
+
const parentBlock = chain.forkChoice.getBlockHexDefaultStatus(parentRoot);
|
|
79
76
|
if (parentBlock === null) {
|
|
80
77
|
// If fork choice does *not* consider the parent to be a descendant of the finalized block,
|
|
81
78
|
// then there are two more cases:
|
|
@@ -90,6 +87,27 @@ export async function validateGossipBlock(
|
|
|
90
87
|
throw new BlockGossipError(GossipAction.IGNORE, {code: BlockErrorCode.PARENT_UNKNOWN, parentRoot});
|
|
91
88
|
}
|
|
92
89
|
|
|
90
|
+
// [IGNORE] The block's parent (defined by `block.parent_root`) passes all validation
|
|
91
|
+
// (including execution node verification of the `block.body.execution_payload`)
|
|
92
|
+
if (isForkPostBellatrix(fork) && parentBlock.executionStatus === ExecutionStatus.Invalid) {
|
|
93
|
+
throw new BlockGossipError(GossipAction.IGNORE, {
|
|
94
|
+
code: BlockErrorCode.PARENT_EXECUTION_INVALID,
|
|
95
|
+
parentRoot,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// [IGNORE] The block's parent execution payload (defined by bid.parent_block_hash) has been seen
|
|
100
|
+
// (via gossip or non-gossip sources) (a client MAY queue blocks for processing once the parent payload is retrieved).
|
|
101
|
+
if (isGloasBeaconBlock(block)) {
|
|
102
|
+
const parentBlockHashHex = toRootHex(block.body.signedExecutionPayloadBid.message.parentBlockHash);
|
|
103
|
+
if (chain.forkChoice.getBlockHexAndBlockHash(parentRoot, parentBlockHashHex) === null) {
|
|
104
|
+
throw new BlockGossipError(GossipAction.IGNORE, {
|
|
105
|
+
code: BlockErrorCode.PARENT_PAYLOAD_UNKNOWN,
|
|
106
|
+
parentBlockHash: parentBlockHashHex,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
93
111
|
// [IGNORE] The attestation head block is too far behind the attestation slot, causing many skip slots.
|
|
94
112
|
// This is deemed a DoS risk because we need to get the proposerShuffling. To get the shuffling we have
|
|
95
113
|
// to do a bunch of epoch transitions, the longer the distance between the parent and block,
|
|
@@ -174,7 +192,7 @@ export async function validateGossipBlock(
|
|
|
174
192
|
if (isForkPostBellatrix(fork) && !isForkPostGloas(fork)) {
|
|
175
193
|
if (!isExecutionBlockBodyType(block.body)) throw Error("Not execution block body type");
|
|
176
194
|
const executionPayload = block.body.executionPayload;
|
|
177
|
-
if (blockState.isExecutionStateType && blockState.isExecutionEnabled(block)) {
|
|
195
|
+
if (isStatePostBellatrix(blockState) && blockState.isExecutionStateType && blockState.isExecutionEnabled(block)) {
|
|
178
196
|
const expectedTimestamp = computeTimeAtSlot(config, blockSlot, chain.genesisTime);
|
|
179
197
|
if (executionPayload.timestamp !== computeTimeAtSlot(config, blockSlot, chain.genesisTime)) {
|
|
180
198
|
throw new BlockGossipError(GossipAction.REJECT, {
|
|
@@ -186,6 +204,11 @@ export async function validateGossipBlock(
|
|
|
186
204
|
}
|
|
187
205
|
}
|
|
188
206
|
|
|
207
|
+
// [REJECT] The proposer index is a valid validator index
|
|
208
|
+
if (proposerIndex >= blockState.validatorCount) {
|
|
209
|
+
throw new BlockGossipError(GossipAction.REJECT, {code: BlockErrorCode.UNKNOWN_PROPOSER, proposerIndex});
|
|
210
|
+
}
|
|
211
|
+
|
|
189
212
|
// [REJECT] The proposer signature, signed_beacon_block.signature, is valid with respect to the proposer_index pubkey.
|
|
190
213
|
if (!chain.seenBlockInputCache.isVerifiedProposerSignature(blockSlot, blockRoot, signedBlock.signature)) {
|
|
191
214
|
const signatureSet = getBlockProposerSignatureSet(chain.config, signedBlock);
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
createSingleSignatureSetFromComponents,
|
|
4
4
|
getExecutionPayloadBidSigningRoot,
|
|
5
5
|
isActiveBuilder,
|
|
6
|
+
isStatePostGloas,
|
|
6
7
|
} from "@lodestar/state-transition";
|
|
7
8
|
import {gloas} from "@lodestar/types";
|
|
8
9
|
import {toRootHex} from "@lodestar/utils";
|
|
@@ -32,6 +33,9 @@ async function validateExecutionPayloadBid(
|
|
|
32
33
|
const parentBlockRootHex = toRootHex(bid.parentBlockRoot);
|
|
33
34
|
const parentBlockHashHex = toRootHex(bid.parentBlockHash);
|
|
34
35
|
const state = await chain.getHeadStateAtCurrentEpoch(RegenCaller.validateGossipExecutionPayloadBid);
|
|
36
|
+
if (!isStatePostGloas(state)) {
|
|
37
|
+
throw new Error(`Expected gloas+ state for execution payload bid validation, got fork=${state.forkName}`);
|
|
38
|
+
}
|
|
35
39
|
|
|
36
40
|
// [IGNORE] `bid.slot` is the current slot or the next slot.
|
|
37
41
|
const currentSlot = chain.clock.currentSlot;
|
|
@@ -83,9 +87,9 @@ async function validateExecutionPayloadBid(
|
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
// [IGNORE] this bid is the highest value bid seen for the
|
|
87
|
-
//
|
|
88
|
-
const bestBid = chain.executionPayloadBidPool.getBestBid(
|
|
90
|
+
// [IGNORE] this bid is the highest value bid seen for the tuple
|
|
91
|
+
// `(bid.slot, bid.parent_block_hash, bid.parent_block_root)`.
|
|
92
|
+
const bestBid = chain.executionPayloadBidPool.getBestBid(bid.slot, parentBlockHashHex, parentBlockRootHex);
|
|
89
93
|
if (bestBid !== null && bestBid.value >= bid.value) {
|
|
90
94
|
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
91
95
|
code: ExecutionPayloadBidErrorCode.BID_TOO_LOW,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import {PayloadStatus} from "@lodestar/fork-choice";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
computeStartSlotAtEpoch,
|
|
4
|
+
getExecutionPayloadEnvelopeSignatureSet,
|
|
5
|
+
isStatePostGloas,
|
|
6
|
+
} from "@lodestar/state-transition";
|
|
3
7
|
import {gloas} from "@lodestar/types";
|
|
4
8
|
import {toRootHex} from "@lodestar/utils";
|
|
5
9
|
import {ExecutionPayloadEnvelopeError, ExecutionPayloadEnvelopeErrorCode, GossipAction} from "../errors/index.js";
|
|
@@ -113,7 +117,12 @@ async function validateExecutionPayloadEnvelope(
|
|
|
113
117
|
slot: envelope.slot,
|
|
114
118
|
});
|
|
115
119
|
});
|
|
120
|
+
if (!isStatePostGloas(blockState)) {
|
|
121
|
+
throw new Error(`Expected gloas+ state for execution payload envelope validation, got fork=${blockState.forkName}`);
|
|
122
|
+
}
|
|
116
123
|
|
|
124
|
+
// [REJECT] `signed_execution_payload_envelope.signature` is valid as verified
|
|
125
|
+
// by `verify_execution_payload_envelope_signature`.
|
|
117
126
|
const signatureSet = getExecutionPayloadEnvelopeSignatureSet(
|
|
118
127
|
chain.config,
|
|
119
128
|
chain.pubkeyCache,
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
computeEpochAtSlot,
|
|
3
3
|
createSingleSignatureSetFromComponents,
|
|
4
4
|
getPayloadAttestationDataSigningRoot,
|
|
5
|
+
isStatePostGloas,
|
|
5
6
|
} from "@lodestar/state-transition";
|
|
6
7
|
import {RootHex, gloas, ssz} from "@lodestar/types";
|
|
7
8
|
import {toRootHex} from "@lodestar/utils";
|
|
@@ -66,6 +67,9 @@ async function validatePayloadAttestationMessage(
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
const state = chain.getHeadState();
|
|
70
|
+
if (!isStatePostGloas(state)) {
|
|
71
|
+
throw new Error(`Expected gloas+ state for payload attestation validation, got fork=${state.forkName}`);
|
|
72
|
+
}
|
|
69
73
|
|
|
70
74
|
// [REJECT] The message's block `data.beacon_block_root` passes validation.
|
|
71
75
|
// TODO GLOAS: implement this. Technically if we cannot get proto block from fork choice,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {SYNC_COMMITTEE_SUBNET_COUNT, SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params";
|
|
2
|
-
import {IBeaconStateView} from "@lodestar/state-transition";
|
|
2
|
+
import {IBeaconStateView, isStatePostAltair} from "@lodestar/state-transition";
|
|
3
3
|
import {SubnetID, altair} from "@lodestar/types";
|
|
4
4
|
import {toRootHex} from "@lodestar/utils";
|
|
5
5
|
import {GossipAction, SyncCommitteeError, SyncCommitteeErrorCode} from "../errors/index.js";
|
|
@@ -148,6 +148,10 @@ function getIndicesInSubcommittee(
|
|
|
148
148
|
subnet: SubnetID,
|
|
149
149
|
data: Pick<altair.SyncCommitteeMessage, "slot" | "validatorIndex">
|
|
150
150
|
): IndexInSubcommittee[] | null {
|
|
151
|
+
if (!isStatePostAltair(headState)) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
|
|
151
155
|
const syncCommittee = headState.getIndexedSyncCommittee(data.slot);
|
|
152
156
|
const indexesInCommittee = syncCommittee.validatorIndexMap.get(data.validatorIndex);
|
|
153
157
|
if (indexesInCommittee === undefined) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {SYNC_COMMITTEE_SUBNET_SIZE} from "@lodestar/params";
|
|
2
|
-
import {IBeaconStateView, isSyncCommitteeAggregator} from "@lodestar/state-transition";
|
|
2
|
+
import {IBeaconStateView, isStatePostAltair, isSyncCommitteeAggregator} from "@lodestar/state-transition";
|
|
3
3
|
import {ValidatorIndex, altair} from "@lodestar/types";
|
|
4
4
|
import {GossipAction, SyncCommitteeError, SyncCommitteeErrorCode} from "../errors/index.js";
|
|
5
5
|
import {IBeaconChain} from "../interface.js";
|
|
@@ -107,6 +107,10 @@ function getContributionIndices(
|
|
|
107
107
|
state: IBeaconStateView,
|
|
108
108
|
contribution: altair.SyncCommitteeContribution
|
|
109
109
|
): ValidatorIndex[] {
|
|
110
|
+
if (!isStatePostAltair(state)) {
|
|
111
|
+
throw new Error("Expected Altair state for sync committee contribution");
|
|
112
|
+
}
|
|
113
|
+
|
|
110
114
|
const startIndex = contribution.subcommitteeIndex * SYNC_COMMITTEE_SUBNET_SIZE;
|
|
111
115
|
|
|
112
116
|
const syncCommittee = state.getIndexedSyncCommittee(contribution.slot);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {
|
|
2
|
+
import {MIN_ATTESTATION_INCLUSION_DELAY, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
3
3
|
import {
|
|
4
4
|
IBeaconStateView,
|
|
5
5
|
ParticipationFlags,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
computeStartSlotAtEpoch,
|
|
8
8
|
computeTimeAtSlot,
|
|
9
9
|
getCurrentSlot,
|
|
10
|
+
isStatePostAltair,
|
|
10
11
|
parseAttesterFlags,
|
|
11
12
|
parseParticipationFlags,
|
|
12
13
|
} from "@lodestar/state-transition";
|
|
@@ -740,7 +741,7 @@ export function createValidatorMonitor(
|
|
|
740
741
|
|
|
741
742
|
const rootCache = new RootHexCache(headState);
|
|
742
743
|
|
|
743
|
-
if (
|
|
744
|
+
if (isStatePostAltair(headState)) {
|
|
744
745
|
const prevEpochStartSlot = computeStartSlotAtEpoch(prevEpoch);
|
|
745
746
|
const prevEpochTargetRoot = toRootHex(headState.getBlockRootAtSlot(prevEpochStartSlot));
|
|
746
747
|
|
|
@@ -1148,6 +1148,11 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1148
1148
|
} catch (e) {
|
|
1149
1149
|
logger.error("Error adding to executionPayloadBid pool", {}, e as Error);
|
|
1150
1150
|
}
|
|
1151
|
+
|
|
1152
|
+
chain.emitter.emit(routes.events.EventType.executionPayloadBid, {
|
|
1153
|
+
version: config.getForkName(executionPayloadBid.message.slot),
|
|
1154
|
+
data: executionPayloadBid,
|
|
1155
|
+
});
|
|
1151
1156
|
},
|
|
1152
1157
|
};
|
|
1153
1158
|
}
|
|
@@ -96,11 +96,13 @@ export function validateBeaconBlocksByRangeRequest(
|
|
|
96
96
|
if (count < 1) {
|
|
97
97
|
throw new ResponseError(RespStatus.INVALID_REQUEST, "count < 1");
|
|
98
98
|
}
|
|
99
|
-
// TODO: validate against MIN_EPOCHS_FOR_BLOCK_REQUESTS
|
|
100
99
|
if (startSlot < GENESIS_SLOT) {
|
|
101
100
|
throw new ResponseError(RespStatus.INVALID_REQUEST, "startSlot < genesis");
|
|
102
101
|
}
|
|
103
102
|
|
|
103
|
+
// The phase0 req/resp spec uses MIN_EPOCHS_FOR_BLOCK_REQUESTS to define the minimum range peers MUST serve.
|
|
104
|
+
// Archival nodes may still serve older retained blocks to allow genesis sync.
|
|
105
|
+
|
|
104
106
|
// step > 1 is deprecated, see https://github.com/ethereum/consensus-specs/pull/2856
|
|
105
107
|
|
|
106
108
|
const maxRequestBlocks = isForkPostDeneb(config.getForkName(startSlot))
|
|
@@ -8,6 +8,9 @@ export async function* onBeaconBlocksByRoot(
|
|
|
8
8
|
requestBody: BeaconBlocksByRootRequest,
|
|
9
9
|
chain: IBeaconChain
|
|
10
10
|
): AsyncIterable<ResponseOutgoing> {
|
|
11
|
+
// The phase0 req/resp spec uses MIN_EPOCHS_FOR_BLOCK_REQUESTS to define the minimum range peers MUST serve.
|
|
12
|
+
// Archival nodes may still serve older retained blocks to allow genesis sync.
|
|
13
|
+
|
|
11
14
|
for (const blockRoot of requestBody) {
|
|
12
15
|
const root = blockRoot;
|
|
13
16
|
const block = await chain.getSerializedBlockByRoot(toRootHex(root));
|
|
@@ -2,7 +2,7 @@ import {ChainConfig} from "@lodestar/config";
|
|
|
2
2
|
import {BLOB_SIDECAR_FIXED_SIZE, GENESIS_SLOT} from "@lodestar/params";
|
|
3
3
|
import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp";
|
|
4
4
|
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
5
|
-
import {Slot, deneb} from "@lodestar/types";
|
|
5
|
+
import {Epoch, Slot, deneb} from "@lodestar/types";
|
|
6
6
|
import {fromHex} from "@lodestar/utils";
|
|
7
7
|
import {IBeaconChain} from "../../../chain/index.js";
|
|
8
8
|
import {IBeaconDb} from "../../../db/index.js";
|
|
@@ -14,7 +14,7 @@ export async function* onBlobSidecarsByRange(
|
|
|
14
14
|
db: IBeaconDb
|
|
15
15
|
): AsyncIterable<ResponseOutgoing> {
|
|
16
16
|
// Non-finalized range of blobs
|
|
17
|
-
const {startSlot, count} = validateBlobSidecarsByRangeRequest(chain.config, request);
|
|
17
|
+
const {startSlot, count} = validateBlobSidecarsByRangeRequest(chain.config, chain.clock.currentEpoch, request);
|
|
18
18
|
const endSlot = startSlot + count;
|
|
19
19
|
|
|
20
20
|
const finalized = db.blobSidecarsArchive;
|
|
@@ -94,6 +94,7 @@ export function* iterateBlobBytesFromWrapper(
|
|
|
94
94
|
|
|
95
95
|
export function validateBlobSidecarsByRangeRequest(
|
|
96
96
|
config: ChainConfig,
|
|
97
|
+
currentEpoch: Epoch,
|
|
97
98
|
request: deneb.BlobSidecarsByRangeRequest
|
|
98
99
|
): deneb.BlobSidecarsByRangeRequest {
|
|
99
100
|
const {startSlot} = request;
|
|
@@ -102,11 +103,22 @@ export function validateBlobSidecarsByRangeRequest(
|
|
|
102
103
|
if (count < 1) {
|
|
103
104
|
throw new ResponseError(RespStatus.INVALID_REQUEST, "count < 1");
|
|
104
105
|
}
|
|
105
|
-
// TODO: validate against MIN_EPOCHS_FOR_BLOCK_REQUESTS
|
|
106
106
|
if (startSlot < GENESIS_SLOT) {
|
|
107
107
|
throw new ResponseError(RespStatus.INVALID_REQUEST, "startSlot < genesis");
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// Spec: [max(current_epoch - MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS, DENEB_FORK_EPOCH), current_epoch]
|
|
111
|
+
const minimumRequestEpoch = Math.max(
|
|
112
|
+
currentEpoch - config.MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS,
|
|
113
|
+
config.DENEB_FORK_EPOCH
|
|
114
|
+
);
|
|
115
|
+
if (computeEpochAtSlot(startSlot) < minimumRequestEpoch) {
|
|
116
|
+
throw new ResponseError(
|
|
117
|
+
RespStatus.RESOURCE_UNAVAILABLE,
|
|
118
|
+
"startSlot is before MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS"
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
110
122
|
if (count > config.MAX_REQUEST_BLOCKS_DENEB) {
|
|
111
123
|
count = config.MAX_REQUEST_BLOCKS_DENEB;
|
|
112
124
|
}
|
|
@@ -12,6 +12,13 @@ export async function* onBlobSidecarsByRoot(
|
|
|
12
12
|
): AsyncIterable<ResponseOutgoing> {
|
|
13
13
|
const finalizedSlot = chain.forkChoice.getFinalizedBlock().slot;
|
|
14
14
|
|
|
15
|
+
// Spec: [max(current_epoch - MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS, DENEB_FORK_EPOCH), current_epoch]
|
|
16
|
+
const currentEpoch = chain.clock.currentEpoch;
|
|
17
|
+
const minimumRequestEpoch = Math.max(
|
|
18
|
+
currentEpoch - chain.config.MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS,
|
|
19
|
+
chain.config.DENEB_FORK_EPOCH
|
|
20
|
+
);
|
|
21
|
+
|
|
15
22
|
// In sidecars by root request, it can be expected that sidecar requests will be come
|
|
16
23
|
// clustured by blockroots, and this helps us save db lookups once we load sidecars
|
|
17
24
|
// for a root
|
|
@@ -29,6 +36,10 @@ export async function* onBlobSidecarsByRoot(
|
|
|
29
36
|
continue;
|
|
30
37
|
}
|
|
31
38
|
|
|
39
|
+
if (computeEpochAtSlot(block.slot) < minimumRequestEpoch) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
|
|
32
43
|
// Check if we need to load sidecars for a new block root
|
|
33
44
|
if (lastFetchedSideCars === null || lastFetchedSideCars.blockRoot !== blockRootHex) {
|
|
34
45
|
const blobSidecarsBytes = await chain.getSerializedBlobSidecars(block.slot, blockRootHex);
|
|
@@ -3,7 +3,7 @@ import {ChainConfig} from "@lodestar/config";
|
|
|
3
3
|
import {GENESIS_SLOT} from "@lodestar/params";
|
|
4
4
|
import {RespStatus, ResponseError, ResponseOutgoing} from "@lodestar/reqresp";
|
|
5
5
|
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
6
|
-
import {ColumnIndex, fulu} from "@lodestar/types";
|
|
6
|
+
import {ColumnIndex, Epoch, fulu} from "@lodestar/types";
|
|
7
7
|
import {fromHex} from "@lodestar/utils";
|
|
8
8
|
import {IBeaconChain} from "../../../chain/index.js";
|
|
9
9
|
import {IBeaconDb} from "../../../db/index.js";
|
|
@@ -21,7 +21,11 @@ export async function* onDataColumnSidecarsByRange(
|
|
|
21
21
|
peerClient: string
|
|
22
22
|
): AsyncIterable<ResponseOutgoing> {
|
|
23
23
|
// Non-finalized range of columns
|
|
24
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
startSlot,
|
|
26
|
+
count,
|
|
27
|
+
columns: requestedColumns,
|
|
28
|
+
} = validateDataColumnSidecarsByRangeRequest(chain.config, chain.clock.currentEpoch, request);
|
|
25
29
|
const availableColumns = validateRequestedDataColumns(chain, requestedColumns);
|
|
26
30
|
const endSlot = startSlot + count;
|
|
27
31
|
|
|
@@ -139,6 +143,7 @@ export async function* onDataColumnSidecarsByRange(
|
|
|
139
143
|
|
|
140
144
|
export function validateDataColumnSidecarsByRangeRequest(
|
|
141
145
|
config: ChainConfig,
|
|
146
|
+
currentEpoch: Epoch,
|
|
142
147
|
request: fulu.DataColumnSidecarsByRangeRequest
|
|
143
148
|
): fulu.DataColumnSidecarsByRangeRequest {
|
|
144
149
|
const {startSlot, columns} = request;
|
|
@@ -147,11 +152,22 @@ export function validateDataColumnSidecarsByRangeRequest(
|
|
|
147
152
|
if (count < 1) {
|
|
148
153
|
throw new ResponseError(RespStatus.INVALID_REQUEST, "count < 1");
|
|
149
154
|
}
|
|
150
|
-
// TODO: validate against MIN_EPOCHS_FOR_BLOCK_REQUESTS
|
|
151
155
|
if (startSlot < GENESIS_SLOT) {
|
|
152
156
|
throw new ResponseError(RespStatus.INVALID_REQUEST, "startSlot < genesis");
|
|
153
157
|
}
|
|
154
158
|
|
|
159
|
+
// Spec: [max(current_epoch - MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS, FULU_FORK_EPOCH), current_epoch]
|
|
160
|
+
const minimumRequestEpoch = Math.max(
|
|
161
|
+
currentEpoch - config.MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS,
|
|
162
|
+
config.FULU_FORK_EPOCH
|
|
163
|
+
);
|
|
164
|
+
if (computeEpochAtSlot(startSlot) < minimumRequestEpoch) {
|
|
165
|
+
throw new ResponseError(
|
|
166
|
+
RespStatus.RESOURCE_UNAVAILABLE,
|
|
167
|
+
"startSlot is before MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS"
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
155
171
|
if (count > config.MAX_REQUEST_BLOCKS_DENEB) {
|
|
156
172
|
count = config.MAX_REQUEST_BLOCKS_DENEB;
|
|
157
173
|
}
|
|
@@ -81,11 +81,13 @@ export function validateExecutionPayloadEnvelopesByRangeRequest(
|
|
|
81
81
|
if (count < 1) {
|
|
82
82
|
throw new ResponseError(RespStatus.INVALID_REQUEST, "count < 1");
|
|
83
83
|
}
|
|
84
|
-
// TODO: validate against MIN_EPOCHS_FOR_BLOCK_REQUESTS
|
|
85
84
|
if (startSlot < GENESIS_SLOT) {
|
|
86
85
|
throw new ResponseError(RespStatus.INVALID_REQUEST, "startSlot < genesis");
|
|
87
86
|
}
|
|
88
87
|
|
|
88
|
+
// The gloas req/resp spec uses MIN_EPOCHS_FOR_BLOCK_REQUESTS to define the minimum range peers MUST serve.
|
|
89
|
+
// Archival nodes may still serve older retained payloads to allow genesis sync.
|
|
90
|
+
|
|
89
91
|
if (count > config.MAX_REQUEST_BLOCKS_DENEB) {
|
|
90
92
|
count = config.MAX_REQUEST_BLOCKS_DENEB;
|
|
91
93
|
}
|
|
@@ -10,12 +10,8 @@ export async function* onExecutionPayloadEnvelopesByRoot(
|
|
|
10
10
|
chain: IBeaconChain,
|
|
11
11
|
db: IBeaconDb
|
|
12
12
|
): AsyncIterable<ResponseOutgoing> {
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
const minimumRequestEpoch = Math.max(
|
|
16
|
-
currentEpoch - chain.config.MIN_EPOCHS_FOR_BLOCK_REQUESTS,
|
|
17
|
-
chain.config.GLOAS_FORK_EPOCH
|
|
18
|
-
);
|
|
13
|
+
// The gloas req/resp spec uses MIN_EPOCHS_FOR_BLOCK_REQUESTS to define the minimum range peers MUST serve.
|
|
14
|
+
// Archival nodes may still serve older retained payloads to allow genesis sync.
|
|
19
15
|
|
|
20
16
|
for (const root of requestBody) {
|
|
21
17
|
const rootHex = toRootHex(root);
|
|
@@ -27,16 +23,11 @@ export async function* onExecutionPayloadEnvelopesByRoot(
|
|
|
27
23
|
continue;
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
const requestedEpoch = computeEpochAtSlot(slot);
|
|
31
|
-
if (requestedEpoch < minimumRequestEpoch) {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
26
|
const envelopeBytes = await chain.getSerializedExecutionPayloadEnvelope(slot, rootHex);
|
|
36
27
|
if (envelopeBytes) {
|
|
37
28
|
yield {
|
|
38
29
|
data: envelopeBytes,
|
|
39
|
-
boundary: chain.config.getForkBoundaryAtEpoch(
|
|
30
|
+
boundary: chain.config.getForkBoundaryAtEpoch(computeEpochAtSlot(slot)),
|
|
40
31
|
};
|
|
41
32
|
}
|
|
42
33
|
}
|
package/src/node/nodejs.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {BeaconApiMethods} from "@lodestar/api/beacon/server";
|
|
|
6
6
|
import {BeaconConfig} from "@lodestar/config";
|
|
7
7
|
import type {LoggerNode} from "@lodestar/logger/node";
|
|
8
8
|
import {ZERO_HASH_HEX} from "@lodestar/params";
|
|
9
|
-
import {IBeaconStateView, PubkeyCache} from "@lodestar/state-transition";
|
|
9
|
+
import {IBeaconStateView, PubkeyCache, isStatePostBellatrix} from "@lodestar/state-transition";
|
|
10
10
|
import {phase0} from "@lodestar/types";
|
|
11
11
|
import {sleep, toRootHex} from "@lodestar/utils";
|
|
12
12
|
import {ProcessShutdownCallback} from "@lodestar/validator";
|
|
@@ -221,7 +221,10 @@ export class BeaconNode {
|
|
|
221
221
|
|
|
222
222
|
let executionEngineOpts = opts.executionEngine;
|
|
223
223
|
if (opts.executionEngine.mode === "mock") {
|
|
224
|
-
const eth1BlockHash =
|
|
224
|
+
const eth1BlockHash =
|
|
225
|
+
isStatePostBellatrix(anchorState) && anchorState.isExecutionStateType
|
|
226
|
+
? toRootHex(anchorState.latestBlockHash)
|
|
227
|
+
: undefined;
|
|
225
228
|
executionEngineOpts = {
|
|
226
229
|
...opts.executionEngine,
|
|
227
230
|
genesisBlockHash: ZERO_HASH_HEX,
|
package/src/node/notifier.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
2
|
import {ExecutionStatus, ProtoBlock} from "@lodestar/fork-choice";
|
|
3
3
|
import {EPOCHS_PER_SYNC_COMMITTEE_PERIOD, SLOTS_PER_EPOCH} from "@lodestar/params";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
IBeaconStateView,
|
|
6
|
+
computeEpochAtSlot,
|
|
7
|
+
computeStartSlotAtEpoch,
|
|
8
|
+
isStatePostBellatrix,
|
|
9
|
+
} from "@lodestar/state-transition";
|
|
5
10
|
import {Epoch} from "@lodestar/types";
|
|
6
11
|
import {ErrorAborted, Logger, prettyBytes, prettyBytesShort, sleep} from "@lodestar/utils";
|
|
7
12
|
import {IBeaconChain} from "../chain/index.js";
|
|
@@ -165,7 +170,7 @@ function getHeadExecutionInfo(
|
|
|
165
170
|
const executionStatusStr = headInfo.executionStatus.toLowerCase();
|
|
166
171
|
|
|
167
172
|
// Add execution status to notifier only if head is on/post bellatrix
|
|
168
|
-
if (headState.isExecutionStateType) {
|
|
173
|
+
if (isStatePostBellatrix(headState) && headState.isExecutionStateType) {
|
|
169
174
|
if (headState.isMergeTransitionComplete) {
|
|
170
175
|
const executionPayloadHashInfo =
|
|
171
176
|
headInfo.executionStatus !== ExecutionStatus.PreMerge ? headInfo.executionPayloadBlockHash : "empty";
|