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

This commit is contained in:
tersec 2023-11-10 18:58:48 +03:00 committed by GitHub
parent eb35039704
commit c7952ff778
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 15 deletions

View File

@ -79,7 +79,7 @@ proc loadBootstrapFile*(bootstrapFile: string,
proc new*(T: type Eth2DiscoveryProtocol, proc new*(T: type Eth2DiscoveryProtocol,
config: BeaconNodeConf | LightClientConf, config: BeaconNodeConf | LightClientConf,
enrIp: Option[ValidIpAddress], enrTcpPort, enrUdpPort: Option[Port], enrIp: Option[IpAddress], enrTcpPort, enrUdpPort: Option[Port],
pk: PrivateKey, pk: PrivateKey,
enrFields: openArray[(string, seq[byte])], rng: ref HmacDrbgContext): enrFields: openArray[(string, seq[byte])], rng: ref HmacDrbgContext):
T = T =

View File

@ -1806,7 +1806,7 @@ proc new(T: type Eth2Node,
enrForkId: ENRForkID, discoveryForkId: ENRForkID, enrForkId: ENRForkID, discoveryForkId: ENRForkID,
forkDigests: ref ForkDigests, getBeaconTime: GetBeaconTimeFn, forkDigests: ref ForkDigests, getBeaconTime: GetBeaconTimeFn,
switch: Switch, pubsub: GossipSub, switch: Switch, pubsub: GossipSub,
ip: Option[ValidIpAddress], tcpPort, udpPort: Option[Port], ip: Option[IpAddress], tcpPort, udpPort: Option[Port],
privKey: keys.PrivateKey, discovery: bool, privKey: keys.PrivateKey, discovery: bool,
directPeers: DirectPeers, directPeers: DirectPeers,
rng: ref HmacDrbgContext): T {.raises: [CatchableError].} = rng: ref HmacDrbgContext): T {.raises: [CatchableError].} =
@ -2304,8 +2304,8 @@ proc createEth2Node*(rng: ref HmacDrbgContext,
cfg, getBeaconTime().slotOrZero.epoch, genesis_validators_root) cfg, getBeaconTime().slotOrZero.epoch, genesis_validators_root)
(extIp, extTcpPort, extUdpPort) = try: setupAddress( (extIp, extTcpPort, extUdpPort) = try: setupAddress(
config.nat, ValidIpAddress.init config.listenAddress, config.tcpPort, config.nat, config.listenAddress, config.tcpPort, config.udpPort,
config.udpPort, clientId) clientId)
except CatchableError as exc: raise exc except CatchableError as exc: raise exc
except Exception as exc: raiseAssert exc.msg except Exception as exc: raiseAssert exc.msg
@ -2330,7 +2330,7 @@ proc createEth2Node*(rng: ref HmacDrbgContext,
hostAddress = tcpEndPoint( hostAddress = tcpEndPoint(
ValidIpAddress.init config.listenAddress, config.tcpPort) ValidIpAddress.init config.listenAddress, config.tcpPort)
announcedAddresses = if extIp.isNone() or extTcpPort.isNone(): @[] 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, debug "Initializing networking", hostAddress,
network_public_key = netKeys.pubkey, network_public_key = netKeys.pubkey,

View File

@ -2132,7 +2132,7 @@ proc doRecord(config: BeaconNodeConf, rng: var HmacDrbgContext) {.
let record = enr.Record.init( let record = enr.Record.init(
config.seqNumber, config.seqNumber,
netKeys.seckey.asEthKey, netKeys.seckey.asEthKey,
some(ValidIpAddress.init config.ipExt), some(config.ipExt),
some(config.tcpPortExt), some(config.tcpPortExt),
some(config.udpPortExt), some(config.udpPortExt),
fieldPairs).expect("Record within size limits") fieldPairs).expect("Record within size limits")

View File

@ -377,7 +377,7 @@ proc createEnr(rng: var HmacDrbgContext,
bootstrapEnr = enr.Record.init( bootstrapEnr = enr.Record.init(
1, # sequence number 1, # sequence number
networkKeys.seckey.asEthKey, networkKeys.seckey.asEthKey,
some(ValidIpAddress.init address), some(address),
some(port), some(port),
some(port), some(port),
[ [

View File

@ -21,13 +21,7 @@ proc new(T: type Eth2DiscoveryProtocol,
enrFields: openArray[(string, seq[byte])] = [], enrFields: openArray[(string, seq[byte])] = [],
rng: ref HmacDrbgContext): rng: ref HmacDrbgContext):
T {.raises: [CatchableError].} = T {.raises: [CatchableError].} =
let optValidIpAddress = newProtocol(pk, enrIp, enrTcpPort, enrUdpPort, enrFields,
if enrIp.isSome:
some ValidIpAddress.init enrIp.get
else:
none ValidIpAddress
newProtocol(pk, optValidIpAddress, enrTcpPort, enrUdpPort, enrFields,
bindPort = bindPort, bindIp = bindIp, rng = rng) bindPort = bindPort, bindIp = bindIp, rng = rng)
proc generateNode(rng: ref HmacDrbgContext, port: Port, proc generateNode(rng: ref HmacDrbgContext, port: Port,

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit e34a9c4e5daee654d6ea16f6c4595253548ffb17 Subproject commit ca4898e24a4ffb61759d57469f208b542123a092