Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
2dd436b
fix(sales): do not crash when retrieving request fails (#1248)
markspanbroek Jun 4, 2025
ffbbee0
fix(purchasing): fix crash completing future more than once (#1249)
markspanbroek Jun 4, 2025
1bea94c
fix(tests): fetching past contract events test (#1255)
emizzle Jun 5, 2025
092de71
parallel tests running
emizzle Dec 20, 2024
38f7526
test summary formatting
emizzle Dec 20, 2024
28eb91b
prevent errors during node shutdown
emizzle Jan 9, 2025
0e9439b
stdout formatting for test results
emizzle Jan 10, 2025
bbea437
clean up
emizzle Jan 13, 2025
8cce661
print start/finish stderr/stdout markers
emizzle Jan 13, 2025
b841f04
default test name to the filename of the integration test
emizzle Jan 13, 2025
f9e26bd
stop hardhat and show logs
emizzle Jan 14, 2025
3af3162
expect process exit code
emizzle Jan 14, 2025
f957c58
Add additional logging info print outs
emizzle Jan 14, 2025
878a384
reinstate removed types
emizzle Jan 14, 2025
7981200
pass hardhat port to ethersuite
emizzle Jan 14, 2025
0d186c6
hang manager off IntegrationTest, cleanup
emizzle Jan 14, 2025
5db892a
print hardhat testmanager errors and hardhat stdout when there is an …
emizzle Jan 14, 2025
44faac5
clean up
emizzle Jan 14, 2025
c8d69b6
lock hardhat start to avoid intermittent start failures
emizzle Jan 14, 2025
855ba63
cleanup
emizzle Jan 16, 2025
78260fe
continually show test status updates
emizzle Jan 16, 2025
ff1eb8b
ensure timeouts work
emizzle Jan 16, 2025
52efcbe
fix nodeprocess not exiting
emizzle Jan 20, 2025
35964f6
add constructor param for continuous status update in terminal
emizzle Jan 20, 2025
982af54
increase port distance per test run
emizzle Jan 20, 2025
8ca9d9f
make onoutputline callback gcsafe
emizzle Jan 20, 2025
756af9b
remove unneeded sleep
emizzle Jan 21, 2025
4661f46
fail early with message when hardhat binary not found
emizzle Jan 21, 2025
87727fb
Use absolute path for binary when checking for existence
emizzle Jan 21, 2025
9a81fb9
fix rebase
emizzle Jan 22, 2025
81ace10
fix rebase, formatting
emizzle Jan 22, 2025
5338c56
DIsable continuous updates by default (for CI)
emizzle Jan 22, 2025
05a11cb
allow test parameters to be set from make testIntegration command
emizzle Jan 22, 2025
e98b601
format info blurbs
emizzle Jan 22, 2025
044edfb
automatically enable chronicles logs for the test harness when DEBUG_…
emizzle Jan 22, 2025
3651779
CI: do not start hardhat for integration tests
emizzle Jan 22, 2025
1218c49
formatting
emizzle Jan 22, 2025
e4ebfaa
use tracked futures for showContinuousStatusUpdates
emizzle Jan 22, 2025
2cfd963
clean up
emizzle Jan 22, 2025
8b70cbc
formatting
emizzle Jan 22, 2025
6b8f6d5
formatting
emizzle Jan 22, 2025
eaa3fbe
npm install to install the hardhat binary in CI
emizzle Jan 22, 2025
f9fae82
disable windows integration tests for now
emizzle Jan 23, 2025
780fb6a
enable CI debugging
emizzle Jan 23, 2025
d3245c3
Back off port inc in the hopes that this is causing issues with CI
emizzle Jan 28, 2025
f0a33ad
temporarily remove linux test to see if macos works in ci
emizzle Jan 28, 2025
e902df5
undo changes done for CI debugging
emizzle Jan 28, 2025
373d4b5
use large linux runner and disable other tests
emizzle Jan 28, 2025
28dea5b
try large runners for linux/windows
emizzle Jan 28, 2025
3fd43f3
temp remove coverage from ci workflow
emizzle Jan 28, 2025
14cc8fd
bump to larger runner, linux only
emizzle Jan 28, 2025
702706d
trying a self-hosted runner to see if it has more resources
emizzle Jan 28, 2025
7d3013f
fix: pass show continuous updates into test manager instance
emizzle Jan 28, 2025
0dcf8de
indicate with exit code 1 if the tests failed
emizzle Jan 28, 2025
3040d27
add windows large runner 32vcpu
emizzle Jan 28, 2025
5659e44
use macos-14-large
emizzle Jan 28, 2025
d260e63
fix exit status
emizzle Jan 28, 2025
52479ef
nil check hardhat process before stopping
emizzle Jan 29, 2025
3e4d677
re-add windows to CI
emizzle Jan 29, 2025
7c248b4
Bubble errors from hardhat start
emizzle Jan 29, 2025
dca40e0
fix hardhat running on windows
emizzle Jan 30, 2025
3554c77
handle cancellations for race and allFutures
emizzle Jan 31, 2025
7695610
fix waiting for hardhat node process exit on windows
emizzle Jan 31, 2025
680430e
swap linux large runner
emizzle Jan 31, 2025
fb39f12
enable debug logs for testpurchasing since the failure in ci
emizzle Jan 31, 2025
42701ee
Increase hardhat, codex api, and codex discovery ports for each subse…
emizzle Feb 3, 2025
44f99f5
fix: use the last used port instead of the globally defined port
emizzle Feb 3, 2025
7ea2179
Allow parallel integration tests to be disabled
emizzle Feb 3, 2025
92ca6de
fix: hardhot not being stopped when test times out
emizzle Feb 4, 2025
29df100
cancel processes soon
emizzle Feb 4, 2025
25ce97e
update Make flag to simply debug
emizzle Feb 5, 2025
5333856
add test name to datadir path
emizzle Feb 6, 2025
aa6678b
lock codex port selection in multinodesuites
emizzle Feb 6, 2025
c59fa9f
increase port gap by 1000 to avoid clashes in windows
emizzle Feb 6, 2025
cddb407
clean up
emizzle Feb 6, 2025
22cdacb
Allow debug runs from the github UI
emizzle Feb 6, 2025
23875b8
run npm install for parallel tests in ci
emizzle Feb 6, 2025
8257ec2
CI: enable artefact upload for parallel tests
emizzle Feb 7, 2025
c3558e1
formatting
emizzle Feb 20, 2025
592e7c1
bump chronos to 4.0.4
emizzle Feb 21, 2025
fb2e343
Add proper async exception tracking to multinodesuite
emizzle Feb 24, 2025
bc5fdd4
run tests async from start so that stop can cancel all tracked futures
emizzle Feb 28, 2025
72d2931
Refactor process launch
emizzle Feb 28, 2025
40c243a
Colorise stdout from test runs
emizzle Feb 25, 2025
494a3b9
ci: check runner for parallel integration tests and use value from vars
veaceslavdoina Feb 21, 2025
b9e3e07
filter out log topics that are making too much noise
emizzle Mar 4, 2025
595e1d3
Ensure started tests are torn down properly on timeout
emizzle Mar 4, 2025
0a4369d
enable more logging to file
emizzle Mar 5, 2025
eb77643
refactor: debug and logging
emizzle Mar 6, 2025
357840d
Fix process hanging after restart
emizzle Mar 6, 2025
e648954
formatting
emizzle Mar 6, 2025
67719ee
formatting
emizzle Mar 6, 2025
f3901d1
Update NBS action.yml in CI
emizzle Mar 6, 2025
f4b78f0
CI yml fix for gcc-14
emizzle Mar 6, 2025
e7a9ada
Add debugging and assertions after test run
emizzle Mar 7, 2025
139aa6e
readd prevention of hanging when closing process streams on windows
emizzle Mar 7, 2025
fa772f7
re-raise CancelledError
emizzle Mar 10, 2025
4da5c8c
do not re-raise CancelledError as convertError not used in async procs
emizzle Mar 11, 2025
f93112d
Remove DebugCodexNodes
emizzle Mar 14, 2025
9d8dbee
ensure runTests doesn't raise CancelledError
emizzle Mar 14, 2025
daa23f4
fix windows issue where reading stdout/stderr hangs forever
emizzle Mar 17, 2025
6bef231
Add wait to stdout/stderr stream future
emizzle Mar 17, 2025
3ec35dc
Remove debug from twonodesconfig
emizzle Mar 17, 2025
4f2f000
fix rebase on top of async http client change
emizzle Mar 18, 2025
9084dd7
Move test assertions at end of start so that test.status can be set a…
emizzle Mar 18, 2025
a52a53b
disable all logging to see if windows passes
emizzle Mar 18, 2025
a9b094a
reinstate logging after it also failed on windows and ci
emizzle Mar 19, 2025
114a46a
Continuously read from stdout/stderr to prevent buffers from filling
emizzle Mar 19, 2025
41eca53
Remove noCancel from captureProcessOutput call
emizzle Mar 19, 2025
a3db38d
remove noCancel from node startup in multinodes
emizzle Mar 19, 2025
a8c573e
unittest2 > unittest1
emizzle Mar 19, 2025
e1cc23d
Add "starting test" log to multinodes logging output for context
emizzle Mar 19, 2025
817c2bc
remove unneeded exception from start raises
emizzle Mar 20, 2025
ac588b9
write to stdout/stderr as the stream is read, rearrange node stop log…
emizzle Mar 21, 2025
84de0ab
fix compilation error
emizzle Mar 21, 2025
3b51d24
add new line to stdout/stderr logs when logging lines
emizzle Mar 21, 2025
91570b4
attempt to kill windows hardhat process
emizzle Mar 21, 2025
c16f8d3
formatting
emizzle Mar 21, 2025
9005522
Reduce the number of requests for asserts in tests
2-towns Mar 21, 2025
cb20b54
fix: forcefully kill windows hardhat processes after termination
emizzle Mar 24, 2025
8b192df
safeEventually > eventuallySafe
emizzle Mar 24, 2025
6e1e8a0
Remove new implementation of eventuallySafe by overidding the default…
emizzle Mar 24, 2025
88264be
fix makefile: DEBUG enables DebugHardhat
emizzle Mar 24, 2025
ebc7183
re-enable debug logging in codex nodes
emizzle Mar 24, 2025
660a0e2
Don't store hardhat logs in memory and do not print to term even if D…
emizzle Mar 24, 2025
e99dc1d
Reinstate unittest > unittest2, move eventually to ./asynctest
emizzle Mar 24, 2025
cff38a7
force kill windows test processes
emizzle Mar 24, 2025
8fcd977
fix eventually symbol resolution
emizzle Mar 24, 2025
98a828e
fix compilation errors in windows
emizzle Mar 24, 2025
9d605a5
formatting
emizzle Mar 24, 2025
b86f995
re-enable all CI tests
emizzle Mar 24, 2025
b8b93d7
update after rebase
emizzle Mar 25, 2025
eebeb8a
verbose unittest2 output to stdout
emizzle Mar 25, 2025
3487645
try increasing polling interval to see if this has an effect on windo…
emizzle Mar 26, 2025
8f4dae1
logging: show test setup/teardown in logs
emizzle Mar 26, 2025
7c00329
try removing verbose output to see if windows ci passes
emizzle Mar 26, 2025
2bfd524
fix previous commit compilation
emizzle Mar 26, 2025
4616c48
revert posix-only verbose unittest output
emizzle Mar 26, 2025
aa00566
update to websockets addresses for hardhat connection
emizzle Jun 4, 2025
69628f4
disable ccache symlink
emizzle Jun 4, 2025
5645518
Update ci.yml to be in line with master
emizzle Jun 4, 2025
8a2394a
contracts: increase period duration for windows ci
emizzle Jun 5, 2025
649bd48
fix(CI): change macos runner arch type to amd64
emizzle Jun 5, 2025
8e35f38
fix(CI): change all macos runners to amd64
emizzle Jun 5, 2025
b4c771b
adding nim-groth16 dep
dryajov Apr 1, 2025
493e3eb
adding threading dep
dryajov Apr 1, 2025
ed3b060
wip nim groth16
dryajov Apr 1, 2025
812b39e
adding deps
dryajov Apr 1, 2025
c5881e3
adding goldilocks deps
dryajov Apr 2, 2025
d069e18
adding circom-witnessgen
dryajov Apr 9, 2025
8599877
Remove vendor/threading submodule
dryajov May 23, 2025
a77dcc1
Refactor Circom compatibility backend and add NimGroth16 backend impl…
dryajov May 29, 2025
086e6f1
Refactor backend structure: remove unused files, add NimGroth16 suppo…
dryajov May 29, 2025
6ec73f3
Refactor SlotsBuilder and DataSampler types to use generic parameters…
dryajov May 29, 2025
aaca013
Refactor codebase: enhance error handling, improve type definitions, …
dryajov May 29, 2025
8e25bb5
Add ProverBackendCmd enum and update configuration for nimGroth16 and…
dryajov May 29, 2025
12eb464
Fix import statement in testslots.nim: replace testbackendfactory wit…
dryajov May 29, 2025
318dc20
Fix typo in testproverfactory.nim: correct getZKeyFile to getZkeyFile
dryajov May 29, 2025
acadfa1
Avoid using pointer to task, use the actual task object. Add some che…
dryajov May 29, 2025
25eb237
Update subproject commits for circom-witnessgen and nim-groth16
dryajov May 29, 2025
8b1d9b8
restore tests
dryajov May 29, 2025
a202eb8
refactor: rename proverBackendCmd to proverBackend and standardize en…
dryajov May 30, 2025
959241e
feat: improve prover logging and add NimGroth16 prover tests
dryajov May 30, 2025
878063c
refactor: replace circom-wasm with circom-graph and update G1/G2 poin…
dryajov May 30, 2025
6201ce0
feat: add single-block slot proof tests and update NimGroth16 backend…
dryajov May 30, 2025
ebf4ce4
chore: add project documentation and update test configurations
dryajov May 30, 2025
71fdf95
refactor: simplify error handling in suggestDownloadTool and enhance …
dryajov May 31, 2025
0442b8f
remove echo (todo: fix trace log)
dryajov May 31, 2025
c4c454e
contracts: fix hardhat modifier error
emizzle Jun 5, 2025
4dec2e9
fix rebase
emizzle Jun 5, 2025
f0c4338
fix(integration): Increase poll interval on codex client calls
emizzle Jun 5, 2025
d9e864c
fix(integration): remove eventually where not necessarily needed
emizzle Jun 5, 2025
bfccbce
fix(ci): Revert to arm64 for all other tests besides integration tests
emizzle Jun 5, 2025
c391f03
fix(ci): macos-14-xlarge is arm64
emizzle Jun 5, 2025
38d8692
fix(integration): replace polling with started event subscription
emizzle Jun 6, 2025
c04eee7
fix(integration): Use RequestFulfilled events instead of querying the…
emizzle Jun 6, 2025
63a28b9
fix(integration): add timeouts to waiting for started futures
emizzle Jun 6, 2025
4063e35
increase period duration to try to fix invalid proof errors
emizzle Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions .github/actions/nimbus-build-system/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ runs:
shell: ${{ inputs.shell }} {0}
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- --default-toolchain=${{ inputs.rust_version }} -y
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"

- name: APT (Linux amd64/arm64)
if: inputs.os == 'linux' && (inputs.cpu == 'amd64' || inputs.cpu == 'arm64')
Expand Down Expand Up @@ -89,7 +90,7 @@ runs:

- name: Install gcc 14 on Linux
# We don't want to install gcc 14 for coverage (Ubuntu 20.04)
if : ${{ inputs.os == 'linux' && inputs.coverage != 'true' }}
if: ${{ inputs.os == 'linux' && inputs.coverage != 'true' }}
shell: ${{ inputs.shell }} {0}
run: |
# Skip for older Ubuntu versions
Expand All @@ -107,10 +108,17 @@ runs:
if: inputs.os == 'linux' || inputs.os == 'macos'
uses: hendrikmuhs/ccache-action@v1.2
with:
create-symlink: true
create-symlink: false
key: ${{ inputs.os }}-${{ inputs.builder }}-${{ inputs.cpu }}-${{ inputs.tests }}-${{ inputs.nim_version }}
evict-old-files: 7d

- name: Add ccache to path on Linux/Mac
if: inputs.os == 'linux' || inputs.os == 'macos'
shell: ${{ inputs.shell }} {0}
run: |
echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> "$GITHUB_PATH"
echo "/usr/local/opt/ccache/libexec" >> "$GITHUB_PATH"

- name: Install ccache on Windows
if: inputs.os == 'windows'
uses: hendrikmuhs/ccache-action@v1.2
Expand All @@ -123,11 +131,11 @@ runs:
shell: ${{ inputs.shell }} {0}
run: |
CCACHE_DIR=$(dirname $(which ccache))/ccached
mkdir ${CCACHE_DIR}
ln -s $(which ccache) ${CCACHE_DIR}/gcc.exe
ln -s $(which ccache) ${CCACHE_DIR}/g++.exe
ln -s $(which ccache) ${CCACHE_DIR}/cc.exe
ln -s $(which ccache) ${CCACHE_DIR}/c++.exe
mkdir -p ${CCACHE_DIR}
ln -sf $(which ccache) ${CCACHE_DIR}/gcc.exe
ln -sf $(which ccache) ${CCACHE_DIR}/g++.exe
ln -sf $(which ccache) ${CCACHE_DIR}/cc.exe
ln -sf $(which ccache) ${CCACHE_DIR}/c++.exe
echo "export PATH=${CCACHE_DIR}:\$PATH" >> $HOME/.bash_profile # prefix path in MSYS2

- name: Derive environment variables
Expand Down Expand Up @@ -208,7 +216,7 @@ runs:
- name: Restore Nim toolchain binaries from cache
id: nim-cache
uses: actions/cache@v4
if : ${{ inputs.coverage != 'true' }}
if: ${{ inputs.coverage != 'true' }}
with:
path: NimBinaries
key: ${{ inputs.os }}-${{ inputs.cpu }}-nim-${{ inputs.nim_version }}-cache-${{ env.cache_nonce }}-${{ github.run_id }}
Expand All @@ -231,4 +239,4 @@ runs:
gcc --version
make -j${ncpu} CI_CACHE=NimBinaries ${ARCH_OVERRIDE} QUICK_AND_DIRTY_COMPILER=1 update
echo
./env.sh nim --version
./env.sh nim --version
53 changes: 50 additions & 3 deletions .github/workflows/ci-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,46 @@ jobs:
nim_version: ${{ matrix.nim_version }}
coverage: false

- name: Check runner resources for parallel integration tests
run: |
echo "Determining runner"
case "${{ matrix.os }}" in
linux) CPU=$(nproc --all)
RAM=$(awk '/MemTotal/ {print int($2 / 1024 / 1024 + 0.5)}' /proc/meminfo)
;;
macos) CPU=$(sysctl -n hw.ncpu)
RAM=$(sysctl -n hw.memsize | awk '{print $0/1073741824}')
sysctl -n hw.ncpu
;;
windows) CPU=$NUMBER_OF_PROCESSORS
RAM=$(systeminfo | awk '/Total Physical Memory:/ { gsub(/,/,"."); print int($4 + 0.5) }')
;;
*) CPU=2
RAM=8
echo "Unknown runner"
;;
esac
echo "CPU=${CPU}" >> $GITHUB_ENV
echo "RAM=${RAM}" >> $GITHUB_ENV
echo "TYPE=${RUNNER_ENVIRONMENT}" >> $GITHUB_ENV

# Set PARALLEL=1 if the runner has enough resources
if [[ ("${{ matrix.os }}" == "linux" || "${{ matrix.os }}" == "windows") && "${CPU}" -ge 16 ]]; then
echo "PARALLEL=1" >> $GITHUB_ENV
elif [[ "${{ matrix.os }}" == "macos" && "${CPU}" -ge 6 ]]; then
echo "PARALLEL=1" >> $GITHUB_ENV
else
echo "PARALLEL=0" >> $GITHUB_ENV
fi

- name: Show runner information
run: |
echo "OS: ${{ matrix.os }}"
echo "CPU: ${{ env.CPU }}"
echo "RAM: ${{ env.RAM }} GB"
echo "TYPE: ${{ env.TYPE }}"
echo "PARALLEL: ${{ env.PARALLEL }}"

## Part 1 Tests ##
- name: Unit tests
if: matrix.tests == 'unittest' || matrix.tests == 'all'
Expand All @@ -53,13 +93,20 @@ jobs:
with:
node-version: 20

- name: Start Ethereum node with Codex contracts
- name: Install Ethereum node dependencies
if: matrix.tests == 'contract' || matrix.tests == 'integration' || matrix.tests == 'tools' || matrix.tests == 'all'
working-directory: vendor/codex-contracts-eth
env:
MSYS2_PATH_TYPE: inherit
run: |
npm install

- name: Run Ethereum node with Codex contracts
if: matrix.tests == 'contract' || (matrix.tests == 'integration' && env.PARALLEL != 1) || matrix.tests == 'tools' || matrix.tests == 'all'
working-directory: vendor/codex-contracts-eth
env:
MSYS2_PATH_TYPE: inherit
run: |
npm start &

## Part 2 Tests ##
Expand All @@ -70,13 +117,13 @@ jobs:
## Part 3 Tests ##
- name: Integration tests
if: matrix.tests == 'integration' || matrix.tests == 'all'
run: make -j${ncpu} testIntegration
run: make -j${ncpu} PARALLEL=${{ env.PARALLEL }} DEBUG=${{ runner.debug }} testIntegration

- name: Upload integration tests log files
uses: actions/upload-artifact@v4
if: (matrix.tests == 'integration' || matrix.tests == 'all') && always()
with:
name: ${{ matrix.os }}-${{ matrix.cpu }}-${{ matrix.nim_version }}-integration-tests-logs
name: ${{ matrix.os }}-${{ matrix.cpu }}-${{ matrix.nim_version }}-${{ matrix.tests }}-tests-logs
path: tests/integration/logs/
retention-days: 1

Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,46 @@ on:
env:
cache_nonce: 0 # Allows for easily busting actions/cache caches
nim_version: v2.2.4
builder_integration_from_vars: true
builder_integration_linux: runner-node-01-linux-03-eu-hel1
builder_integration_macos: macos-14-xlarge
builder_integration_windows: windows-latest-amd64-32vcpu

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
matrix:
name: Compute matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
cache_nonce: ${{ env.cache_nonce }}
steps:
- name: Compute builders
if: ${{ env.builder_integration_from_vars == 'true' }}
run: |
if [[ -n "${{ vars.builder_integration_linux }}" ]]; then echo "builder_integration_linux=${{ vars.builder_integration_linux }}"; fi >> $GITHUB_ENV
if [[ -n "${{ vars.builder_integration_macos }}" ]]; then echo "builder_integration_macos=${{ vars.builder_integration_macos }}"; fi >> $GITHUB_ENV
if [[ -n "${{ vars.builder_integration_windows }}" ]]; then echo "builder_integration_windows=${{ vars.builder_integration_windows }}"; fi >> $GITHUB_ENV

- name: Compute matrix
id: matrix
uses: fabiocaccamo/create-matrix-action@v5
with:
matrix: |
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {unittest}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {contract}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {integration}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {tools}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {unittest}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {contract}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {linux}, cpu {amd64}, builder {${{ env.builder_integration_linux }}}, tests {integration}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {linux}, cpu {amd64}, builder {ubuntu-latest}, tests {tools}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {macos}, cpu {arm64}, builder {macos-14}, tests {unittest}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {macos}, cpu {arm64}, builder {macos-14}, tests {contract}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {macos}, cpu {arm64}, builder {macos-14}, tests {integration}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {macos}, cpu {arm64}, builder {${{ env.builder_integration_macos }}}, tests {integration}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {macos}, cpu {arm64}, builder {macos-14}, tests {tools}, nim_version {${{ env.nim_version }}}, shell {bash --noprofile --norc -e -o pipefail}
os {windows}, cpu {amd64}, builder {windows-latest}, tests {unittest}, nim_version {${{ env.nim_version }}}, shell {msys2}
os {windows}, cpu {amd64}, builder {windows-latest}, tests {contract}, nim_version {${{ env.nim_version }}}, shell {msys2}
os {windows}, cpu {amd64}, builder {windows-latest}, tests {integration}, nim_version {${{ env.nim_version }}}, shell {msys2}
os {windows}, cpu {amd64}, builder {${{ env.builder_integration_windows }}}, tests {integration}, nim_version {${{ env.nim_version }}}, shell {msys2}
os {windows}, cpu {amd64}, builder {windows-latest}, tests {tools}, nim_version {${{ env.nim_version }}}, shell {msys2}

build:
Expand Down
13 changes: 13 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,16 @@
url = https://github.com/vacp2p/nim-ngtcp2.git
ignore = untracked
branch = master
[submodule "vendor/nim-groth16"]
path = vendor/nim-groth16
url = https://github.com/codex-storage/nim-groth16.git
ignore = untracked
branch = master
[submodule "vendor/nim-goldilocks-hash"]
path = vendor/nim-goldilocks-hash
url = https://github.com/codex-storage/nim-goldilocks-hash.git
ignore = untracked
branch = master
[submodule "vendor/circom-witnessgen"]
path = vendor/circom-witnessgen
url = https://github.com/codex-storage/circom-witnessgen.git
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,24 @@ testContracts: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim testContracts $(NIM_PARAMS) --define:ws_resubscribe=240 build.nims

TEST_PARAMS :=
ifdef DEBUG
TEST_PARAMS := $(TEST_PARAMS) -d:DebugTestHarness=$(DEBUG)
TEST_PARAMS := $(TEST_PARAMS) -d:NoCodexLogFilters=$(DEBUG)
TEST_PARAMS := $(TEST_PARAMS) -d:ShowContinuousStatusUpdates=$(DEBUG)
TEST_PARAMS := $(TEST_PARAMS) -d:DebugHardhat=$(DEBUG)
endif
ifdef TEST_TIMEOUT
TEST_PARAMS := $(TEST_PARAMS) -d:TestTimeout=$(TEST_TIMEOUT)
endif
ifdef PARALLEL
TEST_PARAMS := $(TEST_PARAMS) -d:EnableParallelTests=$(PARALLEL)
endif

# Builds and runs the integration tests
testIntegration: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim testIntegration $(NIM_PARAMS) --define:ws_resubscribe=240 build.nims
$(ENV_SCRIPT) nim testIntegration $(TEST_PARAMS) $(NIM_PARAMS) --define:ws_resubscribe=240 build.nims

# Builds and runs all tests (except for Taiko L2 tests)
testAll: | build deps
Expand Down
18 changes: 15 additions & 3 deletions build.nims
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
mode = ScriptMode.Verbose

import std/os except commandLineParams
import std/strutils

### Helper functions
proc truthy(val: string): bool =
const truthySwitches = @["yes", "1", "on", "true"]
return val in truthySwitches

proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
mkDir "build"
Expand Down Expand Up @@ -45,11 +50,18 @@ task testContracts, "Build & run Codex Contract tests":
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"
"-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE -d:chronicles_disabled_topics=JSONRPC-HTTP-CLIENT,websock,libp2p,discv5 -d:codex_enable_proof_failures=true"
var sinks = @["textlines[nocolors,file]"]
for i in 2 ..< paramCount():
if "DebugTestHarness" in paramStr(i) and truthy paramStr(i).split('=')[1]:
sinks.add "textlines[stdout]"
break
var testParams =
"-d:chronicles_log_level=TRACE -d:chronicles_sinks=\"" & sinks.join(",") & "\""
test "testIntegration", params = testParams
# 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"
# "-d:chronicles_enabled_topics:integration:TRACE"

task build, "build codex binary":
codexTask()
Expand Down
1 change: 0 additions & 1 deletion codex.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import pkg/chronos
import pkg/questionable
import pkg/confutils
import pkg/confutils/defs
import pkg/confutils/std/net
import pkg/confutils/toml/defs as confTomlDefs
import pkg/confutils/toml/std/net as confTomlNet
Expand Down
6 changes: 6 additions & 0 deletions codex/blockexchange/engine/engine.nim
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ const
DefaultMaxPeersPerRequest* = 10
DefaultTaskQueueSize = 100
DefaultConcurrentTasks = 10
# DefaultMaxRetries = 3
# DefaultConcurrentDiscRequests = 10
# DefaultConcurrentAdvertRequests = 10
# DefaultDiscoveryTimeout = 1.minutes
# DefaultMaxQueriedBlocksCache = 1000
# DefaultMinPeersPerBlock = 3

type
TaskHandler* = proc(task: BlockExcPeerCtx): Future[void] {.gcsafe.}
Expand Down
32 changes: 14 additions & 18 deletions codex/codex.nim
Original file line number Diff line number Diff line change
Expand Up @@ -208,22 +208,19 @@ proc new*(
.withTcpTransport({ServerFlags.ReuseAddr})
.build()

var
cache: CacheStore = nil
taskpool: Taskpool

try:
if config.numThreads == ThreadCount(0):
taskpool = Taskpool.new(numThreads = min(countProcessors(), 16))
let numThreads =
if int(config.numThreads) == 0:
countProcessors()
else:
taskpool = Taskpool.new(numThreads = int(config.numThreads))
info "Threadpool started", numThreads = taskpool.numThreads
except CatchableError as exc:
raiseAssert("Failure in taskpool initialization:" & exc.msg)
int(config.numThreads)

var tp =
try:
Taskpool.new(numThreads)
except CatchableError as exc:
raiseAssert("Failure in tp initialization:" & exc.msg)

if config.cacheSize > 0'nb:
cache = CacheStore.new(cacheSize = config.cacheSize)
## Is unused?
info "Threadpool started", numThreads = tp.numThreads

let discoveryDir = config.dataDir / CodexDhtNamespace

Expand Down Expand Up @@ -299,9 +296,8 @@ proc new*(
store = NetworkStore.new(engine, repoStore)
prover =
if config.prover:
let backend =
config.initializeBackend().expect("Unable to create prover backend.")
some Prover.new(store, backend, config.numProofSamples)
let prover = config.initializeProver(tp).expect("Unable to create prover.")
some prover
else:
none Prover

Expand All @@ -311,7 +307,7 @@ proc new*(
engine = engine,
discovery = discovery,
prover = prover,
taskPool = taskpool,
taskPool = tp,
)

restServer = RestServerRef
Expand Down
Loading
Loading