Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump nim-eth to remove ValidIpAddress and replace with IpAddress #5587

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beacon_chain/networking/eth2_discovery.nim
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ proc loadBootstrapFile*(bootstrapFile: string,

proc new*(T: type Eth2DiscoveryProtocol,
config: BeaconNodeConf | LightClientConf,
enrIp: Option[ValidIpAddress], enrTcpPort, enrUdpPort: Option[Port],
enrIp: Option[IpAddress], enrTcpPort, enrUdpPort: Option[Port],
pk: PrivateKey,
enrFields: openArray[(string, seq[byte])], rng: ref HmacDrbgContext):
T =
Expand Down
8 changes: 4 additions & 4 deletions beacon_chain/networking/eth2_network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1806,7 +1806,7 @@ proc new(T: type Eth2Node,
enrForkId: ENRForkID, discoveryForkId: ENRForkID,
forkDigests: ref ForkDigests, getBeaconTime: GetBeaconTimeFn,
switch: Switch, pubsub: GossipSub,
ip: Option[ValidIpAddress], tcpPort, udpPort: Option[Port],
ip: Option[IpAddress], tcpPort, udpPort: Option[Port],
privKey: keys.PrivateKey, discovery: bool,
directPeers: DirectPeers,
rng: ref HmacDrbgContext): T {.raises: [CatchableError].} =
Expand Down Expand Up @@ -2304,8 +2304,8 @@ proc createEth2Node*(rng: ref HmacDrbgContext,
cfg, getBeaconTime().slotOrZero.epoch, genesis_validators_root)

(extIp, extTcpPort, extUdpPort) = try: setupAddress(
config.nat, ValidIpAddress.init config.listenAddress, config.tcpPort,
config.udpPort, clientId)
config.nat, config.listenAddress, config.tcpPort, config.udpPort,
clientId)
except CatchableError as exc: raise exc
except Exception as exc: raiseAssert exc.msg

Expand All @@ -2330,7 +2330,7 @@ proc createEth2Node*(rng: ref HmacDrbgContext,
hostAddress = tcpEndPoint(
ValidIpAddress.init config.listenAddress, config.tcpPort)
announcedAddresses = if extIp.isNone() or extTcpPort.isNone(): @[]
else: @[tcpEndPoint(extIp.get(), extTcpPort.get())]
else: @[tcpEndPoint(ValidIpAddress.init(extIp.get()), extTcpPort.get())]

debug "Initializing networking", hostAddress,
network_public_key = netKeys.pubkey,
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,7 @@ proc doRecord(config: BeaconNodeConf, rng: var HmacDrbgContext) {.
let record = enr.Record.init(
config.seqNumber,
netKeys.seckey.asEthKey,
some(ValidIpAddress.init config.ipExt),
some(config.ipExt),
some(config.tcpPortExt),
some(config.udpPortExt),
fieldPairs).expect("Record within size limits")
Expand Down
2 changes: 1 addition & 1 deletion ncli/ncli_testnet.nim
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ proc createEnr(rng: var HmacDrbgContext,
bootstrapEnr = enr.Record.init(
1, # sequence number
networkKeys.seckey.asEthKey,
some(ValidIpAddress.init address),
some(address),
some(port),
some(port),
[
Expand Down
8 changes: 1 addition & 7 deletions tests/test_discovery.nim
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ proc new(T: type Eth2DiscoveryProtocol,
enrFields: openArray[(string, seq[byte])] = [],
rng: ref HmacDrbgContext):
T {.raises: [CatchableError].} =
let optValidIpAddress =
if enrIp.isSome:
some ValidIpAddress.init enrIp.get
else:
none ValidIpAddress

newProtocol(pk, optValidIpAddress, enrTcpPort, enrUdpPort, enrFields,
newProtocol(pk, enrIp, enrTcpPort, enrUdpPort, enrFields,
bindPort = bindPort, bindIp = bindIp, rng = rng)

proc generateNode(rng: ref HmacDrbgContext, port: Port,
Expand Down
Loading