Skip to content

Commit 7ad5a94

Browse files
committed
ci: patch Hive Lean build and run devnet5
1 parent a3045e9 commit 7ad5a94

2 files changed

Lines changed: 102 additions & 8 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env python3
2+
"""Patch Hive's Lean simulator Dockerfile for CI.
3+
4+
The pinned Hive Dockerfile uses unauthenticated GitHub API `ADD` instructions
5+
as cache-busters for commit/release metadata. GitHub-hosted runners can hit the
6+
anonymous API rate limit there before Hive starts. Replace those remote fetches
7+
with local metadata stubs; the build still downloads the actual pinned assets
8+
through the later `git clone`/`curl` steps.
9+
"""
10+
11+
from __future__ import annotations
12+
13+
import pathlib
14+
import sys
15+
16+
17+
REPLACEMENTS = {
18+
"ADD ${LEAN_SPEC_DEVNET4_COMMIT_METADATA_URL} /tmp/devnet4-commit.json":
19+
'RUN printf \'{"sha":"%s"}\\n\' "$devnet4_tag" > /tmp/devnet4-commit.json',
20+
"ADD ${LEAN_SPEC_DEVNET5_COMMIT_METADATA_URL} /tmp/devnet5-commit.json":
21+
'RUN printf \'{"sha":"%s"}\\n\' "$devnet5_tag" > /tmp/devnet5-commit.json',
22+
"ADD ${LEAN_SPEC_TESTS_METADATA_URL} /tmp/lean-spec-tests-commit.json":
23+
'RUN printf \'{"sha":"%s"}\\n\' "$lean_spec_tests_ref" > /tmp/lean-spec-tests-commit.json',
24+
"ADD ${LEAN_SPEC_FIXTURES_METADATA_URL} /tmp/devnet5-lean-spec-fixtures-release.json":
25+
'RUN printf \'{"tag_name":"%s"}\\n\' "$lean_spec_fixtures_tag" > /tmp/devnet5-lean-spec-fixtures-release.json',
26+
"ADD ${LEAN_SPEC_DEVNET5_KEYS_METADATA_URL} /tmp/devnet5-keys-release.json":
27+
'RUN printf \'{"tag_name":"%s"}\\n\' "$devnet5_keys_tag" > /tmp/devnet5-keys-release.json',
28+
}
29+
30+
31+
def main() -> int:
32+
dockerfile = pathlib.Path(sys.argv[1] if len(sys.argv) > 1 else "src/simulators/lean/Dockerfile")
33+
content = dockerfile.read_text()
34+
35+
missing = [needle for needle in REPLACEMENTS if needle not in content]
36+
if missing:
37+
print("Hive Lean Dockerfile did not contain expected metadata ADD line(s):", file=sys.stderr)
38+
for needle in missing:
39+
print(f"- {needle}", file=sys.stderr)
40+
return 1
41+
42+
for needle, replacement in REPLACEMENTS.items():
43+
content = content.replace(needle, replacement)
44+
45+
if "ADD ${LEAN_SPEC_" in content:
46+
print("Hive Lean Dockerfile still contains a remote Lean metadata ADD", file=sys.stderr)
47+
return 1
48+
49+
dockerfile.write_text(content)
50+
print(f"Patched {dockerfile} to avoid unauthenticated GitHub API metadata fetches")
51+
return 0
52+
53+
54+
if __name__ == "__main__":
55+
raise SystemExit(main())

.github/workflows/ci.yml

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,54 @@ jobs:
248248
fi
249249
echo "flags=$FLAGS" >> "$GITHUB_OUTPUT"
250250
251-
- name: Run Hive Simulation
252-
uses: ethpandaops/hive-github-action@09050fc75bae8a10b1876a0826ca4114ea9ed6e8 # v0.6.3
251+
- name: Setup Go
252+
uses: actions/setup-go@v6
253+
with:
254+
go-version: "1.24"
255+
cache: false
256+
257+
- name: Checkout hive
258+
uses: actions/checkout@v6
253259
with:
254-
hive_repository: ethereum/hive
255-
hive_version: dde4f59d04ff0ff8b6585670b08cea1b6c8ab65c
256-
simulator: lean
257-
client: ethlambda_devnet4
258-
client_config: ${{ steps.client-config.outputs.config }}
259-
extra_flags: ${{ steps.hive-flags.outputs.flags }}
260+
repository: ethereum/hive
261+
ref: dde4f59d04ff0ff8b6585670b08cea1b6c8ab65c
262+
path: src
263+
264+
- name: Patch Hive Lean Dockerfile
265+
run: python3 .github/scripts/patch-hive-lean-dockerfile.py src/simulators/lean/Dockerfile
266+
267+
- name: Build Hive
268+
working-directory: src
269+
run: go build -o hive .
270+
271+
- name: Create Hive results directory
272+
working-directory: src
273+
run: mkdir -p results
274+
275+
- name: Write Hive client config
276+
working-directory: src
277+
run: |
278+
cat > client-config.yaml <<'EOF'
279+
${{ steps.client-config.outputs.config }}
280+
EOF
281+
282+
- name: Run Hive Simulation
283+
working-directory: src
284+
run: |
285+
set -x
286+
(./hive \
287+
--sim lean \
288+
--client ethlambda_devnet5 \
289+
--results-root results \
290+
--client-file=client-config.yaml \
291+
${{ steps.hive-flags.outputs.flags }} \
292+
2>&1 || true) | tee hive.log
293+
294+
if tail -n 10 hive.log | grep -q "simulation .* finished"; then
295+
exit 0
296+
fi
297+
298+
exit 1
260299
261300
- name: Check Hive Results For Failures
262301
id: verify-hive-results

0 commit comments

Comments
 (0)