Skip to content

Commit 1ed6871

Browse files
authored
Check binary revision vs repo revision (#3668)
* Check binary revision vs repo revision * Update check_revision.sh executable permission * Fix Makefile * Fix script path
1 parent 388e146 commit 1ed6871

File tree

3 files changed

+42
-17
lines changed

3 files changed

+42
-17
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ jobs:
6868
run: |
6969
gcc --version
7070
DEFAULT_MAKE_FLAGS="-j${ncpu} ENABLE_VMLOWMEM=${ENABLE_VMLOWMEM} ROCKSDB_CI_CACHE=RocksBinCache"
71-
mingw32-make ${DEFAULT_MAKE_FLAGS} all test_import build_fuzzers
72-
build/nimbus_execution_client.exe --help
73-
# give us more space
74-
# find . -type d -name ".git" -exec rm -rf {} +
71+
mingw32-make ${DEFAULT_MAKE_FLAGS} all test_import build_fuzzers check_revision
7572
find . -type d -name "nimcache" -exec rm -rf {} +
7673
mingw32-make ${DEFAULT_MAKE_FLAGS} test t8n_test eest_full_test
7774
@@ -80,29 +77,18 @@ jobs:
8077
run: |
8178
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib"
8279
DEFAULT_MAKE_FLAGS="-j${ncpu} ROCKSDB_CI_CACHE=RocksBinCache"
83-
env CC=gcc make ${DEFAULT_MAKE_FLAGS} all test_import build_fuzzers
80+
env CC=gcc make ${DEFAULT_MAKE_FLAGS} all test_import build_fuzzers check_revision
8481
build/nimbus_execution_client --help
8582
# CC, GOARCH, and CGO_ENABLED are needed to select correct compiler 32/64 bit
86-
# pushd vendor/nimbus-eth2
87-
# env NIMBUSEL_BINARY=../../build/nimbus_execution_client NIMBUSEL_GENESIS=scripts/nimbusel_genesis.json \
88-
# ./scripts/launch_local_testnet.sh --nodes=3 --stop-at-epoch=7 \
89-
# --disable-htop --reuse-binaries --run-nimbus-el --dl-eth2 --verbose --kill-old-processes
90-
# popd
9183
env CC=gcc GOARCH=${GOARCH} CXX=g++ CGO_ENABLED=1 make ${DEFAULT_MAKE_FLAGS} test t8n_test eest_full_test
9284
9385
- name: Run nimbus-eth1 tests (Macos)
9486
if: runner.os == 'Macos'
9587
run: |
9688
export ZERO_AR_DATE=1 # avoid timestamps in binaries
9789
DEFAULT_MAKE_FLAGS="-j${ncpu} ROCKSDB_CI_CACHE=RocksBinCache"
98-
make ${DEFAULT_MAKE_FLAGS} all test_import build_fuzzers
99-
build/nimbus_execution_client --help
90+
make ${DEFAULT_MAKE_FLAGS} all test_import build_fuzzers check_revision
10091
# "-static" option will not work for osx unless static system libraries are provided
101-
# pushd vendor/nimbus-eth2
102-
# env NIMBUSEL_BINARY=../../build/nimbus_execution_client NIMBUSEL_GENESIS=scripts/nimbusel_genesis.json \
103-
# ./scripts/launch_local_testnet.sh --nodes=3 --stop-at-epoch=7 \
104-
# --disable-htop --reuse-binaries --run-nimbus-el --dl-eth2 --verbose --kill-old-processes
105-
# popd
10692
make ${DEFAULT_MAKE_FLAGS} test t8n_test eest_full_test
10793
10894
lint:

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ nimbus_execution_client: | build deps rocksdb
213213
echo -e $(BUILD_MSG) "build/nimbus_execution_client" && \
214214
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:chronicles_log_level=TRACE -o:build/nimbus_execution_client "execution_chain/nimbus_execution_client.nim"
215215

216+
check_revision: nimbus_execution_client
217+
scripts/check_revision.sh
218+
216219
nimbus: nimbus_execution_client
217220
echo "The nimbus target is deprecated and will soon change meaning, use 'nimbus_execution_client' instead"
218221

scripts/check_revision.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2025 Status Research & Development GmbH.
4+
# Licensed under either of:
5+
# - Apache License, version 2.0
6+
# - MIT license
7+
# at your option.
8+
9+
# prevent issue https://github.com/status-im/nimbus-eth1/issues/3661
10+
11+
set -e
12+
13+
cd "$(dirname "${BASH_SOURCE[0]}")"/..
14+
15+
REPO_DIR="${PWD}"
16+
EL=build/nimbus_execution_client
17+
18+
$EL --help
19+
REPO_REVISION=$(git -C $REPO_DIR rev-parse --short=8 HEAD)
20+
21+
# nimbus-eth1/v0.2.0-f10349dc/windows-amd64/Nim-2.2.4
22+
# Copyright (c) 2019-2025 Status Research & Development GmbH
23+
24+
# From `EL --version` output above,
25+
# Get first line and then second field after split by '/'
26+
VERSION=$(echo "$($EL --version | head -n 1)" | cut -d '/' -f 2)
27+
28+
# Get second field after split by '-'
29+
BINARY_REVISION=$(echo $VERSION | cut -d '-' -f 2)
30+
31+
if [[ $REPO_REVISION -ne $BINARY_REVISION ]]; then
32+
echo "Binary revision differ from repository revision. Expect $REPO_REVISION, get $BINARY_REVISION."
33+
exit 1 # Exit the script with an error code
34+
fi
35+
36+
# TODO: check copyright year start from 2018, the current 2019 is from nimbus-eth2

0 commit comments

Comments
 (0)