@lodestar/beacon-node 1.48.0-dev.b5f4a8f2c6 → 1.48.0-dev.baa28132d2
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/state/utils.d.ts.map +1 -1
- package/lib/api/impl/beacon/state/utils.js +14 -0
- package/lib/api/impl/beacon/state/utils.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts +5 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +9 -3
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/index.d.ts +8 -4
- package/lib/chain/blocks/index.d.ts.map +1 -1
- package/lib/chain/blocks/index.js +80 -15
- package/lib/chain/blocks/index.js.map +1 -1
- package/lib/chain/blocks/types.d.ts +8 -0
- package/lib/chain/blocks/types.d.ts.map +1 -1
- package/lib/chain/blocks/types.js.map +1 -1
- package/lib/chain/chain.d.ts +2 -2
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +2 -2
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/errors/gossipValidation.d.ts +2 -1
- package/lib/chain/errors/gossipValidation.d.ts.map +1 -1
- package/lib/chain/errors/gossipValidation.js +1 -0
- package/lib/chain/errors/gossipValidation.js.map +1 -1
- package/lib/chain/interface.d.ts +2 -2
- package/lib/chain/interface.d.ts.map +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js +1 -1
- package/lib/chain/opPools/aggregatedAttestationPool.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +11 -0
- package/lib/network/processor/index.js.map +1 -1
- package/lib/sync/range/range.d.ts.map +1 -1
- package/lib/sync/range/range.js +24 -1
- package/lib/sync/range/range.js.map +1 -1
- package/package.json +14 -14
- package/src/api/impl/beacon/state/utils.ts +15 -0
- package/src/chain/blocks/importBlock.ts +21 -5
- package/src/chain/blocks/index.ts +107 -21
- package/src/chain/blocks/types.ts +9 -0
- package/src/chain/chain.ts +4 -4
- package/src/chain/errors/gossipValidation.ts +1 -0
- package/src/chain/interface.ts +2 -2
- package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
- package/src/network/processor/index.ts +13 -0
- package/src/sync/range/range.ts +23 -1
package/src/chain/interface.ts
CHANGED
|
@@ -35,7 +35,7 @@ import {IArchiveStore} from "./archiveStore/interface.js";
|
|
|
35
35
|
import {CheckpointBalancesCache} from "./balancesCache.js";
|
|
36
36
|
import {BeaconProposerCache, ProposerPreparationData} from "./beaconProposerCache.js";
|
|
37
37
|
import {IBlockInput} from "./blocks/blockInput/index.js";
|
|
38
|
-
import {ImportBlockOpts, ImportPayloadOpts} from "./blocks/types.js";
|
|
38
|
+
import {ImportBlockOpts, ImportPayloadOpts, ProcessBlocksResult} from "./blocks/types.js";
|
|
39
39
|
import {IBlsVerifier} from "./bls/index.js";
|
|
40
40
|
import {BuilderCircuitBreaker} from "./builderCircuitBreaker.js";
|
|
41
41
|
import {ColumnReconstructionTracker} from "./ColumnReconstructionTracker.js";
|
|
@@ -262,7 +262,7 @@ export interface IBeaconChain {
|
|
|
262
262
|
blocks: IBlockInput[],
|
|
263
263
|
payloadEnvelopes: Map<Slot, PayloadEnvelopeInput> | null,
|
|
264
264
|
opts?: ImportBlockOpts
|
|
265
|
-
): Promise<
|
|
265
|
+
): Promise<ProcessBlocksResult>;
|
|
266
266
|
|
|
267
267
|
/** Process execution payload envelope: verify, import to fork choice, and persist to DB */
|
|
268
268
|
processExecutionPayload(payloadInput: PayloadEnvelopeInput, opts?: ImportPayloadOpts): Promise<void>;
|
|
@@ -363,7 +363,7 @@ export class AggregatedAttestationPool {
|
|
|
363
363
|
stateEpoch,
|
|
364
364
|
rootCache,
|
|
365
365
|
gloasState?.executionPayloadAvailability ?? null,
|
|
366
|
-
gloasState?.
|
|
366
|
+
gloasState?.latestBlockHeader.slot ?? null
|
|
367
367
|
);
|
|
368
368
|
|
|
369
369
|
const weight =
|
|
@@ -360,6 +360,19 @@ export class NetworkProcessor {
|
|
|
360
360
|
return;
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
// DOS protection: drop far-future messages before allocating any unknown-root tracking entry.
|
|
364
|
+
// Bound each topic to what its gossip validator accepts; only execution_payload_bid accepts the next slot.
|
|
365
|
+
const latestPermissableSlot =
|
|
366
|
+
this.chain.clock.currentSlotWithGossipDisparity + (topicType === GossipType.execution_payload_bid ? 1 : 0);
|
|
367
|
+
if (slot > latestPermissableSlot) {
|
|
368
|
+
// No need to report the dropped job to gossip. It will be eventually pruned from the mcache
|
|
369
|
+
this.metrics?.networkProcessor.gossipValidationError.inc({
|
|
370
|
+
topic: topicType,
|
|
371
|
+
error: GossipErrorCode.FUTURE_SLOT,
|
|
372
|
+
});
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
|
|
363
376
|
message.msgSlot = slot;
|
|
364
377
|
|
|
365
378
|
// this determines whether this message needs to wait for a Block or Envelope
|
package/src/sync/range/range.ts
CHANGED
|
@@ -217,7 +217,29 @@ export class RangeSync extends (EventEmitter as {new (): RangeSyncEmitter}) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
} else {
|
|
220
|
-
await this.chain.processChainSegment(blocks, payloadEnvelopes, flags);
|
|
220
|
+
const {orphaned, skipped} = await this.chain.processChainSegment(blocks, payloadEnvelopes, flags);
|
|
221
|
+
// We log orphaned payloads to work with different clients
|
|
222
|
+
// in the future, consider applying penalties in certain conditions
|
|
223
|
+
// make sure the payload source was from range sync in that case
|
|
224
|
+
for (const {slot, payloadEnvelopeInput} of orphaned) {
|
|
225
|
+
const {peerIdStr, source} = payloadEnvelopeInput.getPayloadEnvelopeSource();
|
|
226
|
+
let client = "unknown";
|
|
227
|
+
if (peerIdStr !== undefined) {
|
|
228
|
+
try {
|
|
229
|
+
client = this.getConnectedPeerSyncMeta(peerIdStr).client;
|
|
230
|
+
} catch {
|
|
231
|
+
// peer disconnected since serving the envelope, keep "unknown"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
this.logger.debug("Orphaned payload envelope in range sync batch", {
|
|
235
|
+
slot,
|
|
236
|
+
root: payloadEnvelopeInput.blockRootHex,
|
|
237
|
+
peer: peerIdStr ?? "unknown",
|
|
238
|
+
source,
|
|
239
|
+
client,
|
|
240
|
+
skipped,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
221
243
|
}
|
|
222
244
|
};
|
|
223
245
|
|