@lodestar/beacon-node 1.46.0-dev.b22e48117e → 1.46.0-dev.b9d4e89e49
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/config/constants.d.ts +1 -0
- package/lib/api/impl/config/constants.d.ts.map +1 -1
- package/lib/api/impl/config/constants.js +3 -1
- package/lib/api/impl/config/constants.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/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 +5 -0
- package/lib/chain/blocks/verifyBlock.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +33 -23
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +10 -1
- package/lib/chain/produceBlock/produceBlockBody.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/chain/validation/executionPayloadBid.js +1 -1
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +668 -23
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +3 -3
- package/lib/network/gossip/topic.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/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +14 -2
- package/lib/sync/range/batch.js.map +1 -1
- package/package.json +14 -14
- package/src/api/impl/config/constants.ts +4 -0
- package/src/api/impl/validator/index.ts +19 -6
- package/src/chain/blocks/utils/polarBearBanner.ts +50 -0
- package/src/chain/blocks/verifyBlock.ts +6 -0
- package/src/chain/prepareNextSlot.ts +58 -33
- package/src/chain/produceBlock/produceBlockBody.ts +12 -0
- package/src/chain/validation/dataColumnSidecar.ts +27 -17
- package/src/chain/validation/executionPayloadBid.ts +1 -1
- package/src/network/gossip/topic.ts +4 -2
- package/src/network/reqresp/score.ts +22 -3
- package/src/sync/range/batch.ts +19 -2
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import {routes} from "@lodestar/api";
|
|
2
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
3
3
|
import {getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ForkPostBellatrix,
|
|
6
|
+
ForkSeq,
|
|
7
|
+
SLOTS_PER_EPOCH,
|
|
8
|
+
isForkPostBellatrix,
|
|
9
|
+
isForkPostFulu,
|
|
10
|
+
isForkPostGloas,
|
|
11
|
+
} from "@lodestar/params";
|
|
5
12
|
import {
|
|
6
13
|
IBeaconStateView,
|
|
7
14
|
IBeaconStateViewBellatrix,
|
|
@@ -11,7 +18,7 @@ import {
|
|
|
11
18
|
isStatePostBellatrix,
|
|
12
19
|
isStatePostGloas,
|
|
13
20
|
} from "@lodestar/state-transition";
|
|
14
|
-
import {Bytes32, Slot} from "@lodestar/types";
|
|
21
|
+
import {Bytes32, Slot, ValidatorIndex} from "@lodestar/types";
|
|
15
22
|
import {Logger, fromHex, isErrorAborted, sleep} from "@lodestar/utils";
|
|
16
23
|
import {GENESIS_SLOT, ZERO_HASH_HEX} from "../constants/constants.js";
|
|
17
24
|
import {BuilderStatus} from "../execution/builder/http.js";
|
|
@@ -111,29 +118,36 @@ export class PrepareNextSlotScheduler {
|
|
|
111
118
|
: null;
|
|
112
119
|
const start = Date.now();
|
|
113
120
|
// 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
121
|
if (isForkPostBellatrix(fork)) {
|
|
127
|
-
|
|
122
|
+
let preparedState: IBeaconStateView | undefined;
|
|
123
|
+
|
|
124
|
+
const getProposerIndex = async (): Promise<ValidatorIndex> => {
|
|
125
|
+
if (isForkPostFulu(fork)) {
|
|
126
|
+
// getBeaconProposer covers the current + next epoch; should not throw
|
|
127
|
+
// PROPOSER_EPOCH_MISMATCH here due to the PREPARE_EPOCH_LIMIT check above.
|
|
128
|
+
return this.chain.getHeadState().getBeaconProposer(prepareSlot);
|
|
129
|
+
}
|
|
130
|
+
// the slot 0 of next epoch will likely use this Previous Root Checkpoint state for state transition so we transfer cache here
|
|
131
|
+
// the resulting state with cache will be cached in Checkpoint State Cache which is used for the upcoming block processing
|
|
132
|
+
// for other slots dontTransferCached=true because we don't run state transition on this state
|
|
133
|
+
preparedState = await this.chain.regen.getBlockSlotState(
|
|
134
|
+
headBlock,
|
|
135
|
+
prepareSlot,
|
|
136
|
+
{dontTransferCache: !isEpochTransition},
|
|
137
|
+
RegenCaller.precomputeEpoch
|
|
138
|
+
);
|
|
139
|
+
return preparedState.getBeaconProposer(prepareSlot);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const proposerIndex = await getProposerIndex();
|
|
128
143
|
const feeRecipient = this.chain.beaconProposerCache.get(proposerIndex);
|
|
129
|
-
let updatedPrepareState = prepareState;
|
|
130
144
|
|
|
131
145
|
if (feeRecipient) {
|
|
132
146
|
// If we are proposing next slot, we need to predict if we can proposer-boost-reorg or not
|
|
133
147
|
const proposerHead = this.chain.predictProposerHead(clockSlot);
|
|
134
148
|
const {slot: proposerHeadSlot, blockRoot: proposerHeadRoot} = proposerHead;
|
|
135
149
|
|
|
136
|
-
// If we predict we can reorg,
|
|
150
|
+
// If we predict we can reorg, we build on the proposer head (parent) block instead
|
|
137
151
|
if (proposerHeadRoot !== headRoot || proposerHeadSlot !== headSlot) {
|
|
138
152
|
this.logger.verbose("Weak head detected. May build on parent block instead", {
|
|
139
153
|
proposerHeadSlot,
|
|
@@ -142,13 +156,6 @@ export class PrepareNextSlotScheduler {
|
|
|
142
156
|
headRoot,
|
|
143
157
|
});
|
|
144
158
|
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
159
|
updatedHead = proposerHead;
|
|
153
160
|
}
|
|
154
161
|
|
|
@@ -165,30 +172,41 @@ export class PrepareNextSlotScheduler {
|
|
|
165
172
|
}
|
|
166
173
|
}
|
|
167
174
|
|
|
168
|
-
|
|
175
|
+
// post-fulu we'll always reach here because preparedState is undefined
|
|
176
|
+
if (preparedState === undefined || updatedHead !== headBlock) {
|
|
177
|
+
preparedState = await this.chain.regen.getBlockSlotState(
|
|
178
|
+
updatedHead,
|
|
179
|
+
prepareSlot,
|
|
180
|
+
// only transfer cache if epoch transition because that's the state we will use to stateTransition() the 1st block of epoch
|
|
181
|
+
{dontTransferCache: !isEpochTransition},
|
|
182
|
+
updatedHead === headBlock ? RegenCaller.precomputeEpoch : RegenCaller.predictProposerHead
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!isStatePostBellatrix(preparedState)) {
|
|
169
187
|
throw new Error("Expected Bellatrix state for payload attributes");
|
|
170
188
|
}
|
|
171
189
|
|
|
172
190
|
let parentBlockHash: Bytes32;
|
|
173
191
|
// Apply parent payload once here as it's reused by EL prep and SSE emit below
|
|
174
|
-
let stateAfterParentPayload: IBeaconStateViewBellatrix =
|
|
175
|
-
if (isStatePostGloas(
|
|
192
|
+
let stateAfterParentPayload: IBeaconStateViewBellatrix = preparedState;
|
|
193
|
+
if (isStatePostGloas(preparedState)) {
|
|
176
194
|
// Spec: should_build_on_full(store, head, slot) - see produceBlockBody.ts for context.
|
|
177
195
|
if (this.chain.forkChoice.shouldBuildOnFull(updatedHead, prepareSlot)) {
|
|
178
|
-
parentBlockHash =
|
|
196
|
+
parentBlockHash = preparedState.latestExecutionPayloadBid.blockHash;
|
|
179
197
|
// Skip applying parent payload unless we're proposing the next slot or have to emit payload_attributes events
|
|
180
198
|
if (feeRecipient !== undefined || this.chain.opts.emitPayloadAttributes === true) {
|
|
181
199
|
const parentExecutionRequests = await this.chain.getParentExecutionRequests(
|
|
182
200
|
updatedHead.slot,
|
|
183
201
|
updatedHead.blockRoot
|
|
184
202
|
);
|
|
185
|
-
stateAfterParentPayload =
|
|
203
|
+
stateAfterParentPayload = preparedState.withParentPayloadApplied(parentExecutionRequests);
|
|
186
204
|
}
|
|
187
205
|
} else {
|
|
188
|
-
parentBlockHash =
|
|
206
|
+
parentBlockHash = preparedState.latestExecutionPayloadBid.parentBlockHash;
|
|
189
207
|
}
|
|
190
208
|
} else {
|
|
191
|
-
parentBlockHash =
|
|
209
|
+
parentBlockHash = preparedState.latestExecutionPayloadHeader.blockHash;
|
|
192
210
|
}
|
|
193
211
|
|
|
194
212
|
if (feeRecipient) {
|
|
@@ -221,7 +239,7 @@ export class PrepareNextSlotScheduler {
|
|
|
221
239
|
});
|
|
222
240
|
}
|
|
223
241
|
|
|
224
|
-
this.computeStateHashTreeRoot(
|
|
242
|
+
this.computeStateHashTreeRoot(preparedState, isEpochTransition);
|
|
225
243
|
|
|
226
244
|
// If emitPayloadAttributes is true emit a SSE payloadAttributes event for
|
|
227
245
|
// every slot. Without the flag, only emit the event if we are proposing in the next slot.
|
|
@@ -239,7 +257,14 @@ export class PrepareNextSlotScheduler {
|
|
|
239
257
|
this.chain.emitter.emit(routes.events.EventType.payloadAttributes, {data, version: fork});
|
|
240
258
|
}
|
|
241
259
|
} else {
|
|
242
|
-
|
|
260
|
+
// Pre-bellatrix only reaches here at an epoch transition to precompute the next epoch state
|
|
261
|
+
const preparedState = await this.chain.regen.getBlockSlotState(
|
|
262
|
+
headBlock,
|
|
263
|
+
prepareSlot,
|
|
264
|
+
{dontTransferCache: !isEpochTransition},
|
|
265
|
+
RegenCaller.precomputeEpoch
|
|
266
|
+
);
|
|
267
|
+
this.computeStateHashTreeRoot(preparedState, isEpochTransition);
|
|
243
268
|
}
|
|
244
269
|
|
|
245
270
|
// assuming there is no reorg, it caches the checkpoint state & helps avoid doing a full state transition in the next slot
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {BitArray} from "@chainsafe/ssz";
|
|
1
2
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
3
|
import {IForkChoice, ProtoBlock, getSafeExecutionBlockHash} from "@lodestar/fork-choice";
|
|
3
4
|
import {
|
|
@@ -10,6 +11,7 @@ import {
|
|
|
10
11
|
ForkPostGloas,
|
|
11
12
|
ForkPreGloas,
|
|
12
13
|
ForkSeq,
|
|
14
|
+
INCLUSION_LIST_COMMITTEE_SIZE,
|
|
13
15
|
isForkPostAltair,
|
|
14
16
|
isForkPostBellatrix,
|
|
15
17
|
isForkPostGloas,
|
|
@@ -49,6 +51,7 @@ import {
|
|
|
49
51
|
electra,
|
|
50
52
|
fulu,
|
|
51
53
|
gloas,
|
|
54
|
+
heze,
|
|
52
55
|
ssz,
|
|
53
56
|
} from "@lodestar/types";
|
|
54
57
|
import {GWEI_TO_WEI, Logger, byteArrayEquals, fromHex, sleep, toHex, toPubkeyHex, toRootHex} from "@lodestar/utils";
|
|
@@ -353,6 +356,10 @@ export async function produceBlockBody<T extends BlockType>(
|
|
|
353
356
|
blobKzgCommitments: blobsBundle.commitments,
|
|
354
357
|
executionRequestsRoot: ssz.gloas.ExecutionRequests.hashTreeRoot(executionRequests as gloas.ExecutionRequests),
|
|
355
358
|
};
|
|
359
|
+
if (ForkSeq[fork] >= ForkSeq.heze) {
|
|
360
|
+
// TODO HEZE: populate from inclusion list pool once IL aggregation is wired up.
|
|
361
|
+
(bid as heze.ExecutionPayloadBid).inclusionListBits = BitArray.fromBitLen(INCLUSION_LIST_COMMITTEE_SIZE);
|
|
362
|
+
}
|
|
356
363
|
const signedBid: gloas.SignedExecutionPayloadBid = {
|
|
357
364
|
message: bid,
|
|
358
365
|
signature: G2_POINT_AT_INFINITY,
|
|
@@ -927,6 +934,11 @@ function preparePayloadAttributes(
|
|
|
927
934
|
);
|
|
928
935
|
}
|
|
929
936
|
|
|
937
|
+
if (ForkSeq[fork] >= ForkSeq.heze) {
|
|
938
|
+
// TODO HEZE: populate from inclusion list pool once IL aggregation is wired up.
|
|
939
|
+
(payloadAttributes as heze.SSEPayloadAttributes["payloadAttributes"]).inclusionListTransactions = [];
|
|
940
|
+
}
|
|
941
|
+
|
|
930
942
|
return payloadAttributes;
|
|
931
943
|
}
|
|
932
944
|
|
|
@@ -2,15 +2,16 @@ import {ChainConfig, ChainForkConfig} from "@lodestar/config";
|
|
|
2
2
|
import {
|
|
3
3
|
KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH,
|
|
4
4
|
KZG_COMMITMENTS_SUBTREE_INDEX,
|
|
5
|
+
MIN_SEED_LOOKAHEAD,
|
|
5
6
|
NUMBER_OF_COLUMNS,
|
|
7
|
+
isForkPostFulu,
|
|
6
8
|
} from "@lodestar/params";
|
|
7
9
|
import {
|
|
8
10
|
computeEpochAtSlot,
|
|
9
11
|
computeStartSlotAtEpoch,
|
|
10
12
|
getBlockHeaderProposerSignatureSetByHeaderSlot,
|
|
11
|
-
getBlockHeaderProposerSignatureSetByParentStateSlot,
|
|
12
13
|
} from "@lodestar/state-transition";
|
|
13
|
-
import {DataColumnSidecar, Root, Slot, SubnetID, fulu, gloas, ssz} from "@lodestar/types";
|
|
14
|
+
import {DataColumnSidecar, Root, Slot, SubnetID, ValidatorIndex, fulu, gloas, ssz} from "@lodestar/types";
|
|
14
15
|
import {byteArrayEquals, toRootHex, verifyMerkleBranch} from "@lodestar/utils";
|
|
15
16
|
import {BeaconMetrics} from "../../metrics/metrics/beacon.js";
|
|
16
17
|
import {Metrics} from "../../metrics/metrics.js";
|
|
@@ -104,19 +105,23 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
|
|
107
|
-
// getBlockSlotState also checks for whether the current finalized checkpoint is an ancestor of the block.
|
|
108
|
-
// As a result, we throw an IGNORE (whereas the spec says we should REJECT for this scenario).
|
|
109
|
-
// this is something we should change this in the future to make the code airtight to the spec.
|
|
110
108
|
// 7) [REJECT] The sidecar's block's parent passes validation.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
// Post-fulu, we can use parent state to get expected proposer index thanks to proposer lookahead
|
|
110
|
+
const parentEpoch = computeEpochAtSlot(parentBlock.slot);
|
|
111
|
+
const blockEpoch = computeEpochAtSlot(blockHeader.slot);
|
|
112
|
+
const getProposerIndex = async (): Promise<ValidatorIndex> => {
|
|
113
|
+
if (isForkPostFulu(chain.config.getForkName(parentBlock.slot)) && blockEpoch - parentEpoch <= MIN_SEED_LOOKAHEAD) {
|
|
114
|
+
const parentState = await chain.regen.getState(parentBlock.stateRoot, RegenCaller.validateGossipDataColumn);
|
|
115
|
+
return parentState.getBeaconProposer(blockHeader.slot);
|
|
116
|
+
}
|
|
117
|
+
const blockState = await chain.regen.getBlockSlotState(
|
|
118
|
+
parentBlock,
|
|
119
|
+
blockHeader.slot,
|
|
120
|
+
{dontTransferCache: true},
|
|
121
|
+
RegenCaller.validateGossipDataColumn
|
|
122
|
+
);
|
|
123
|
+
return blockState.getBeaconProposer(blockHeader.slot);
|
|
124
|
+
};
|
|
120
125
|
|
|
121
126
|
// 13) [REJECT] The sidecar is proposed by the expected proposer_index for the block's slot in the context of the current
|
|
122
127
|
// shuffling (defined by block_header.parent_root/block_header.slot). If the proposer_index cannot
|
|
@@ -124,7 +129,13 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
124
129
|
// while proposers for the block's branch are calculated -- in such a case do not REJECT, instead IGNORE
|
|
125
130
|
// this message.
|
|
126
131
|
const proposerIndex = blockHeader.proposerIndex;
|
|
127
|
-
const expectedProposerIndex =
|
|
132
|
+
const expectedProposerIndex = await getProposerIndex().catch(() => {
|
|
133
|
+
throw new DataColumnSidecarGossipError(GossipAction.IGNORE, {
|
|
134
|
+
code: DataColumnSidecarErrorCode.PARENT_UNKNOWN,
|
|
135
|
+
parentRoot,
|
|
136
|
+
slot: blockHeader.slot,
|
|
137
|
+
});
|
|
138
|
+
});
|
|
128
139
|
|
|
129
140
|
if (proposerIndex !== expectedProposerIndex) {
|
|
130
141
|
throw new DataColumnSidecarGossipError(GossipAction.REJECT, {
|
|
@@ -137,9 +148,8 @@ export async function validateGossipFuluDataColumnSidecar(
|
|
|
137
148
|
// 5) [REJECT] The proposer signature of sidecar.signed_block_header, is valid with respect to the block_header.proposer_index pubkey.
|
|
138
149
|
const signature = dataColumnSidecar.signedBlockHeader.signature;
|
|
139
150
|
if (!chain.seenBlockInputCache.isVerifiedProposerSignature(blockHeader.slot, blockRootHex, signature)) {
|
|
140
|
-
const signatureSet =
|
|
151
|
+
const signatureSet = getBlockHeaderProposerSignatureSetByHeaderSlot(
|
|
141
152
|
chain.config,
|
|
142
|
-
blockState.slot,
|
|
143
153
|
dataColumnSidecar.signedBlockHeader
|
|
144
154
|
);
|
|
145
155
|
|
|
@@ -346,7 +346,7 @@ async function validateExecutionPayloadBid(
|
|
|
346
346
|
// [REJECT] `signed_execution_payload_bid.signature` is valid with respect to the `bid.builder_index`.
|
|
347
347
|
const signatureSet = createSingleSignatureSetFromComponents(
|
|
348
348
|
PublicKey.fromBytes(builder.pubkey),
|
|
349
|
-
getExecutionPayloadBidSigningRoot(chain.config,
|
|
349
|
+
getExecutionPayloadBidSigningRoot(chain.config, bid),
|
|
350
350
|
signedExecutionPayloadBid.signature
|
|
351
351
|
);
|
|
352
352
|
|
|
@@ -8,11 +8,13 @@ import {
|
|
|
8
8
|
MAX_DATA_COLUMN_SIDECAR_SIZE,
|
|
9
9
|
MAX_SIGNED_AGGREGATE_AND_PROOF_SIZE,
|
|
10
10
|
MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE,
|
|
11
|
+
MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE_HEZE,
|
|
11
12
|
SYNC_COMMITTEE_SUBNET_COUNT,
|
|
12
13
|
isForkPostAltair,
|
|
13
14
|
isForkPostElectra,
|
|
14
15
|
isForkPostFulu,
|
|
15
16
|
isForkPostGloas,
|
|
17
|
+
isForkPostHeze,
|
|
16
18
|
} from "@lodestar/params";
|
|
17
19
|
import {Attestation, SingleAttestation, ssz, sszTypesFor} from "@lodestar/types";
|
|
18
20
|
import {GossipAction, GossipActionError, GossipErrorCode} from "../../chain/errors/gossipValidation.js";
|
|
@@ -130,7 +132,7 @@ export function getGossipSSZType(topic: GossipTopic) {
|
|
|
130
132
|
case GossipType.payload_attestation_message:
|
|
131
133
|
return ssz.gloas.PayloadAttestationMessage;
|
|
132
134
|
case GossipType.execution_payload_bid:
|
|
133
|
-
return ssz.gloas.SignedExecutionPayloadBid;
|
|
135
|
+
return isForkPostGloas(fork) ? sszTypesFor(fork).SignedExecutionPayloadBid : ssz.gloas.SignedExecutionPayloadBid;
|
|
134
136
|
case GossipType.proposer_preferences:
|
|
135
137
|
return ssz.gloas.SignedProposerPreferences;
|
|
136
138
|
}
|
|
@@ -154,7 +156,7 @@ export function getGossipSSZMaxSize(topic: GossipTopic, maxPayloadSize: number,
|
|
|
154
156
|
case GossipType.execution_payload:
|
|
155
157
|
return maxPayloadSize;
|
|
156
158
|
case GossipType.execution_payload_bid:
|
|
157
|
-
return MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE;
|
|
159
|
+
return isForkPostHeze(fork) ? MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE_HEZE : MAX_SIGNED_EXECUTION_PAYLOAD_BID_SIZE;
|
|
158
160
|
default:
|
|
159
161
|
return (sszType ?? getGossipSSZType(topic)).maxSize;
|
|
160
162
|
}
|
|
@@ -33,9 +33,28 @@ export function onOutgoingReqRespError(e: RequestError, method: ReqRespMethod):
|
|
|
33
33
|
|
|
34
34
|
case RequestErrorCode.DIAL_TIMEOUT:
|
|
35
35
|
case RequestErrorCode.DIAL_ERROR:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
// `RequestError` renders `e.message` as just the error code (see `renderErrorMessage`), so the
|
|
37
|
+
// multistream "protocol selection failed" text is only on the wrapped inner error, which is
|
|
38
|
+
// available on `DIAL_ERROR` via `e.type.error` (`DIAL_TIMEOUT` carries no inner error).
|
|
39
|
+
if (
|
|
40
|
+
e.type.code === RequestErrorCode.DIAL_ERROR &&
|
|
41
|
+
e.type.error.message.includes(multiStreamSelectErrorCodes.protocolSelectionFailed)
|
|
42
|
+
) {
|
|
43
|
+
// Peer does not support the protocol, a real incompatibility rather than a transient
|
|
44
|
+
// failure, so keep the stronger penalty (Fatal for Ping, as before).
|
|
45
|
+
return method === ReqRespMethod.Ping ? PeerAction.Fatal : PeerAction.LowToleranceError;
|
|
46
|
+
}
|
|
47
|
+
switch (method) {
|
|
48
|
+
// Ping and Status are liveness probes; their dial timeouts are dominated by transient
|
|
49
|
+
// network congestion rather than peer misbehavior, so penalize leniently to avoid
|
|
50
|
+
// self-inflicted peer starvation (https://github.com/ChainSafe/lodestar/issues/9562),
|
|
51
|
+
// while still applying some penalty so genuinely dead peers eventually free the slot.
|
|
52
|
+
case ReqRespMethod.Ping:
|
|
53
|
+
case ReqRespMethod.Status:
|
|
54
|
+
return PeerAction.HighToleranceError;
|
|
55
|
+
default:
|
|
56
|
+
return PeerAction.LowToleranceError;
|
|
57
|
+
}
|
|
39
58
|
// TODO: Detect SSZDecodeError and return PeerAction.Fatal
|
|
40
59
|
|
|
41
60
|
case RequestErrorCode.RESP_TIMEOUT:
|
package/src/sync/range/batch.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {LodestarError, byteArrayEquals, prettyPrintIndices, toRootHex} from "@lo
|
|
|
5
5
|
import {isBlockInputColumns} from "../../chain/blocks/blockInput/blockInput.js";
|
|
6
6
|
import {IBlockInput} from "../../chain/blocks/blockInput/types.js";
|
|
7
7
|
import {isDaOutOfRange} from "../../chain/blocks/blockInput/utils.js";
|
|
8
|
+
import {PayloadError, PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
|
|
8
9
|
import {PayloadEnvelopeInput} from "../../chain/blocks/payloadEnvelopeInput/payloadEnvelopeInput.js";
|
|
9
10
|
import {BlockError, BlockErrorCode} from "../../chain/errors/index.js";
|
|
10
11
|
import {ZERO_HASH} from "../../constants/constants.js";
|
|
@@ -702,7 +703,7 @@ export class Batch {
|
|
|
702
703
|
throw new BatchError(this.wrongStatusErrorType(BatchStatus.Processing));
|
|
703
704
|
}
|
|
704
705
|
|
|
705
|
-
if (err
|
|
706
|
+
if (isExecutionEngineError(err)) {
|
|
706
707
|
this.onExecutionEngineError(this.state.attempt);
|
|
707
708
|
} else {
|
|
708
709
|
this.onProcessingError(this.state.attempt);
|
|
@@ -717,7 +718,7 @@ export class Batch {
|
|
|
717
718
|
throw new BatchError(this.wrongStatusErrorType(BatchStatus.AwaitingValidation));
|
|
718
719
|
}
|
|
719
720
|
|
|
720
|
-
if (err
|
|
721
|
+
if (isExecutionEngineError(err)) {
|
|
721
722
|
this.onExecutionEngineError(this.state.attempt);
|
|
722
723
|
} else {
|
|
723
724
|
this.onProcessingError(this.state.attempt);
|
|
@@ -787,3 +788,19 @@ type BatchErrorMetadata = {
|
|
|
787
788
|
};
|
|
788
789
|
|
|
789
790
|
export class BatchError extends LodestarError<BatchErrorType & BatchErrorMetadata> {}
|
|
791
|
+
|
|
792
|
+
function isExecutionEngineError(err: Error): boolean {
|
|
793
|
+
if (!(err instanceof BlockError)) {
|
|
794
|
+
return false;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
if (err.type.code === BlockErrorCode.EXECUTION_ENGINE_ERROR) {
|
|
798
|
+
return true;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
return (
|
|
802
|
+
err.type.code === BlockErrorCode.BEACON_CHAIN_ERROR &&
|
|
803
|
+
err.type.error instanceof PayloadError &&
|
|
804
|
+
err.type.error.type.code === PayloadErrorCode.EXECUTION_ENGINE_ERROR
|
|
805
|
+
);
|
|
806
|
+
}
|