Merge pull request #105 from codex-storage/fix/deps/2.0-deps

fix(deps): remove deps pinned to commit hash
This commit is contained in:
Eric 2025-02-13 15:25:50 +11:00 committed by GitHub
commit d435c6945f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 41 additions and 36 deletions

View File

@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
nim: [1.6.18, 2.0.14]
nim: [2.0.14]
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- name: Checkout

View File

@ -7,16 +7,17 @@ license = "MIT"
skipDirs = @["tests"]
# Dependencies
requires "secp256k1#2acbbdcc0e63002a013fff49f015708522875832" # >= 0.5.2 & < 0.6.0
requires "protobuf_serialization#5a31137a82c2b6a989c9ed979bb636c7a49f570e" # >= 0.2.0 & < 0.3.0
requires "nimcrypto >= 0.5.4"
requires "bearssl == 0.2.5"
requires "nim >= 2.0.14 & < 3.0.0"
requires "secp256k1" # >= 0.5.2 & < 0.6.0
requires "protobuf_serialization" # >= 0.2.0 & < 0.3.0
requires "nimcrypto >= 0.6.2 & < 0.7.0"
requires "bearssl >= 0.2.5 & < 0.3.0"
requires "chronicles >= 0.10.2 & < 0.11.0"
requires "chronos >= 4.0.3 & < 4.1.0"
requires "libp2p == 1.5.0"
requires "metrics#cacfdc12454a0804c65112b9f4f50d1375208dcd"
requires "stew >= 0.2.0"
requires "stint#3236fa68394f1e3a06e2bc34218aacdd2d675923"
requires "libp2p >= 1.5.0 & < 2.0.0"
requires "metrics"
requires "stew >= 0.2.0 & < 0.3.0"
requires "stint >= 0.8.1 & < 0.9.0"
requires "https://github.com/codex-storage/nim-datastore#a969b9799cb7fd2c2511b6820ded00bced141dea"
requires "questionable >= 0.10.15 & < 0.11.0"

View File

@ -11,7 +11,7 @@
## https://github.com/ethereum/devp2p/blob/master/discv5/discv5-theory.md#sessions
##
{.push raises: [Defect].}
{.push raises: [].}
import
std/[hashes, net, options, sugar, tables],

View File

@ -15,7 +15,7 @@
## To select the right address, a majority count is done. This is done over a
## sort of moving window as votes expire after `IpVoteTimeout`.
{.push raises: [Defect].}
{.push raises: [].}
import
std/[tables, options],

View File

@ -1,6 +1,6 @@
import std/[tables, lists, options]
{.push raises: [Defect].}
{.push raises: [].}
export tables, lists, options

View File

@ -10,7 +10,7 @@
## These messages get protobuf encoded, while in the spec they get RLP encoded.
##
{.push raises: [Defect].}
{.push raises: [].}
import
std/[hashes, net],

View File

@ -14,6 +14,7 @@ import
stew/endians2,
libp2p/routing_record,
libp2p/signed_envelope,
libp2p/protobuf/minprotobuf,
"."/[messages, spr, node],
../../../../dht/providers_encoding

View File

@ -5,7 +5,7 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.push raises: [Defect].}
{.push raises: [].}
import
std/hashes,

View File

@ -1,4 +1,4 @@
{.push raises: [Defect].}
{.push raises: [].}
import
std/[sets, options],

View File

@ -71,7 +71,7 @@
## more requests will be needed for a lookup (adding bandwidth and latency).
## This might be a concern for mobile devices.
{.push raises: [Defect].}
{.push raises: [].}
import
std/[tables, sets, options, math, sequtils, algorithm, strutils],
@ -236,18 +236,18 @@ proc getNode*(d: Protocol, id: NodeId): Option[Node] =
## Get the node with id from the routing table.
d.routingTable.getNode(id)
proc randomNodes*(d: Protocol, maxAmount: int): seq[Node] {.raises: Exception.} =
proc randomNodes*(d: Protocol, maxAmount: int): seq[Node] =
## Get a `maxAmount` of random nodes from the local routing table.
d.routingTable.randomNodes(maxAmount)
proc randomNodes*(d: Protocol, maxAmount: int,
pred: proc(x: Node): bool {.gcsafe, noSideEffect.}): seq[Node] {.raises: Exception.} =
pred: proc(x: Node): bool {.gcsafe, noSideEffect, raises: [].}): seq[Node] =
## Get a `maxAmount` of random nodes from the local routing table with the
## `pred` predicate function applied as filter on the nodes selected.
d.routingTable.randomNodes(maxAmount, pred)
proc randomNodes*(d: Protocol, maxAmount: int,
enrField: (string, seq[byte])): seq[Node] {.raises: Exception.} =
enrField: (string, seq[byte])): seq[Node] =
## Get a `maxAmount` of random nodes from the local routing table. The
## the nodes selected are filtered by provided `enrField`.
d.randomNodes(maxAmount, proc(x: Node): bool = x.record.contains(enrField))
@ -563,7 +563,7 @@ proc ping*(d: Protocol, toNode: Node):
dht_message_requests_outgoing.inc(labelValues = ["invalid_response"])
return err("Invalid response to ping message")
else:
# A ping (or the pong) was lost, what should we do? Previous implementation called
# A ping (or the pong) was lost, what should we do? Previous implementation called
# d.replaceNode(toNode) immediately, which removed the node. This is too aggressive,
# especially if we have a temporary network outage. Although bootstrap nodes are protected
# from being removed, everything else would slowly be removed.

View File

@ -5,7 +5,7 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.push raises: [Defect].}
{.push raises: [].}
import std/sequtils

View File

@ -5,7 +5,7 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.push raises: [Defect].}
{.push raises: [].}
import std/sequtils
import std/strutils

View File

@ -5,7 +5,7 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.push raises: [Defect].}
{.push raises: [].}
import std/options
import std/sequtils

View File

@ -19,7 +19,7 @@ import pkg/stew/byteutils
import pkg/questionable
import pkg/questionable/results
{.push raises: [Defect].}
{.push raises: [].}
import ./maintenance
import ./cache

View File

@ -5,7 +5,7 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.push raises: [Defect].}
{.push raises: [].}
import
std/[algorithm, times, sequtils, bitops, sets, options, tables],
@ -21,7 +21,7 @@ declarePublicGauge dht_routing_table_buckets,
logScope:
topics = "discv5 routingtable"
type
DistanceProc* = proc(a, b: NodeId): NodeId {.raises: [Defect], gcsafe, noSideEffect.}
LogDistanceProc* = proc(a, b: NodeId): uint16 {.raises: [Defect], gcsafe, noSideEffect.}
@ -425,7 +425,7 @@ proc addNode*(r: var RoutingTable, n: Node): NodeStatus =
(depth mod r.bitsPerHop != 0 and depth != ID_SIZE):
r.splitBucket(r.buckets.find(bucket))
return r.addNode(n) # retry adding
# When bucket doesn't get split the node is added to the replacement cache
return r.addReplacement(bucket, n)
@ -555,7 +555,7 @@ proc nodeToRevalidate*(r: RoutingTable): Node =
return b.nodes[^1]
proc randomNodes*(r: RoutingTable, maxAmount: int,
pred: proc(x: Node): bool {.gcsafe, noSideEffect.} = nil): seq[Node] {.raises: Exception.} =
pred: proc(x: Node): bool {.gcsafe, noSideEffect, raises: [].} = nil): seq[Node] =
## Get a `maxAmount` of random nodes from the routing table with the `pred`
## predicate function applied as filter on the nodes selected.
var maxAmount = maxAmount

View File

@ -16,7 +16,7 @@
## - the one derived in the key-exchange started by the other node.
## To alleviate this issue, we store two decryption keys in each session.
{.push raises: [Defect].}
{.push raises: [].}
import
std/options,
@ -39,7 +39,7 @@ type
func makeKey(id: NodeId, address: Address): SessionKey =
var pos = 0
result[pos ..< pos+sizeof(id)] = toBytes(id)
result[pos ..< pos+sizeof(id)] = toBytesBE(id)
pos.inc(sizeof(id))
case address.ip.family
of IpAddressFamily.IpV4:
@ -47,7 +47,7 @@ func makeKey(id: NodeId, address: Address): SessionKey =
of IpAddressFamily.IpV6:
result[pos ..< pos+sizeof(address.ip.address_v6)] = address.ip.address_v6
pos.inc(sizeof(address.ip.address_v6))
result[pos ..< pos+sizeof(address.port)] = toBytes(address.port.uint16)
result[pos ..< pos+sizeof(address.port)] = toBytesBE(address.port.uint16)
func swapr*(s: var Sessions, id: NodeId, address: Address) =
var value: array[3 * sizeof(AesKey), byte]

View File

@ -287,7 +287,7 @@ suite "Discovery v5 Tests":
await mainNode.closeWait()
await testNode.closeWait()
proc testLookupTargets(fast: bool = false) {.async: (raises: [Exception]).} =
proc testLookupTargets(fast: bool = false): Future[bool] {.async.} =
const
nodeCount = 17
@ -306,9 +306,9 @@ suite "Discovery v5 Tests":
for t in nodes:
if n != t:
let pong = await n.ping(t.localNode)
check pong.isOk()
if pong.isErr():
echo pong.error
return false
# check (await n.ping(t.localNode)).isOk()
for i in 1 ..< nodeCount:
@ -318,16 +318,19 @@ suite "Discovery v5 Tests":
let target = nodes[i]
let discovered = await nodes[nodeCount-1].lookup(target.localNode.id, fast = fast)
debug "Lookup result", target = target.localNode, discovered
check discovered[0] == target.localNode
if discovered[0] != target.localNode:
return false
for node in nodes:
await node.closeWait()
return true
test "Lookup targets":
await testLookupTargets()
check await testLookupTargets()
test "Lookup targets using traditional findNode":
await testLookupTargets(fast = true)
check await testLookupTargets(fast = true)
test "Resolve target":
let