From 6df9f0f17ab577111c7231c267062487a9a4c1d0 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Wed, 12 Aug 2026 11:09:51 +0000 Subject: [PATCH] zero-gravity: detect tarball layout; galileo 3.0.8 moved binaries to a shared root bin/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the de-32 build break introduced by vibe-node #2912 (galileo 3.0.3 -> 3.0.8, merged as bc4cecf). Job ad580587: #16 chmod: cannot access '/0g/bin/0gchaind': No such file or directory The Dockerfile hardcoded 'galileo -> mv /rpc /0g'. That held for 3.0.3, where every profile dir carried its own copy of the binaries. 3.0.8 DEDUPLICATED them into a shared /bin/ (168 MB -> 69 MB), leaving rpc/ as configs-only — so the move produced configs and no binaries, and the build died two layers later on a chmod. Note 'does /rpc exist' is not a sufficient test: 3.0.8 still ships rpc/, it just no longer holds bin/. Verified layouts: galileo 3.0.3 /{rpc,validator,archive,seed}/bin/ + configs galileo 3.0.8 /bin/ shared + /{rpc,...}/ configs aristotle 1.0.6 /bin/ + configs, no profile dirs So: take configs from the profile dir when present, then top the binaries up from the shared root bin/ if the profile dir did not supply them. Also asserts both binaries exist immediately after extraction, naming the chain, the version and the known layouts — so the next upstream reshuffle reports itself at the point of failure rather than as an anonymous chmod error. Verified against the real artifacts — all three now yield an identical /0g (bin/0gchaind 76M, bin/geth 46M, geth-config.toml, geth-genesis.json, kzg-trusted-setup.json, 0g-home/, rollback_cl.sh), and a synthetic unknown layout exits 1 with the diagnostic instead of reaching chmod. Co-Authored-By: Claude Opus 5 (1M context) --- zero-gravity/zerog.Dockerfile | 57 ++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/zero-gravity/zerog.Dockerfile b/zero-gravity/zerog.Dockerfile index 7c2b1422..da1e0786 100644 --- a/zero-gravity/zerog.Dockerfile +++ b/zero-gravity/zerog.Dockerfile @@ -48,17 +48,52 @@ RUN set -eu; \ exit 1; \ fi -RUN tar -xzf /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz -C /tmp -RUN if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "galileo" ]; then \ - mv /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/rpc /0g; \ +# Extract by DETECTING the layout rather than assuming one per chain. 0G has shipped +# three shapes so far and changed between them without notice: +# +# galileo <= 3.0.3 /{rpc,validator,archive,seed}/bin/ + configs (168 MB) +# -> binaries duplicated inside every profile dir +# galileo >= 3.0.8 /bin/ shared, + /{rpc,...}/ configs (69 MB) +# -> binaries DEDUPLICATED to the tarball root; rpc/ is configs-only +# aristotle 1.0.x /bin/ + configs, no profile dirs at all +# +# So "does /rpc exist" is NOT sufficient: 3.0.8 still has rpc/, it just no longer +# holds bin/. Take configs from the profile dir when present, then top the binaries up +# from the shared root bin/ if the profile dir didn't supply them. +# +# The old code hardcoded "galileo -> mv /rpc /0g", so 3.0.8 yielded configs but no +# binaries and the build died two layers later at +# `chmod: cannot access '/0g/bin/0gchaind'` — an error naming neither the chain, the +# version, nor the layout. Assert on the binaries here so the NEXT upstream reshuffle +# reports itself at the point of failure instead. +RUN set -eu; \ + SRC="/tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}"; \ + tar -xzf "${SRC}.tar.gz" -C /tmp; \ + mkdir -p /0g; \ + if [ -d "${SRC}/rpc" ]; then \ + echo "0g: profile dir found -> ${SRC}/rpc"; \ + cp -a "${SRC}/rpc/." /0g/; \ else \ - mkdir -p /0g && \ - cp -a /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/* /0g/ 2>/dev/null || true; \ - cp -a /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}/.[^.]* /0g/ 2>/dev/null || true; \ - rm -rf /tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}; \ - fi - -RUN chmod +x /0g/bin/0gchaind -RUN chmod +x /0g/bin/geth + echo "0g: no profile dir -> using tarball root ${SRC}"; \ + cp -a "${SRC}/." /0g/; \ + fi; \ + if [ ! -f /0g/bin/0gchaind ] && [ -d "${SRC}/bin" ]; then \ + echo "0g: binaries not in the profile dir -> topping up from ${SRC}/bin"; \ + cp -a "${SRC}/bin" /0g/; \ + fi; \ + rm -rf "${SRC}"; \ + missing=""; \ + for b in 0gchaind geth; do \ + [ -f "/0g/bin/${b}" ] || missing="${missing} bin/${b}"; \ + done; \ + if [ -n "${missing}" ]; then \ + echo "0g: FATAL - missing after extraction:${missing}" >&2; \ + echo "0g: ${ZERO_GRAVITY_CHAIN_SPEC} v${ZERO_GRAVITY_VERSION} tarball layout not recognised." >&2; \ + echo "0g: known layouts are '/rpc/bin/' (per-profile) and '/bin/' (flat)." >&2; \ + echo "0g: contents of /0g were:" >&2; \ + ls -la /0g >&2 || true; \ + exit 1; \ + fi; \ + chmod +x /0g/bin/0gchaind /0g/bin/geth ENTRYPOINT [ "init.sh" ] -- 2.49.1