Skip to content

Commit 8745339

Browse files
committed
correctly set the enr with custody subnet info
1 parent 3c36b23 commit 8745339

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/cli/src/cmds/beacon/initPeerIdAndEnr.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {Multiaddr} from "@multiformats/multiaddr";
77
import {createPrivateKeyFromPeerId, SignableENR} from "@chainsafe/enr";
88
import {Logger, fromHex} from "@lodestar/utils";
99
import {ChainForkConfig} from "@lodestar/config";
10+
import {ssz} from "@lodestar/types";
1011

1112
import {exportToJSON, readPeerId} from "../../config/index.js";
1213
import {writeFile600Perm} from "../../util/file.js";
@@ -69,7 +70,7 @@ function maybeUpdateEnr<T extends "ip" | "tcp" | "udp" | "ip6" | "tcp6" | "udp6"
6970
}
7071

7172
export function overwriteEnrWithCliArgs(
72-
_config: ChainForkConfig,
73+
config: ChainForkConfig,
7374
enr: SignableENR,
7475
args: BeaconArgs,
7576
logger: Logger,
@@ -78,7 +79,6 @@ export function overwriteEnrWithCliArgs(
7879
const preSeq = enr.seq;
7980
const {port, discoveryPort, port6, discoveryPort6} = parseListenArgs(args);
8081
// TODO remove the hardcoding serialize count
81-
(enr as unknown as {custody_subnet_count: string}).custody_subnet_count = "0x1000000000000000";
8282
maybeUpdateEnr(enr, "ip", args["enr.ip"] ?? enr.ip);
8383
maybeUpdateEnr(enr, "ip6", args["enr.ip6"] ?? enr.ip6);
8484
maybeUpdateEnr(enr, "udp", args["enr.udp"] ?? discoveryPort ?? enr.udp);
@@ -87,6 +87,7 @@ export function overwriteEnrWithCliArgs(
8787
maybeUpdateEnr(enr, "tcp", args["enr.tcp"] ?? port ?? enr.tcp);
8888
maybeUpdateEnr(enr, "tcp6", args["enr.tcp6"] ?? port6 ?? enr.tcp6);
8989
}
90+
enr.set("custody_subnet_count", ssz.UintNum64.serialize(config.CUSTODY_REQUIREMENT));
9091

9192
function testMultiaddrForLocal(mu: Multiaddr, ip4: boolean): void {
9293
const isLocal = isLocalMultiAddr(mu);

0 commit comments

Comments
 (0)