mirror of
https://github.com/logos-storage/logos-storage-nim-dht.git
synced 2026-01-08 00:13:07 +00:00
Fix nimble install (#78)
* make encryption scheme explicit * supress compiler noise * make `nimble install` without `-d` work * move `libp2p_pki_schemes=secp256k1` to config.nims * fix include
This commit is contained in:
parent
1f27eb4aff
commit
9ae0bfb1c3
@ -1,7 +1,5 @@
|
|||||||
import std / [os, strutils, sequtils]
|
import std / [os, strutils, sequtils]
|
||||||
|
|
||||||
switch("define", "libp2p_pki_schemes=secp256k1")
|
|
||||||
|
|
||||||
task testAll, "Run DHT tests":
|
task testAll, "Run DHT tests":
|
||||||
exec "nim c -r tests/testAll.nim"
|
exec "nim c -r tests/testAll.nim"
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
author = "Status Research & Development GmbH"
|
author = "Status Research & Development GmbH"
|
||||||
description = "DHT based on the libp2p Kademlia spec"
|
description = "DHT based on Eth discv5 implementation"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
skipDirs = @["tests"]
|
skipDirs = @["tests"]
|
||||||
|
installFiles = @["build.nims"]
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
requires "nim >= 1.2.0"
|
requires "nim >= 1.2.0"
|
||||||
@ -24,5 +24,3 @@ requires "https://github.com/status-im/nim-datastore#head"
|
|||||||
requires "questionable"
|
requires "questionable"
|
||||||
|
|
||||||
include "build.nims"
|
include "build.nims"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -307,7 +307,7 @@ proc encodeHandshakePacket*(rng: var HmacDrbgContext, c: var Codec,
|
|||||||
|
|
||||||
authdataHead.add(c.localNode.id.toByteArrayBE())
|
authdataHead.add(c.localNode.id.toByteArrayBE())
|
||||||
|
|
||||||
let ephKeys = ? KeyPair.random(rng)
|
let ephKeys = ? KeyPair.random(PKScheme.Secp256k1, rng)
|
||||||
.mapErr((e: CryptoError) =>
|
.mapErr((e: CryptoError) =>
|
||||||
("Failed to create random key pair: " & $e).cstring)
|
("Failed to create random key pair: " & $e).cstring)
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
switch("define", "libp2p_pki_schemes=secp256k1")
|
||||||
|
|
||||||
include "build.nims"
|
include "build.nims"
|
||||||
|
|
||||||
# begin Nimble config (version 2)
|
# begin Nimble config (version 2)
|
||||||
|
|||||||
@ -14,7 +14,7 @@ proc localAddress*(port: int): Address =
|
|||||||
Address(ip: ValidIpAddress.init("127.0.0.1"), port: Port(port))
|
Address(ip: ValidIpAddress.init("127.0.0.1"), port: Port(port))
|
||||||
|
|
||||||
proc example*(T: type PrivateKey, rng: ref HmacDrbgContext): PrivateKey =
|
proc example*(T: type PrivateKey, rng: ref HmacDrbgContext): PrivateKey =
|
||||||
PrivateKey.random(rng[]).expect("Valid rng for private key")
|
PrivateKey.random(PKScheme.Secp256k1, rng[]).expect("Valid rng for private key")
|
||||||
|
|
||||||
proc example*(T: type NodeId, rng: ref HmacDrbgContext): NodeId =
|
proc example*(T: type NodeId, rng: ref HmacDrbgContext): NodeId =
|
||||||
let
|
let
|
||||||
|
|||||||
@ -125,7 +125,6 @@ suite "Providers Tests: node alone":
|
|||||||
debug "Providers:", providers
|
debug "Providers:", providers
|
||||||
check (providers.len == 0)
|
check (providers.len == 0)
|
||||||
|
|
||||||
|
|
||||||
suite "Providers Tests: two nodes":
|
suite "Providers Tests: two nodes":
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|||||||
@ -8,13 +8,13 @@ var cmds: seq[string]
|
|||||||
|
|
||||||
when defined(testsPart1) or defined(testsAll):
|
when defined(testsPart1) or defined(testsAll):
|
||||||
cmds.add [
|
cmds.add [
|
||||||
"nim c -r tests/dht/test_providers.nim",
|
"nim c -r --hints:off --verbosity:0 tests/dht/test_providers.nim",
|
||||||
"nim c -r tests/dht/test_providermngr.nim",
|
"nim c -r --hints:off --verbosity:0 tests/dht/test_providermngr.nim",
|
||||||
]
|
]
|
||||||
when defined(testsPart2) or defined(testsAll):
|
when defined(testsPart2) or defined(testsAll):
|
||||||
cmds.add [
|
cmds.add [
|
||||||
"nim c -r tests/discv5/test_discoveryv5.nim",
|
"nim c -r --hints:off --verbosity:0 tests/discv5/test_discoveryv5.nim",
|
||||||
"nim c -r tests/discv5/test_discoveryv5_encoding.nim",
|
"nim c -r --hints:off --verbosity:0 tests/discv5/test_discoveryv5_encoding.nim",
|
||||||
]
|
]
|
||||||
|
|
||||||
echo "Running Test Commands: ", cmds
|
echo "Running Test Commands: ", cmds
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user