@lodestar/beacon-node 1.48.0-dev.dd957b093d → 1.48.0-dev.df6a2aa429
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 +0 -7
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- 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/api/impl/config/index.d.ts.map +1 -1
- package/lib/api/impl/config/index.js +4 -1
- package/lib/api/impl/config/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +39 -39
- package/lib/api/impl/validator/index.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 -16
- 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/blocks/utils/chainSegment.d.ts +1 -1
- package/lib/chain/blocks/utils/chainSegment.d.ts.map +1 -1
- package/lib/chain/blocks/utils/chainSegment.js +26 -11
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/chain.d.ts +7 -2
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +69 -40
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/emitter.d.ts +1 -1
- package/lib/chain/emitter.js +1 -1
- package/lib/chain/errors/executionPayloadBid.d.ts +4 -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/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/chain/validation/executionPayloadBid.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadBid.js +16 -0
- package/lib/chain/validation/executionPayloadBid.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts +7 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +22 -5
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/execution/builder/validateBid.d.ts.map +1 -1
- package/lib/execution/builder/validateBid.js +3 -0
- package/lib/execution/builder/validateBid.js.map +1 -1
- package/lib/execution/engine/mock.d.ts.map +1 -1
- package/lib/execution/engine/mock.js +4 -1
- package/lib/execution/engine/mock.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +0 -3
- package/lib/metrics/metrics/lodestar.d.ts.map +1 -1
- package/lib/metrics/metrics/lodestar.js +0 -5
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +378 -278
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +22 -16
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/rateLimit.js +2 -1
- package/lib/network/reqresp/rateLimit.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/blocks/index.ts +0 -10
- package/src/api/impl/beacon/state/utils.ts +15 -0
- package/src/api/impl/config/index.ts +4 -1
- package/src/api/impl/validator/index.ts +44 -43
- package/src/chain/blocks/importBlock.ts +21 -18
- package/src/chain/blocks/index.ts +107 -21
- package/src/chain/blocks/types.ts +9 -0
- package/src/chain/blocks/utils/chainSegment.ts +26 -12
- package/src/chain/chain.ts +78 -50
- package/src/chain/emitter.ts +1 -1
- package/src/chain/errors/executionPayloadBid.ts +2 -0
- 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/chain/validation/executionPayloadBid.ts +18 -0
- package/src/chain/validatorMonitor.ts +24 -7
- package/src/execution/builder/validateBid.ts +4 -0
- package/src/execution/engine/mock.ts +4 -1
- package/src/metrics/metrics/lodestar.ts +0 -5
- package/src/network/processor/gossipHandlers.ts +487 -348
- package/src/network/processor/index.ts +24 -17
- package/src/network/reqresp/rateLimit.ts +2 -1
- package/src/sync/range/range.ts +23 -1
|
@@ -11,7 +11,6 @@ import {IBeaconChain} from "../../chain/interface.js";
|
|
|
11
11
|
import {IBeaconDb} from "../../db/interface.js";
|
|
12
12
|
import {Metrics} from "../../metrics/metrics.js";
|
|
13
13
|
import {ClockEvent} from "../../util/clock.js";
|
|
14
|
-
import {callInNextEventLoop} from "../../util/eventLoop.js";
|
|
15
14
|
import {PeerIdStr} from "../../util/peerId.js";
|
|
16
15
|
import {
|
|
17
16
|
getBeaconBlockRootFromExecutionPayloadEnvelopeSerialized,
|
|
@@ -361,6 +360,19 @@ export class NetworkProcessor {
|
|
|
361
360
|
return;
|
|
362
361
|
}
|
|
363
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
|
+
|
|
364
376
|
message.msgSlot = slot;
|
|
365
377
|
|
|
366
378
|
// this determines whether this message needs to wait for a Block or Envelope
|
|
@@ -781,27 +793,22 @@ export class NetworkProcessor {
|
|
|
781
793
|
this.trackJobTime(messageOrArray, 1, acceptanceArr[0]);
|
|
782
794
|
}
|
|
783
795
|
|
|
784
|
-
//
|
|
785
|
-
//
|
|
786
|
-
//
|
|
787
|
-
|
|
796
|
+
// Report the validation verdict synchronously so it reaches the network worker before any deferred
|
|
797
|
+
// handler (e.g. block import) runs on the next event loop. At network thread side, gossipsub onValidationResult()
|
|
798
|
+
// has its own callInNextEventLoop
|
|
788
799
|
if (Array.isArray(messageOrArray)) {
|
|
789
800
|
for (const [i, msg] of messageOrArray.entries()) {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
acceptance: acceptanceArr[i],
|
|
795
|
-
});
|
|
801
|
+
this.events.emit(NetworkEvent.gossipMessageValidationResult, {
|
|
802
|
+
msgId: msg.msgId,
|
|
803
|
+
propagationSource: msg.propagationSource,
|
|
804
|
+
acceptance: acceptanceArr[i],
|
|
796
805
|
});
|
|
797
806
|
}
|
|
798
807
|
} else {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
acceptance: acceptanceArr[0],
|
|
804
|
-
});
|
|
808
|
+
this.events.emit(NetworkEvent.gossipMessageValidationResult, {
|
|
809
|
+
msgId: messageOrArray.msgId,
|
|
810
|
+
propagationSource: messageOrArray.propagationSource,
|
|
811
|
+
acceptance: acceptanceArr[0],
|
|
805
812
|
});
|
|
806
813
|
}
|
|
807
814
|
}
|
|
@@ -126,7 +126,8 @@ function getRequestCountFn<T extends ReqRespMethod>(
|
|
|
126
126
|
const type = requestSszTypeByMethod(fork, config)[method];
|
|
127
127
|
return (reqData: Uint8Array) => {
|
|
128
128
|
try {
|
|
129
|
-
|
|
129
|
+
// A schema-valid request can cost 0 tokens; floor to 1 so it stays charged and bannable, not free.
|
|
130
|
+
return Math.max(1, (type && fn(type.deserialize(reqData))) ?? 1);
|
|
130
131
|
} catch (_e) {
|
|
131
132
|
return 1;
|
|
132
133
|
}
|
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
|
|