@lodestar/beacon-node 1.48.0-dev.67df6eac67 → 1.48.0-dev.68ce7b06a0
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 +4 -4
- package/lib/api/impl/beacon/blocks/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/archiveStore/historicalState/metrics.d.ts.map +1 -1
- package/lib/chain/archiveStore/historicalState/metrics.js +12 -1
- package/lib/chain/archiveStore/historicalState/metrics.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 +83 -17
- 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 +10 -1
- package/lib/chain/blocks/utils/chainSegment.js.map +1 -1
- package/lib/chain/chain.d.ts +9 -4
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +82 -51
- 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/blockError.d.ts +3 -5
- package/lib/chain/errors/blockError.d.ts.map +1 -1
- package/lib/chain/errors/blockError.js +2 -2
- package/lib/chain/errors/blockError.js.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.d.ts +0 -11
- package/lib/chain/errors/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/errors/executionPayloadEnvelope.js +0 -2
- package/lib/chain/errors/executionPayloadEnvelope.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 +4 -4
- 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/prepareNextSlot.js +13 -13
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.d.ts.map +1 -1
- package/lib/chain/produceBlock/produceBlockBody.js +46 -64
- package/lib/chain/produceBlock/produceBlockBody.js.map +1 -1
- package/lib/chain/validation/block.d.ts.map +1 -1
- package/lib/chain/validation/block.js +9 -50
- package/lib/chain/validation/block.js.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.d.ts.map +1 -1
- package/lib/chain/validation/executionPayloadEnvelope.js +0 -29
- package/lib/chain/validation/executionPayloadEnvelope.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/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/network/gossip/encoding.d.ts.map +1 -1
- package/lib/network/gossip/encoding.js +0 -6
- package/lib/network/gossip/encoding.js.map +1 -1
- package/lib/network/gossip/topic.d.ts +2 -1
- package/lib/network/gossip/topic.d.ts.map +1 -1
- package/lib/network/gossip/topic.js +4 -20
- package/lib/network/gossip/topic.js.map +1 -1
- package/lib/network/processor/gossipHandlers.d.ts.map +1 -1
- package/lib/network/processor/gossipHandlers.js +1 -1
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/processor/index.d.ts +49 -3
- package/lib/network/processor/index.d.ts.map +1 -1
- package/lib/network/processor/index.js +243 -98
- package/lib/network/processor/index.js.map +1 -1
- package/lib/network/reqresp/protocols.d.ts.map +1 -1
- package/lib/network/reqresp/protocols.js +6 -22
- package/lib/network/reqresp/protocols.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 +15 -15
- package/src/api/impl/beacon/blocks/index.ts +8 -4
- package/src/api/impl/validator/index.ts +44 -43
- package/src/chain/archiveStore/historicalState/metrics.ts +14 -1
- package/src/chain/blocks/importBlock.ts +21 -18
- package/src/chain/blocks/index.ts +120 -23
- package/src/chain/blocks/types.ts +9 -0
- package/src/chain/blocks/utils/chainSegment.ts +10 -1
- package/src/chain/chain.ts +100 -61
- package/src/chain/emitter.ts +1 -1
- package/src/chain/errors/blockError.ts +3 -3
- package/src/chain/errors/executionPayloadEnvelope.ts +0 -9
- package/src/chain/errors/gossipValidation.ts +1 -0
- package/src/chain/interface.ts +4 -4
- package/src/chain/opPools/aggregatedAttestationPool.ts +1 -1
- package/src/chain/prepareNextSlot.ts +16 -16
- package/src/chain/produceBlock/produceBlockBody.ts +50 -71
- package/src/chain/validation/block.ts +9 -66
- package/src/chain/validation/executionPayloadEnvelope.ts +0 -37
- package/src/chain/validatorMonitor.ts +24 -7
- package/src/execution/engine/mock.ts +4 -1
- package/src/network/gossip/encoding.ts +0 -6
- package/src/network/gossip/topic.ts +3 -25
- package/src/network/processor/gossipHandlers.ts +6 -1
- package/src/network/processor/index.ts +276 -148
- package/src/network/reqresp/protocols.ts +7 -24
- package/src/network/reqresp/rateLimit.ts +2 -1
- package/src/sync/range/range.ts +23 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {ForkName
|
|
2
|
+
import {ForkName} from "@lodestar/params";
|
|
3
3
|
import {ContextBytesFactory, ContextBytesType, Encoding, TypeSizes} from "@lodestar/reqresp";
|
|
4
4
|
import {rateLimitQuotas} from "./rateLimit.js";
|
|
5
5
|
import {ProtocolNoHandler, ReqRespMethod, Version, requestSszTypeByMethod, responseSszTypeByMethod} from "./types.js";
|
|
@@ -151,35 +151,18 @@ function toProtocol(protocol: ProtocolSummary) {
|
|
|
151
151
|
encoding: Encoding.SSZ_SNAPPY,
|
|
152
152
|
contextBytes: toContextBytes(protocol.contextBytesType, config),
|
|
153
153
|
inboundRateLimits: rateLimitQuotas(fork, config)[protocol.method],
|
|
154
|
-
requestSizes: requestType === null ? null : clampTypeSizes(requestType,
|
|
155
|
-
responseSizes: (fork) =>
|
|
156
|
-
clampTypeSizes(responseSszTypeByMethod[protocol.method](fork, protocol.version), protocol.method, fork, config),
|
|
154
|
+
requestSizes: requestType === null ? null : clampTypeSizes(requestType, config),
|
|
155
|
+
responseSizes: (fork) => clampTypeSizes(responseSszTypeByMethod[protocol.method](fork, protocol.version), config),
|
|
157
156
|
};
|
|
158
157
|
};
|
|
159
158
|
}
|
|
160
159
|
|
|
161
160
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* The length-prefix must be within the size bounds derived from the payload SSZ type or `MAX_PAYLOAD_SIZE`,
|
|
166
|
-
* whichever is smaller, see
|
|
167
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/phase0/p2p-interface.md#encoding-strategies.
|
|
168
|
-
* Type-specific SSZ bounds supersede the bounds derived from the SSZ type, see
|
|
169
|
-
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/gloas/p2p-interface.md#type-specific-ssz-bounds.
|
|
161
|
+
* Length-prefix must be within the SSZ type bounds or MAX_PAYLOAD_SIZE, whichever is smaller
|
|
162
|
+
* https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.12/specs/phase0/p2p-interface.md#encoding-strategies
|
|
170
163
|
*/
|
|
171
|
-
function clampTypeSizes(type: TypeSizes,
|
|
172
|
-
|
|
173
|
-
if (isForkPostGloas(fork)) {
|
|
174
|
-
switch (method) {
|
|
175
|
-
case ReqRespMethod.DataColumnSidecarsByRange:
|
|
176
|
-
case ReqRespMethod.DataColumnSidecarsByRoot:
|
|
177
|
-
typeSpecificBound = MAX_DATA_COLUMN_SIDECAR_SIZE;
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return {minSize: type.minSize, maxSize: Math.min(type.maxSize, typeSpecificBound)};
|
|
164
|
+
function clampTypeSizes(type: TypeSizes, config: BeaconConfig): TypeSizes {
|
|
165
|
+
return {minSize: type.minSize, maxSize: Math.min(type.maxSize, config.MAX_PAYLOAD_SIZE)};
|
|
183
166
|
}
|
|
184
167
|
|
|
185
168
|
function toContextBytes(type: ContextBytesType, config: BeaconConfig): ContextBytesFactory {
|
|
@@ -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
|
|