Skip to content

Commit 2cae2d9

Browse files
committed
automate building of misconfigured geth image
1 parent 45556e7 commit 2cae2d9

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

Makefile

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,26 @@ prepare:
7777

7878
PARAMS_FILE_MAJORITY_FORK=./scenarios/majority-fork.yaml
7979

80-
# Prepare images for the majority fork. Run the `prepare` step and build go-ethereum image.
80+
# Prepare images for the majority fork. Run the `prepare` step and build a misconfigured geth image.
8181
.PHONY: prepare-majority-fork
8282
prepare-majority-fork: prepare
83-
@if [ ! -d "../go-ethereum" ]; then \
84-
git clone https://github.com/ethereum/go-ethereum.git ../go-ethereum; \
85-
else \
86-
echo "✅ go-ethereum repo already cloned."; \
87-
cd ../go-ethereum && git fetch && git checkout master; \
88-
fi
89-
@docker image inspect geth >/dev/null 2>&1 || (cd ../go-ethereum && docker build -t node/ssv . && echo "✅ Geth image built successfully.")
83+
@set -e; \
84+
if [ ! -d "../geth-misconfigured" ]; then \
85+
git clone https://github.com/ethereum/go-ethereum.git ../geth-misconfigured; \
86+
fi; \
87+
cd ../geth-misconfigured; \
88+
git fetch --all --tags; \
89+
git checkout v1.15.2
90+
91+
@set -e; \
92+
FILE="../geth-misconfigured/core/state_processor.go"; \
93+
test -f "$$FILE"; \
94+
cp "$$FILE" "$$FILE.bak"; \
95+
perl -0777 -pi -e 's/if\s+log\.Address\s*==\s*config\.DepositContractAddress/if log.Address == (common.Address{})/g' "$$FILE"; \
96+
grep -n "if log.Address == (common.Address{})" "$$FILE" >/dev/null || { echo "❌ Replacement not found in $$FILE"; exit 1; }; \
97+
echo "✅ Replacement applied in $$FILE"
98+
99+
@cd ../geth-misconfigured && docker build -t geth-misconfigured .
90100

91101
# Run the majority fork scenario without prepare: Uses existing local repos and Docker images (for custom branches/versions).
92102
# It must be prepared manually until its prepare step is implemented. Make sure all images are ready.

scenarios/majority-fork.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ network:
99
validator_count: 16
1010
count: 6
1111
- el_type: geth
12-
el_image: geth-bug
12+
el_image: geth-misconfigured
1313
cl_type: lighthouse
1414
cl_image: sigp/lighthouse:v7.0.0
1515
validator_count: 16

0 commit comments

Comments
 (0)