From 276d1a60c03c5a94887ee62a51699431eaf9d1c6 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Wed, 20 May 2026 21:26:18 +0100 Subject: [PATCH 1/7] ci: cache zerokit/RLN build artifacts on PR CI Avoid rebuilding librln (zerokit) from Rust source on every job. Cache the final static library keyed by OS + RLN version + zerokit submodule SHA, and add a Cargo registry/target fallback cache for the miss path. Applied to the build and test jobs in ci.yml. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52d20157a..92ee4b2c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,30 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Get zerokit submodule SHA + id: zerokit-sha + run: echo "sha=$(git submodule status vendor/zerokit | awk '{print $1}' | sed 's/^[+-]//')" >> $GITHUB_OUTPUT + + - name: Cache librln + id: cache-librln + uses: actions/cache@v3 + with: + path: librln_v0.9.0.a + key: ${{ runner.os }}-librln-v0.9.0-${{ steps.zerokit-sha.outputs.sha }} + + - name: Cache cargo + if: steps.cache-librln.outputs.cache-hit != 'true' + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + vendor/zerokit/target/ + key: ${{ runner.os }}-cargo-zerokit-${{ steps.zerokit-sha.outputs.sha }} + restore-keys: | + ${{ runner.os }}-cargo-zerokit- + - name: Install Nim ${{ env.NIM_VERSION }} uses: jiro4989/setup-nim-action@v2 with: @@ -119,6 +143,30 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Get zerokit submodule SHA + id: zerokit-sha + run: echo "sha=$(git submodule status vendor/zerokit | awk '{print $1}' | sed 's/^[+-]//')" >> $GITHUB_OUTPUT + + - name: Cache librln + id: cache-librln + uses: actions/cache@v3 + with: + path: librln_v0.9.0.a + key: ${{ runner.os }}-librln-v0.9.0-${{ steps.zerokit-sha.outputs.sha }} + + - name: Cache cargo + if: steps.cache-librln.outputs.cache-hit != 'true' + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + vendor/zerokit/target/ + key: ${{ runner.os }}-cargo-zerokit-${{ steps.zerokit-sha.outputs.sha }} + restore-keys: | + ${{ runner.os }}-cargo-zerokit- + - name: Install Nim ${{ env.NIM_VERSION }} uses: jiro4989/setup-nim-action@v2 with: From b8cdcc8622423aab1417fb411a6b1e2dcb77d4b6 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Wed, 20 May 2026 22:53:44 +0100 Subject: [PATCH 2/7] ci: fix nimble caching --- .github/workflows/ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92ee4b2c5..21343b1b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,7 +116,9 @@ jobs: nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps - touch nimbledeps/.nimble-setup + + - name: Refresh nimbledeps stamp + run: touch nimbledeps/.nimble-setup - name: Build binaries run: make V=1 all @@ -193,7 +195,9 @@ jobs: nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps - touch nimbledeps/.nimble-setup + + - name: Refresh nimbledeps stamp + run: touch nimbledeps/.nimble-setup - name: Run tests run: | @@ -272,7 +276,9 @@ jobs: nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps - touch nimbledeps/.nimble-setup + + - name: Refresh nimbledeps stamp + run: touch nimbledeps/.nimble-setup - name: Build nph run: | From ee5aaa20015b090512182432f31e8bcce226459f Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Thu, 21 May 2026 10:15:00 +0100 Subject: [PATCH 3/7] ci: bump nimble deps cache key + add restore-keys The nimbledeps cache key was based only on hashFiles(nimble.lock, ...), which hasn't changed, so PRs kept restoring a stale, incomplete master cache. GitHub caches are immutable per key, so that poisoned cache was never refreshed and `make all` re-resolved/re-downloaded deps every run. Add a bumpable NIMBLE_CACHE_VERSION token to abandon the poisoned cache and restore-keys for warm starts. `nimble setup --localdeps` fully installs the locked dep set, so a fresh v2 cache will be complete. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21343b1b1..979f16790 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,8 @@ env: NIMFLAGS: "--parallelBuild:${NPROC} --colors:off -d:chronicles_colors:none" NIM_VERSION: '2.2.4' NIMBLE_VERSION: '0.22.3' + # Bump to invalidate the nimble deps cache (GitHub caches are immutable per key). + NIMBLE_CACHE_VERSION: 'v2' jobs: changes: # changes detection @@ -108,7 +110,9 @@ jobs: path: | nimbledeps/ nimble.paths - key: ${{ runner.os }}-nimbledeps-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + restore-keys: | + ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' @@ -187,7 +191,9 @@ jobs: path: | nimbledeps/ nimble.paths - key: ${{ runner.os }}-nimbledeps-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + restore-keys: | + ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' @@ -268,7 +274,9 @@ jobs: path: | nimbledeps/ nimble.paths - key: ${{ runner.os }}-nimbledeps-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + restore-keys: | + ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' From 485e53244a06f3adbb8754c93dbe212fd0420301 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Thu, 21 May 2026 11:16:08 +0100 Subject: [PATCH 4/7] ci: add nimble deps caching to Windows build The Windows build referenced steps.cache-nimbledeps.outputs.cache-hit but never defined a Cache nimble deps step, so the condition was always true and nimble deps were never cached on Windows. Add the cache step with the same versioned key + restore-keys as the Linux/macOS jobs, and move the .nimble-setup stamp touch into its own unconditional step so a cache hit doesn't re-trigger `nimble setup`. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/windows-build.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 50f1602cd..50588f7fc 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -11,6 +11,8 @@ env: NPROC: 4 NIM_VERSION: '2.2.4' NIMBLE_VERSION: '0.22.3' + # Bump to invalidate the nimble deps cache (GitHub caches are immutable per key). + NIMBLE_CACHE_VERSION: 'v2' jobs: build: @@ -88,6 +90,17 @@ jobs: run: | sed -i 's/68bb85cbfb1832ce4db43943911b046c3af3caab/a092a045d3a427d127a5334a6e59c76faff54686/g' nimble.lock + - name: Cache nimble deps + id: cache-nimbledeps + uses: actions/cache@v3 + with: + path: | + nimbledeps/ + nimble.paths + key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + restore-keys: | + ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- + - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' run: | @@ -95,7 +108,9 @@ jobs: nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps CC=gcc make rebuild-bearssl-nimbledeps CC=gcc - touch nimbledeps/.nimble-setup + + - name: Refresh nimbledeps stamp + run: touch nimbledeps/.nimble-setup - name: Creating tmp directory run: mkdir -p tmp From 2d42f05b9e5ff2879e7e55052cd5491fb308dea5 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Thu, 21 May 2026 11:43:37 +0100 Subject: [PATCH 5/7] ci: cache ~/.nimble so builds don't re-resolve deps over the network Caching only nimbledeps/ was insufficient: make invokes `nimble `, which re-resolves dependencies on every build using ~/.nimble/pkgcache (nimble's git clone/version cache). That dir was not cached, so every cache-hit build re-cloned ~50 packages and intermittently failed when the runner's `git fetch --tags` flaked, breaking nimble's SAT solver. Add ~/.nimble to the cached paths (alongside nimbledeps/ + nimble.paths) so re-resolution is served from the local clone cache. Bump the cache version to v3 since the cached contents changed. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 5 ++++- .github/workflows/windows-build.yml | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 979f16790..a1c2ff0de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ env: NIM_VERSION: '2.2.4' NIMBLE_VERSION: '0.22.3' # Bump to invalidate the nimble deps cache (GitHub caches are immutable per key). - NIMBLE_CACHE_VERSION: 'v2' + NIMBLE_CACHE_VERSION: 'v3' jobs: changes: # changes detection @@ -110,6 +110,7 @@ jobs: path: | nimbledeps/ nimble.paths + ~/.nimble key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} restore-keys: | ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- @@ -191,6 +192,7 @@ jobs: path: | nimbledeps/ nimble.paths + ~/.nimble key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} restore-keys: | ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- @@ -274,6 +276,7 @@ jobs: path: | nimbledeps/ nimble.paths + ~/.nimble key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} restore-keys: | ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 50588f7fc..035d0614d 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -12,7 +12,7 @@ env: NIM_VERSION: '2.2.4' NIMBLE_VERSION: '0.22.3' # Bump to invalidate the nimble deps cache (GitHub caches are immutable per key). - NIMBLE_CACHE_VERSION: 'v2' + NIMBLE_CACHE_VERSION: 'v3' jobs: build: @@ -97,6 +97,7 @@ jobs: path: | nimbledeps/ nimble.paths + ~/.nimble key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} restore-keys: | ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- From f36f84b4c0ebb42dadd074f249c7117e3b7a817f Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Thu, 21 May 2026 15:29:42 +0100 Subject: [PATCH 6/7] ci: simplify windows builds --- .github/workflows/windows-build.yml | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 035d0614d..9dbb92bee 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -116,27 +116,7 @@ jobs: - name: Creating tmp directory run: mkdir -p tmp - - name: Building wakunode2.exe + - name: Build binaries run: | export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH" - make wakunode2 V=3 -j${{ env.NPROC }} - - - name: Building libwaku.dll - run: | - export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH" - make libwaku STATIC=0 V=1 -j - - - name: Check Executable - run: | - if [ -f "./build/wakunode2.exe" ]; then - echo "wakunode2.exe build successful" - else - echo "Build failed: wakunode2.exe not found" - exit 1 - fi - if [ -f "./build/libwaku.dll" ]; then - echo "libwaku.dll build successful" - else - echo "Build failed: libwaku.dll not found" - exit 1 - fi \ No newline at end of file + make all STATIC=0 V=1 -j${{ env.NPROC }} From 7b25ae9781b8d5665d3c1f966b9c5a4b6236e2f0 Mon Sep 17 00:00:00 2001 From: Igor Sirotin Date: Thu, 21 May 2026 16:01:39 +0100 Subject: [PATCH 7/7] ci: derive librln version from Makefile, drop cargo cache The librln cache key/path hardcoded v0.9.0, so after the zerokit v2.0.2 bump it never matched the built artifact and librln was rebuilt every run. Derive the version via `make print-librln-version` so it tracks the Makefile automatically. Drop the cargo/zerokit-target cache: zerokit is bumped rarely, so the librln artifact cache covers the common case, and caching the target dir inside the submodule broke `git submodule update --init` (non-empty dir). Co-Authored-By: Claude Opus 4.7 --- .github/workflows/ci.yml | 42 ++++++++++++---------------------------- Makefile | 5 ++++- 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1c2ff0de..183facc67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,25 +72,16 @@ jobs: id: zerokit-sha run: echo "sha=$(git submodule status vendor/zerokit | awk '{print $1}' | sed 's/^[+-]//')" >> $GITHUB_OUTPUT + - name: Get librln version + id: librln-version + run: echo "version=$(make print-librln-version)" >> $GITHUB_OUTPUT + - name: Cache librln id: cache-librln uses: actions/cache@v3 with: - path: librln_v0.9.0.a - key: ${{ runner.os }}-librln-v0.9.0-${{ steps.zerokit-sha.outputs.sha }} - - - name: Cache cargo - if: steps.cache-librln.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - vendor/zerokit/target/ - key: ${{ runner.os }}-cargo-zerokit-${{ steps.zerokit-sha.outputs.sha }} - restore-keys: | - ${{ runner.os }}-cargo-zerokit- + path: librln_${{ steps.librln-version.outputs.version }}.a + key: ${{ runner.os }}-librln-${{ steps.librln-version.outputs.version }}-${{ steps.zerokit-sha.outputs.sha }} - name: Install Nim ${{ env.NIM_VERSION }} uses: jiro4989/setup-nim-action@v2 @@ -154,25 +145,16 @@ jobs: id: zerokit-sha run: echo "sha=$(git submodule status vendor/zerokit | awk '{print $1}' | sed 's/^[+-]//')" >> $GITHUB_OUTPUT + - name: Get librln version + id: librln-version + run: echo "version=$(make print-librln-version)" >> $GITHUB_OUTPUT + - name: Cache librln id: cache-librln uses: actions/cache@v3 with: - path: librln_v0.9.0.a - key: ${{ runner.os }}-librln-v0.9.0-${{ steps.zerokit-sha.outputs.sha }} - - - name: Cache cargo - if: steps.cache-librln.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - vendor/zerokit/target/ - key: ${{ runner.os }}-cargo-zerokit-${{ steps.zerokit-sha.outputs.sha }} - restore-keys: | - ${{ runner.os }}-cargo-zerokit- + path: librln_${{ steps.librln-version.outputs.version }}.a + key: ${{ runner.os }}-librln-${{ steps.librln-version.outputs.version }}-${{ steps.zerokit-sha.outputs.sha }} - name: Install Nim ${{ env.NIM_VERSION }} uses: jiro4989/setup-nim-action@v2 diff --git a/Makefile b/Makefile index be9e14027..b3a6a1d3a 100644 --- a/Makefile +++ b/Makefile @@ -173,11 +173,14 @@ deps: | nimble ################## ## RLN ## ################## -.PHONY: librln +.PHONY: librln print-librln-version LIBRLN_BUILDDIR := $(CURDIR)/vendor/zerokit LIBRLN_VERSION := v0.9.0 +print-librln-version: + @echo "$(LIBRLN_VERSION)" + ifeq ($(detected_OS),Windows) LIBRLN_FILE ?= rln.lib else