@lodestar/beacon-node 1.35.0-dev.fcf8d024ea → 1.35.0-dev.fd1dac853d
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.js +1 -1
- package/lib/api/impl/beacon/blocks/index.js.map +1 -1
- package/lib/api/impl/lodestar/index.js +1 -1
- package/lib/api/impl/lodestar/index.js.map +1 -1
- package/lib/api/impl/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +16 -23
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +3 -3
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/chain.js +1 -1
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +5 -5
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/network/gossip/gossipsub.js +1 -1
- package/lib/network/gossip/gossipsub.js.map +1 -1
- package/lib/network/gossip/scoringParameters.js +4 -4
- package/lib/network/gossip/scoringParameters.js.map +1 -1
- package/lib/network/peers/peerManager.d.ts.map +1 -1
- package/lib/network/peers/peerManager.js +2 -1
- package/lib/network/peers/peerManager.js.map +1 -1
- package/lib/network/processor/gossipHandlers.js +1 -1
- package/lib/network/processor/gossipHandlers.js.map +1 -1
- package/lib/network/subnets/attnetsService.d.ts.map +1 -1
- package/lib/network/subnets/attnetsService.js +1 -1
- package/lib/network/subnets/attnetsService.js.map +1 -1
- package/lib/node/notifier.js +1 -1
- package/lib/node/notifier.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +2 -1
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/clock.d.ts +3 -3
- package/lib/util/clock.js +6 -6
- package/lib/util/clock.js.map +1 -1
- package/package.json +14 -14
- package/src/api/impl/beacon/blocks/index.ts +1 -1
- package/src/api/impl/lodestar/index.ts +1 -1
- package/src/api/impl/validator/index.ts +17 -24
- package/src/chain/blocks/importBlock.ts +4 -2
- package/src/chain/chain.ts +1 -1
- package/src/chain/validatorMonitor.ts +5 -4
- package/src/network/gossip/gossipsub.ts +1 -1
- package/src/network/gossip/scoringParameters.ts +4 -4
- package/src/network/peers/peerManager.ts +2 -1
- package/src/network/processor/gossipHandlers.ts +1 -1
- package/src/network/subnets/attnetsService.ts +3 -6
- package/src/node/notifier.ts +1 -1
- package/src/sync/unknownBlock.ts +2 -1
- package/src/util/clock.ts +7 -7
package/lib/util/clock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/util/clock.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAEjG,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,8BAA8B,EAAC,MAAM,2BAA2B,CAAC;AAEzE,MAAM,CAAN,IAAY,UAWX;AAXD,WAAY,UAAU;IACpB;;;OAGG;IACH,iCAAmB,CAAA;IACnB;;;OAGG;IACH,mCAAqB,CAAA;AACvB,CAAC,EAXW,UAAU,KAAV,UAAU,QAWrB;AA+CD;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,YAAY;IAC5B,WAAW,CAAS;IACZ,MAAM,CAAkB;IACjC,SAAS,CAA0B;IAC1B,MAAM,CAAc;IAC7B,YAAY,CAAS;IAE7B,YAAY,EAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAsE;QAC5G,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC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CAAC,eAAe,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC,CAAC;IAEM,eAAe;QACrB,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACzD,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAChE,OAAO,mBAAmB,GAAG,CAAC,kBAAkB,GAAG,mBAAmB,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.35.0-dev.
|
|
14
|
+
"version": "1.35.0-dev.fd1dac853d",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -134,18 +134,18 @@
|
|
|
134
134
|
"@libp2p/peer-id": "^5.1.0",
|
|
135
135
|
"@libp2p/prometheus-metrics": "^4.3.15",
|
|
136
136
|
"@libp2p/tcp": "^10.1.8",
|
|
137
|
-
"@lodestar/api": "1.35.0-dev.
|
|
138
|
-
"@lodestar/config": "1.35.0-dev.
|
|
139
|
-
"@lodestar/db": "1.35.0-dev.
|
|
140
|
-
"@lodestar/fork-choice": "1.35.0-dev.
|
|
141
|
-
"@lodestar/light-client": "1.35.0-dev.
|
|
142
|
-
"@lodestar/logger": "1.35.0-dev.
|
|
143
|
-
"@lodestar/params": "1.35.0-dev.
|
|
144
|
-
"@lodestar/reqresp": "1.35.0-dev.
|
|
145
|
-
"@lodestar/state-transition": "1.35.0-dev.
|
|
146
|
-
"@lodestar/types": "1.35.0-dev.
|
|
147
|
-
"@lodestar/utils": "1.35.0-dev.
|
|
148
|
-
"@lodestar/validator": "1.35.0-dev.
|
|
137
|
+
"@lodestar/api": "1.35.0-dev.fd1dac853d",
|
|
138
|
+
"@lodestar/config": "1.35.0-dev.fd1dac853d",
|
|
139
|
+
"@lodestar/db": "1.35.0-dev.fd1dac853d",
|
|
140
|
+
"@lodestar/fork-choice": "1.35.0-dev.fd1dac853d",
|
|
141
|
+
"@lodestar/light-client": "1.35.0-dev.fd1dac853d",
|
|
142
|
+
"@lodestar/logger": "1.35.0-dev.fd1dac853d",
|
|
143
|
+
"@lodestar/params": "1.35.0-dev.fd1dac853d",
|
|
144
|
+
"@lodestar/reqresp": "1.35.0-dev.fd1dac853d",
|
|
145
|
+
"@lodestar/state-transition": "1.35.0-dev.fd1dac853d",
|
|
146
|
+
"@lodestar/types": "1.35.0-dev.fd1dac853d",
|
|
147
|
+
"@lodestar/utils": "1.35.0-dev.fd1dac853d",
|
|
148
|
+
"@lodestar/validator": "1.35.0-dev.fd1dac853d",
|
|
149
149
|
"@multiformats/multiaddr": "^12.1.3",
|
|
150
150
|
"datastore-core": "^10.0.2",
|
|
151
151
|
"datastore-fs": "^10.0.6",
|
|
@@ -180,5 +180,5 @@
|
|
|
180
180
|
"beacon",
|
|
181
181
|
"blockchain"
|
|
182
182
|
],
|
|
183
|
-
"gitHead": "
|
|
183
|
+
"gitHead": "f06d12a7e66a85186ef97b1f6da57c22536e4a18"
|
|
184
184
|
}
|
|
@@ -256,7 +256,7 @@ export function getBeaconBlockApi({
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
// TODO: Validate block
|
|
259
|
-
const delaySec = seenTimestampSec - (
|
|
259
|
+
const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
|
|
260
260
|
metrics?.gossipBlock.elapsedTimeTillReceived.observe({source: OpSource.api}, delaySec);
|
|
261
261
|
chain.validatorMonitor?.registerBeaconBlock(OpSource.api, delaySec, signedBlock.message);
|
|
262
262
|
|
|
@@ -26,7 +26,7 @@ export function getLodestarApi({
|
|
|
26
26
|
}: Pick<ApiModules, "chain" | "config" | "db" | "network" | "sync">): ApplicationMethods<routes.lodestar.Endpoints> {
|
|
27
27
|
let writingHeapdump = false;
|
|
28
28
|
let writingProfile = false;
|
|
29
|
-
const defaultProfileMs = SLOTS_PER_EPOCH * config.
|
|
29
|
+
const defaultProfileMs = SLOTS_PER_EPOCH * config.SLOT_DURATION_MS;
|
|
30
30
|
|
|
31
31
|
return {
|
|
32
32
|
async writeHeapdump({thread = "main", dirpath = "."}) {
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
calculateCommitteeAssignments,
|
|
23
23
|
computeEpochAtSlot,
|
|
24
24
|
computeStartSlotAtEpoch,
|
|
25
|
+
computeTimeAtSlot,
|
|
25
26
|
createCachedBeaconState,
|
|
26
27
|
getBlockRootAtSlot,
|
|
27
28
|
getCurrentSlot,
|
|
@@ -82,7 +83,7 @@ import {getDefaultGraffiti, toGraffitiBytes} from "../../../util/graffiti.js";
|
|
|
82
83
|
import {getLodestarClientVersion} from "../../../util/metadata.js";
|
|
83
84
|
import {ApiOptions} from "../../options.js";
|
|
84
85
|
import {getStateResponseWithRegen} from "../beacon/state/utils.js";
|
|
85
|
-
import {ApiError, NodeIsSyncing, OnlySupportedByDVT} from "../errors.js";
|
|
86
|
+
import {ApiError, FailureList, IndexedError, NodeIsSyncing, OnlySupportedByDVT} from "../errors.js";
|
|
86
87
|
import {ApiModules} from "../types.js";
|
|
87
88
|
import {computeSubnetForCommitteesAtSlot, getPubkeysForIndices, selectBlockProductionSource} from "./utils.js";
|
|
88
89
|
|
|
@@ -180,7 +181,7 @@ export function getValidatorApi(
|
|
|
180
181
|
* This value is the same to MAXIMUM_GOSSIP_CLOCK_DISPARITY_SEC.
|
|
181
182
|
* For very fast networks, reduce clock disparity to half a slot.
|
|
182
183
|
*/
|
|
183
|
-
const MAX_API_CLOCK_DISPARITY_SEC = Math.min(0.5, config.
|
|
184
|
+
const MAX_API_CLOCK_DISPARITY_SEC = Math.min(0.5, config.SLOT_DURATION_MS / 2000);
|
|
184
185
|
const MAX_API_CLOCK_DISPARITY_MS = MAX_API_CLOCK_DISPARITY_SEC * 1000;
|
|
185
186
|
|
|
186
187
|
/** Compute and cache the genesis block root */
|
|
@@ -213,7 +214,7 @@ export function getValidatorApi(
|
|
|
213
214
|
return;
|
|
214
215
|
}
|
|
215
216
|
|
|
216
|
-
const slotStartSec =
|
|
217
|
+
const slotStartSec = computeTimeAtSlot(config, slot, chain.genesisTime);
|
|
217
218
|
const msToSlot = slotStartSec * 1000 - Date.now();
|
|
218
219
|
|
|
219
220
|
if (msToSlot > MAX_API_CLOCK_DISPARITY_MS) {
|
|
@@ -244,7 +245,7 @@ export function getValidatorApi(
|
|
|
244
245
|
*/
|
|
245
246
|
function msToNextEpoch(): number {
|
|
246
247
|
const nextEpoch = chain.clock.currentEpoch + 1;
|
|
247
|
-
const secPerEpoch = SLOTS_PER_EPOCH * config.
|
|
248
|
+
const secPerEpoch = (SLOTS_PER_EPOCH * config.SLOT_DURATION_MS) / 1000;
|
|
248
249
|
const nextEpochStartSec = chain.genesisTime + nextEpoch * secPerEpoch;
|
|
249
250
|
return nextEpochStartSec * 1000 - Date.now();
|
|
250
251
|
}
|
|
@@ -1018,8 +1019,8 @@ export function getValidatorApi(
|
|
|
1018
1019
|
const head = chain.forkChoice.getHead();
|
|
1019
1020
|
let state: CachedBeaconStateAllForks | undefined = undefined;
|
|
1020
1021
|
const startSlot = computeStartSlotAtEpoch(epoch);
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1022
|
+
const prepareNextSlotLookAheadMs =
|
|
1023
|
+
config.SLOT_DURATION_MS - config.getSlotComponentDurationMs(PREPARE_NEXT_SLOT_BPS);
|
|
1023
1024
|
const toNextEpochMs = msToNextEpoch();
|
|
1024
1025
|
// validators may request next epoch's duties when it's close to next epoch
|
|
1025
1026
|
// this is to avoid missed block proposal due to 0 epoch look ahead
|
|
@@ -1292,7 +1293,7 @@ export function getValidatorApi(
|
|
|
1292
1293
|
notWhileSyncing();
|
|
1293
1294
|
|
|
1294
1295
|
const seenTimestampSec = Date.now() / 1000;
|
|
1295
|
-
const
|
|
1296
|
+
const failures: FailureList = [];
|
|
1296
1297
|
const fork = chain.config.getForkName(chain.clock.currentSlot);
|
|
1297
1298
|
|
|
1298
1299
|
await Promise.all(
|
|
@@ -1328,8 +1329,8 @@ export function getValidatorApi(
|
|
|
1328
1329
|
return; // Ok to submit the same aggregate twice
|
|
1329
1330
|
}
|
|
1330
1331
|
|
|
1331
|
-
|
|
1332
|
-
logger.
|
|
1332
|
+
failures.push({index: i, message: (e as Error).message});
|
|
1333
|
+
logger.verbose(`Error on publishAggregateAndProofs [${i}]`, logCtx, e as Error);
|
|
1333
1334
|
if (e instanceof AttestationError && e.action === GossipAction.REJECT) {
|
|
1334
1335
|
chain.persistInvalidSszValue(ssz.phase0.SignedAggregateAndProof, signedAggregateAndProof, "api_reject");
|
|
1335
1336
|
}
|
|
@@ -1337,12 +1338,8 @@ export function getValidatorApi(
|
|
|
1337
1338
|
})
|
|
1338
1339
|
);
|
|
1339
1340
|
|
|
1340
|
-
if (
|
|
1341
|
-
throw
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
if (errors.length === 1) {
|
|
1345
|
-
throw errors[0];
|
|
1341
|
+
if (failures.length > 0) {
|
|
1342
|
+
throw new IndexedError("Error processing aggregate and proofs", failures);
|
|
1346
1343
|
}
|
|
1347
1344
|
},
|
|
1348
1345
|
|
|
@@ -1356,7 +1353,7 @@ export function getValidatorApi(
|
|
|
1356
1353
|
async publishContributionAndProofs({contributionAndProofs}) {
|
|
1357
1354
|
notWhileSyncing();
|
|
1358
1355
|
|
|
1359
|
-
const
|
|
1356
|
+
const failures: FailureList = [];
|
|
1360
1357
|
|
|
1361
1358
|
await Promise.all(
|
|
1362
1359
|
contributionAndProofs.map(async (contributionAndProof, i) => {
|
|
@@ -1388,8 +1385,8 @@ export function getValidatorApi(
|
|
|
1388
1385
|
return; // Ok to submit the same aggregate twice
|
|
1389
1386
|
}
|
|
1390
1387
|
|
|
1391
|
-
|
|
1392
|
-
logger.
|
|
1388
|
+
failures.push({index: i, message: (e as Error).message});
|
|
1389
|
+
logger.verbose(`Error on publishContributionAndProofs [${i}]`, logCtx, e as Error);
|
|
1393
1390
|
if (e instanceof SyncCommitteeError && e.action === GossipAction.REJECT) {
|
|
1394
1391
|
chain.persistInvalidSszValue(ssz.altair.SignedContributionAndProof, contributionAndProof, "api_reject");
|
|
1395
1392
|
}
|
|
@@ -1397,12 +1394,8 @@ export function getValidatorApi(
|
|
|
1397
1394
|
})
|
|
1398
1395
|
);
|
|
1399
1396
|
|
|
1400
|
-
if (
|
|
1401
|
-
throw
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
if (errors.length === 1) {
|
|
1405
|
-
throw errors[0];
|
|
1397
|
+
if (failures.length > 0) {
|
|
1398
|
+
throw new IndexedError("Error processing contribution and proofs", failures);
|
|
1406
1399
|
}
|
|
1407
1400
|
},
|
|
1408
1401
|
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
RootCache,
|
|
15
15
|
computeEpochAtSlot,
|
|
16
16
|
computeStartSlotAtEpoch,
|
|
17
|
+
computeTimeAtSlot,
|
|
17
18
|
isExecutionStateType,
|
|
18
19
|
isStartSlotOfEpoch,
|
|
19
20
|
isStateValidatorsNodesPopulated,
|
|
@@ -78,7 +79,8 @@ export async function importBlock(
|
|
|
78
79
|
const currentEpoch = computeEpochAtSlot(currentSlot);
|
|
79
80
|
const blockEpoch = computeEpochAtSlot(blockSlot);
|
|
80
81
|
const prevFinalizedEpoch = this.forkChoice.getFinalizedCheckpoint().epoch;
|
|
81
|
-
const blockDelaySec =
|
|
82
|
+
const blockDelaySec =
|
|
83
|
+
fullyVerifiedBlock.seenTimestampSec - computeTimeAtSlot(this.config, blockSlot, postState.genesisTime);
|
|
82
84
|
const recvToValLatency = Date.now() / 1000 - (opts.seenTimestampSec ?? Date.now() / 1000);
|
|
83
85
|
const fork = this.config.getForkSeq(blockSlot);
|
|
84
86
|
|
|
@@ -258,7 +260,7 @@ export async function importBlock(
|
|
|
258
260
|
this.metrics.headSlot.set(newHead.slot);
|
|
259
261
|
// Only track "recent" blocks. Otherwise sync can distort this metrics heavily.
|
|
260
262
|
// We want to track recent blocks coming from gossip, unknown block sync, and API.
|
|
261
|
-
if (delaySec < SLOTS_PER_EPOCH * this.config.
|
|
263
|
+
if (delaySec < (SLOTS_PER_EPOCH * this.config.SLOT_DURATION_MS) / 1000) {
|
|
262
264
|
this.metrics.importBlock.elapsedTimeTillBecomeHead.observe(delaySec);
|
|
263
265
|
const cutOffSec = this.config.getAttestationDueMs(this.config.getForkName(blockSlot)) / 1000;
|
|
264
266
|
if (delaySec > cutOffSec) {
|
package/src/chain/chain.ts
CHANGED
|
@@ -1139,7 +1139,7 @@ export class BeaconChain implements IBeaconChain {
|
|
|
1139
1139
|
const metrics = this.metrics;
|
|
1140
1140
|
if (metrics && (slot + 1) % SLOTS_PER_EPOCH === 0) {
|
|
1141
1141
|
// On the last slot of the epoch
|
|
1142
|
-
sleep(
|
|
1142
|
+
sleep(this.config.SLOT_DURATION_MS / 2)
|
|
1143
1143
|
.then(() => this.validatorMonitor?.onceEveryEndOfEpoch(this.getHeadState()))
|
|
1144
1144
|
.catch((e) => {
|
|
1145
1145
|
if (!isErrorAborted(e)) this.logger.error("Error on validator monitor onceEveryEndOfEpoch", {slot}, e);
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
ParticipationFlags,
|
|
7
7
|
computeEpochAtSlot,
|
|
8
8
|
computeStartSlotAtEpoch,
|
|
9
|
+
computeTimeAtSlot,
|
|
9
10
|
getBlockRootAtSlot,
|
|
10
11
|
getCurrentSlot,
|
|
11
12
|
parseAttesterFlags,
|
|
@@ -455,7 +456,7 @@ export function createValidatorMonitor(
|
|
|
455
456
|
// Returns the duration between when the attestation `data` could be produced (ATTESTATION_DUE_BPS through the slot) and `seenTimestamp`.
|
|
456
457
|
const delaySec =
|
|
457
458
|
seenTimestampSec -
|
|
458
|
-
(
|
|
459
|
+
(computeTimeAtSlot(config, data.slot, genesisTime) + config.getAttestationDueMs(fork) / 1000);
|
|
459
460
|
for (const index of indexedAttestation.attestingIndices) {
|
|
460
461
|
const validator = validators.get(index);
|
|
461
462
|
if (validator) {
|
|
@@ -491,7 +492,7 @@ export function createValidatorMonitor(
|
|
|
491
492
|
// Returns the duration between when the attestation `data` could be produced (ATTESTATION_DUE_BPS through the slot) and `seenTimestamp`.
|
|
492
493
|
const delaySec =
|
|
493
494
|
seenTimestampSec -
|
|
494
|
-
(
|
|
495
|
+
(computeTimeAtSlot(config, data.slot, genesisTime) + config.getAttestationDueMs(fork) / 1000);
|
|
495
496
|
|
|
496
497
|
for (const index of indexedAttestation.attestingIndices) {
|
|
497
498
|
const validator = validators.get(index);
|
|
@@ -510,7 +511,7 @@ export function createValidatorMonitor(
|
|
|
510
511
|
const fork = config.getForkName(data.slot);
|
|
511
512
|
// Returns the duration between when a `AggregateAndproof` with `data` could be produced (AGGREGATE_DUE_BPS through the slot) and `seenTimestamp`.
|
|
512
513
|
const delaySec =
|
|
513
|
-
seenTimestampSec - (
|
|
514
|
+
seenTimestampSec - (computeTimeAtSlot(config, data.slot, genesisTime) + config.getAggregateDueMs(fork) / 1000);
|
|
514
515
|
|
|
515
516
|
for (const index of indexedAttestation.attestingIndices) {
|
|
516
517
|
const validator = validators.get(index);
|
|
@@ -539,7 +540,7 @@ export function createValidatorMonitor(
|
|
|
539
540
|
const fork = config.getForkName(data.slot);
|
|
540
541
|
// Returns the duration between when a `AggregateAndproof` with `data` could be produced (AGGREGATE_DUE_BPS through the slot) and `seenTimestamp`.
|
|
541
542
|
const delaySec =
|
|
542
|
-
seenTimestampSec - (
|
|
543
|
+
seenTimestampSec - (computeTimeAtSlot(config, data.slot, genesisTime) + config.getAggregateDueMs(fork) / 1000);
|
|
543
544
|
|
|
544
545
|
const aggregatorIndex = signedAggregateAndProof.message.aggregatorIndex;
|
|
545
546
|
const validatorAggregator = validators.get(aggregatorIndex);
|
|
@@ -105,7 +105,7 @@ export class Eth2Gossipsub extends GossipSub {
|
|
|
105
105
|
mcacheLength: 6,
|
|
106
106
|
mcacheGossip: 3,
|
|
107
107
|
// this should be in ms
|
|
108
|
-
seenTTL: config.
|
|
108
|
+
seenTTL: config.SLOT_DURATION_MS * SLOTS_PER_EPOCH * 2,
|
|
109
109
|
scoreParams,
|
|
110
110
|
scoreThresholds: gossipScoreThresholds,
|
|
111
111
|
// For a single stream, await processing each RPC before processing the next
|
|
@@ -84,10 +84,10 @@ export function computeGossipPeerScoreParams({
|
|
|
84
84
|
config: BeaconConfig;
|
|
85
85
|
eth2Context: Eth2Context;
|
|
86
86
|
}): Partial<PeerScoreParams> {
|
|
87
|
-
const decayIntervalMs = config.
|
|
87
|
+
const decayIntervalMs = config.SLOT_DURATION_MS;
|
|
88
88
|
const decayToZero = 0.01;
|
|
89
|
-
const epochDurationMs = config.
|
|
90
|
-
const slotDurationMs = config.
|
|
89
|
+
const epochDurationMs = config.SLOT_DURATION_MS * SLOTS_PER_EPOCH;
|
|
90
|
+
const slotDurationMs = config.SLOT_DURATION_MS;
|
|
91
91
|
const scoreParameterDecayFn = (decayTimeMs: number): number => {
|
|
92
92
|
return scoreParameterDecayWithBase(decayTimeMs, decayIntervalMs, decayToZero);
|
|
93
93
|
};
|
|
@@ -265,7 +265,7 @@ function getTopicScoreParams(
|
|
|
265
265
|
|
|
266
266
|
if (meshMessageInfo) {
|
|
267
267
|
const {decaySlots, capFactor, activationWindow, currentSlot} = meshMessageInfo;
|
|
268
|
-
const decayTimeMs = config.
|
|
268
|
+
const decayTimeMs = config.SLOT_DURATION_MS * decaySlots;
|
|
269
269
|
params.meshMessageDeliveriesDecay = scoreParameterDecayFn(decayTimeMs);
|
|
270
270
|
params.meshMessageDeliveriesThreshold = threshold(params.meshMessageDeliveriesDecay, expectedMessageRate / 50);
|
|
271
271
|
params.meshMessageDeliveriesCap = Math.max(capFactor * params.meshMessageDeliveriesThreshold, 2);
|
|
@@ -3,6 +3,7 @@ import {BitArray} from "@chainsafe/ssz";
|
|
|
3
3
|
import {BeaconConfig} from "@lodestar/config";
|
|
4
4
|
import {LoggerNode} from "@lodestar/logger/node";
|
|
5
5
|
import {ForkSeq, SLOTS_PER_EPOCH, SYNC_COMMITTEE_SUBNET_COUNT} from "@lodestar/params";
|
|
6
|
+
import {computeTimeAtSlot} from "@lodestar/state-transition";
|
|
6
7
|
import {Metadata, Status, altair, fulu, phase0} from "@lodestar/types";
|
|
7
8
|
import {prettyPrintIndices, toHex, withTimeout} from "@lodestar/utils";
|
|
8
9
|
import {GOODBYE_KNOWN_CODES, GoodByeReasonCode, Libp2pEvent} from "../../constants/index.js";
|
|
@@ -599,7 +600,7 @@ export class PeerManager {
|
|
|
599
600
|
subnet: query.subnet,
|
|
600
601
|
type,
|
|
601
602
|
maxPeersToDiscover: query.maxPeersToDiscover,
|
|
602
|
-
toUnixMs:
|
|
603
|
+
toUnixMs: computeTimeAtSlot(this.config, query.toSlot, this.clock.genesisTime) * 1000,
|
|
603
604
|
});
|
|
604
605
|
}
|
|
605
606
|
|
|
@@ -379,7 +379,7 @@ function getSequentialHandlers(modules: ValidatorFnsModules, options: GossipHand
|
|
|
379
379
|
|
|
380
380
|
// Handler - MUST NOT `await`, to allow validation result to be propagated
|
|
381
381
|
|
|
382
|
-
const delaySec = seenTimestampSec - (
|
|
382
|
+
const delaySec = seenTimestampSec - computeTimeAtSlot(config, slot, chain.genesisTime);
|
|
383
383
|
metrics?.gossipBlock.elapsedTimeTillReceived.observe({source: OpSource.gossip}, delaySec);
|
|
384
384
|
chain.validatorMonitor?.registerBeaconBlock(OpSource.gossip, delaySec, signedBlock.message);
|
|
385
385
|
if (!blockInput.hasBlockAndAllData()) {
|
|
@@ -163,12 +163,9 @@ export class AttnetsService implements IAttnetsService {
|
|
|
163
163
|
*/
|
|
164
164
|
private onSlot = (clockSlot: Slot): void => {
|
|
165
165
|
try {
|
|
166
|
-
setTimeout(
|
|
167
|
-
()
|
|
168
|
-
|
|
169
|
-
},
|
|
170
|
-
this.config.SECONDS_PER_SLOT * 0.5 * 1000
|
|
171
|
-
);
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
this.onHalfSlot(clockSlot);
|
|
168
|
+
}, this.config.SLOT_DURATION_MS * 0.5);
|
|
172
169
|
|
|
173
170
|
for (const [dutiedSlot, dutiedInfo] of this.aggregatorSlotSubnet.entries()) {
|
|
174
171
|
if (dutiedSlot === clockSlot + this.opts.slotsToSubscribeBeforeAggregatorDuty) {
|
package/src/node/notifier.ts
CHANGED
|
@@ -157,7 +157,7 @@ export async function runNodeNotifier(modules: NodeNotifierModules): Promise<voi
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
function timeToNextHalfSlot(config: BeaconConfig, chain: IBeaconChain, isFirstTime: boolean): number {
|
|
160
|
-
const msPerSlot = config.
|
|
160
|
+
const msPerSlot = config.SLOT_DURATION_MS;
|
|
161
161
|
const msPerHalfSlot = msPerSlot / 2;
|
|
162
162
|
const msFromGenesis = Date.now() - chain.genesisTime * 1000;
|
|
163
163
|
const msToNextSlot =
|
package/src/sync/unknownBlock.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
2
|
import {ForkSeq} from "@lodestar/params";
|
|
3
3
|
import {RequestError, RequestErrorCode} from "@lodestar/reqresp";
|
|
4
|
+
import {computeTimeAtSlot} from "@lodestar/state-transition";
|
|
4
5
|
import {RootHex} from "@lodestar/types";
|
|
5
6
|
import {Logger, prettyPrintIndices, pruneSetToMax, sleep} from "@lodestar/utils";
|
|
6
7
|
import {isBlockInputBlobs, isBlockInputColumns} from "../chain/blocks/blockInput/blockInput.js";
|
|
@@ -329,7 +330,7 @@ export class BlockInputSync {
|
|
|
329
330
|
this.pendingBlocks.set(pending.blockInput.blockRootHex, pending);
|
|
330
331
|
const blockSlot = pending.blockInput.slot;
|
|
331
332
|
const finalizedSlot = this.chain.forkChoice.getFinalizedBlock().slot;
|
|
332
|
-
const delaySec = Date.now() / 1000 - (this.
|
|
333
|
+
const delaySec = Date.now() / 1000 - computeTimeAtSlot(this.config, blockSlot, this.chain.genesisTime);
|
|
333
334
|
this.metrics?.blockInputSync.elapsedTimeTillReceived.observe(delaySec);
|
|
334
335
|
|
|
335
336
|
const parentInForkChoice = this.chain.forkChoice.hasBlockHex(pending.blockInput.parentRootHex);
|
package/src/util/clock.ts
CHANGED
|
@@ -9,12 +9,12 @@ import {MAXIMUM_GOSSIP_CLOCK_DISPARITY} from "../constants/constants.js";
|
|
|
9
9
|
export enum ClockEvent {
|
|
10
10
|
/**
|
|
11
11
|
* This event signals the start of a new slot, and that subsequent calls to `clock.currentSlot` will equal `slot`.
|
|
12
|
-
* This event is guaranteed to be emitted every `
|
|
12
|
+
* This event is guaranteed to be emitted every `SLOT_DURATION_MS` milliseconds.
|
|
13
13
|
*/
|
|
14
14
|
slot = "clock:slot",
|
|
15
15
|
/**
|
|
16
16
|
* This event signals the start of a new epoch, and that subsequent calls to `clock.currentEpoch` will return `epoch`.
|
|
17
|
-
* This event is guaranteed to be emitted every `
|
|
17
|
+
* This event is guaranteed to be emitted every `SLOT_DURATION_MS * SLOTS_PER_EPOCH` milliseconds.
|
|
18
18
|
*/
|
|
19
19
|
epoch = "clock:epoch",
|
|
20
20
|
}
|
|
@@ -29,7 +29,7 @@ export type ClockEvents = {
|
|
|
29
29
|
*
|
|
30
30
|
* The time is dependent on:
|
|
31
31
|
* - `state.genesisTime` - the genesis time
|
|
32
|
-
* - `
|
|
32
|
+
* - `SLOT_DURATION_MS` - # of milliseconds per slot
|
|
33
33
|
* - `SLOTS_PER_EPOCH` - # of slots per epoch
|
|
34
34
|
*/
|
|
35
35
|
export type IClock = StrictEventEmitter<EventEmitter, ClockEvents> & {
|
|
@@ -174,16 +174,16 @@ export class Clock extends EventEmitter implements IClock {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
secFromSlot(slot: Slot, toSec = Date.now() / 1000): number {
|
|
177
|
-
return toSec - (this.
|
|
177
|
+
return toSec - computeTimeAtSlot(this.config, slot, this.genesisTime);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
msFromSlot(slot: Slot, toMs = Date.now()): number {
|
|
181
|
-
return toMs - (this.
|
|
181
|
+
return toMs - computeTimeAtSlot(this.config, slot, this.genesisTime) * 1000;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
private onNextSlot = (slot?: Slot): void => {
|
|
185
185
|
const clockSlot = slot ?? getCurrentSlot(this.config, this.genesisTime);
|
|
186
|
-
// process multiple clock slots in the case the main thread has been saturated for >
|
|
186
|
+
// process multiple clock slots in the case the main thread has been saturated for > SLOT_DURATION_MS
|
|
187
187
|
while (this._currentSlot < clockSlot && !this.signal.aborted) {
|
|
188
188
|
const previousSlot = this._currentSlot;
|
|
189
189
|
this._currentSlot++;
|
|
@@ -205,7 +205,7 @@ export class Clock extends EventEmitter implements IClock {
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
private msUntilNextSlot(): number {
|
|
208
|
-
const milliSecondsPerSlot = this.config.
|
|
208
|
+
const milliSecondsPerSlot = this.config.SLOT_DURATION_MS;
|
|
209
209
|
const diffInMilliSeconds = Date.now() - this.genesisTime * 1000;
|
|
210
210
|
return milliSecondsPerSlot - (diffInMilliSeconds % milliSecondsPerSlot);
|
|
211
211
|
}
|