diff --git a/dagger/blockexchange.nim b/dagger/blockexchange.nim new file mode 100644 index 00000000..125f50bf --- /dev/null +++ b/dagger/blockexchange.nim @@ -0,0 +1,11 @@ +import ./blockexchange/[ + network, + engine, + peercontext] + +import ./blockexchange/protobuf/[ + blockexc, + payments, + presence] + +export network, engine, peercontext, blockexc, payments, presence diff --git a/dagger/blockexchange.out b/dagger/blockexchange.out new file mode 100755 index 00000000..0288a06d Binary files /dev/null and b/dagger/blockexchange.out differ diff --git a/dagger/stores/network/engine.nim b/dagger/blockexchange/engine.nim similarity index 98% rename from dagger/stores/network/engine.nim rename to dagger/blockexchange/engine.nim index 82f59b9a..d28b09c5 100644 --- a/dagger/stores/network/engine.nim +++ b/dagger/blockexchange/engine.nim @@ -15,18 +15,19 @@ import pkg/chronicles import pkg/libp2p import pkg/libp2p/errors +import ../stores/blockstore +import ../blocktype as bt +import ../utils/asyncheapqueue + import ./protobuf/blockexc import ./protobuf/presence -import ../../blocktype as bt -import ../blockstore -import ../../utils/asyncheapqueue import ./network import ./pendingblocks import ./peercontext import ./engine/payments -export peercontext +export peercontext, payments, pendingblocks logScope: topics = "dagger blockexc engine" diff --git a/dagger/stores/network/engine/payments.nim b/dagger/blockexchange/engine/payments.nim similarity index 100% rename from dagger/stores/network/engine/payments.nim rename to dagger/blockexchange/engine/payments.nim diff --git a/dagger/stores/network/network.nim b/dagger/blockexchange/network.nim similarity index 99% rename from dagger/stores/network/network.nim rename to dagger/blockexchange/network.nim index ca96abd6..6338dd00 100644 --- a/dagger/stores/network/network.nim +++ b/dagger/blockexchange/network.nim @@ -16,13 +16,12 @@ import pkg/libp2p import pkg/questionable import pkg/questionable/results -import ../../blocktype as bt +import ../blocktype as bt import ./protobuf/blockexc as pb import ./protobuf/payments import ./networkpeer -export networkpeer -export payments +export networkpeer, payments logScope: topics = "dagger blockexc network" diff --git a/dagger/stores/network/networkpeer.nim b/dagger/blockexchange/networkpeer.nim similarity index 100% rename from dagger/stores/network/networkpeer.nim rename to dagger/blockexchange/networkpeer.nim diff --git a/dagger/stores/network/peercontext.nim b/dagger/blockexchange/peercontext.nim similarity index 97% rename from dagger/stores/network/peercontext.nim rename to dagger/blockexchange/peercontext.nim index d01a92eb..99c7b15f 100644 --- a/dagger/stores/network/peercontext.nim +++ b/dagger/blockexchange/peercontext.nim @@ -8,8 +8,7 @@ import ./protobuf/blockexc import ./protobuf/payments import ./protobuf/presence -export payments -export nitro +export payments, nitro type BlockExcPeerCtx* = ref object of RootObj diff --git a/dagger/stores/network/pendingblocks.nim b/dagger/blockexchange/pendingblocks.nim similarity index 98% rename from dagger/stores/network/pendingblocks.nim rename to dagger/blockexchange/pendingblocks.nim index 4bf27b23..b783c0d1 100644 --- a/dagger/stores/network/pendingblocks.nim +++ b/dagger/blockexchange/pendingblocks.nim @@ -13,7 +13,7 @@ import pkg/chronicles import pkg/chronos import pkg/libp2p -import ../../blocktype +import ../blocktype logScope: topics = "dagger blockexc pendingblocks" diff --git a/dagger/stores/network/protobuf/blockexc.nim b/dagger/blockexchange/protobuf/blockexc.nim similarity index 100% rename from dagger/stores/network/protobuf/blockexc.nim rename to dagger/blockexchange/protobuf/blockexc.nim diff --git a/dagger/stores/network/protobuf/message.proto b/dagger/blockexchange/protobuf/message.proto similarity index 100% rename from dagger/stores/network/protobuf/message.proto rename to dagger/blockexchange/protobuf/message.proto diff --git a/dagger/stores/network/protobuf/message.proto.license b/dagger/blockexchange/protobuf/message.proto.license similarity index 100% rename from dagger/stores/network/protobuf/message.proto.license rename to dagger/blockexchange/protobuf/message.proto.license diff --git a/dagger/stores/network/protobuf/payments.nim b/dagger/blockexchange/protobuf/payments.nim similarity index 100% rename from dagger/stores/network/protobuf/payments.nim rename to dagger/blockexchange/protobuf/payments.nim diff --git a/dagger/stores/network/protobuf/presence.nim b/dagger/blockexchange/protobuf/presence.nim similarity index 100% rename from dagger/stores/network/protobuf/presence.nim rename to dagger/blockexchange/protobuf/presence.nim diff --git a/dagger/stores.nim b/dagger/stores.nim new file mode 100644 index 00000000..bc0e604a --- /dev/null +++ b/dagger/stores.nim @@ -0,0 +1,3 @@ +import ./stores/[memorystore, blockstore, blockexchange] + +export memorystore, blockstore, blockexchange diff --git a/dagger/blockexc.nim b/dagger/stores/blockexchange.nim similarity index 94% rename from dagger/blockexc.nim rename to dagger/stores/blockexchange.nim index 8626c72a..4652437f 100644 --- a/dagger/blockexc.nim +++ b/dagger/stores/blockexchange.nim @@ -14,15 +14,16 @@ import pkg/chronos import pkg/libp2p import pkg/libp2p/errors -import ./stores/network/protobuf/blockexc as pb -import ./blocktype as bt -import ./stores/blockstore -import ./utils/asyncheapqueue +import ../blocktype as bt +import ../utils/asyncheapqueue -import ./stores/network/network -import ./stores/network/engine +import ./blockstore +import ../blockexchange/network +import ../blockexchange/engine +import ../blockexchange/peercontext +import ../blockexchange/protobuf/blockexc as pb -export network, blockstore, asyncheapqueue, engine +export blockstore, network, engine, asyncheapqueue logScope: topics = "dagger blockexc" diff --git a/tests/dagger/blockexc/engine/testpayments.nim b/tests/dagger/blockexc/engine/testpayments.nim index 9020b208..fa8dfe6d 100644 --- a/tests/dagger/blockexc/engine/testpayments.nim +++ b/tests/dagger/blockexc/engine/testpayments.nim @@ -1,5 +1,6 @@ import std/unittest -import pkg/dagger/stores/network/engine/payments + +import pkg/dagger/stores import ../../examples suite "engine payments": diff --git a/tests/dagger/blockexc/protobuf/testpayments.nim b/tests/dagger/blockexc/protobuf/testpayments.nim index 2a2e9ba6..a341255e 100644 --- a/tests/dagger/blockexc/protobuf/testpayments.nim +++ b/tests/dagger/blockexc/protobuf/testpayments.nim @@ -2,7 +2,7 @@ import pkg/asynctest import pkg/chronos import pkg/stew/byteutils import ../../examples -import pkg/dagger/stores/network/protobuf/payments +import pkg/dagger/stores suite "account protobuf messages": diff --git a/tests/dagger/blockexc/protobuf/testpresence.nim b/tests/dagger/blockexc/protobuf/testpresence.nim index dc768cb3..b4a1bc33 100644 --- a/tests/dagger/blockexc/protobuf/testpresence.nim +++ b/tests/dagger/blockexc/protobuf/testpresence.nim @@ -2,7 +2,8 @@ import std/sequtils import pkg/asynctest import pkg/chronos import pkg/libp2p -import pkg/dagger/stores/network/protobuf/presence + +import pkg/dagger/blockexchange/protobuf/presence import ../../examples suite "block presence protobuf messages": diff --git a/tests/dagger/blockexc/testengine.nim b/tests/dagger/blockexc/testengine.nim index 8ea661db..381d3c83 100644 --- a/tests/dagger/blockexc/testengine.nim +++ b/tests/dagger/blockexc/testengine.nim @@ -8,14 +8,11 @@ import pkg/libp2p import pkg/libp2p/errors import pkg/dagger/rng -import pkg/dagger/blockexc -import pkg/dagger/stores/network/protobuf/blockexc as pb -import pkg/dagger/stores/network/pendingblocks -import pkg/dagger/stores/network/engine/payments -import pkg/dagger/stores/network/protobuf/presence -import pkg/dagger/stores/memorystore +import pkg/dagger/blockexchange +import pkg/dagger/stores import pkg/dagger/chunker import pkg/dagger/blocktype as bt +import pkg/dagger/utils/asyncheapqueue import ../helpers import ../examples diff --git a/tests/dagger/blockexc/testnetwork.nim b/tests/dagger/blockexc/testnetwork.nim index 6d4dcc32..56609335 100644 --- a/tests/dagger/blockexc/testnetwork.nim +++ b/tests/dagger/blockexc/testnetwork.nim @@ -5,15 +5,14 @@ import pkg/asynctest import pkg/chronos import pkg/libp2p import pkg/libp2p/errors +import questionable +import questionable/results import pkg/protobuf_serialization import pkg/dagger/rng import pkg/dagger/chunker import pkg/dagger/blocktype as bt -import pkg/dagger/stores/memorystore -import pkg/dagger/stores/network/network -import pkg/dagger/stores/network/protobuf/blockexc -import pkg/dagger/stores/network/protobuf/payments +import pkg/dagger/blockexchange import ../helpers import ../examples diff --git a/tests/dagger/examples.nim b/tests/dagger/examples.nim index ff0d7f69..199a653b 100644 --- a/tests/dagger/examples.nim +++ b/tests/dagger/examples.nim @@ -3,9 +3,7 @@ import std/sequtils import pkg/libp2p import pkg/nitro import pkg/dagger/rng -import pkg/dagger/stores/network/protobuf/payments -import pkg/dagger/stores/network/peercontext -import pkg/dagger/stores/network/engine +import pkg/dagger/stores import pkg/dagger/blocktype proc example*(_: type EthAddress): EthAddress = diff --git a/tests/dagger/blockexc/testblockexc.nim b/tests/dagger/stores/testblockexc.nim similarity index 96% rename from tests/dagger/blockexc/testblockexc.nim rename to tests/dagger/stores/testblockexc.nim index f7ba1801..9d5ebb32 100644 --- a/tests/dagger/blockexc/testblockexc.nim +++ b/tests/dagger/stores/testblockexc.nim @@ -4,17 +4,15 @@ import std/algorithm import pkg/asynctest import pkg/chronos import pkg/stew/byteutils + import pkg/libp2p import pkg/libp2p/errors import pkg/dagger/rng -import pkg/dagger/blockexc -import pkg/dagger/stores/network/protobuf/blockexc as pb -import pkg/dagger/stores/network/engine/payments -import pkg/dagger/stores/memorystore +import pkg/dagger/stores +import pkg/dagger/blockexchange import pkg/dagger/chunker import pkg/dagger/blocktype as bt -import pkg/dagger/utils/asyncheapqueue import ./utils import ../helpers diff --git a/tests/dagger/testblockstore.nim b/tests/dagger/stores/testblockstore.nim similarity index 99% rename from tests/dagger/testblockstore.nim rename to tests/dagger/stores/testblockstore.nim index bc5b2c04..54a0bb04 100644 --- a/tests/dagger/testblockstore.nim +++ b/tests/dagger/stores/testblockstore.nim @@ -10,7 +10,7 @@ import pkg/dagger/rng import pkg/dagger/stores/memorystore import pkg/dagger/chunker -import ./helpers +import ../helpers suite "Memory Store": diff --git a/tests/dagger/blockexc/utils.nim b/tests/dagger/stores/utils.nim similarity index 93% rename from tests/dagger/blockexc/utils.nim rename to tests/dagger/stores/utils.nim index 356a2177..b6b3309c 100644 --- a/tests/dagger/blockexc/utils.nim +++ b/tests/dagger/stores/utils.nim @@ -3,8 +3,7 @@ import std/sequtils import pkg/chronos import pkg/libp2p -import pkg/dagger/blockexc -import pkg/dagger/stores/memorystore +import pkg/dagger/stores import pkg/dagger/blocktype as bt import ../examples @@ -15,7 +14,6 @@ proc generateNodes*( secureManagers: openarray[SecureProtocol] = [ SecureProtocol.Noise, ]): seq[tuple[switch: Switch, blockexc: BlockExc]] = - for i in 0..