diff --git a/libp2pdht.nimble b/libp2pdht.nimble index b40f9d9..546c2a2 100644 --- a/libp2pdht.nimble +++ b/libp2pdht.nimble @@ -12,12 +12,13 @@ requires "nim >= 1.2.0", "nimcrypto >= 0.5.4 & < 0.6.0", "bearssl#head", "chronicles >= 0.10.2 & < 0.11.0", - "chronos >= 3.0.11 & < 3.3.0", + "chronos == 3.2.0", "libp2p#unstable", "metrics", - "secp256k1 >= 0.6.0 & < 0.7.0", + "protobufserialization >= 0.2.0 & <= 0.3.0", + "secp256k1 >= 0.5.2 & < 0.6.1", "stew#head", - "stint", + "stint#036c71d06a6b22f8f967ba9d54afd2189c3872ca", "asynctest >= 0.3.1 & < 0.4.0", "https://github.com/status-im/nim-datastore#head", "questionable" diff --git a/nimble.lock b/nimble.lock index 0b45057..4c561c5 100644 --- a/nimble.lock +++ b/nimble.lock @@ -1,87 +1,54 @@ { - "version": 2, + "version": 1, "packages": { - "upraises": { - "version": "0.1.0", - "vcsRevision": "d9f268db1021959fe0f2c7a5e49fba741f9932a0", - "url": "https://github.com/markspanbroek/upraises", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "176234f808b44a0be763df706ed634d6e8df17bb" - } - }, - "sqlite3_abi": { - "version": "3.40.1.1", - "vcsRevision": "362e1bd9f689ad9f5380d9d27f0705b3d4dfc7d3", - "url": "https://github.com/arnetheduck/nim-sqlite3-abi", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "8e91db8156a82383d9c48f53b33e48f4e93077b1" - } - }, - "asynctest": { - "version": "0.3.2", - "vcsRevision": "a236a5f0f3031573ac2cb082b63dbf6e170e06e7", - "url": "https://github.com/markspanbroek/asynctest", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "0ef50d086659835b0a23a4beb77cb11747695448" - } - }, "unittest2": { - "version": "0.0.7", - "vcsRevision": "b178f47527074964f76c395ad0dfc81cf118f379", - "url": "https://github.com/status-im/nim-unittest2", + "version": "0.0.4", + "vcsRevision": "f180f596c88dfd266f746ed6f8dbebce39c824db", + "url": "https://github.com/status-im/nim-unittest2.git", "downloadMethod": "git", "dependencies": [], "checksums": { - "sha1": "b6d4a5cbe28b43c166d6442ba6804aafd4abe368" + "sha1": "fa309c41eaf6ef57895b9e603f2620a2f6e11780" } }, "stew": { "version": "0.1.0", - "vcsRevision": "13e55ed27a6ab125435ad9f9f0353669b9b554fa", - "url": "https://github.com/status-im/nim-stew", + "vcsRevision": "e18f5a62af2ade7a1fd1d39635d4e04d944def08", + "url": "https://github.com/status-im/nim-stew.git", "downloadMethod": "git", - "dependencies": [ - "unittest2" - ], + "dependencies": [], "checksums": { - "sha1": "88ce27d9e9b86c518cd3d753cd77cf7051e4123f" + "sha1": "2a80972f66597bf87d820dca8164d89d3bb24c6d" } }, "bearssl": { - "version": "0.2.0", - "vcsRevision": "9372f27a25d0718d3527afad6cc936f6a853f86e", + "version": "0.1.5", + "vcsRevision": "f4c4233de453cb7eac0ce3f3ffad6496295f83ab", "url": "https://github.com/status-im/nim-bearssl", "downloadMethod": "git", "dependencies": [ "unittest2" ], "checksums": { - "sha1": "9e9b4c34bae17aa7218e7ce449128064ae5e1118" + "sha1": "dabf4aaac8969fb10281ebd9ff51875d37eeaaa9" } }, "httputils": { "version": "0.3.0", - "vcsRevision": "aad684d3758a74c1b327df93da2e956458410b48", - "url": "https://github.com/status-im/nim-http-utils", + "vcsRevision": "689da19e9e9cfff4ced85e2b25c6b2b5598ed079", + "url": "https://github.com/status-im/nim-http-utils.git", "downloadMethod": "git", "dependencies": [ - "stew", - "unittest2" + "stew" ], "checksums": { - "sha1": "cff631f7f4d6769aa3c02e48ab079b371614896f" + "sha1": "4ad3ad68d13c50184180ab4b2eacc0bd7ed2ed44" } }, "chronos": { - "version": "3.2.0", - "vcsRevision": "ba143e029f35fd9b4cd3d89d007cc834d0d5ba3c", - "url": "https://github.com/status-im/nim-chronos", + "version": "3.0.11", + "vcsRevision": "17fed89c99beac5a92d3668d0d3e9b0e4ac13936", + "url": "https://github.com/status-im/nim-chronos.git", "downloadMethod": "git", "dependencies": [ "stew", @@ -90,64 +57,62 @@ "unittest2" ], "checksums": { - "sha1": "5783067584ac6812eb64b8454ea6f9c97ff1262a" + "sha1": "f6fffc87571e5f76af2a77c4ebcc0e00909ced4e" } }, - "questionable": { - "version": "0.10.8", - "vcsRevision": "6cbbda7e4d009e02d0583b325b31dc68dff27854", - "url": "https://github.com/markspanbroek/questionable", + "metrics": { + "version": "0.0.1", + "vcsRevision": "71e0f0e354e1f4c59e3dc92153989c8b723c3440", + "url": "https://github.com/status-im/nim-metrics", + "downloadMethod": "git", + "dependencies": [ + "chronos" + ], + "checksums": { + "sha1": "86da251fe532ef2163da30343688ab1c148c0340" + } + }, + "combparser": { + "version": "0.2.0", + "vcsRevision": "ba4464c005d7617c008e2ed2ebc1ba52feb469c6", + "url": "https://github.com/PMunch/combparser", "downloadMethod": "git", "dependencies": [], "checksums": { - "sha1": "401d04d895a057513fea64872d26e21309bf1012" + "sha1": "a3635260961a893b88f69aac19f1b24e032a7e97" } }, - "datastore": { - "version": "0.0.1", - "vcsRevision": "0cde8aeb67c59fd0ac95496dc6b5e1168d6632aa", - "url": "https://github.com/status-im/nim-datastore", + "testutils": { + "version": "0.4.2", + "vcsRevision": "aa6e5216f4b4ab5aa971cdcdd70e1ec1203cedf2", + "url": "https://github.com/status-im/nim-testutils", "downloadMethod": "git", "dependencies": [ - "asynctest", - "chronos", - "questionable", - "sqlite3_abi", - "stew", - "unittest2", - "upraises" + "unittest2" ], "checksums": { - "sha1": "2c03bb47de97962d2a64be1ed0a8161cd9d65159" + "sha1": "94427e0cce0e0c5841edcd3a6530b4e6b857a3cb" } }, "faststreams": { "version": "0.3.0", - "vcsRevision": "2a771bb91f8aae8520a5553955a2acce5fdd0c87", - "url": "https://github.com/status-im/nim-faststreams", + "vcsRevision": "1b561a9e71b6bdad1c1cdff753418906037e9d09", + "url": "https://github.com/status-im/nim-faststreams.git", "downloadMethod": "git", "dependencies": [ "stew", + "testutils", + "chronos", "unittest2" ], "checksums": { - "sha1": "787fa266aafe0eebec2c216cc166c31deab36226" - } - }, - "dnsclient": { - "version": "0.3.3", - "vcsRevision": "2b3d4b4e35b5e698fbbeafe16a4fa757926a4673", - "url": "https://github.com/ba0f3/dnsclient.nim", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "e5bd81f1b29bef3c2881d6dfd9adc400956d14af" + "sha1": "97edf9797924af48566a0af8267203dc21d80c77" } }, "serialization": { - "version": "0.2.0", - "vcsRevision": "f0860e1c25acf26ef5e6ea231c7c0537c793b555", - "url": "https://github.com/status-im/nim-serialization", + "version": "0.1.0", + "vcsRevision": "fcd0eadadde0ee000a63df8ab21dc4e9f015a790", + "url": "https://github.com/status-im/nim-serialization.git", "downloadMethod": "git", "dependencies": [ "faststreams", @@ -155,97 +120,70 @@ "stew" ], "checksums": { - "sha1": "744cbc8305ac3e39bba5089aeac1aebe7fe1f507" - } - }, - "nimcrypto": { - "version": "0.5.4", - "vcsRevision": "4014ef939b51e02053c2e16dd3481d47bc9267dd", - "url": "https://github.com/cheatfate/nimcrypto", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "6e0f5178a608ecf7bb046fd0179bf78662fcff16" - } - }, - "testutils": { - "version": "0.5.0", - "vcsRevision": "dfc4c1b39f9ded9baf6365014de2b4bfb4dafc34", - "url": "https://github.com/status-im/nim-testutils", - "downloadMethod": "git", - "dependencies": [ - "unittest2" - ], - "checksums": { - "sha1": "756d0757c4dd06a068f9d38c7f238576ba5ee897" + "sha1": "fef59519892cac70cccd81b612085caaa5e3e6cf" } }, "json_serialization": { - "version": "0.1.5", - "vcsRevision": "aa44ee61dd323022d4abe7cbf4e44668aad88454", - "url": "https://github.com/status-im/nim-json-serialization", + "version": "0.1.0", + "vcsRevision": "c5f0e2465e8375dfc7aa0f56ccef67cb680bc6b0", + "url": "https://github.com/status-im/nim-json-serialization.git", "downloadMethod": "git", "dependencies": [ "serialization", "stew" ], "checksums": { - "sha1": "87124e1a8c4278d85f55ccae7f5597445b57ad8d" + "sha1": "d89d79d0679a3a41b350e3ad4be56c0308cc5ec6" } }, "chronicles": { - "version": "0.10.3", - "vcsRevision": "32ac8679680ea699f7dbc046e8e0131cac97d41a", - "url": "https://github.com/status-im/nim-chronicles", + "version": "0.10.2", + "vcsRevision": "1682096306ddba8185dcfac360a8c3f952d721e4", + "url": "https://github.com/status-im/nim-chronicles.git", "downloadMethod": "git", "dependencies": [ "testutils", "json_serialization" ], "checksums": { - "sha1": "79f09526d4d9b9196dd2f6a75310d71a890c4f88" + "sha1": "9a5bebb76b0f7d587a31e621d260119279e91c76" } }, - "metrics": { - "version": "0.0.1", - "vcsRevision": "abf3acc7f06cee9ee2c287d2f31413dc3df4c04e", - "url": "https://github.com/status-im/nim-metrics", + "asynctest": { + "version": "0.3.1", + "vcsRevision": "5347c59b4b057443a014722aa40800cd8bb95c69", + "url": "https://github.com/status-im/asynctest.git", "downloadMethod": "git", - "dependencies": [ - "chronos" - ], + "dependencies": [], "checksums": { - "sha1": "b966ea6e6f86f1d5c77e7822fc838f6f5c65a9f7" + "sha1": "53e0b610d13700296755a4ebe789882cae47a3b9" } }, - "secp256k1": { - "version": "0.6.0.3.1", - "vcsRevision": "5fd81357839d57ef38fb17647bd5e31dfa9f55b8", - "url": "https://github.com/status-im/nim-secp256k1", + "nimcrypto": { + "version": "0.5.4", + "vcsRevision": "a5742a9a214ac33f91615f3862c7b099aec43b00", + "url": "https://github.com/cheatfate/nimcrypto", "downloadMethod": "git", - "dependencies": [ - "stew", - "nimcrypto" - ], + "dependencies": [], "checksums": { - "sha1": "84c318e294175ba91d25516e0ee676814301ca95" + "sha1": "f76c87707cd4e96355b8bb6ef27e7f8b0aac1e08" } }, "zlib": { "version": "0.1.0", - "vcsRevision": "d65ee2a7611eb9f0ef0e7350caed6e93ccfa9651", + "vcsRevision": "74cdeb54b21bededb5a515d36f608bc1850555a2", "url": "https://github.com/status-im/nim-zlib", "downloadMethod": "git", "dependencies": [ "stew" ], "checksums": { - "sha1": "c4d041561c815506eeb02251205d41e73814e906" + "sha1": "01d330dc4c1924e56b1559ee73bc760e526f635c" } }, "websock": { "version": "0.1.0", - "vcsRevision": "3696e3f3a5b938e478e473a6089bf8de386d2f04", + "vcsRevision": "7b2ed397d6e4c37ea4df08ae82aeac7ff04cd180", "url": "https://github.com/status-im/nim-websock", "downloadMethod": "git", "dependencies": [ @@ -253,17 +191,41 @@ "httputils", "chronicles", "stew", + "asynctest", "nimcrypto", "bearssl", "zlib" ], "checksums": { - "sha1": "e15709d37f9142ed6053098de555f645cca5770f" + "sha1": "d27f126527be59f5a0dc35303cb37b82d4e2770b" + } + }, + "dnsclient": { + "version": "0.1.2", + "vcsRevision": "fbb76f8af8a33ab818184a7d4406d9fee20993be", + "url": "https://github.com/ba0f3/dnsclient.nim.git", + "downloadMethod": "git", + "dependencies": [], + "checksums": { + "sha1": "663239a914c814204b30dda6e0902cc0fbd0b8ee" + } + }, + "secp256k1": { + "version": "0.5.2", + "vcsRevision": "5340cf188168d6afcafc8023770d880f067c0b2f", + "url": "https://github.com/status-im/nim-secp256k1.git", + "downloadMethod": "git", + "dependencies": [ + "stew", + "nimcrypto" + ], + "checksums": { + "sha1": "ae9cbea4487be94a06653ffee075a7f1bd1e231e" } }, "libp2p": { - "version": "1.1.0", - "vcsRevision": "3725f6a95b2619f8e05454ccf5c121a5c5041568", + "version": "1.0.0", + "vcsRevision": "a3e9d1ed80c048cd5abc839cbe0863cefcedc702", "url": "https://github.com/status-im/nim-libp2p", "downloadMethod": "git", "dependencies": [ @@ -275,25 +237,82 @@ "metrics", "secp256k1", "stew", - "websock", - "unittest2" + "websock" ], "checksums": { - "sha1": "5512ca4813243e4b1009ddc404d4dd79c5bfbb3f" + "sha1": "65e473566f19f7f9a3529745e7181fb58d30b5ef" + } + }, + "protobuf_serialization": { + "version": "0.2.0", + "vcsRevision": "f7d671f877e01213494aac7903421ccdbe70616f", + "url": "https://github.com/status-im/nim-protobuf-serialization.git", + "downloadMethod": "git", + "dependencies": [ + "stew", + "faststreams", + "serialization", + "combparser" + ], + "checksums": { + "sha1": "9418459027d0d5eb30a974649dc615a76e8e4aca" } }, "stint": { "version": "0.0.1", - "vcsRevision": "86621eced1dcfb5e25903019ebcfc76ed9128ec5", - "url": "https://github.com/status-im/nim-stint", + "vcsRevision": "036c71d06a6b22f8f967ba9d54afd2189c3872ca", + "url": "https://github.com/status-im/stint.git", "downloadMethod": "git", "dependencies": [ "stew" ], "checksums": { - "sha1": "6b4a6fdd317202b7c092dc32b74a6573f81cca62" + "sha1": "0f187a2115315ca898e5f9a30c5e506cf6057062" + } + }, + "datastore": { + "version": "0.0.1", + "vcsRevision": "0cde8aeb67c59fd0ac95496dc6b5e1168d6632aa", + "url": "https://github.com/status-im/nim-datastore", + "downloadMethod": "git", + "dependencies": [ + ], + "checksums": { + "sha1": "2c03bb47de97962d2a64be1ed0a8161cd9d65159" + } + }, + "questionable": { + "version": "0.10.6", + "vcsRevision": "30e4184a99c8c1ba329925912d2c5d4b09acf8cc", + "url": "https://github.com/status-im/questionable", + "downloadMethod": "git", + "dependencies": [ + ], + "checksums": { + "sha1": "ca2d1e2e0be6566b4bf13261b29645721d01673d" + } + }, + "upraises": { + "version": "0.1.0", + "vcsRevision": "ff4f8108e44fba9b35cac535ab63d3927e8fd3c2", + "url": "https://github.com/markspanbroek/upraises", + "downloadMethod": "git", + "dependencies": [ + ], + "checksums": { + "sha1": "a0243c8039e12d547dbb2e9c73789c16bb8bc956" + } + }, + "sqlite3-abi": { + "version": "3.34.0", + "vcsRevision": "fda455cfea2df707dde052034411ce63de218453", + "url": "https://github.com/arnetheduck/nim-sqlite3-abi", + "downloadMethod": "git", + "dependencies": [ + ], + "checksums": { + "sha1": "720aaffb34259c1a9dd2239c77ee1fbcc2a41346" } } - }, - "tasks": {} -} + } +} \ No newline at end of file diff --git a/tests/dht/test_providermngr.nim b/tests/dht/test_providermngr.nim index 7ec742c..be58c81 100644 --- a/tests/dht/test_providermngr.nim +++ b/tests/dht/test_providermngr.nim @@ -1,8 +1,9 @@ import std/sequtils -import pkg/chronos import pkg/asynctest + +import pkg/chronos import pkg/datastore import pkg/libp2p @@ -22,7 +23,7 @@ suite "Test Providers Manager simple": provider = privKey.toSignedPeerRecord() nodeId = NodeId.example(rng) - teardownAll: + teardownAllAsync: (await ds.close()).tryGet() test "Should add provider": @@ -70,7 +71,7 @@ suite "Test Providers Manager multiple": ds: SQLiteDatastore manager: ProvidersManager - setup: + setupAsync: ds = SQLiteDatastore.new(Memory).tryGet() manager = ProvidersManager.new(ds, disableCache = true) @@ -78,7 +79,7 @@ suite "Test Providers Manager multiple": for p in providers: (await manager.add(id, p)).tryGet - teardown: + teardownAsync: (await ds.close()).tryGet() ds = nil manager = nil @@ -128,7 +129,7 @@ suite "Test providers with cache": ds: SQLiteDatastore manager: ProvidersManager - setup: + setupAsync: ds = SQLiteDatastore.new(Memory).tryGet() manager = ProvidersManager.new(ds) @@ -136,7 +137,7 @@ suite "Test providers with cache": for p in providers: (await manager.add(id, p)).tryGet - teardown: + teardownAsync: (await ds.close()).tryGet() ds = nil manager = nil @@ -196,7 +197,7 @@ suite "Test Provider Maintenance": ds: SQLiteDatastore manager: ProvidersManager - setupAll: + setupAllAsync: ds = SQLiteDatastore.new(Memory).tryGet() manager = ProvidersManager.new(ds, disableCache = true) @@ -204,7 +205,7 @@ suite "Test Provider Maintenance": for p in providers: (await manager.add(id, p, ttl = 1.millis)).tryGet - teardownAll: + teardownAllAsync: (await ds.close()).tryGet() ds = nil manager = nil diff --git a/tests/dht/test_providers.nim b/tests/dht/test_providers.nim index fecb9b9..8d79e55 100644 --- a/tests/dht/test_providers.nim +++ b/tests/dht/test_providers.nim @@ -77,7 +77,7 @@ suite "Providers Tests: node alone": signedPeerRec0: SignedPeerRecord peerRec0: PeerRecord - setupAll: + setupAllAsync: rng = newRng() nodes = await bootstrapNetwork(nodecount=1) targetId = NodeId.example(rng) @@ -85,7 +85,7 @@ suite "Providers Tests: node alone": signedPeerRec0 = privKey0.toSignedPeerRecord peerRec0 = signedPeerRec0.data - teardownAll: + teardownAllAsync: for (n, _) in nodes: await n.closeWait() await sleepAsync(chronos.seconds(3)) @@ -137,7 +137,7 @@ suite "Providers Tests: two nodes": signedPeerRec0: SignedPeerRecord peerRec0: PeerRecord - setupAll: + setupAllAsync: rng = newRng() nodes = await bootstrapNetwork(nodecount=3) targetId = NodeId.example(rng) @@ -145,7 +145,7 @@ suite "Providers Tests: two nodes": signedPeerRec0 = privKey0.toSignedPeerRecord peerRec0 = signedPeerRec0.data - teardownAll: + teardownAllAsync: for (n, _) in nodes: await n.closeWait() await sleepAsync(chronos.seconds(3)) @@ -186,7 +186,7 @@ suite "Providers Tests: 20 nodes": signedPeerRec0: SignedPeerRecord peerRec0: PeerRecord - setupAll: + setupAllAsync: rng = newRng() nodes = await bootstrapNetwork(nodecount=20) targetId = NodeId.example(rng) @@ -196,7 +196,7 @@ suite "Providers Tests: 20 nodes": await sleepAsync(chronos.seconds(15)) - teardownAll: + teardownAllAsync: for (n, _) in nodes: # if last test is enabled, we need nodes[1..^1] here await n.closeWait()