@lodestar/beacon-node 2.0.0 → 2.1.0-dev.03db1e1994
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/rest/base.d.ts.map +1 -1
- package/lib/api/rest/base.js +1 -1
- package/lib/api/rest/base.js.map +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +5 -0
- package/lib/chain/errors/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadBid.js +1 -0
- package/lib/chain/errors/executionPayloadBid.js.map +1 -1
- package/lib/chain/options.d.ts.map +1 -1
- package/lib/chain/options.js +0 -1
- package/lib/chain/options.js.map +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js +1 -1
- package/lib/chain/seenCache/seenGossipBlockInput.js.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +11 -1
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validation/payloadAttestationMessage.js +2 -2
- package/lib/chain/validation/payloadAttestationMessage.js.map +1 -1
- package/lib/network/network.js +6 -6
- package/lib/network/network.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +9 -7
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/sync/range/batch.d.ts.map +1 -1
- package/lib/sync/range/batch.js +5 -1
- package/lib/sync/range/batch.js.map +1 -1
- package/lib/util/sszBytes.d.ts.map +1 -1
- package/lib/util/sszBytes.js +6 -4
- package/lib/util/sszBytes.js.map +1 -1
- package/package.json +16 -16
- package/src/api/rest/base.ts +5 -1
- package/src/chain/errors/executionPayloadBid.ts +6 -0
- package/src/chain/options.ts +0 -1
- package/src/chain/seenCache/seenGossipBlockInput.ts +1 -1
- package/src/chain/validation/executionPayloadBid.ts +15 -6
- package/src/chain/validation/payloadAttestationMessage.ts +2 -2
- package/src/network/network.ts +6 -6
- package/src/network/processor/gossipHandlers.ts +12 -7
- package/src/sync/range/batch.ts +5 -1
- package/src/util/sszBytes.ts +7 -8
|
@@ -378,7 +378,7 @@ export class SeenBlockInput {
|
|
|
378
378
|
for (const [, blockInput] of sorted) {
|
|
379
379
|
this.evictBlockInput(blockInput);
|
|
380
380
|
itemsToDelete--;
|
|
381
|
-
if (itemsToDelete <= 0)
|
|
381
|
+
if (itemsToDelete <= 0) break;
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
pruneSetToMax(this.verifiedProposerSignatures, MAX_BLOCK_INPUT_CACHE_SIZE);
|
|
@@ -214,12 +214,21 @@ async function validateExecutionPayloadBid(
|
|
|
214
214
|
if (isForkPostHeze(chain.config.getForkName(bid.slot))) {
|
|
215
215
|
const {inclusionListBits} = bid as heze.ExecutionPayloadBid;
|
|
216
216
|
const inclusionListSlot = bid.slot - 1;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
217
|
+
let inclusionListDependentRoot: RootHex;
|
|
218
|
+
try {
|
|
219
|
+
inclusionListDependentRoot = getShufflingDependentRoot(
|
|
220
|
+
chain.forkChoice,
|
|
221
|
+
computeEpochAtSlot(inclusionListSlot),
|
|
222
|
+
computeEpochAtSlot(parentBlock.slot),
|
|
223
|
+
parentBlock
|
|
224
|
+
);
|
|
225
|
+
} catch {
|
|
226
|
+
throw new ExecutionPayloadBidError(GossipAction.IGNORE, {
|
|
227
|
+
code: ExecutionPayloadBidErrorCode.UNKNOWN_INCLUSION_LIST_DEPENDENT_ROOT,
|
|
228
|
+
slot: bid.slot,
|
|
229
|
+
parentBlockRoot: bidParentBlockRoot,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
223
232
|
if (
|
|
224
233
|
!chain.inclusionListStore.isInclusionListBitsInclusive(
|
|
225
234
|
inclusionListSlot,
|
|
@@ -105,8 +105,8 @@ async function validatePayloadAttestationMessage(
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// [REJECT] The message's validator index is within the payload committee in
|
|
108
|
-
// `get_ptc(state, data.slot)`. The `state` is the
|
|
109
|
-
//
|
|
108
|
+
// `get_ptc(state, data.slot)`. The `state` is the post-state of the attested block,
|
|
109
|
+
// so the committee is the one of the block's branch, as in fork choice.
|
|
110
110
|
// The validator may occupy multiple PTC positions because `compute_ptc` samples
|
|
111
111
|
// by effective balance — collect all of them so duplicate votes are counted.
|
|
112
112
|
const validatorCommitteeIndices = state.getIndicesInPayloadTimelinessCommittee(validatorIndex, data.slot);
|
package/src/network/network.ts
CHANGED
|
@@ -424,8 +424,8 @@ export class Network implements INetwork {
|
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
async publishVoluntaryExit(voluntaryExit: phase0.SignedVoluntaryExit): Promise<number> {
|
|
427
|
-
|
|
428
|
-
const boundary = this.config.getForkBoundaryAtEpoch(
|
|
427
|
+
// An exit stays valid indefinitely but peers unsubscribe from the topics of previous forks
|
|
428
|
+
const boundary = this.config.getForkBoundaryAtEpoch(this.clock.currentEpoch);
|
|
429
429
|
|
|
430
430
|
return this.publishGossip<GossipType.voluntary_exit>({type: GossipType.voluntary_exit, boundary}, voluntaryExit);
|
|
431
431
|
}
|
|
@@ -455,8 +455,8 @@ export class Network implements INetwork {
|
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
async publishProposerSlashing(proposerSlashing: phase0.ProposerSlashing): Promise<number> {
|
|
458
|
-
|
|
459
|
-
const boundary = this.config.getForkBoundaryAtEpoch(
|
|
458
|
+
// The slashed headers can be from a previous fork but peers unsubscribe from the topics of previous forks
|
|
459
|
+
const boundary = this.config.getForkBoundaryAtEpoch(this.clock.currentEpoch);
|
|
460
460
|
|
|
461
461
|
return this.publishGossip<GossipType.proposer_slashing>(
|
|
462
462
|
{type: GossipType.proposer_slashing, boundary},
|
|
@@ -465,8 +465,8 @@ export class Network implements INetwork {
|
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
async publishAttesterSlashing(attesterSlashing: AttesterSlashing): Promise<number> {
|
|
468
|
-
|
|
469
|
-
const boundary = this.config.getForkBoundaryAtEpoch(
|
|
468
|
+
// The slashed attestations can be from a previous fork but peers unsubscribe from the topics of previous forks
|
|
469
|
+
const boundary = this.config.getForkBoundaryAtEpoch(this.clock.currentEpoch);
|
|
470
470
|
|
|
471
471
|
return this.publishGossip<GossipType.attester_slashing>(
|
|
472
472
|
{type: GossipType.attester_slashing, boundary},
|
|
@@ -1295,20 +1295,25 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
1295
1295
|
try {
|
|
1296
1296
|
const delaySec = chain.clock.secFromSlot(payloadAttestationMessage.data.slot, seenTimestampSec);
|
|
1297
1297
|
metrics?.gossipPayloadAttestationMessage.elapsedTimeTillReceived.observe({source: OpSource.gossip}, delaySec);
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
if (isNextSlotProposer) {
|
|
1302
|
-
try {
|
|
1298
|
+
try {
|
|
1299
|
+
const nextSlotProposer = chain.getHeadState().getBeaconProposer(payloadAttestationMessage.data.slot + 1);
|
|
1300
|
+
if (chain.beaconProposerCache.has(nextSlotProposer)) {
|
|
1303
1301
|
const insertOutcome = chain.payloadAttestationPool.add(
|
|
1304
1302
|
payloadAttestationMessage,
|
|
1305
1303
|
validationResult.attDataRootHex,
|
|
1306
1304
|
validationResult.validatorCommitteeIndices
|
|
1307
1305
|
);
|
|
1308
1306
|
metrics?.opPool.payloadAttestationPool.gossipInsertOutcome.inc({insertOutcome});
|
|
1309
|
-
} catch (e) {
|
|
1310
|
-
logger.debug("Error adding to payloadAttestation pool", {}, e as Error);
|
|
1311
1307
|
}
|
|
1308
|
+
} catch (e) {
|
|
1309
|
+
logger.debug(
|
|
1310
|
+
"Error adding to payloadAttestation pool",
|
|
1311
|
+
{
|
|
1312
|
+
slot: payloadAttestationMessage.data.slot,
|
|
1313
|
+
root: toRootHex(payloadAttestationMessage.data.beaconBlockRoot),
|
|
1314
|
+
},
|
|
1315
|
+
e as Error
|
|
1316
|
+
);
|
|
1312
1317
|
}
|
|
1313
1318
|
|
|
1314
1319
|
// Gossip accepts adjacent slots within the clock disparity but fork choice only counts the current slot
|
package/src/sync/range/batch.ts
CHANGED
|
@@ -366,9 +366,13 @@ export class Batch {
|
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
const needsEnvelope = !parentPayloadInput?.hasPayloadEnvelope();
|
|
369
|
+
// The parent precedes the batch, so it can be outside the DA window even when the batch is inside it
|
|
370
|
+
const parentPayload = this.getParentPayload();
|
|
369
371
|
const missingColumns = parentPayloadInput
|
|
370
372
|
? parentPayloadInput.getMissingSampledColumnMeta().missing
|
|
371
|
-
: this.
|
|
373
|
+
: isDaOutOfRange(this.config, parentPayload.forkName, parentPayload.slot, this.clock.currentEpoch)
|
|
374
|
+
? []
|
|
375
|
+
: this.custodyConfig.sampledColumns;
|
|
372
376
|
|
|
373
377
|
if (needsEnvelope || missingColumns.length > 0) {
|
|
374
378
|
requests.parentPayloadRequest = {
|
package/src/util/sszBytes.ts
CHANGED
|
@@ -693,7 +693,7 @@ export function getLastProcessedSlotFromBeaconStateSerialized(data: Uint8Array):
|
|
|
693
693
|
|
|
694
694
|
const SLOT_BYTES_POSITION_IN_BEACON_STATE = 8 + 32;
|
|
695
695
|
export function getSlotFromBeaconStateSerialized(data: Uint8Array): Slot | null {
|
|
696
|
-
if (data.length < SLOT_BYTES_POSITION_IN_BEACON_STATE) {
|
|
696
|
+
if (data.length < SLOT_BYTES_POSITION_IN_BEACON_STATE + SLOT_SIZE) {
|
|
697
697
|
return null;
|
|
698
698
|
}
|
|
699
699
|
|
|
@@ -886,17 +886,16 @@ export function getBlobKzgCommitmentsCountFromSignedBeaconBlockSerialized(
|
|
|
886
886
|
const bodyIndex = Object.keys(BeaconBlock.fields).indexOf("body");
|
|
887
887
|
const bodyRange = blockFieldRanges[bodyIndex];
|
|
888
888
|
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
);
|
|
889
|
+
const bodyStart = messageRange.start + bodyRange.start;
|
|
890
|
+
const bodyEnd = messageRange.start + bodyRange.end;
|
|
891
|
+
|
|
892
|
+
const bodyFieldRanges = BeaconBlockBody.getFieldRanges(view, bodyStart, bodyEnd);
|
|
894
893
|
const kzgCommitmentsIndex = Object.keys(BeaconBlockBody.fields).indexOf("blobKzgCommitments");
|
|
895
894
|
const kzgCommitmentsRange = bodyFieldRanges[kzgCommitmentsIndex];
|
|
896
895
|
const commitmentSize = KZGCommitment.fixedSize;
|
|
897
896
|
|
|
898
|
-
const end =
|
|
899
|
-
const start =
|
|
897
|
+
const end = bodyStart + kzgCommitmentsRange.end;
|
|
898
|
+
const start = bodyStart + kzgCommitmentsRange.start;
|
|
900
899
|
|
|
901
900
|
return Math.round((Math.min(end, blockBytes.byteLength) - start) / commitmentSize);
|
|
902
901
|
}
|