Skip to content

Commit

Permalink
fix: set time to stable mesh -1 if not able to form stable mesh withi…
Browse files Browse the repository at this point in the history
…n 2 slots
  • Loading branch information
twoeths committed Aug 22, 2023
1 parent a3e6a45 commit 9114a94
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/beacon-node/src/network/subnets/dllAttnetsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type AggregatorDutyInfo = Map<Subnet, number | null>;
/**
* This value means node is not able to form stable mesh.
*/
const MAX_TIME_TO_STABLE_MESH_SEC = 120;
const NOT_ABLE_TO_FORM_STABLE_MESH_SEC = -1;

/**
* Manage deleterministic long lived (DLL) subnets and short lived subnets.
Expand Down Expand Up @@ -210,10 +210,10 @@ export class DLLAttnetsService implements IAttnetsService {
// aggregator duty is expired, set timeToStableMesh to some big value so we know this value is not good
for (const [subnet, timeToFormMesh] of dutiedInfo.entries()) {
if (timeToFormMesh === null) {
dutiedInfo.set(subnet, MAX_TIME_TO_STABLE_MESH_SEC);
dutiedInfo.set(subnet, NOT_ABLE_TO_FORM_STABLE_MESH_SEC);
this.metrics?.attnetsService.subscriptionsCommitteeTimeToStableMesh.observe(
{subnet},
MAX_TIME_TO_STABLE_MESH_SEC
NOT_ABLE_TO_FORM_STABLE_MESH_SEC
);
}
}
Expand All @@ -228,7 +228,9 @@ export class DLLAttnetsService implements IAttnetsService {
});
const numMeshPeers = this.gossip.mesh.get(topicStr)?.size ?? 0;
if (numMeshPeers >= GOSSIP_D_LOW) {
const timeToStableMeshSec = this.clock.secFromSlot(dutiedSlot);
const timeToStableMeshSec = this.clock.secFromSlot(
dutiedSlot - this.opts.slotsToSubscribeBeforeAggregatorDuty
);
// set to dutiedInfo so we'll not set to metrics again
dutiedInfo.set(subnet, timeToStableMeshSec);
this.metrics?.attnetsService.subscriptionsCommitteeTimeToStableMesh.observe({subnet}, timeToStableMeshSec);
Expand Down

0 comments on commit 9114a94

Please sign in to comment.