diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e9ed94a..34f58414 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -209,12 +209,12 @@ jobs: make NIM_COMMIT="${{ matrix.branch }}" testAll if [[ ${{ runner.os }} = macOS ]]; then echo - echo otool -L build/testDagger - otool -L build/testDagger + echo otool -L build/testCodex + otool -L build/testCodex else echo - echo ldd build/testDagger - ldd build/testDagger + echo ldd build/testCodex + ldd build/testCodex fi echo "Testing TRACE log level" - ./env.sh nim c -d:chronicles_log_level=TRACE dagger.nim + ./env.sh nim c -d:chronicles_log_level=TRACE codex.nim diff --git a/.gitignore b/.gitignore index c9bad6d9..b1c8f7e0 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,4 @@ nimble.paths .env .update.timestamp -dagger.nims +codex.nims diff --git a/Makefile b/Makefile index b6bdb8c7..30adaf84 100644 --- a/Makefile +++ b/Makefile @@ -56,15 +56,15 @@ else NIM_PARAMS := $(NIM_PARAMS) -d:release endif -deps: | deps-common nat-libs dagger.nims +deps: | deps-common nat-libs codex.nims ifneq ($(USE_LIBBACKTRACE), 0) deps: | libbacktrace endif -#- deletes and recreates "dagger.nims" which on Windows is a copy instead of a proper symlink +#- deletes and recreates "codex.nims" which on Windows is a copy instead of a proper symlink update: | update-common - rm -rf dagger.nims && \ - $(MAKE) dagger.nims $(HANDLE_OUTPUT) + rm -rf codex.nims && \ + $(MAKE) codex.nims $(HANDLE_OUTPUT) # detecting the os ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10... @@ -79,16 +79,16 @@ endif # Builds and run a part of the test suite test: | build deps echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim test $(NIM_PARAMS) dagger.nims + $(ENV_SCRIPT) nim test $(NIM_PARAMS) codex.nims # Builds and runs all tests testAll: | build deps - echo -e $(BUILD_MSG) "build/testDagger" "build/testContracts" && \ - $(ENV_SCRIPT) nim testAll $(NIM_PARAMS) dagger.nims + echo -e $(BUILD_MSG) "build/testCodex" "build/testContracts" && \ + $(ENV_SCRIPT) nim testAll $(NIM_PARAMS) codex.nims # symlink -dagger.nims: - ln -s dagger.nimble $@ +codex.nims: + ln -s codex.nimble $@ # nim-libbacktrace libbacktrace: @@ -96,12 +96,12 @@ libbacktrace: coverage: $(MAKE) NIMFLAGS="--lineDir:on --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage" testAll - cd nimcache/release/testDagger && rm -f *.c + cd nimcache/release/testCodex && rm -f *.c cd nimcache/release/testContracts && rm -f *.c mkdir -p coverage - lcov --capture --directory nimcache/release/testDagger --directory nimcache/release/testContracts --output-file coverage/coverage.info - shopt -s globstar && ls $$(pwd)/dagger/{*,**/*}.nim - shopt -s globstar && lcov --extract coverage/coverage.info $$(pwd)/dagger/{*,**/*}.nim --output-file coverage/coverage.f.info + lcov --capture --directory nimcache/release/testCodex --directory nimcache/release/testContracts --output-file coverage/coverage.info + shopt -s globstar && ls $$(pwd)/codex/{*,**/*}.nim + shopt -s globstar && lcov --extract coverage/coverage.info $$(pwd)/codex/{*,**/*}.nim --output-file coverage/coverage.f.info echo -e $(BUILD_MSG) "coverage/report/index.html" genhtml coverage/coverage.f.info --output-directory coverage/report if which open >/dev/null; then (echo -e "\e[92mOpening\e[39m HTML coverage report in browser..." && open coverage/report/index.html) || true; fi diff --git a/dagger.nim b/codex.nim similarity index 88% rename from dagger.nim rename to codex.nim index 72249041..1003d21a 100644 --- a/dagger.nim +++ b/codex.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -12,23 +12,23 @@ import pkg/chronos import pkg/confutils import pkg/libp2p -import ./dagger/conf -import ./dagger/dagger +import ./codex/conf +import ./codex/codex -export dagger, conf, libp2p, chronos, chronicles +export codex, conf, libp2p, chronos, chronicles when isMainModule: import std/os import pkg/confutils/defs - import ./dagger/utils/fileutils + import ./codex/utils/fileutils when defined(posix): import system/ansi_c - let config = DaggerConf.load( - version = daggerFullVersion + let config = CodexConf.load( + version = codexFullVersion ) config.setupLogging() config.setupMetrics() @@ -50,7 +50,7 @@ when isMainModule: trace "Repo dir initialized", dir = config.dataDir / "repo" - let server = DaggerServer.new(config) + let server = CodexServer.new(config) ## Ctrl+C handling proc controlCHandler() {.noconv.} = diff --git a/dagger.nimble b/codex.nimble similarity index 83% rename from dagger.nimble rename to codex.nimble index 34bbc6cc..d3e017aa 100644 --- a/dagger.nimble +++ b/codex.nimble @@ -1,7 +1,7 @@ mode = ScriptMode.Verbose version = "0.1.0" -author = "Dagger Team" +author = "Codex Team" description = "p2p data durability engine" license = "MIT" binDir = "build" @@ -28,7 +28,7 @@ requires "nim >= 1.2.0", when declared(namedBin): namedBin = { - "dagger/dagger": "dagger" + "codex/codex": "codex" }.toTable() ### Helper functions @@ -45,23 +45,23 @@ proc test(name: string, srcDir = "tests/", lang = "c") = buildBinary name, srcDir exec "build/" & name -task dagger, "build dagger binary": - buildBinary "dagger" +task codex, "build codex binary": + buildBinary "codex" -task testDagger, "Build & run Dagger tests": - test "testDagger" +task testCodex, "Build & run Codex tests": + test "testCodex" -task testContracts, "Build & run Dagger Contract tests": +task testContracts, "Build & run Codex Contract tests": test "testContracts" task testIntegration, "Run integration tests": - daggerTask() + codexTask() test "testIntegration" task test, "Run tests": - testDaggerTask() + testCodexTask() task testAll, "Run all tests": - testDaggerTask() + testCodexTask() testContractsTask() testIntegrationTask() diff --git a/dagger/blockexchange.nim b/codex/blockexchange.nim similarity index 100% rename from dagger/blockexchange.nim rename to codex/blockexchange.nim diff --git a/dagger/blockexchange/engine.nim b/codex/blockexchange/engine.nim similarity index 99% rename from dagger/blockexchange/engine.nim rename to codex/blockexchange/engine.nim index 6a67d964..6223ee13 100644 --- a/dagger/blockexchange/engine.nim +++ b/codex/blockexchange/engine.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -30,7 +30,7 @@ import ./pendingblocks export peers, pendingblocks, payments, discovery logScope: - topics = "dagger blockexc engine" + topics = "codex blockexc engine" const DefaultMaxPeersPerRequest* = 10 diff --git a/dagger/blockexchange/engine/discovery.nim b/codex/blockexchange/engine/discovery.nim similarity index 99% rename from dagger/blockexchange/engine/discovery.nim rename to codex/blockexchange/engine/discovery.nim index aba3ccd0..aeb88557 100644 --- a/dagger/blockexchange/engine/discovery.nim +++ b/codex/blockexchange/engine/discovery.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -25,7 +25,7 @@ import ../../stores/blockstore import ../pendingblocks logScope: - topics = "dagger discovery engine" + topics = "codex discovery engine" const DefaultConcurrentDiscRequests = 10 diff --git a/dagger/blockexchange/engine/payments.nim b/codex/blockexchange/engine/payments.nim similarity index 100% rename from dagger/blockexchange/engine/payments.nim rename to codex/blockexchange/engine/payments.nim diff --git a/dagger/blockexchange/network.nim b/codex/blockexchange/network.nim similarity index 99% rename from dagger/blockexchange/network.nim rename to codex/blockexchange/network.nim index 60fe6a28..0c14e51c 100644 --- a/dagger/blockexchange/network.nim +++ b/codex/blockexchange/network.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -26,9 +26,9 @@ import ./networkpeer export networkpeer, payments logScope: - topics = "dagger blockexc network" + topics = "codex blockexc network" -const Codec* = "/dagger/blockexc/1.0.0" +const Codec* = "/codex/blockexc/1.0.0" type WantListHandler* = proc(peer: PeerID, wantList: WantList): Future[void] {.gcsafe.} diff --git a/dagger/blockexchange/networkpeer.nim b/codex/blockexchange/networkpeer.nim similarity index 97% rename from dagger/blockexchange/networkpeer.nim rename to codex/blockexchange/networkpeer.nim index bf84384a..1c44c3c2 100644 --- a/dagger/blockexchange/networkpeer.nim +++ b/codex/blockexchange/networkpeer.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -15,7 +15,7 @@ import pkg/libp2p import ./protobuf/blockexc logScope: - topics = "dagger blockexc networkpeer" + topics = "codex blockexc networkpeer" const MaxMessageSize = 100 * 1024 * 1024 # manifest files can be big diff --git a/dagger/blockexchange/peercontext.nim b/codex/blockexchange/peercontext.nim similarity index 100% rename from dagger/blockexchange/peercontext.nim rename to codex/blockexchange/peercontext.nim diff --git a/dagger/blockexchange/peers.nim b/codex/blockexchange/peers.nim similarity index 100% rename from dagger/blockexchange/peers.nim rename to codex/blockexchange/peers.nim diff --git a/dagger/blockexchange/peers/peerctxstore.nim b/codex/blockexchange/peers/peerctxstore.nim similarity index 97% rename from dagger/blockexchange/peers/peerctxstore.nim rename to codex/blockexchange/peers/peerctxstore.nim index 9453a6f8..77ad6f60 100644 --- a/dagger/blockexchange/peers/peerctxstore.nim +++ b/codex/blockexchange/peers/peerctxstore.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -25,7 +25,7 @@ import ../peercontext export peercontext logScope: - topics = "dagger blockexc peerctxstore" + topics = "codex blockexc peerctxstore" type PeerCtxStore* = ref object of RootObj diff --git a/dagger/blockexchange/pendingblocks.nim b/codex/blockexchange/pendingblocks.nim similarity index 97% rename from dagger/blockexchange/pendingblocks.nim rename to codex/blockexchange/pendingblocks.nim index f1e30f6c..5539734f 100644 --- a/dagger/blockexchange/pendingblocks.nim +++ b/codex/blockexchange/pendingblocks.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -21,7 +21,7 @@ import pkg/libp2p import ../blocktype logScope: - topics = "dagger blockexc pendingblocks" + topics = "codex blockexc pendingblocks" const DefaultBlockTimeout* = 10.minutes diff --git a/dagger/blockexchange/protobuf/blockexc.nim b/codex/blockexchange/protobuf/blockexc.nim similarity index 98% rename from dagger/blockexchange/protobuf/blockexc.nim rename to codex/blockexchange/protobuf/blockexc.nim index b7b7bf47..326a098a 100644 --- a/dagger/blockexchange/protobuf/blockexc.nim +++ b/codex/blockexchange/protobuf/blockexc.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/blockexchange/protobuf/message.proto b/codex/blockexchange/protobuf/message.proto similarity index 100% rename from dagger/blockexchange/protobuf/message.proto rename to codex/blockexchange/protobuf/message.proto diff --git a/dagger/blockexchange/protobuf/message.proto.license b/codex/blockexchange/protobuf/message.proto.license similarity index 100% rename from dagger/blockexchange/protobuf/message.proto.license rename to codex/blockexchange/protobuf/message.proto.license diff --git a/dagger/blockexchange/protobuf/payments.nim b/codex/blockexchange/protobuf/payments.nim similarity index 100% rename from dagger/blockexchange/protobuf/payments.nim rename to codex/blockexchange/protobuf/payments.nim diff --git a/dagger/blockexchange/protobuf/presence.nim b/codex/blockexchange/protobuf/presence.nim similarity index 100% rename from dagger/blockexchange/protobuf/presence.nim rename to codex/blockexchange/protobuf/presence.nim diff --git a/dagger/blocktype.nim b/codex/blocktype.nim similarity index 99% rename from dagger/blocktype.nim rename to codex/blocktype.nim index ce48d497..b324c2a4 100644 --- a/dagger/blocktype.nim +++ b/codex/blocktype.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/chunker.nim b/codex/chunker.nim similarity index 99% rename from dagger/chunker.nim rename to codex/chunker.nim index 1ecb5cb2..6b0b9cc2 100644 --- a/dagger/chunker.nim +++ b/codex/chunker.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/clock.nim b/codex/clock.nim similarity index 100% rename from dagger/clock.nim rename to codex/clock.nim diff --git a/dagger/dagger.nim b/codex/codex.nim similarity index 89% rename from dagger/dagger.nim rename to codex/codex.nim index f938bd8b..27baa2a2 100644 --- a/dagger/dagger.nim +++ b/codex/codex.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -33,26 +33,26 @@ import ./discovery import ./contracts type - DaggerServer* = ref object + CodexServer* = ref object runHandle: Future[void] - config: DaggerConf + config: CodexConf restServer: RestServerRef - daggerNode: DaggerNodeRef + codexNode: CodexNodeRef -proc start*(s: DaggerServer) {.async.} = +proc start*(s: CodexServer) {.async.} = s.restServer.start() - await s.daggerNode.start() + await s.codexNode.start() s.runHandle = newFuture[void]() await s.runHandle -proc stop*(s: DaggerServer) {.async.} = +proc stop*(s: CodexServer) {.async.} = await allFuturesThrowing( - s.restServer.stop(), s.daggerNode.stop()) + s.restServer.stop(), s.codexNode.stop()) s.runHandle.complete() -proc new*(T: type DaggerServer, config: DaggerConf): T = +proc new*(T: type CodexServer, config: CodexConf): T = const SafePermissions = {UserRead, UserWrite} let @@ -130,9 +130,9 @@ proc new*(T: type DaggerServer, config: DaggerConf): T = config.ethDeployment, config.ethAccount ) - daggerNode = DaggerNodeRef.new(switch, store, engine, erasure, blockDiscovery, contracts) + codexNode = CodexNodeRef.new(switch, store, engine, erasure, blockDiscovery, contracts) restServer = RestServerRef.new( - daggerNode.initRestApi(config), + codexNode.initRestApi(config), initTAddress("127.0.0.1" , config.apiPort), bufferSize = (1024 * 64), maxRequestBodySize = int.high) @@ -141,6 +141,6 @@ proc new*(T: type DaggerServer, config: DaggerConf): T = switch.mount(network) T( config: config, - daggerNode: daggerNode, + codexNode: codexNode, restServer: restServer, ) diff --git a/dagger/conf.nim b/codex/conf.nim similarity index 94% rename from dagger/conf.nim rename to codex/conf.nim index 5ef7f770..6f16adb2 100644 --- a/dagger/conf.nim +++ b/codex/conf.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -44,7 +44,7 @@ type Json = "json" None = "none" - DaggerConf* = object + CodexConf* = object logLevel* {. defaultValue: LogLevel.INFO desc: "Sets the log level", @@ -74,7 +74,7 @@ type name: "metrics-port" }: Port dataDir* {. - desc: "The directory where dagger will store configuration and data." + desc: "The directory where codex will store configuration and data." defaultValue: defaultDataDir() defaultValueDesc: "" abbr: "d" @@ -124,7 +124,7 @@ type name: "max-peers" }: int agentString* {. - defaultValue: "Dagger" + defaultValue: "Codex" desc: "Node agent string which is used as identifier in network" name: "agent-string" }: string @@ -171,20 +171,20 @@ const nimBanner* = staticExec("nim --version | grep Version") #TODO add versionMajor, Minor & Fix when we switch to semver - daggerVersion* = gitRevision + codexVersion* = gitRevision - daggerFullVersion* = - "Dagger build " & daggerVersion & "\p" & + codexFullVersion* = + "Codex build " & codexVersion & "\p" & nimBanner proc defaultDataDir*(): string = let dataDir = when defined(windows): - "AppData" / "Roaming" / "Dagger" + "AppData" / "Roaming" / "Codex" elif defined(macosx): - "Library" / "Application Support" / "Dagger" + "Library" / "Application Support" / "Codex" else: - ".cache" / "dagger" + ".cache" / "codex" getHomeDir() / dataDir @@ -246,7 +246,7 @@ proc stripAnsi(v: string): string = res -proc setupLogging*(conf: DaggerConf) = +proc setupLogging*(conf: CodexConf) = when defaultChroniclesStream.outputs.type.arity != 2: warn "Logging configuration options not enabled in the current build" else: @@ -283,7 +283,7 @@ proc setupLogging*(conf: DaggerConf) = setLogLevel(conf.logLevel) -proc setupMetrics*(config: DaggerConf) = +proc setupMetrics*(config: CodexConf) = if config.metricsEnabled: let metricsAddress = config.metricsAddress notice "Starting metrics HTTP server", diff --git a/dagger/contracts.nim b/codex/contracts.nim similarity index 100% rename from dagger/contracts.nim rename to codex/contracts.nim diff --git a/dagger/contracts/Readme.md b/codex/contracts/Readme.md similarity index 94% rename from dagger/contracts/Readme.md rename to codex/contracts/Readme.md index 687b0acc..6a4ea8d0 100644 --- a/dagger/contracts/Readme.md +++ b/codex/contracts/Readme.md @@ -1,13 +1,13 @@ -Dagger Contracts in Nim +Codex Contracts in Nim ======================= -Nim API for the [Dagger smart contracts][1]. +Nim API for the [Codex smart contracts][1]. Usage ----- For a global overview of the steps involved in starting and fulfilling a -storage contract, see [Dagger Contracts][1]. +storage contract, see [Codex Contracts][1]. Smart contract -------------- @@ -15,7 +15,7 @@ Smart contract Connecting to the smart contract on an Ethereum node: ```nim -import dagger/contracts +import codex/contracts import ethers let address = # fill in address where the contract was deployed @@ -178,4 +178,4 @@ await storage [1]: https://github.com/status-im/dagger-contracts/ [2]: https://ethereum.org/en/developers/docs/standards/tokens/erc-20/ -[3]: https://github.com/status-im/dagger-research/blob/main/design/storage-proof-timing.md +[3]: https://github.com/status-im/codex-research/blob/main/design/storage-proof-timing.md diff --git a/dagger/contracts/clock.nim b/codex/contracts/clock.nim similarity index 100% rename from dagger/contracts/clock.nim rename to codex/contracts/clock.nim diff --git a/dagger/contracts/deployment.nim b/codex/contracts/deployment.nim similarity index 100% rename from dagger/contracts/deployment.nim rename to codex/contracts/deployment.nim diff --git a/dagger/contracts/interactions.nim b/codex/contracts/interactions.nim similarity index 100% rename from dagger/contracts/interactions.nim rename to codex/contracts/interactions.nim diff --git a/dagger/contracts/market.nim b/codex/contracts/market.nim similarity index 100% rename from dagger/contracts/market.nim rename to codex/contracts/market.nim diff --git a/dagger/contracts/offers.nim b/codex/contracts/offers.nim similarity index 100% rename from dagger/contracts/offers.nim rename to codex/contracts/offers.nim diff --git a/dagger/contracts/proofs.nim b/codex/contracts/proofs.nim similarity index 100% rename from dagger/contracts/proofs.nim rename to codex/contracts/proofs.nim diff --git a/dagger/contracts/requests.nim b/codex/contracts/requests.nim similarity index 100% rename from dagger/contracts/requests.nim rename to codex/contracts/requests.nim diff --git a/dagger/contracts/storage.nim b/codex/contracts/storage.nim similarity index 100% rename from dagger/contracts/storage.nim rename to codex/contracts/storage.nim diff --git a/dagger/contracts/testtoken.nim b/codex/contracts/testtoken.nim similarity index 100% rename from dagger/contracts/testtoken.nim rename to codex/contracts/testtoken.nim diff --git a/dagger/discovery.nim b/codex/discovery.nim similarity index 99% rename from dagger/discovery.nim rename to codex/discovery.nim index 44dfd04d..5ead151a 100644 --- a/dagger/discovery.nim +++ b/codex/discovery.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/erasure.nim b/codex/erasure.nim similarity index 97% rename from dagger/erasure.nim rename to codex/erasure.nim index b55ba413..b14d8e52 100644 --- a/dagger/erasure.nim +++ b/codex/erasure.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/erasure/backend.nim b/codex/erasure/backend.nim similarity index 98% rename from dagger/erasure/backend.nim rename to codex/erasure/backend.nim index 35a30cd2..9feac36b 100644 --- a/dagger/erasure/backend.nim +++ b/codex/erasure/backend.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/erasure/backends/leopard.nim b/codex/erasure/backends/leopard.nim similarity index 99% rename from dagger/erasure/backends/leopard.nim rename to codex/erasure/backends/leopard.nim index afeb13e7..bf0a8161 100644 --- a/dagger/erasure/backends/leopard.nim +++ b/codex/erasure/backends/leopard.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/erasure/erasure.nim b/codex/erasure/erasure.nim similarity index 99% rename from dagger/erasure/erasure.nim rename to codex/erasure/erasure.nim index c47f57cd..87fc6a17 100644 --- a/dagger/erasure/erasure.nim +++ b/codex/erasure/erasure.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -26,7 +26,7 @@ import ./backend export backend logScope: - topics = "dagger erasure" + topics = "codex erasure" type ## Encode a manifest into one that is erasure protected. diff --git a/dagger/errors.nim b/codex/errors.nim similarity index 75% rename from dagger/errors.nim rename to codex/errors.nim index 847db46b..b3777f2a 100644 --- a/dagger/errors.nim +++ b/codex/errors.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -10,12 +10,12 @@ import pkg/stew/results type - DaggerError* = object of CatchableError # base dagger error - DaggerResult*[T] = Result[T, ref DaggerError] + CodexError* = object of CatchableError # base codex error + CodexResult*[T] = Result[T, ref CodexError] template mapFailure*( exp: untyped, - exc: typed = type DaggerError): untyped = + exc: typed = type CodexError): untyped = ## Convert `Result[T, E]` to `Result[E, ref CatchableError]` ## diff --git a/dagger/manifest.nim b/codex/manifest.nim similarity index 100% rename from dagger/manifest.nim rename to codex/manifest.nim diff --git a/dagger/manifest/coders.nim b/codex/manifest/coders.nim similarity index 99% rename from dagger/manifest/coders.nim rename to codex/manifest/coders.nim index 02b76c6f..f99277bd 100644 --- a/dagger/manifest/coders.nim +++ b/codex/manifest/coders.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/manifest/manifest.nim b/codex/manifest/manifest.nim similarity index 99% rename from dagger/manifest/manifest.nim rename to codex/manifest/manifest.nim index e797ef4b..ebfe039a 100644 --- a/dagger/manifest/manifest.nim +++ b/codex/manifest/manifest.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/manifest/types.nim b/codex/manifest/types.nim similarity index 99% rename from dagger/manifest/types.nim rename to codex/manifest/types.nim index b0b7ddec..3ae0e497 100644 --- a/dagger/manifest/types.nim +++ b/codex/manifest/types.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/market.nim b/codex/market.nim similarity index 100% rename from dagger/market.nim rename to codex/market.nim diff --git a/dagger/node.nim b/codex/node.nim similarity index 92% rename from dagger/node.nim rename to codex/node.nim index 8a40baaf..82e73763 100644 --- a/dagger/node.nim +++ b/codex/node.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -32,12 +32,12 @@ import ./discovery import ./contracts logScope: - topics = "dagger node" + topics = "codex node" type - DaggerError = object of CatchableError + CodexError = object of CatchableError - DaggerNodeRef* = ref object + CodexNodeRef* = ref object switch*: Switch networkId*: PeerID blockStore*: BlockStore @@ -46,7 +46,7 @@ type discovery*: Discovery contracts*: ?ContractInteractions -proc start*(node: DaggerNodeRef) {.async.} = +proc start*(node: CodexNodeRef) {.async.} = if not node.switch.isNil: await node.switch.start() @@ -63,9 +63,9 @@ proc start*(node: DaggerNodeRef) {.async.} = await contracts.start() node.networkId = node.switch.peerInfo.peerId - notice "Started dagger node", id = $node.networkId, addrs = node.switch.peerInfo.addrs + notice "Started codex node", id = $node.networkId, addrs = node.switch.peerInfo.addrs -proc stop*(node: DaggerNodeRef) {.async.} = +proc stop*(node: CodexNodeRef) {.async.} = trace "Stopping node" if not node.engine.isNil: @@ -84,28 +84,28 @@ proc stop*(node: DaggerNodeRef) {.async.} = await contracts.stop() proc findPeer*( - node: DaggerNodeRef, + node: CodexNodeRef, peerId: PeerID): Future[?PeerRecord] {.async.} = return await node.discovery.findPeer(peerId) proc connect*( - node: DaggerNodeRef, + node: CodexNodeRef, peerId: PeerID, addrs: seq[MultiAddress]): Future[void] = node.switch.connect(peerId, addrs) proc retrieve*( - node: DaggerNodeRef, + node: CodexNodeRef, cid: Cid): Future[?!LPStream] {.async.} = trace "Received retrieval request", cid without blk =? await node.blockStore.getBlock(cid): return failure( - newException(DaggerError, "Couldn't retrieve block for Cid!")) + newException(CodexError, "Couldn't retrieve block for Cid!")) without mc =? blk.cid.contentType(): return failure( - newException(DaggerError, "Couldn't identify Cid!")) + newException(CodexError, "Couldn't identify Cid!")) # if we got a manifest, stream the blocks if $mc in ManifestContainers: @@ -152,7 +152,7 @@ proc retrieve*( return LPStream(stream).success() proc store*( - node: DaggerNodeRef, + node: CodexNodeRef, stream: LPStream): Future[?!Cid] {.async.} = trace "Storing data" @@ -186,7 +186,7 @@ proc store*( # Generate manifest without data =? blockManifest.encode(): return failure( - newException(DaggerError, "Could not generate dataset manifest!")) + newException(CodexError, "Could not generate dataset manifest!")) # Store as a dag-pb block without manifest =? bt.Block.new(data = data, codec = DagPBCodec): @@ -207,7 +207,7 @@ proc store*( return manifest.cid.success -proc requestStorage*(self: DaggerNodeRef, +proc requestStorage*(self: CodexNodeRef, cid: Cid, duration: UInt256, nodes: uint, @@ -289,7 +289,7 @@ proc requestStorage*(self: DaggerNodeRef, return success purchase.id proc new*( - T: type DaggerNodeRef, + T: type CodexNodeRef, switch: Switch, store: BlockStore, engine: BlockExcEngine, diff --git a/dagger/por/README.md b/codex/por/README.md similarity index 100% rename from dagger/por/README.md rename to codex/por/README.md diff --git a/dagger/por/benchmark.nim b/codex/por/benchmark.nim similarity index 100% rename from dagger/por/benchmark.nim rename to codex/por/benchmark.nim diff --git a/dagger/por/example.txt b/codex/por/example.txt similarity index 100% rename from dagger/por/example.txt rename to codex/por/example.txt diff --git a/dagger/por/por.nim b/codex/por/por.nim similarity index 99% rename from dagger/por/por.nim rename to codex/por/por.nim index fa021be4..d0d1f7c4 100644 --- a/dagger/por/por.nim +++ b/codex/por/por.nim @@ -199,8 +199,8 @@ proc split(f: File, s: int64): int64 = return n proc hashToG1[T: byte|char](msg: openArray[T]): blst_p1 = - ## Hash to curve with Dagger specific domain separation - const dst = "DAGGER-PROOF-OF-CONCEPT" + ## Hash to curve with Codex specific domain separation + const dst = "CODEX-PROOF-OF-CONCEPT" result.blst_hash_to_g1(msg, dst, aug = "") proc hashNameI(name: array[namelen, byte], i: int64): blst_p1 = diff --git a/dagger/por/testpor.nim b/codex/por/testpor.nim similarity index 100% rename from dagger/por/testpor.nim rename to codex/por/testpor.nim diff --git a/dagger/por/timing/periods.nim b/codex/por/timing/periods.nim similarity index 100% rename from dagger/por/timing/periods.nim rename to codex/por/timing/periods.nim diff --git a/dagger/por/timing/proofs.nim b/codex/por/timing/proofs.nim similarity index 100% rename from dagger/por/timing/proofs.nim rename to codex/por/timing/proofs.nim diff --git a/dagger/proving.nim b/codex/proving.nim similarity index 100% rename from dagger/proving.nim rename to codex/proving.nim diff --git a/dagger/purchasing.nim b/codex/purchasing.nim similarity index 100% rename from dagger/purchasing.nim rename to codex/purchasing.nim diff --git a/dagger/rest/api.nim b/codex/rest/api.nim similarity index 94% rename from dagger/rest/api.nim rename to codex/rest/api.nim index d0aef0ae..22a27c1a 100644 --- a/dagger/rest/api.nim +++ b/codex/rest/api.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -102,11 +102,11 @@ proc decodeString(_: type array[32, byte], except ValueError as e: err e.msg.cstring -proc initRestApi*(node: DaggerNodeRef, conf: DaggerConf): RestRouter = +proc initRestApi*(node: CodexNodeRef, conf: CodexConf): RestRouter = var router = RestRouter.init(validate) router.api( MethodGet, - "/api/dagger/v1/connect/{peerId}") do ( + "/api/codex/v1/connect/{peerId}") do ( peerId: PeerID, addrs: seq[MultiAddress]) -> RestApiResponse: ## Connect to a peer @@ -140,7 +140,7 @@ proc initRestApi*(node: DaggerNodeRef, conf: DaggerConf): RestRouter = router.api( MethodGet, - "/api/dagger/v1/download/{id}") do ( + "/api/codex/v1/download/{id}") do ( id: Cid, resp: HttpResponseRef) -> RestApiResponse: ## Download a file from the node in a streaming ## manner @@ -185,7 +185,7 @@ proc initRestApi*(node: DaggerNodeRef, conf: DaggerConf): RestRouter = router.rawApi( MethodPost, - "/api/dagger/v1/storage/request/{cid}") do (cid: Cid) -> RestApiResponse: + "/api/codex/v1/storage/request/{cid}") do (cid: Cid) -> RestApiResponse: ## Create a request for storage ## ## cid - the cid of a previously uploaded dataset @@ -216,7 +216,7 @@ proc initRestApi*(node: DaggerNodeRef, conf: DaggerConf): RestRouter = router.rawApi( MethodPost, - "/api/dagger/v1/upload") do ( + "/api/codex/v1/upload") do ( ) -> RestApiResponse: ## Upload a file in a streamming manner ## @@ -273,7 +273,7 @@ proc initRestApi*(node: DaggerNodeRef, conf: DaggerConf): RestRouter = router.api( MethodGet, - "/api/dagger/v1/info") do () -> RestApiResponse: + "/api/codex/v1/info") do () -> RestApiResponse: ## Print rudimentary node information ## @@ -288,7 +288,7 @@ proc initRestApi*(node: DaggerNodeRef, conf: DaggerConf): RestRouter = router.api( MethodGet, - "/api/dagger/v1/sales/availability") do () -> RestApiResponse: + "/api/codex/v1/sales/availability") do () -> RestApiResponse: ## Returns storage that is for sale without contracts =? node.contracts: @@ -299,7 +299,7 @@ proc initRestApi*(node: DaggerNodeRef, conf: DaggerConf): RestRouter = router.rawApi( MethodPost, - "/api/dagger/v1/sales/availability") do () -> RestApiResponse: + "/api/codex/v1/sales/availability") do () -> RestApiResponse: ## Add available storage to sell ## ## size - size of available storage in bytes @@ -321,7 +321,7 @@ proc initRestApi*(node: DaggerNodeRef, conf: DaggerConf): RestRouter = router.api( MethodGet, - "/api/dagger/v1/storage/purchases/{id}") do ( + "/api/codex/v1/storage/purchases/{id}") do ( id: array[32, byte]) -> RestApiResponse: without contracts =? node.contracts: diff --git a/dagger/rest/json.nim b/codex/rest/json.nim similarity index 100% rename from dagger/rest/json.nim rename to codex/rest/json.nim diff --git a/dagger/rng.nim b/codex/rng.nim similarity index 99% rename from dagger/rng.nim rename to codex/rng.nim index 61ff24aa..b1f6266d 100644 --- a/dagger/rng.nim +++ b/codex/rng.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/sales.nim b/codex/sales.nim similarity index 100% rename from dagger/sales.nim rename to codex/sales.nim diff --git a/dagger/stores.nim b/codex/stores.nim similarity index 100% rename from dagger/stores.nim rename to codex/stores.nim diff --git a/dagger/stores/blockstore.nim b/codex/stores/blockstore.nim similarity index 99% rename from dagger/stores/blockstore.nim rename to codex/stores/blockstore.nim index ddcbc550..6ae774be 100644 --- a/dagger/stores/blockstore.nim +++ b/codex/stores/blockstore.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/stores/cachestore.nim b/codex/stores/cachestore.nim similarity index 97% rename from dagger/stores/cachestore.nim rename to codex/stores/cachestore.nim index 50cfaf9d..0864c55d 100644 --- a/dagger/stores/cachestore.nim +++ b/codex/stores/cachestore.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -29,7 +29,7 @@ import ../errors export blockstore logScope: - topics = "dagger cachestore" + topics = "codex cachestore" type CacheStore* = ref object of BlockStore @@ -37,7 +37,7 @@ type size*: Positive # in bytes cache: LruCache[Cid, Block] - InvalidBlockSize* = object of DaggerError + InvalidBlockSize* = object of CodexError const MiB* = 1024 * 1024 # bytes, 1 mebibyte = 1,048,576 bytes diff --git a/dagger/stores/fsstore.nim b/codex/stores/fsstore.nim similarity index 98% rename from dagger/stores/fsstore.nim rename to codex/stores/fsstore.nim index a7c76732..ac98d42d 100644 --- a/dagger/stores/fsstore.nim +++ b/codex/stores/fsstore.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -26,7 +26,7 @@ import ./blockstore export blockstore logScope: - topics = "dagger fsstore" + topics = "codex fsstore" type FSStore* = ref object of BlockStore diff --git a/dagger/stores/networkstore.nim b/codex/stores/networkstore.nim similarity index 97% rename from dagger/stores/networkstore.nim rename to codex/stores/networkstore.nim index a3cd9a71..951d853f 100644 --- a/dagger/stores/networkstore.nim +++ b/codex/stores/networkstore.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -24,7 +24,7 @@ import ../blockexchange export blockstore, blockexchange, asyncheapqueue logScope: - topics = "dagger networkstore" + topics = "codex networkstore" type NetworkStore* = ref object of BlockStore diff --git a/dagger/streams.nim b/codex/streams.nim similarity index 100% rename from dagger/streams.nim rename to codex/streams.nim diff --git a/dagger/streams/seekablestream.nim b/codex/streams/seekablestream.nim similarity index 92% rename from dagger/streams/seekablestream.nim rename to codex/streams/seekablestream.nim index 2c1ec1b8..ab5ae0fd 100644 --- a/dagger/streams/seekablestream.nim +++ b/codex/streams/seekablestream.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -14,7 +14,7 @@ import pkg/chronicles export libp2p, chronos, chronicles logScope: - topics = "dagger seekablestream" + topics = "codex seekablestream" type SeekableStream* = ref object of LPStream diff --git a/dagger/streams/storestream.nim b/codex/streams/storestream.nim similarity index 97% rename from dagger/streams/storestream.nim rename to codex/streams/storestream.nim index 9e87710c..88b9b8f8 100644 --- a/dagger/streams/storestream.nim +++ b/codex/streams/storestream.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -25,7 +25,7 @@ import ./seekablestream export stores, blocktype, manifest, chronos logScope: - topics = "dagger storestream" + topics = "codex storestream" type StoreStream* = ref object of SeekableStream diff --git a/dagger/utils.nim b/codex/utils.nim similarity index 100% rename from dagger/utils.nim rename to codex/utils.nim diff --git a/dagger/utils/asyncheapqueue.nim b/codex/utils/asyncheapqueue.nim similarity index 99% rename from dagger/utils/asyncheapqueue.nim rename to codex/utils/asyncheapqueue.nim index efbc7a66..b85f7de7 100644 --- a/dagger/utils/asyncheapqueue.nim +++ b/codex/utils/asyncheapqueue.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/dagger/utils/fileutils.nim b/codex/utils/fileutils.nim similarity index 99% rename from dagger/utils/fileutils.nim rename to codex/utils/fileutils.nim index eeaba77f..a900460a 100644 --- a/dagger/utils/fileutils.nim +++ b/codex/utils/fileutils.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2021 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) diff --git a/config.nims b/config.nims index d43c6d7c..12ad5c0e 100644 --- a/config.nims +++ b/config.nims @@ -75,8 +75,8 @@ switch("warning", "LockLevel:off") switch("define", "libp2p_pki_schemes=secp256k1") #TODO this infects everything in this folder, ideally it would only -# apply to dagger.nim, but since dagger.nims is used for other purpose -# we can't use it. And dagger.cfg doesn't work +# apply to codex.nim, but since codex.nims is used for other purpose +# we can't use it. And codex.cfg doesn't work switch("define", "chronicles_sinks=textlines[dynamic],json[dynamic]") # begin Nimble config (version 1) diff --git a/tests/dagger/blockexc/discovery/testdiscovery.nim b/tests/codex/blockexc/discovery/testdiscovery.nim similarity index 98% rename from tests/dagger/blockexc/discovery/testdiscovery.nim rename to tests/codex/blockexc/discovery/testdiscovery.nim index 520a5bee..37a8a271 100644 --- a/tests/dagger/blockexc/discovery/testdiscovery.nim +++ b/tests/codex/blockexc/discovery/testdiscovery.nim @@ -8,11 +8,11 @@ import pkg/chronos import pkg/libp2p import pkg/libp2p/errors -import pkg/dagger/rng -import pkg/dagger/stores -import pkg/dagger/blockexchange -import pkg/dagger/chunker -import pkg/dagger/blocktype as bt +import pkg/codex/rng +import pkg/codex/stores +import pkg/codex/blockexchange +import pkg/codex/chunker +import pkg/codex/blocktype as bt import ../../helpers/mockdiscovery diff --git a/tests/dagger/blockexc/discovery/testdiscoveryengine.nim b/tests/codex/blockexc/discovery/testdiscoveryengine.nim similarity index 97% rename from tests/dagger/blockexc/discovery/testdiscoveryengine.nim rename to tests/codex/blockexc/discovery/testdiscoveryengine.nim index 766fe0f4..3531206a 100644 --- a/tests/dagger/blockexc/discovery/testdiscoveryengine.nim +++ b/tests/codex/blockexc/discovery/testdiscoveryengine.nim @@ -8,12 +8,12 @@ import pkg/chronos import pkg/chronicles import pkg/libp2p -import pkg/dagger/rng -import pkg/dagger/stores -import pkg/dagger/blockexchange -import pkg/dagger/chunker -import pkg/dagger/blocktype as bt -import pkg/dagger/blockexchange/engine +import pkg/codex/rng +import pkg/codex/stores +import pkg/codex/blockexchange +import pkg/codex/chunker +import pkg/codex/blocktype as bt +import pkg/codex/blockexchange/engine import ../../helpers/mockdiscovery diff --git a/tests/dagger/blockexc/engine/testpayments.nim b/tests/codex/blockexc/engine/testpayments.nim similarity index 97% rename from tests/dagger/blockexc/engine/testpayments.nim rename to tests/codex/blockexc/engine/testpayments.nim index fa8dfe6d..b50a1720 100644 --- a/tests/dagger/blockexc/engine/testpayments.nim +++ b/tests/codex/blockexc/engine/testpayments.nim @@ -1,6 +1,6 @@ import std/unittest -import pkg/dagger/stores +import pkg/codex/stores import ../../examples suite "engine payments": diff --git a/tests/dagger/blockexc/protobuf/testpayments.nim b/tests/codex/blockexc/protobuf/testpayments.nim similarity index 97% rename from tests/dagger/blockexc/protobuf/testpayments.nim rename to tests/codex/blockexc/protobuf/testpayments.nim index a341255e..c9d6f9c6 100644 --- a/tests/dagger/blockexc/protobuf/testpayments.nim +++ b/tests/codex/blockexc/protobuf/testpayments.nim @@ -2,7 +2,7 @@ import pkg/asynctest import pkg/chronos import pkg/stew/byteutils import ../../examples -import pkg/dagger/stores +import pkg/codex/stores suite "account protobuf messages": diff --git a/tests/dagger/blockexc/protobuf/testpresence.nim b/tests/codex/blockexc/protobuf/testpresence.nim similarity index 96% rename from tests/dagger/blockexc/protobuf/testpresence.nim rename to tests/codex/blockexc/protobuf/testpresence.nim index 65969d0c..43593e13 100644 --- a/tests/dagger/blockexc/protobuf/testpresence.nim +++ b/tests/codex/blockexc/protobuf/testpresence.nim @@ -2,7 +2,7 @@ import pkg/asynctest import pkg/chronos import pkg/libp2p -import pkg/dagger/blockexchange/protobuf/presence +import pkg/codex/blockexchange/protobuf/presence import ../../examples suite "block presence protobuf messages": diff --git a/tests/dagger/blockexc/testblockexc.nim b/tests/codex/blockexc/testblockexc.nim similarity index 97% rename from tests/dagger/blockexc/testblockexc.nim rename to tests/codex/blockexc/testblockexc.nim index b878b6ff..351dfe0c 100644 --- a/tests/dagger/blockexc/testblockexc.nim +++ b/tests/codex/blockexc/testblockexc.nim @@ -8,12 +8,12 @@ import pkg/stew/byteutils import pkg/libp2p import pkg/libp2p/errors -import pkg/dagger/rng -import pkg/dagger/stores -import pkg/dagger/blockexchange -import pkg/dagger/chunker -import pkg/dagger/discovery -import pkg/dagger/blocktype as bt +import pkg/codex/rng +import pkg/codex/stores +import pkg/codex/blockexchange +import pkg/codex/chunker +import pkg/codex/discovery +import pkg/codex/blocktype as bt import ../helpers import ../examples diff --git a/tests/dagger/blockexc/testengine.nim b/tests/codex/blockexc/testengine.nim similarity index 98% rename from tests/dagger/blockexc/testengine.nim rename to tests/codex/blockexc/testengine.nim index 7813b626..eb128327 100644 --- a/tests/dagger/blockexc/testengine.nim +++ b/tests/codex/blockexc/testengine.nim @@ -9,13 +9,13 @@ import pkg/libp2p import pkg/libp2p/routing_record import pkg/libp2pdht/discv5/protocol as discv5 -import pkg/dagger/rng -import pkg/dagger/blockexchange -import pkg/dagger/stores -import pkg/dagger/chunker -import pkg/dagger/discovery -import pkg/dagger/blocktype as bt -import pkg/dagger/utils/asyncheapqueue +import pkg/codex/rng +import pkg/codex/blockexchange +import pkg/codex/stores +import pkg/codex/chunker +import pkg/codex/discovery +import pkg/codex/blocktype as bt +import pkg/codex/utils/asyncheapqueue import ../helpers import ../examples diff --git a/tests/dagger/blockexc/testnetwork.nim b/tests/codex/blockexc/testnetwork.nim similarity index 98% rename from tests/dagger/blockexc/testnetwork.nim rename to tests/codex/blockexc/testnetwork.nim index 6aa5b589..fe955d35 100644 --- a/tests/dagger/blockexc/testnetwork.nim +++ b/tests/codex/blockexc/testnetwork.nim @@ -7,10 +7,10 @@ import pkg/libp2p import pkg/libp2p/errors import pkg/protobuf_serialization -import pkg/dagger/rng -import pkg/dagger/chunker -import pkg/dagger/blocktype as bt -import pkg/dagger/blockexchange +import pkg/codex/rng +import pkg/codex/chunker +import pkg/codex/blocktype as bt +import pkg/codex/blockexchange import ../helpers import ../examples diff --git a/tests/dagger/blockexc/testpeerctxstore.nim b/tests/codex/blockexc/testpeerctxstore.nim similarity index 96% rename from tests/dagger/blockexc/testpeerctxstore.nim rename to tests/codex/blockexc/testpeerctxstore.nim index 21f75cb3..a1c826e3 100644 --- a/tests/dagger/blockexc/testpeerctxstore.nim +++ b/tests/codex/blockexc/testpeerctxstore.nim @@ -4,8 +4,8 @@ import std/sequtils import pkg/unittest2 import pkg/libp2p -import pkg/dagger/blockexchange/peers -import pkg/dagger/blockexchange/protobuf/blockexc +import pkg/codex/blockexchange/peers +import pkg/codex/blockexchange/protobuf/blockexc import ../examples diff --git a/tests/dagger/examples.nim b/tests/codex/examples.nim similarity index 93% rename from tests/dagger/examples.nim rename to tests/codex/examples.nim index c4eb8fe4..8f75b02b 100644 --- a/tests/dagger/examples.nim +++ b/tests/codex/examples.nim @@ -3,10 +3,10 @@ import std/sequtils import pkg/libp2p import pkg/nitro import pkg/stint -import pkg/dagger/rng -import pkg/dagger/stores -import pkg/dagger/blocktype as bt -import pkg/dagger/sales +import pkg/codex/rng +import pkg/codex/stores +import pkg/codex/blocktype as bt +import pkg/codex/sales import ../examples export examples diff --git a/tests/dagger/helpers.nim b/tests/codex/helpers.nim similarity index 95% rename from tests/dagger/helpers.nim rename to tests/codex/helpers.nim index 82ff7aaf..cf68c45e 100644 --- a/tests/dagger/helpers.nim +++ b/tests/codex/helpers.nim @@ -1,6 +1,6 @@ import pkg/libp2p import pkg/libp2p/varint -import pkg/dagger/blocktype +import pkg/codex/blocktype import ./helpers/nodeutils import ./helpers/randomchunker diff --git a/tests/dagger/helpers/mockclock.nim b/tests/codex/helpers/mockclock.nim similarity index 95% rename from tests/dagger/helpers/mockclock.nim rename to tests/codex/helpers/mockclock.nim index 6ff8a411..55283f8a 100644 --- a/tests/dagger/helpers/mockclock.nim +++ b/tests/codex/helpers/mockclock.nim @@ -1,5 +1,5 @@ import std/times -import dagger/clock +import codex/clock export clock diff --git a/tests/dagger/helpers/mockdiscovery.nim b/tests/codex/helpers/mockdiscovery.nim similarity index 97% rename from tests/dagger/helpers/mockdiscovery.nim rename to tests/codex/helpers/mockdiscovery.nim index 9b671a9a..51192427 100644 --- a/tests/dagger/helpers/mockdiscovery.nim +++ b/tests/codex/helpers/mockdiscovery.nim @@ -1,4 +1,4 @@ -## Nim-Dagger +## Nim-Codex ## Copyright (c) 2022 Status Research & Development GmbH ## Licensed under either of ## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE)) @@ -12,7 +12,7 @@ import pkg/libp2p import pkg/questionable import pkg/questionable/results import pkg/stew/shims/net -import pkg/dagger/discovery +import pkg/codex/discovery type MockDiscovery* = ref object of Discovery diff --git a/tests/dagger/helpers/mockmarket.nim b/tests/codex/helpers/mockmarket.nim similarity index 99% rename from tests/dagger/helpers/mockmarket.nim rename to tests/codex/helpers/mockmarket.nim index 1852be03..48b7f591 100644 --- a/tests/dagger/helpers/mockmarket.nim +++ b/tests/codex/helpers/mockmarket.nim @@ -1,7 +1,7 @@ import std/sequtils import std/heapqueue import pkg/questionable -import pkg/dagger/market +import pkg/codex/market export market diff --git a/tests/dagger/helpers/mockproofs.nim b/tests/codex/helpers/mockproofs.nim similarity index 98% rename from tests/dagger/helpers/mockproofs.nim rename to tests/codex/helpers/mockproofs.nim index f9fdbe5b..90dcc6bb 100644 --- a/tests/dagger/helpers/mockproofs.nim +++ b/tests/codex/helpers/mockproofs.nim @@ -2,7 +2,7 @@ import std/sets import std/tables import std/sequtils import pkg/upraises -import pkg/dagger/por/timing/proofs +import pkg/codex/por/timing/proofs type MockProofs* = ref object of Proofs diff --git a/tests/dagger/helpers/nodeutils.nim b/tests/codex/helpers/nodeutils.nim similarity index 93% rename from tests/dagger/helpers/nodeutils.nim rename to tests/codex/helpers/nodeutils.nim index bfc21a24..a792aa81 100644 --- a/tests/dagger/helpers/nodeutils.nim +++ b/tests/codex/helpers/nodeutils.nim @@ -3,10 +3,10 @@ import std/sequtils import pkg/chronos import pkg/libp2p -import pkg/dagger/discovery -import pkg/dagger/stores -import pkg/dagger/blocktype as bt -import pkg/dagger/blockexchange +import pkg/codex/discovery +import pkg/codex/stores +import pkg/codex/blocktype as bt +import pkg/codex/blockexchange import ../examples diff --git a/tests/dagger/helpers/randomchunker.nim b/tests/codex/helpers/randomchunker.nim similarity index 94% rename from tests/dagger/helpers/randomchunker.nim rename to tests/codex/helpers/randomchunker.nim index 4e3e5aad..87726953 100644 --- a/tests/dagger/helpers/randomchunker.nim +++ b/tests/codex/helpers/randomchunker.nim @@ -2,8 +2,8 @@ import std/sequtils import pkg/chronos -import pkg/dagger/chunker -import pkg/dagger/rng +import pkg/codex/chunker +import pkg/codex/rng export chunker diff --git a/tests/dagger/stores/testcachestore.nim b/tests/codex/stores/testcachestore.nim similarity index 98% rename from tests/dagger/stores/testcachestore.nim rename to tests/codex/stores/testcachestore.nim index 3bd128dd..2fcdf736 100644 --- a/tests/dagger/stores/testcachestore.nim +++ b/tests/codex/stores/testcachestore.nim @@ -5,8 +5,8 @@ import pkg/asynctest import pkg/libp2p import pkg/stew/byteutils import pkg/questionable/results -import pkg/dagger/stores/cachestore -import pkg/dagger/chunker +import pkg/codex/stores/cachestore +import pkg/codex/chunker import ../helpers diff --git a/tests/dagger/stores/testfsstore.nim b/tests/codex/stores/testfsstore.nim similarity index 93% rename from tests/dagger/stores/testfsstore.nim rename to tests/codex/stores/testfsstore.nim index 254c146d..070a602c 100644 --- a/tests/dagger/stores/testfsstore.nim +++ b/tests/codex/stores/testfsstore.nim @@ -8,10 +8,10 @@ import pkg/asynctest import pkg/libp2p import pkg/stew/byteutils -import pkg/dagger/stores/cachestore -import pkg/dagger/chunker -import pkg/dagger/stores -import pkg/dagger/blocktype as bt +import pkg/codex/stores/cachestore +import pkg/codex/chunker +import pkg/codex/stores +import pkg/codex/blocktype as bt import ../helpers diff --git a/tests/dagger/testasyncheapqueue.nim b/tests/codex/testasyncheapqueue.nim similarity index 98% rename from tests/dagger/testasyncheapqueue.nim rename to tests/codex/testasyncheapqueue.nim index 7837e2e0..d7fe3ec1 100644 --- a/tests/dagger/testasyncheapqueue.nim +++ b/tests/codex/testasyncheapqueue.nim @@ -2,8 +2,8 @@ import pkg/chronos import pkg/asynctest import pkg/stew/results -import pkg/dagger/utils/asyncheapqueue -import pkg/dagger/rng +import pkg/codex/utils/asyncheapqueue +import pkg/codex/rng type Task* = tuple[name: string, priority: int] diff --git a/tests/dagger/testblockexc.nim b/tests/codex/testblockexc.nim similarity index 100% rename from tests/dagger/testblockexc.nim rename to tests/codex/testblockexc.nim diff --git a/tests/dagger/testchunking.nim b/tests/codex/testchunking.nim similarity index 98% rename from tests/dagger/testchunking.nim rename to tests/codex/testchunking.nim index 4d4668a8..626c332c 100644 --- a/tests/dagger/testchunking.nim +++ b/tests/codex/testchunking.nim @@ -1,6 +1,6 @@ import pkg/asynctest import pkg/stew/byteutils -import pkg/dagger/chunker +import pkg/codex/chunker import pkg/chronicles import pkg/chronos import pkg/libp2p diff --git a/tests/dagger/testerasure.nim b/tests/codex/testerasure.nim similarity index 97% rename from tests/dagger/testerasure.nim rename to tests/codex/testerasure.nim index 70d46f19..23eab4e2 100644 --- a/tests/dagger/testerasure.nim +++ b/tests/codex/testerasure.nim @@ -6,11 +6,11 @@ import pkg/libp2p import pkg/questionable import pkg/questionable/results -import pkg/dagger/erasure -import pkg/dagger/manifest -import pkg/dagger/stores -import pkg/dagger/blocktype as bt -import pkg/dagger/rng +import pkg/codex/erasure +import pkg/codex/manifest +import pkg/codex/stores +import pkg/codex/blocktype as bt +import pkg/codex/rng import ./helpers diff --git a/tests/dagger/testmanifest.nim b/tests/codex/testmanifest.nim similarity index 96% rename from tests/dagger/testmanifest.nim rename to tests/codex/testmanifest.nim index e78f1beb..7cd43b6e 100644 --- a/tests/dagger/testmanifest.nim +++ b/tests/codex/testmanifest.nim @@ -7,9 +7,9 @@ import pkg/asynctest import pkg/libp2p import pkg/stew/byteutils -import pkg/dagger/chunker -import pkg/dagger/blocktype as bt -import pkg/dagger/manifest +import pkg/codex/chunker +import pkg/codex/blocktype as bt +import pkg/codex/manifest import ./helpers diff --git a/tests/dagger/testnode.nim b/tests/codex/testnode.nim similarity index 90% rename from tests/dagger/testnode.nim rename to tests/codex/testnode.nim index b0038fdf..98cbff01 100644 --- a/tests/dagger/testnode.nim +++ b/tests/codex/testnode.nim @@ -10,14 +10,14 @@ import pkg/nitro import pkg/libp2p import pkg/libp2pdht/discv5/protocol as discv5 -import pkg/dagger/stores -import pkg/dagger/blockexchange -import pkg/dagger/chunker -import pkg/dagger/node -import pkg/dagger/manifest -import pkg/dagger/discovery -import pkg/dagger/blocktype as bt -import pkg/dagger/contracts +import pkg/codex/stores +import pkg/codex/blockexchange +import pkg/codex/chunker +import pkg/codex/node +import pkg/codex/manifest +import pkg/codex/discovery +import pkg/codex/blocktype as bt +import pkg/codex/contracts import ./helpers @@ -34,7 +34,7 @@ suite "Test Node": localStore: CacheStore engine: BlockExcEngine store: NetworkStore - node: DaggerNodeRef + node: CodexNodeRef blockDiscovery: Discovery peerStore: PeerCtxStore pendingBlocks: PendingBlocksManager @@ -55,7 +55,7 @@ suite "Test Node": engine = BlockExcEngine.new(localStore, wallet, network, discovery, peerStore, pendingBlocks) store = NetworkStore.new(engine, localStore) contracts = ContractInteractions.new() - node = DaggerNodeRef.new(switch, store, engine, nil, blockDiscovery, contracts) # TODO: pass `Erasure` + node = CodexNodeRef.new(switch, store, engine, nil, blockDiscovery, contracts) # TODO: pass `Erasure` await node.start() diff --git a/tests/dagger/testproving.nim b/tests/codex/testproving.nim similarity index 99% rename from tests/dagger/testproving.nim rename to tests/codex/testproving.nim index ae5ea01f..a2779efd 100644 --- a/tests/dagger/testproving.nim +++ b/tests/codex/testproving.nim @@ -1,6 +1,6 @@ import pkg/asynctest import pkg/chronos -import pkg/dagger/proving +import pkg/codex/proving import ./helpers/mockproofs import ./helpers/mockclock import ./examples diff --git a/tests/dagger/testpurchasing.nim b/tests/codex/testpurchasing.nim similarity index 99% rename from tests/dagger/testpurchasing.nim rename to tests/codex/testpurchasing.nim index 4b260ec5..e4456593 100644 --- a/tests/dagger/testpurchasing.nim +++ b/tests/codex/testpurchasing.nim @@ -2,7 +2,7 @@ import std/times import pkg/asynctest import pkg/chronos import pkg/stint -import pkg/dagger/purchasing +import pkg/codex/purchasing import ./helpers/mockmarket import ./helpers/mockclock import ./examples diff --git a/tests/dagger/testsales.nim b/tests/codex/testsales.nim similarity index 99% rename from tests/dagger/testsales.nim rename to tests/codex/testsales.nim index 72997a44..af8dd648 100644 --- a/tests/dagger/testsales.nim +++ b/tests/codex/testsales.nim @@ -1,7 +1,7 @@ import std/times import pkg/asynctest import pkg/chronos -import pkg/dagger/sales +import pkg/codex/sales import ./helpers/mockmarket import ./helpers/mockclock import ./examples diff --git a/tests/dagger/teststores.nim b/tests/codex/teststores.nim similarity index 100% rename from tests/dagger/teststores.nim rename to tests/codex/teststores.nim diff --git a/tests/dagger/teststorestream.nim b/tests/codex/teststorestream.nim similarity index 94% rename from tests/dagger/teststorestream.nim rename to tests/codex/teststorestream.nim index 3d457fee..1f810ba5 100644 --- a/tests/dagger/teststorestream.nim +++ b/tests/codex/teststorestream.nim @@ -5,11 +5,11 @@ import pkg/questionable/results import ./helpers -import pkg/dagger/streams -import pkg/dagger/stores -import pkg/dagger/manifest -import pkg/dagger/rng -import pkg/dagger/blocktype as bt +import pkg/codex/streams +import pkg/codex/stores +import pkg/codex/manifest +import pkg/codex/rng +import pkg/codex/blocktype as bt suite "StoreStream": var diff --git a/tests/contracts/examples.nim b/tests/contracts/examples.nim index 3dbbd888..2fc2b035 100644 --- a/tests/contracts/examples.nim +++ b/tests/contracts/examples.nim @@ -1,7 +1,7 @@ import std/times import pkg/stint import pkg/ethers -import dagger/contracts +import codex/contracts import ../examples export examples diff --git a/tests/contracts/testClock.nim b/tests/contracts/testClock.nim index 1b325af7..db97d70e 100644 --- a/tests/contracts/testClock.nim +++ b/tests/contracts/testClock.nim @@ -1,6 +1,6 @@ import std/times import pkg/chronos -import dagger/contracts/clock +import codex/contracts/clock import ../ethertest ethersuite "On-Chain Clock": diff --git a/tests/contracts/testCollateral.nim b/tests/contracts/testCollateral.nim index 523fdf36..6d2079b8 100644 --- a/tests/contracts/testCollateral.nim +++ b/tests/contracts/testCollateral.nim @@ -1,7 +1,7 @@ import pkg/chronos import pkg/stint -import dagger/contracts -import dagger/contracts/testtoken +import codex/contracts +import codex/contracts/testtoken import ../ethertest ethersuite "Collateral": diff --git a/tests/contracts/testContracts.nim b/tests/contracts/testContracts.nim index b7f345b1..efb4d6a7 100644 --- a/tests/contracts/testContracts.nim +++ b/tests/contracts/testContracts.nim @@ -1,9 +1,9 @@ import std/json import pkg/chronos import pkg/nimcrypto -import dagger/contracts -import dagger/contracts/testtoken -import dagger/por/timing/periods +import codex/contracts +import codex/contracts/testtoken +import codex/por/timing/periods import ../ethertest import ./examples import ./time diff --git a/tests/contracts/testInteractions.nim b/tests/contracts/testInteractions.nim index 84eed9f5..fbfbd0fe 100644 --- a/tests/contracts/testInteractions.nim +++ b/tests/contracts/testInteractions.nim @@ -1,5 +1,5 @@ import std/os -import dagger/contracts +import codex/contracts import ../ethertest import ./examples diff --git a/tests/contracts/testMarket.nim b/tests/contracts/testMarket.nim index 7b32579a..4c3b7b52 100644 --- a/tests/contracts/testMarket.nim +++ b/tests/contracts/testMarket.nim @@ -1,6 +1,6 @@ import pkg/chronos -import dagger/contracts -import dagger/contracts/testtoken +import codex/contracts +import codex/contracts/testtoken import ../ethertest import ./examples import ./time diff --git a/tests/contracts/testProofs.nim b/tests/contracts/testProofs.nim index ade20bef..359f4ecc 100644 --- a/tests/contracts/testProofs.nim +++ b/tests/contracts/testProofs.nim @@ -1,4 +1,4 @@ -import dagger/contracts +import codex/contracts import ../ethertest import ./examples import ./time diff --git a/tests/integration/nodes.nim b/tests/integration/nodes.nim index 57c66f96..12a0b71e 100644 --- a/tests/integration/nodes.nim +++ b/tests/integration/nodes.nim @@ -4,7 +4,7 @@ import std/streams import std/strutils const workingDir = currentSourcePath() / ".." / ".." / ".." -const executable = "build" / "dagger" +const executable = "build" / "codex" proc startNode*(args: openArray[string], debug = false): Process = if debug: @@ -13,7 +13,7 @@ proc startNode*(args: openArray[string], debug = false): Process = else: result = startProcess(executable, workingDir, args) for line in result.outputStream.lines: - if line.contains("Started dagger node"): + if line.contains("Started codex node"): break proc stop*(node: Process) = diff --git a/tests/integration/tokens.nim b/tests/integration/tokens.nim index 4c7c8d47..8c1a00d7 100644 --- a/tests/integration/tokens.nim +++ b/tests/integration/tokens.nim @@ -1,5 +1,5 @@ -import dagger/contracts -import dagger/contracts/testtoken +import codex/contracts +import codex/contracts/testtoken proc mint*(signer: Signer, amount = 1_000_000.u256) {.async.} = ## Mints a considerable amount of tokens and approves them for transfer to diff --git a/tests/testCodex.nim b/tests/testCodex.nim new file mode 100644 index 00000000..b5088732 --- /dev/null +++ b/tests/testCodex.nim @@ -0,0 +1,16 @@ +import ./codex/teststores +import ./codex/testblockexc +import ./codex/testasyncheapqueue +import ./codex/testchunking +import ./codex/testmanifest +import ./codex/testnode +import ./codex/teststorestream +import ./codex/testpurchasing +import ./codex/testsales +import ./codex/testerasure +import ./codex/testproving + +# to check that everything compiles +import ../codex + +{.warning[UnusedImport]: off.} diff --git a/tests/testDagger.nim.cfg b/tests/testCodex.nim.cfg similarity index 100% rename from tests/testDagger.nim.cfg rename to tests/testCodex.nim.cfg diff --git a/tests/testDagger.nim b/tests/testDagger.nim deleted file mode 100644 index 332baa0a..00000000 --- a/tests/testDagger.nim +++ /dev/null @@ -1,16 +0,0 @@ -import ./dagger/teststores -import ./dagger/testblockexc -import ./dagger/testasyncheapqueue -import ./dagger/testchunking -import ./dagger/testmanifest -import ./dagger/testnode -import ./dagger/teststorestream -import ./dagger/testpurchasing -import ./dagger/testsales -import ./dagger/testerasure -import ./dagger/testproving - -# to check that everything compiles -import ../dagger - -{.warning[UnusedImport]: off.} diff --git a/tests/testIntegration.nim b/tests/testIntegration.nim index 5f67fd37..422bf396 100644 --- a/tests/testIntegration.nim +++ b/tests/testIntegration.nim @@ -27,8 +27,8 @@ ethersuite "Integration tests": "--udp-port=8091", "--eth-account=" & $accounts[1] ] - baseurl1 = "http://localhost:8080/api/dagger/v1" - baseurl2 = "http://localhost:8081/api/dagger/v1" + baseurl1 = "http://localhost:8080/api/codex/v1" + baseurl2 = "http://localhost:8081/api/codex/v1" client = newHttpClient() teardown: