setting up

This commit is contained in:
thatben 2025-06-02 11:06:18 +02:00
parent a7b3323e12
commit cc02dbcbfc
No known key found for this signature in database
GPG Key ID: 62C543548433D43E
36 changed files with 262 additions and 0 deletions

99
.gitmodules vendored Normal file
View File

@ -0,0 +1,99 @@
[submodule "vendor/nimbus-build-system"]
path = vendor/nimbus-build-system
url = https://github.com/status-im/nimbus-build-system.git
[submodule "vendor/nim-libp2p"]
path = vendor/nim-libp2p
url = https://github.com/vacp2p/nim-libp2p.git
[submodule "vendor/nimcrypto"]
path = vendor/nimcrypto
url = https://github.com/cheatfate/nimcrypto.git
[submodule "vendor/nim-chronicles"]
path = vendor/nim-chronicles
url = https://github.com/status-im/nim-chronicles.git
[submodule "vendor/nim-metrics"]
path = vendor/nim-metrics
url = https://github.com/status-im/nim-metrics.git
[submodule "vendor/nim-secp256k1"]
path = vendor/nim-secp256k1
url = https://github.com/status-im/nim-secp256k1.git
[submodule "nim-stew"]
path = nim-stew
url = https://github.com/status-im/nim-stew.git
[submodule "vendor/questionable"]
path = vendor/questionable
url = https://github.com/status-im/questionable.git
[submodule "vendor/upraises"]
path = vendor/upraises
url = https://github.com/markspanbroek/upraises.git
[submodule "vendor/asynctest"]
path = vendor/asynctest
url = https://github.com/status-im/asynctest.git
[submodule "vendor/nim-confutils"]
path = vendor/nim-confutils
url = https://github.com/status-im/nim-confutils.git
[submodule "vendor/nim-nat-traversal"]
path = vendor/nim-nat-traversal
url = https://github.com/status-im/nim-nat-traversal.git
[submodule "vendor/nim-libbacktrace"]
path = vendor/nim-libbacktrace
url = https://github.com/status-im/nim-libbacktrace.git
[submodule "vendor/nim-chronos"]
path = vendor/nim-chronos
url = https://github.com/status-im/nim-chronos.git
[submodule "vendor/nim-json-serialization"]
path = vendor/nim-json-serialization
url = https://github.com/status-im/nim-json-serialization.git
[submodule "vendor/nim-serialization"]
path = vendor/nim-serialization
url = https://github.com/status-im/nim-serialization.git
[submodule "vendor/nim-bearssl"]
path = vendor/nim-bearssl
url = https://github.com/status-im/nim-bearssl.git
[submodule "vendor/stint"]
path = vendor/stint
url = https://github.com/status-im/stint.git
[submodule "vendor/nim-unittest2"]
path = vendor/nim-unittest2
url = https://github.com/status-im/nim-unittest2.git
[submodule "vendor/nim-websock"]
path = vendor/nim-websock
url = https://github.com/status-im/nim-websock.git
[submodule "vendor/nim-contract-abi"]
path = vendor/nim-contract-abi
url = https://github.com/status-im/nim-contract-abi
[submodule "vendor/nim-json-rpc"]
path = vendor/nim-json-rpc
url = https://github.com/status-im/nim-json-rpc
[submodule "vendor/nim-ethers"]
path = vendor/nim-ethers
url = https://github.com/status-im/nim-ethers
[submodule "vendor/lrucache.nim"]
path = vendor/lrucache.nim
url = https://github.com/status-im/lrucache.nim
[submodule "vendor/nim-blscurve"]
path = vendor/nim-blscurve
url = https://github.com/status-im/nim-blscurve.git
[submodule "vendor/nim-codex-dht"]
path = vendor/nim-codex-dht
url = https://github.com/codex-storage/nim-codex-dht.git
[submodule "vendor/nim-eth"]
path = vendor/nim-eth
url = https://github.com/status-im/nim-eth
[submodule "vendor/codex-contracts-eth"]
path = vendor/codex-contracts-eth
url = https://github.com/status-im/codex-contracts-eth
[submodule "vendor/nim-protobuf-serialization"]
path = vendor/nim-protobuf-serialization
url = https://github.com/status-im/nim-protobuf-serialization
[submodule "vendor/nim-results"]
path = vendor/nim-results
url = https://github.com/arnetheduck/nim-results
[submodule "vendor/nim-testutils"]
path = vendor/nim-testutils
url = https://github.com/status-im/nim-testutils
[submodule "vendor/nim-serde"]
path = vendor/nim-serde
url = https://github.com/codex-storage/nim-serde.git
[submodule "vendor/nph"]
path = vendor/nph
url = https://github.com/arnetheduck/nph.git

123
build.nims Normal file
View File

@ -0,0 +1,123 @@
mode = ScriptMode.Verbose
import std/os except commandLineParams
### Helper functions
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
mkDir "build"
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
var extra_params = params
when compiles(commandLineParams):
for param in commandLineParams():
extra_params &= " " & param
else:
for i in 2 ..< paramCount():
extra_params &= " " & paramStr(i)
let
# Place build output in 'build' folder, even if name includes a longer path.
outName = os.lastPathPart(name)
cmd =
"nim " & lang & " --out:build/" & outName & " " & extra_params & " " & srcDir &
name & ".nim"
exec(cmd)
proc test(name: string, srcDir = "tests/", params = "", lang = "c") =
buildBinary name, srcDir, params
exec "build/" & name
task codex, "build codex binary":
buildBinary "codex",
params = "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE"
task toolsCirdl, "build tools/cirdl binary":
buildBinary "tools/cirdl/cirdl"
task testCodex, "Build & run Codex tests":
test "testCodex", params = "-d:codex_enable_proof_failures=true"
task testContracts, "Build & run Codex Contract tests":
test "testContracts"
task testIntegration, "Run integration tests":
buildBinary "codex",
params =
"-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE -d:codex_enable_proof_failures=true"
test "testIntegration"
# use params to enable logging from the integration test executable
# test "testIntegration", params = "-d:chronicles_sinks=textlines[notimestamps,stdout],textlines[dynamic] " &
# "-d:chronicles_enabled_topics:integration:TRACE"
task build, "build codex binary":
codexTask()
task test, "Run tests":
testCodexTask()
task testTools, "Run Tools tests":
toolsCirdlTask()
test "testTools"
task testAll, "Run all tests (except for Taiko L2 tests)":
testCodexTask()
testContractsTask()
testIntegrationTask()
testToolsTask()
task testTaiko, "Run Taiko L2 tests":
codexTask()
test "testTaiko"
import strutils
import os
task coverage, "generates code coverage report":
var (output, exitCode) = gorgeEx("which lcov")
if exitCode != 0:
echo " ************************** ⛔️ ERROR ⛔️ **************************"
echo " ** ERROR: lcov not found, it must be installed to run code **"
echo " ** coverage locally **"
echo " *****************************************************************"
quit 1
(output, exitCode) = gorgeEx("gcov --version")
if output.contains("Apple LLVM"):
echo " ************************* ⚠️ WARNING ⚠️ *************************"
echo " ** WARNING: Using Apple's llvm-cov in place of gcov, which **"
echo " ** emulates an old version of gcov (4.2.0) and therefore **"
echo " ** coverage results will differ than those on CI (which **"
echo " ** uses a much newer version of gcov). **"
echo " *****************************************************************"
var nimSrcs = " "
for f in walkDirRec("codex", {pcFile}):
if f.endswith(".nim"):
nimSrcs.add " " & f.absolutePath.quoteShell()
echo "======== Running Tests ======== "
test "coverage",
srcDir = "tests/",
params =
" --nimcache:nimcache/coverage -d:release -d:codex_enable_proof_failures=true"
exec("rm nimcache/coverage/*.c")
rmDir("coverage")
mkDir("coverage")
echo " ======== Running LCOV ======== "
exec(
"lcov --capture --keep-going --directory nimcache/coverage --output-file coverage/coverage.info"
)
exec(
"lcov --extract coverage/coverage.info --keep-going --output-file coverage/coverage.f.info " &
nimSrcs
)
echo " ======== Generating HTML coverage report ======== "
exec("genhtml coverage/coverage.f.info --keep-going --output-directory coverage/report ")
echo " ======== Coverage report Done ======== "
task showCoverage, "open coverage html":
echo " ======== Opening HTML coverage report in browser... ======== "
if findExe("open") != "":
exec("open coverage/report/index.html")

7
env.sh Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# We use ${BASH_SOURCE[0]} instead of $0 to allow sourcing this file
# and we fall back to a Zsh-specific special var to also support Zsh.
REL_PATH="$(dirname ${BASH_SOURCE[0]:-${(%):-%x}})"
ABS_PATH="$(cd ${REL_PATH}; pwd)"
source ${ABS_PATH}/vendor/nimbus-build-system/scripts/env.sh

1
nim-stew Submodule

@ -0,0 +1 @@
Subproject commit 58abb4891f97c6cdc07335e868414e0c7b736c68

1
vendor/asynctest vendored Submodule

@ -0,0 +1 @@
Subproject commit 572c897a4e1177e905105a3bafe8c5573d9bae83

1
vendor/codex-contracts-eth vendored Submodule

@ -0,0 +1 @@
Subproject commit 0bf138512b7c1c3b8d77c48376e47f702e47106c

1
vendor/lrucache.nim vendored Submodule

@ -0,0 +1 @@
Subproject commit 8767ade0b76ea5b5d4ce24a52d0c58a6ebeb66cd

1
vendor/nim-bearssl vendored Submodule

@ -0,0 +1 @@
Subproject commit 667b40440a53a58e9f922e29e20818720c62d9ac

1
vendor/nim-blscurve vendored Submodule

@ -0,0 +1 @@
Subproject commit de2d3c79264bba18dbea469c8c5c4b3bb3c8bc55

1
vendor/nim-chronicles vendored Submodule

@ -0,0 +1 @@
Subproject commit 81a4a7a360c78be9c80c8f735c76b6d4a1517304

1
vendor/nim-chronos vendored Submodule

@ -0,0 +1 @@
Subproject commit c04576d829b8a0a1b12baaa8bc92037501b3a4a0

1
vendor/nim-codex-dht vendored Submodule

@ -0,0 +1 @@
Subproject commit f6eef1ac95c70053b2518f1e3909c909ed8701a6

1
vendor/nim-confutils vendored Submodule

@ -0,0 +1 @@
Subproject commit cb858a27f4347be949d10ed74b58713d687936d2

1
vendor/nim-contract-abi vendored Submodule

@ -0,0 +1 @@
Subproject commit 842f48910be4f388bcbf8abf1f02aba1d5e2ee64

1
vendor/nim-eth vendored Submodule

@ -0,0 +1 @@
Subproject commit dcfbc4291d39b59563828c3e32be4d51a2f25931

1
vendor/nim-ethers vendored Submodule

@ -0,0 +1 @@
Subproject commit bbced4673316763c6ef931b4d0a08069cde2474c

1
vendor/nim-json-rpc vendored Submodule

@ -0,0 +1 @@
Subproject commit 274372132de497e6b7b793c9d5d5474b71bf80a2

1
vendor/nim-json-serialization vendored Submodule

@ -0,0 +1 @@
Subproject commit 6eadb6e939ffa7882ff5437033c11a9464d3385c

1
vendor/nim-libbacktrace vendored Submodule

@ -0,0 +1 @@
Subproject commit 6da0cda88ab7780bd5fd342327adb91ab84692aa

1
vendor/nim-libp2p vendored Submodule

@ -0,0 +1 @@
Subproject commit c08d80734989b028b3d1705f2188d783a343aac0

1
vendor/nim-metrics vendored Submodule

@ -0,0 +1 @@
Subproject commit cacfdc12454a0804c65112b9f4f50d1375208dcd

1
vendor/nim-nat-traversal vendored Submodule

@ -0,0 +1 @@
Subproject commit 6508ce75060878dfcdfa21f94721672c69a1823b

1
vendor/nim-protobuf-serialization vendored Submodule

@ -0,0 +1 @@
Subproject commit 5a31137a82c2b6a989c9ed979bb636c7a49f570e

1
vendor/nim-results vendored Submodule

@ -0,0 +1 @@
Subproject commit df8113dda4c2d74d460a8fa98252b0b771bf1f27

1
vendor/nim-secp256k1 vendored Submodule

@ -0,0 +1 @@
Subproject commit 2acbbdcc0e63002a013fff49f015708522875832

1
vendor/nim-serde vendored Submodule

@ -0,0 +1 @@
Subproject commit 5ced7c88b97d99c582285ce796957fb71fd42434

1
vendor/nim-serialization vendored Submodule

@ -0,0 +1 @@
Subproject commit 2086c99608b4bf472e1ef5fe063710f280243396

1
vendor/nim-testutils vendored Submodule

@ -0,0 +1 @@
Subproject commit 4d37244f9f5e1acd8592a4ceb5c3fc47bc160181

1
vendor/nim-unittest2 vendored Submodule

@ -0,0 +1 @@
Subproject commit 845b6af28b9f68f02d320e03ad18eccccea7ddb9

1
vendor/nim-websock vendored Submodule

@ -0,0 +1 @@
Subproject commit ebe308a79a7b440a11dfbe74f352be86a3883508

1
vendor/nimbus-build-system vendored Submodule

@ -0,0 +1 @@
Subproject commit 0be0663e1af76e869837226a4ef3e586fcc737d3

1
vendor/nimcrypto vendored Submodule

@ -0,0 +1 @@
Subproject commit dc07e3058c6904eef965394493b6ea99aa2adefc

1
vendor/nph vendored Submodule

@ -0,0 +1 @@
Subproject commit f1f047760c6cb38d5c55d0ddb29b57a9c008a976

1
vendor/questionable vendored Submodule

@ -0,0 +1 @@
Subproject commit 47692e0d923ada8f7f731275b2a87614c0150987

1
vendor/stint vendored Submodule

@ -0,0 +1 @@
Subproject commit 5c5e01cef089a261474b7abfe246b37447aaa8ed

1
vendor/upraises vendored Submodule

@ -0,0 +1 @@
Subproject commit bc2628989b63854d980e92dadbd58f83e34b6f25