Change every dagger to codex (#102)

This commit is contained in:
Michael Bradley 2022-05-19 14:56:03 -05:00 committed by GitHub
parent a3f10f7f20
commit 209343087c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
116 changed files with 257 additions and 257 deletions

View File

@ -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

2
.gitignore vendored
View File

@ -27,4 +27,4 @@ nimble.paths
.env
.update.timestamp
dagger.nims
codex.nims

View File

@ -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

View File

@ -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.} =

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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.}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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))

View File

@ -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))

View File

@ -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,
)

View File

@ -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",

View File

@ -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

View File

@ -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))

View File

@ -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))

View File

@ -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))

View File

@ -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))

View File

@ -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.

View File

@ -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]`
##

View File

@ -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))

View File

@ -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))

View File

@ -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))

View File

@ -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,

View File

@ -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 =

View File

@ -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:

View File

@ -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))

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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))

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
import std/unittest
import pkg/dagger/stores
import pkg/codex/stores
import ../../examples
suite "engine payments":

View File

@ -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":

View File

@ -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":

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
import std/times
import dagger/clock
import codex/clock
export clock

View File

@ -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

View File

@ -1,7 +1,7 @@
import std/sequtils
import std/heapqueue
import pkg/questionable
import pkg/dagger/market
import pkg/codex/market
export market

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More