Skip to content

Commit

Permalink
chore: address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Jan 21, 2025
1 parent 6f82fe7 commit e1e9a64
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions packages/beacon-node/src/network/peers/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {NodeId, computeNodeId} from "../subnets/interface.js";
import {getDataColumnSubnets} from "../../util/dataColumns.js";
import {deserializeEnrSubnets, zeroAttnets, zeroSyncnets} from "./utils/enrSubnetsDeserialize.js";
import {IPeerRpcScoreStore, ScoreState} from "./score/index.js";
import {ColumnSubnetId} from "./peersData.js";
import {type ColumnSubnetQueries } from "./utils/prioritizePeers.js";

/** Max number of cached ENRs after discovering a good peer */
const MAX_CACHED_ENRS = 100;
Expand Down Expand Up @@ -87,11 +87,6 @@ export type SubnetDiscvQueryMs = {
maxPeersToDiscover: number;
};

/**
* A map of column subnet id to maxPeersToDiscover
*/
type ColumnSubnetQueries = Map<ColumnSubnetId, number>;

type CachedENR = {
peerId: PeerId;
multiaddrTCP: Multiaddr;
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/network/peers/peerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export class PeerManager {
const oldMetadata = peerData.metadata;
const csc = (metadata as Partial<peerdas.Metadata>).csc ?? this.config.CUSTODY_REQUIREMENT;
const nodeId = peerData?.nodeId ?? computeNodeId(peer);
const custodySubnets = (csc !== oldMetadata?.csc || oldMetadata?.custodySubnets == null)? getDataColumnSubnets(nodeId, csc) : oldMetadata?.custodySubnets;
const custodySubnets = (oldMetadata == null || oldMetadata.custodySubnets == null || csc !== oldMetadata.csc) ? getDataColumnSubnets(nodeId, csc) : oldMetadata.custodySubnets;
peerData.metadata = {
seqNumber: metadata.seqNumber,
attnets: metadata.attnets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type SubnetDiscvQuery = {subnet: number; toSlot: number; maxPeersToDiscover: num
/**
* A map of column subnet id to maxPeersToDiscover
*/
type ColumnSubnetQueries = Map<ColumnSubnetId, number>;
export type ColumnSubnetQueries = Map<ColumnSubnetId, number>;

type PeerInfo = {
id: PeerId;
Expand Down

0 comments on commit e1e9a64

Please sign in to comment.