From a8a1e39052f43187e423f1e5dd46fc0ec64b5267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Thor=C3=A9n?= Date: Mon, 15 Jun 2020 11:05:37 +0800 Subject: [PATCH] Upgrade submodules (#30) * Update submodules * Fix secureManager signature as part of libp2p upgrade --- tests/v2/standard_setup.nim | 34 +++++++++++++++++++++++++--------- vendor/nim-chronos | 2 +- vendor/nim-confutils | 2 +- vendor/nim-eth | 2 +- vendor/nim-faststreams | 2 +- vendor/nim-json-rpc | 2 +- vendor/nim-json-serialization | 2 +- vendor/nim-libp2p | 2 +- vendor/nimbus-build-system | 2 +- 9 files changed, 33 insertions(+), 17 deletions(-) diff --git a/tests/v2/standard_setup.nim b/tests/v2/standard_setup.nim index e69d1a732..27971f813 100644 --- a/tests/v2/standard_setup.nim +++ b/tests/v2/standard_setup.nim @@ -13,17 +13,27 @@ import libp2p/protocols/pubsub/[pubsub, gossipsub], ../../waku/protocol/v2/waku_protocol -when libp2p_secure == "noise": - import libp2p/protocols/secure/noise -else: - import libp2p/protocols/secure/secio +import + libp2p/protocols/secure/noise, + libp2p/protocols/secure/secio export switch, peer, peerinfo, connection, multiaddress, crypto +type + SecureProtocol* {.pure.} = enum + Noise, + Secio + proc newStandardSwitch*(privKey = none(PrivateKey), address = MultiAddress.init("/ip4/127.0.0.1/tcp/0").tryGet(), triggerSelf = false, + secureManagers: openarray[SecureProtocol] = [ + # NOTE below relates to Eth2 + # TODO investigate why we're getting fewer peers on public testnets with noise + SecureProtocol.Secio, + SecureProtocol.Noise, # array cos order matters + ], verifySignature = libp2p_pubsub_verify, sign = libp2p_pubsub_sign, transportFlags: set[ServerFlags] = {}): Switch = @@ -38,15 +48,21 @@ proc newStandardSwitch*(privKey = none(PrivateKey), transports = @[Transport(TcpTransport.init(transportFlags))] muxers = {MplexCodec: mplexProvider}.toTable identify = newIdentify(peerInfo) - when libp2p_secure == "noise": - let secureManagers = {NoiseCodec: newNoise(seckey).Secure}.toTable - else: - let secureManagers = {SecioCodec: newSecio(seckey).Secure}.toTable + + var + secureManagerInstances: seq[Secure] + for sec in secureManagers: + case sec + of SecureProtocol.Noise: + secureManagerInstances &= newNoise(seckey).Secure + of SecureProtocol.Secio: + secureManagerInstances &= newSecio(seckey).Secure + let pubSub = PubSub newPubSub(WakuSub, peerInfo, triggerSelf) result = newSwitch(peerInfo, transports, identify, muxers, - secureManagers = secureManagers, + secureManagers = secureManagerInstances, pubSub = some(pubSub)) diff --git a/vendor/nim-chronos b/vendor/nim-chronos index bce0f878d..bedd1ded5 160000 --- a/vendor/nim-chronos +++ b/vendor/nim-chronos @@ -1 +1 @@ -Subproject commit bce0f878d16bea14395dc8944ff8dbdeffe33496 +Subproject commit bedd1ded5edc3bfb6877f7025ca4b21f62492ffe diff --git a/vendor/nim-confutils b/vendor/nim-confutils index 6e5d57049..26667818b 160000 --- a/vendor/nim-confutils +++ b/vendor/nim-confutils @@ -1 +1 @@ -Subproject commit 6e5d570490989c753d4645ba9173ef9358d302bb +Subproject commit 26667818be48d428892b26be9535c1f0a98d1510 diff --git a/vendor/nim-eth b/vendor/nim-eth index be9a87848..4d0a7a46b 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit be9a87848e068d68aa8fa1a7bfa07d7c7271eba7 +Subproject commit 4d0a7a46ba38947b8daecb1b5ae817c82c8e16c5 diff --git a/vendor/nim-faststreams b/vendor/nim-faststreams index 81c24860e..5df69fc69 160000 --- a/vendor/nim-faststreams +++ b/vendor/nim-faststreams @@ -1 +1 @@ -Subproject commit 81c24860e2622a15e05c81d15e3d1cc02c460870 +Subproject commit 5df69fc6961e58205189cd92ae2477769fa8c4c0 diff --git a/vendor/nim-json-rpc b/vendor/nim-json-rpc index ecf49a063..8c1a8ef8d 160000 --- a/vendor/nim-json-rpc +++ b/vendor/nim-json-rpc @@ -1 +1 @@ -Subproject commit ecf49a06329f49f1993008b0ee08e3f3e13cc422 +Subproject commit 8c1a8ef8d9fd1705d4e8640b4c30df2caee76881 diff --git a/vendor/nim-json-serialization b/vendor/nim-json-serialization index 8d4c31f7c..c478b7bbb 160000 --- a/vendor/nim-json-serialization +++ b/vendor/nim-json-serialization @@ -1 +1 @@ -Subproject commit 8d4c31f7c2f56e17ec3325ec054fe15ccf4e89d4 +Subproject commit c478b7bbbab6ee298a25c29c7357783d94aaecaa diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index 6affcda93..85b56d0b3 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit 6affcda9378593f96e9d2b75f9d9ac5e6e33c526 +Subproject commit 85b56d0b3a53611feaddd9247dd55bb43dc27103 diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system index 34a884e1c..46b6f7880 160000 --- a/vendor/nimbus-build-system +++ b/vendor/nimbus-build-system @@ -1 +1 @@ -Subproject commit 34a884e1cfa8f4f542db7777085f2024b398eea5 +Subproject commit 46b6f78806026b37e4710eabf8bd047969d2d23c