Skip to content

Commit f6eef1a

Browse files
authored
Merge pull request #104 from codex-storage/update-to-nim-2-x
Update to nim 2 x
2 parents 57f4b6f + fb17db8 commit f6eef1a

25 files changed

+92
-91
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ${{ matrix.os }}
88
strategy:
99
matrix:
10-
nim: [1.6.18]
10+
nim: [2.0.14]
1111
os: [ubuntu-latest, macOS-latest, windows-latest]
1212
steps:
1313
- name: Checkout

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ NimBinaries
1313
.update.timestamp
1414
*.dSYM
1515
.vscode/*
16+
nimbledeps

codexdht.nimble

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
# Package
22

3-
version = "0.4.0"
3+
version = "0.5.0"
44
author = "Status Research & Development GmbH"
55
description = "DHT based on Eth discv5 implementation"
66
license = "MIT"
77
skipDirs = @["tests"]
88

99
# Dependencies
10-
requires "secp256k1#2acbbdcc0e63002a013fff49f015708522875832" # >= 0.5.2 & < 0.6.0
11-
requires "protobuf_serialization" # >= 0.2.0 & < 0.3.0
12-
requires "nimcrypto >= 0.5.4"
13-
requires "bearssl == 0.2.5"
10+
requires "nim >= 2.0.14 & < 3.0.0"
11+
requires "secp256k1 >= 0.6.0 & < 0.7.0"
12+
requires "protobuf_serialization >= 0.3.0 & < 0.4.0"
13+
requires "nimcrypto >= 0.6.2 & < 0.7.0"
14+
requires "bearssl >= 0.2.5 & < 0.3.0"
1415
requires "chronicles >= 0.10.2 & < 0.11.0"
1516
requires "chronos >= 4.0.3 & < 4.1.0"
16-
requires "libp2p == 1.5.0"
17-
requires "metrics"
18-
requires "stew#head"
19-
requires "stint"
20-
requires "https://github.com/codex-storage/nim-datastore >= 0.1.1 & < 0.2.0"
21-
requires "questionable"
17+
requires "libp2p >= 1.5.0 & < 2.0.0"
18+
requires "metrics >= 0.1.0 & < 0.2.0"
19+
requires "stew >= 0.2.0 & < 0.3.0"
20+
requires "stint >= 0.8.1 & < 0.9.0"
21+
requires "https://github.com/codex-storage/nim-datastore >= 0.2.0 & < 0.3.0"
22+
requires "questionable >= 0.10.15 & < 0.11.0"
2223

2324
task testAll, "Run all test suites":
2425
exec "nimble install -d -y"

codexdht/private/eth/p2p/discoveryv5/encoding.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
## https://github.com/ethereum/devp2p/blob/master/discv5/discv5-theory.md#sessions
1212
##
1313

14-
{.push raises: [Defect].}
14+
{.push raises: [].}
1515

1616
import
1717
std/[hashes, net, options, sugar, tables],

codexdht/private/eth/p2p/discoveryv5/ip_vote.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
## To select the right address, a majority count is done. This is done over a
1616
## sort of moving window as votes expire after `IpVoteTimeout`.
1717

18-
{.push raises: [Defect].}
18+
{.push raises: [].}
1919

2020
import
2121
std/[tables, options],

codexdht/private/eth/p2p/discoveryv5/lru.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import std/[tables, lists, options]
22

3-
{.push raises: [Defect].}
3+
{.push raises: [].}
44

55
export tables, lists, options
66

codexdht/private/eth/p2p/discoveryv5/messages.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
## These messages get protobuf encoded, while in the spec they get RLP encoded.
1111
##
1212

13-
{.push raises: [Defect].}
13+
{.push raises: [].}
1414

1515
import
1616
std/[hashes, net],

codexdht/private/eth/p2p/discoveryv5/messages_encoding.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import
1414
stew/endians2,
1515
libp2p/routing_record,
1616
libp2p/signed_envelope,
17+
libp2p/protobuf/minprotobuf,
1718
"."/[messages, spr, node],
1819
../../../../dht/providers_encoding
1920

codexdht/private/eth/p2p/discoveryv5/node.nim

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
66
# at your option. This file may not be copied, modified, or distributed except according to those terms.
77

8-
{.push raises: [Defect].}
8+
{.push raises: [].}
99

1010
import
1111
std/hashes,
@@ -28,7 +28,7 @@ type
2828
NodeId* = UInt256
2929

3030
Address* = object
31-
ip*: ValidIpAddress
31+
ip*: IpAddress
3232
port*: Port
3333

3434
Stats* = object
@@ -69,7 +69,7 @@ func newNode*(
6969
id: ? pk.toNodeId(),
7070
pubkey: pk,
7171
record: record,
72-
address: Address(ip: ValidIpAddress.init(ip), port: port).some)
72+
address: Address(ip: ip, port: port).some)
7373

7474
ok node
7575

@@ -103,7 +103,7 @@ func newNode*(r: SignedPeerRecord): Result[Node, cstring] =
103103
record: r,
104104
address: none(Address)))
105105

106-
proc update*(n: Node, pk: PrivateKey, ip: Option[ValidIpAddress],
106+
proc update*(n: Node, pk: PrivateKey, ip: Option[IpAddress],
107107
tcpPort, udpPort: Option[Port] = none[Port]()): Result[void, cstring] =
108108
? n.record.update(pk, ip, tcpPort, udpPort)
109109

@@ -154,7 +154,7 @@ func shortLog*(id: NodeId): string =
154154
result.add(sid[i])
155155
chronicles.formatIt(NodeId): shortLog(it)
156156

157-
func hash*(ip: ValidIpAddress): Hash =
157+
func hash*(ip: IpAddress): Hash =
158158
case ip.family
159159
of IpAddressFamily.IPv6: hash(ip.address_v6)
160160
of IpAddressFamily.IPv4: hash(ip.address_v4)

codexdht/private/eth/p2p/discoveryv5/nodes_verification.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{.push raises: [Defect].}
1+
{.push raises: [].}
22

33
import
44
std/[sets, options],

0 commit comments

Comments
 (0)