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:
Dmitriy Ryajov 2023-07-21 15:51:42 -06:00 committed by GitHub
parent 1f27eb4aff
commit 9ae0bfb1c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 13 deletions

View File

@ -1,7 +1,5 @@
import std / [os, strutils, sequtils]
switch("define", "libp2p_pki_schemes=secp256k1")
task testAll, "Run DHT tests":
exec "nim c -r tests/testAll.nim"

View File

@ -2,10 +2,10 @@
version = "0.3.2"
author = "Status Research & Development GmbH"
description = "DHT based on the libp2p Kademlia spec"
description = "DHT based on Eth discv5 implementation"
license = "MIT"
skipDirs = @["tests"]
installFiles = @["build.nims"]
# Dependencies
requires "nim >= 1.2.0"
@ -24,5 +24,3 @@ requires "https://github.com/status-im/nim-datastore#head"
requires "questionable"
include "build.nims"

View File

@ -307,7 +307,7 @@ proc encodeHandshakePacket*(rng: var HmacDrbgContext, c: var Codec,
authdataHead.add(c.localNode.id.toByteArrayBE())
let ephKeys = ? KeyPair.random(rng)
let ephKeys = ? KeyPair.random(PKScheme.Secp256k1, rng)
.mapErr((e: CryptoError) =>
("Failed to create random key pair: " & $e).cstring)

View File

@ -1,4 +1,6 @@
switch("define", "libp2p_pki_schemes=secp256k1")
include "build.nims"
# begin Nimble config (version 2)

View File

@ -14,7 +14,7 @@ proc localAddress*(port: int): Address =
Address(ip: ValidIpAddress.init("127.0.0.1"), port: Port(port))
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 =
let

View File

@ -125,7 +125,6 @@ suite "Providers Tests: node alone":
debug "Providers:", providers
check (providers.len == 0)
suite "Providers Tests: two nodes":
var

View File

@ -8,13 +8,13 @@ var cmds: seq[string]
when defined(testsPart1) or defined(testsAll):
cmds.add [
"nim c -r tests/dht/test_providers.nim",
"nim c -r tests/dht/test_providermngr.nim",
"nim c -r --hints:off --verbosity:0 tests/dht/test_providers.nim",
"nim c -r --hints:off --verbosity:0 tests/dht/test_providermngr.nim",
]
when defined(testsPart2) or defined(testsAll):
cmds.add [
"nim c -r 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.nim",
"nim c -r --hints:off --verbosity:0 tests/discv5/test_discoveryv5_encoding.nim",
]
echo "Running Test Commands: ", cmds