bump libp2p (#1031)

This commit is contained in:
Jacek Sieka 2020-05-18 10:11:21 +02:00 committed by GitHub
parent 24a17f5814
commit 6be7d64e8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 16 deletions

View File

@ -910,17 +910,19 @@ template tcpEndPoint(address, port): auto =
MultiAddress.init(address, Protocol.IPPROTO_TCP, port)
proc getPersistentNetKeys*(conf: BeaconNodeConf): KeyPair =
let privKeyPath = conf.dataDir / networkKeyFilename
var privKey: PrivateKey
if not fileExists(privKeyPath):
createDir conf.dataDir.string
privKey = PrivateKey.random(Secp256k1)
writeFile(privKeyPath, privKey.getBytes())
else:
let keyBytes = readFile(privKeyPath)
privKey = PrivateKey.init(keyBytes.toOpenArrayByte(0, keyBytes.high))
let
privKeyPath = conf.dataDir / networkKeyFilename
privKey =
if not fileExists(privKeyPath):
createDir conf.dataDir.string
let key = PrivateKey.random(Secp256k1).tryGet()
writeFile(privKeyPath, key.getBytes().tryGet())
key
else:
let keyBytes = readFile(privKeyPath)
PrivateKey.init(keyBytes.toOpenArrayByte(0, keyBytes.high)).tryGet()
KeyPair(seckey: privKey, pubkey: privKey.getKey())
KeyPair(seckey: privKey, pubkey: privKey.getKey().tryGet())
proc createEth2Node*(conf: BeaconNodeConf, enrForkId: ENRForkID): Future[Eth2Node] {.async, gcsafe.} =
var

View File

@ -316,10 +316,10 @@ proc init*(p: typedesc[PeerInfo],
if trecOpt.isSome():
trec = trecOpt.get()
if trec.secp256k1.isSome():
var skpubkey: SkPublicKey
if skpubkey.init(trec.secp256k1.get()):
let skpubkey = SkPublicKey.fromRaw(trec.secp256k1.get())
if skpubkey.isOk():
let peerid = PeerID.init(PublicKey(scheme: Secp256k1,
skkey: skpubkey))
skkey: skpubkey[]))
var mas = newSeq[MultiAddress]()
if trec.ip.isSome() and trec.tcp.isSome():
let ma = MultiAddress.init(multiCodec("ip4"), trec.ip.get()) &
@ -411,7 +411,7 @@ proc bootstrapDiscovery(conf: InspectorConf,
privkey: lcrypto.PrivateKey,
bootnodes: seq[enr.Record],
enrFields: Option[ENRFieldPair]): DiscoveryProtocol =
var pk = ethkeys.PrivateKey.fromRaw(privkey.getBytes()).tryGet()
var pk = ethkeys.PrivateKey(privkey.skkey)
var db = DiscoveryDB.init(newMemoryDB())
let udpPort = Port(conf.discoveryPort)
let tcpPort = Port(conf.ethPort)
@ -684,7 +684,7 @@ proc run(conf: InspectorConf) {.async.} =
bootstrap_fork_digest = forkDigest.get()
forkDigest = argForkDigest
let seckey = lcrypto.PrivateKey.random(PKScheme.Secp256k1)
let seckey = lcrypto.PrivateKey.random(PKScheme.Secp256k1).tryGet()
# let pubkey = seckey.getKey()
let hostAddress = tryGetMultiAddress(conf.bindAddress)

2
vendor/nim-libp2p vendored

@ -1 +1 @@
Subproject commit 5abbcfb5eb85826b1a141f7035bc17fc6e8a949a
Subproject commit 7dcb807f647a9f979820de5d450f17492f2e0ed5