@lodestar/beacon-node 1.35.0-dev.fcf8d024ea → 1.35.0-rc.0
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/validator/index.d.ts.map +1 -1
- package/lib/api/impl/validator/index.js +3 -5
- package/lib/api/impl/validator/index.js.map +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js +1 -1
- package/lib/chain/archiveStore/historicalState/worker.js.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.d.ts.map +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js +1 -1
- package/lib/chain/blocks/blockInput/blockInput.js.map +1 -1
- package/lib/chain/blocks/importBlock.d.ts.map +1 -1
- package/lib/chain/blocks/importBlock.js +3 -4
- package/lib/chain/blocks/importBlock.js.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.d.ts.map +1 -1
- package/lib/chain/blocks/verifyBlocksDataAvailability.js +1 -8
- package/lib/chain/blocks/verifyBlocksDataAvailability.js.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.d.ts.map +1 -1
- package/lib/chain/blocks/writeBlockInputToDb.js +7 -1
- package/lib/chain/blocks/writeBlockInputToDb.js.map +1 -1
- package/lib/chain/chain.d.ts.map +1 -1
- package/lib/chain/chain.js +3 -2
- package/lib/chain/chain.js.map +1 -1
- package/lib/chain/opPools/attestationPool.d.ts +3 -2
- package/lib/chain/opPools/attestationPool.d.ts.map +1 -1
- package/lib/chain/opPools/attestationPool.js +5 -3
- package/lib/chain/opPools/attestationPool.js.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.d.ts +2 -3
- package/lib/chain/opPools/syncCommitteeMessagePool.d.ts.map +1 -1
- package/lib/chain/opPools/syncCommitteeMessagePool.js +5 -6
- package/lib/chain/opPools/syncCommitteeMessagePool.js.map +1 -1
- package/lib/chain/opPools/types.d.ts +1 -1
- package/lib/chain/opPools/types.d.ts.map +1 -1
- package/lib/chain/opPools/types.js +1 -1
- package/lib/chain/opPools/types.js.map +1 -1
- package/lib/chain/prepareNextSlot.d.ts +3 -3
- package/lib/chain/prepareNextSlot.d.ts.map +1 -1
- package/lib/chain/prepareNextSlot.js +8 -8
- package/lib/chain/prepareNextSlot.js.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.d.ts.map +1 -1
- package/lib/chain/stateCache/persistentCheckpointsCache.js +8 -9
- package/lib/chain/stateCache/persistentCheckpointsCache.js.map +1 -1
- package/lib/chain/validation/lightClientFinalityUpdate.d.ts.map +1 -1
- package/lib/chain/validation/lightClientFinalityUpdate.js +3 -4
- package/lib/chain/validation/lightClientFinalityUpdate.js.map +1 -1
- package/lib/chain/validation/lightClientOptimisticUpdate.d.ts +4 -6
- package/lib/chain/validation/lightClientOptimisticUpdate.d.ts.map +1 -1
- package/lib/chain/validation/lightClientOptimisticUpdate.js +11 -11
- package/lib/chain/validation/lightClientOptimisticUpdate.js.map +1 -1
- package/lib/chain/validatorMonitor.d.ts.map +1 -1
- package/lib/chain/validatorMonitor.js +14 -20
- package/lib/chain/validatorMonitor.js.map +1 -1
- package/lib/metrics/metrics/lodestar.d.ts +1 -1
- package/lib/metrics/metrics/lodestar.js +3 -3
- package/lib/metrics/metrics/lodestar.js.map +1 -1
- package/lib/network/network.d.ts +1 -1
- package/lib/network/network.d.ts.map +1 -1
- package/lib/network/network.js +9 -9
- package/lib/network/network.js.map +1 -1
- package/lib/sync/unknownBlock.d.ts +1 -0
- package/lib/sync/unknownBlock.d.ts.map +1 -1
- package/lib/sync/unknownBlock.js +5 -5
- package/lib/sync/unknownBlock.js.map +1 -1
- package/lib/util/clock.d.ts +0 -5
- package/lib/util/clock.d.ts.map +1 -1
- package/lib/util/clock.js +0 -3
- package/lib/util/clock.js.map +1 -1
- package/package.json +14 -14
- package/src/api/impl/validator/index.ts +3 -5
- package/src/chain/archiveStore/historicalState/worker.ts +1 -1
- package/src/chain/blocks/blockInput/blockInput.ts +1 -2
- package/src/chain/blocks/importBlock.ts +10 -4
- package/src/chain/blocks/verifyBlocksDataAvailability.ts +2 -10
- package/src/chain/blocks/writeBlockInputToDb.ts +9 -1
- package/src/chain/chain.ts +13 -2
- package/src/chain/opPools/attestationPool.ts +3 -2
- package/src/chain/opPools/syncCommitteeMessagePool.ts +3 -5
- package/src/chain/opPools/types.ts +1 -1
- package/src/chain/prepareNextSlot.ts +8 -8
- package/src/chain/stateCache/persistentCheckpointsCache.ts +8 -10
- package/src/chain/validation/lightClientFinalityUpdate.ts +3 -4
- package/src/chain/validation/lightClientOptimisticUpdate.ts +11 -12
- package/src/chain/validatorMonitor.ts +17 -27
- package/src/metrics/metrics/lodestar.ts +3 -3
- package/src/network/network.ts +9 -9
- package/src/sync/unknownBlock.ts +5 -5
- package/src/util/clock.ts +0 -8
package/src/network/network.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {BeaconConfig} from "@lodestar/config";
|
|
|
7
7
|
import {LoggerNode} from "@lodestar/logger/node";
|
|
8
8
|
import {ForkSeq} from "@lodestar/params";
|
|
9
9
|
import {ResponseIncoming} from "@lodestar/reqresp";
|
|
10
|
-
import {computeEpochAtSlot} from "@lodestar/state-transition";
|
|
10
|
+
import {computeEpochAtSlot, computeTimeAtSlot} from "@lodestar/state-transition";
|
|
11
11
|
import {
|
|
12
12
|
AttesterSlashing,
|
|
13
13
|
LightClientBootstrap,
|
|
@@ -689,9 +689,9 @@ export class Network implements INetwork {
|
|
|
689
689
|
// TODO: Review is OK to remove if (this.hasAttachedSyncCommitteeMember())
|
|
690
690
|
|
|
691
691
|
try {
|
|
692
|
-
// messages SHOULD be broadcast after
|
|
692
|
+
// messages SHOULD be broadcast after one-third of slot has transpired
|
|
693
693
|
// https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/p2p-interface.md#sync-committee
|
|
694
|
-
await this.
|
|
694
|
+
await this.waitOneThirdOfSlot(finalityUpdate.signatureSlot);
|
|
695
695
|
await this.publishLightClientFinalityUpdate(finalityUpdate);
|
|
696
696
|
} catch (e) {
|
|
697
697
|
// Non-mandatory route on most of network as of Oct 2022. May not have found any peers on topic yet
|
|
@@ -706,9 +706,9 @@ export class Network implements INetwork {
|
|
|
706
706
|
// TODO: Review is OK to remove if (this.hasAttachedSyncCommitteeMember())
|
|
707
707
|
|
|
708
708
|
try {
|
|
709
|
-
// messages SHOULD be broadcast after
|
|
709
|
+
// messages SHOULD be broadcast after one-third of slot has transpired
|
|
710
710
|
// https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/light-client/p2p-interface.md#sync-committee
|
|
711
|
-
await this.
|
|
711
|
+
await this.waitOneThirdOfSlot(optimisticUpdate.signatureSlot);
|
|
712
712
|
await this.publishLightClientOptimisticUpdate(optimisticUpdate);
|
|
713
713
|
} catch (e) {
|
|
714
714
|
// Non-mandatory route on most of network as of Oct 2022. May not have found any peers on topic yet
|
|
@@ -719,10 +719,10 @@ export class Network implements INetwork {
|
|
|
719
719
|
}
|
|
720
720
|
};
|
|
721
721
|
|
|
722
|
-
private
|
|
723
|
-
const
|
|
724
|
-
const
|
|
725
|
-
await sleep(
|
|
722
|
+
private waitOneThirdOfSlot = async (slot: number): Promise<void> => {
|
|
723
|
+
const secAtSlot = computeTimeAtSlot(this.config, slot + 1 / 3, this.chain.genesisTime);
|
|
724
|
+
const msToSlot = secAtSlot * 1000 - Date.now();
|
|
725
|
+
await sleep(msToSlot, this.controller.signal);
|
|
726
726
|
};
|
|
727
727
|
|
|
728
728
|
private onHead = async (): Promise<void> => {
|
package/src/sync/unknownBlock.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ChainForkConfig} from "@lodestar/config";
|
|
2
|
-
import {ForkSeq} from "@lodestar/params";
|
|
2
|
+
import {ForkSeq, INTERVALS_PER_SLOT} from "@lodestar/params";
|
|
3
3
|
import {RequestError, RequestErrorCode} from "@lodestar/reqresp";
|
|
4
4
|
import {RootHex} from "@lodestar/types";
|
|
5
5
|
import {Logger, prettyPrintIndices, pruneSetToMax, sleep} from "@lodestar/utils";
|
|
@@ -78,6 +78,7 @@ export class BlockInputSync {
|
|
|
78
78
|
*/
|
|
79
79
|
private readonly pendingBlocks = new Map<RootHex, BlockInputSyncCacheItem>();
|
|
80
80
|
private readonly knownBadBlocks = new Set<RootHex>();
|
|
81
|
+
private readonly proposerBoostSecWindow: number;
|
|
81
82
|
private readonly maxPendingBlocks;
|
|
82
83
|
private subscribedToNetworkEvents = false;
|
|
83
84
|
private peerBalancer: UnknownBlockPeerBalancer;
|
|
@@ -91,6 +92,7 @@ export class BlockInputSync {
|
|
|
91
92
|
private readonly opts?: SyncOptions
|
|
92
93
|
) {
|
|
93
94
|
this.maxPendingBlocks = opts?.maxPendingBlocks ?? MAX_PENDING_BLOCKS;
|
|
95
|
+
this.proposerBoostSecWindow = this.config.SECONDS_PER_SLOT / INTERVALS_PER_SLOT;
|
|
94
96
|
this.peerBalancer = new UnknownBlockPeerBalancer();
|
|
95
97
|
|
|
96
98
|
if (metrics) {
|
|
@@ -394,10 +396,8 @@ export class BlockInputSync {
|
|
|
394
396
|
// this prevents unbundling attack
|
|
395
397
|
// see https://lighthouse-blog.sigmaprime.io/mev-unbundling-rpc.html
|
|
396
398
|
const {slot: blockSlot, proposerIndex} = pendingBlock.blockInput.getBlock().message;
|
|
397
|
-
const fork = this.config.getForkName(blockSlot);
|
|
398
|
-
const proposerBoostWindowMs = this.config.getAttestationDueMs(fork);
|
|
399
399
|
if (
|
|
400
|
-
this.chain.clock.
|
|
400
|
+
this.chain.clock.secFromSlot(blockSlot) < this.proposerBoostSecWindow &&
|
|
401
401
|
this.chain.seenBlockProposers.isKnown(blockSlot, proposerIndex)
|
|
402
402
|
) {
|
|
403
403
|
// proposer is known by a gossip block already, wait a bit to make sure this block is not
|
|
@@ -407,7 +407,7 @@ export class BlockInputSync {
|
|
|
407
407
|
root: pendingBlock.blockInput.blockRootHex,
|
|
408
408
|
proposerIndex,
|
|
409
409
|
});
|
|
410
|
-
await sleep(
|
|
410
|
+
await sleep(this.proposerBoostSecWindow * 1000);
|
|
411
411
|
}
|
|
412
412
|
// At gossip time, it's critical to keep a good number of mesh peers.
|
|
413
413
|
// To do that, the Gossip Job Wait Time should be consistently <3s to avoid the behavior penalties in gossip
|
package/src/util/clock.ts
CHANGED
|
@@ -58,10 +58,6 @@ export type IClock = StrictEventEmitter<EventEmitter, ClockEvents> & {
|
|
|
58
58
|
* Return second from a slot to either toSec or now.
|
|
59
59
|
*/
|
|
60
60
|
secFromSlot(slot: Slot, toSec?: number): number;
|
|
61
|
-
/**
|
|
62
|
-
* Return milliseconds from a slot to either toMs or now.
|
|
63
|
-
*/
|
|
64
|
-
msFromSlot(slot: Slot, toMs?: number): number;
|
|
65
61
|
};
|
|
66
62
|
|
|
67
63
|
/**
|
|
@@ -177,10 +173,6 @@ export class Clock extends EventEmitter implements IClock {
|
|
|
177
173
|
return toSec - (this.genesisTime + slot * this.config.SECONDS_PER_SLOT);
|
|
178
174
|
}
|
|
179
175
|
|
|
180
|
-
msFromSlot(slot: Slot, toMs = Date.now()): number {
|
|
181
|
-
return toMs - (this.genesisTime * 1000 + slot * this.config.SLOT_DURATION_MS);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
176
|
private onNextSlot = (slot?: Slot): void => {
|
|
185
177
|
const clockSlot = slot ?? getCurrentSlot(this.config, this.genesisTime);
|
|
186
178
|
// process multiple clock slots in the case the main thread has been saturated for > SECONDS_PER_SLOT
|