@lodestar/beacon-node 1.50.0-dev.859c034d37 → 1.50.0-dev.8ba9d1dd30
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/chain/blocks/payloadEnvelopeInput/types.d.ts +1 -2
- package/lib/chain/blocks/payloadEnvelopeInput/types.d.ts.map +1 -1
- package/lib/chain/errors/gossipValidation.d.ts +0 -1
- package/lib/chain/errors/gossipValidation.d.ts.map +1 -1
- package/lib/chain/errors/gossipValidation.js +0 -1
- package/lib/chain/errors/gossipValidation.js.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts +0 -6
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.d.ts.map +1 -1
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js +0 -10
- package/lib/chain/seenCache/seenPayloadEnvelopeInput.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +0 -3
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/gossipValidatorFn.d.ts +2 -4
- package/lib/network/processor/gossipValidatorFn.d.ts.map +1 -1
- package/lib/network/processor/gossipValidatorFn.js +2 -6
- package/lib/network/processor/gossipValidatorFn.js.map +1 -1
- package/lib/network/processor/index.d.ts +0 -8
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +2 -49
- 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 +18 -50
- package/lib/sync/range/range.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +4 -5
- package/lib/sync/unknownBlock.js.map +1 -1
- package/package.json +15 -15
- package/src/chain/blocks/payloadEnvelopeInput/types.ts +1 -2
- package/src/chain/errors/gossipValidation.ts +0 -1
- package/src/chain/seenCache/seenPayloadEnvelopeInput.ts +0 -11
- package/src/network/processor/gossipHandlers.ts +0 -3
- package/src/network/processor/gossipValidatorFn.ts +2 -12
- package/src/network/processor/index.ts +2 -55
- package/src/sync/range/range.ts +18 -50
- package/src/sync/unknownBlock.ts +4 -5
package/src/sync/range/range.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {IBeaconStateViewGloas, computeStartSlotAtEpoch, isStatePostGloas} from "
|
|
|
5
5
|
import {Epoch, Status, fulu} from "@lodestar/types";
|
|
6
6
|
import {Logger, prettyPrintIndices, toRootHex} from "@lodestar/utils";
|
|
7
7
|
import {IBlockInput} from "../../chain/blocks/blockInput/types.js";
|
|
8
|
-
import {PayloadError, PayloadErrorCode} from "../../chain/blocks/importExecutionPayload.js";
|
|
9
8
|
import {AttestationImportOpt, ImportBlockOpts} from "../../chain/blocks/index.js";
|
|
10
9
|
import {assertLinearChainSegment} from "../../chain/blocks/utils/chainSegment.js";
|
|
11
10
|
import {BlockError} from "../../chain/errors/index.js";
|
|
@@ -208,50 +207,22 @@ export class RangeSync extends (EventEmitter as {new (): RangeSyncEmitter}) {
|
|
|
208
207
|
blsVerifyOnMainThread: false,
|
|
209
208
|
};
|
|
210
209
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
await this.chain.processExecutionPayload(payloadEnvelope);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
} else {
|
|
222
|
-
const {orphaned, skipped} = await this.chain.processChainSegment(blocks, payloadEnvelopes, flags);
|
|
223
|
-
// We log orphaned payloads to work with different clients
|
|
224
|
-
// in the future, consider applying penalties in certain conditions
|
|
225
|
-
// make sure the payload source was from range sync in that case
|
|
226
|
-
for (const {slot, payloadEnvelopeInput} of orphaned) {
|
|
227
|
-
const {peerIdStr, source} = payloadEnvelopeInput.getPayloadEnvelopeSource();
|
|
228
|
-
let client = "unknown";
|
|
229
|
-
if (peerIdStr !== undefined) {
|
|
230
|
-
try {
|
|
231
|
-
client = this.getConnectedPeerSyncMeta(peerIdStr).client;
|
|
232
|
-
} catch {
|
|
233
|
-
// peer disconnected since serving the envelope, keep "unknown"
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
this.logger.debug("Orphaned payload envelope in range sync batch", {
|
|
237
|
-
slot,
|
|
238
|
-
root: payloadEnvelopeInput.blockRootHex,
|
|
239
|
-
peer: peerIdStr ?? "unknown",
|
|
240
|
-
source,
|
|
241
|
-
client,
|
|
242
|
-
skipped,
|
|
243
|
-
});
|
|
210
|
+
if (this.opts?.disableProcessAsChainSegment) {
|
|
211
|
+
// Should only be used for debugging or testing
|
|
212
|
+
for (const block of blocks) {
|
|
213
|
+
await this.chain.processBlock(block, flags);
|
|
214
|
+
const payloadEnvelope = payloadEnvelopes?.get(block.slot);
|
|
215
|
+
if (payloadEnvelope?.hasPayloadEnvelope()) {
|
|
216
|
+
await this.chain.processExecutionPayload(payloadEnvelope);
|
|
244
217
|
}
|
|
245
218
|
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
const {payloadInput} = e;
|
|
254
|
-
const {peerIdStr, source} = payloadInput.getPayloadEnvelopeSource();
|
|
219
|
+
} else {
|
|
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();
|
|
255
226
|
let client = "unknown";
|
|
256
227
|
if (peerIdStr !== undefined) {
|
|
257
228
|
try {
|
|
@@ -260,18 +231,15 @@ export class RangeSync extends (EventEmitter as {new (): RangeSyncEmitter}) {
|
|
|
260
231
|
// peer disconnected since serving the envelope, keep "unknown"
|
|
261
232
|
}
|
|
262
233
|
}
|
|
263
|
-
this.logger.debug("
|
|
264
|
-
slot
|
|
265
|
-
root:
|
|
234
|
+
this.logger.debug("Orphaned payload envelope in range sync batch", {
|
|
235
|
+
slot,
|
|
236
|
+
root: payloadEnvelopeInput.blockRootHex,
|
|
266
237
|
peer: peerIdStr ?? "unknown",
|
|
267
238
|
source,
|
|
268
239
|
client,
|
|
269
|
-
|
|
240
|
+
skipped,
|
|
270
241
|
});
|
|
271
|
-
// The batch is downloaded again, it would otherwise reuse the cached envelope and fail the same way
|
|
272
|
-
this.chain.seenPayloadEnvelopeInputCache.removeInvalid(payloadInput);
|
|
273
242
|
}
|
|
274
|
-
throw e;
|
|
275
243
|
}
|
|
276
244
|
};
|
|
277
245
|
|
package/src/sync/unknownBlock.ts
CHANGED
|
@@ -1426,23 +1426,20 @@ export class BlockInputSync {
|
|
|
1426
1426
|
pendingPayload.status = PendingPayloadInputStatus.downloaded;
|
|
1427
1427
|
break;
|
|
1428
1428
|
|
|
1429
|
-
// The invalid envelope is evicted from the seen cache in the cases below, otherwise the next
|
|
1430
|
-
// attempt would reuse it instead of fetching another envelope from peers
|
|
1431
1429
|
case PayloadErrorCode.EXECUTION_ENGINE_INVALID:
|
|
1432
1430
|
this.logger.debug("Error processing payload from unknown sync", logCtx, res.err);
|
|
1433
|
-
this.chain.seenPayloadEnvelopeInputCache.removeInvalid(pendingPayload.payloadInput);
|
|
1434
1431
|
this.removePendingPayloadAndDescendants(rootHex, DroppedItemReason.elInvalid);
|
|
1435
1432
|
break;
|
|
1436
1433
|
|
|
1437
1434
|
case PayloadErrorCode.ENVELOPE_VERIFICATION_ERROR:
|
|
1438
1435
|
this.logger.debug("Error processing payload from unknown sync", logCtx, res.err);
|
|
1439
|
-
this.chain.seenPayloadEnvelopeInputCache.removeInvalid(pendingPayload.payloadInput);
|
|
1440
1436
|
this.removePendingPayloadAndDescendants(rootHex, DroppedItemReason.invalidEnvelope);
|
|
1441
1437
|
break;
|
|
1442
1438
|
|
|
1443
1439
|
case PayloadErrorCode.INVALID_SIGNATURE:
|
|
1440
|
+
// TODO GLOAS: Decide how invalid payload inputs should eventually leave memory without
|
|
1441
|
+
// reintroducing envelope replacement / recreation flows.
|
|
1444
1442
|
this.logger.debug("Error processing payload from unknown sync", logCtx, res.err);
|
|
1445
|
-
this.chain.seenPayloadEnvelopeInputCache.removeInvalid(pendingPayload.payloadInput);
|
|
1446
1443
|
this.removePendingPayloadAndDescendants(rootHex, DroppedItemReason.invalidSignature);
|
|
1447
1444
|
break;
|
|
1448
1445
|
|
|
@@ -1882,6 +1879,8 @@ export class BlockInputSync {
|
|
|
1882
1879
|
|
|
1883
1880
|
// Once a parent payload is invalid, every descendant waiting on that payload lineage becomes unrecoverable too.
|
|
1884
1881
|
private removePendingPayloadAndDescendants(rootHex: RootHex, headReason: DroppedItemReason): void {
|
|
1882
|
+
// Keep PayloadEnvelopeInput resident in the seen cache. importBlock() owns that object and
|
|
1883
|
+
// later validation/finalization logic decides when it can leave memory.
|
|
1885
1884
|
if (this.pendingPayloads.delete(rootHex)) {
|
|
1886
1885
|
this.metrics?.blockInputSync.removedPayloads.inc({reason: headReason}, 1);
|
|
1887
1886
|
}
|