From 61ddf9efa627754ed806c23f2ed06a618f87428c Mon Sep 17 00:00:00 2001 From: JoE11-y Date: Tue, 14 Apr 2026 07:52:49 +0100 Subject: [PATCH] chore: refactor contract releasese --- .github/workflows/contracts-release.yml | 16 ++++++++-------- scripts/docker-local/.env.example | 6 +++--- scripts/docker-local/Dockerfile.deployer | 2 +- scripts/docker-local/README.md | 18 +++++++++--------- scripts/docker-local/docker-compose.yaml | 5 +++-- scripts/docker-local/entrypoint.sh | 9 +++++++-- scripts/docker-local/up.sh | 10 +++++----- 7 files changed, 36 insertions(+), 30 deletions(-) diff --git a/.github/workflows/contracts-release.yml b/.github/workflows/contracts-release.yml index 76a7fc3..8dcf3c7 100644 --- a/.github/workflows/contracts-release.yml +++ b/.github/workflows/contracts-release.yml @@ -121,27 +121,27 @@ jobs: echo "manifest=$MANIFEST" >> "$GITHUB_OUTPUT" # ── immutable per-sha release ─────────────────────────────────── - - name: Release contracts-${{ steps.sha.outputs.short }} + - name: Release ${{ steps.sha.outputs.short }} uses: softprops/action-gh-release@v2 with: - tag_name: contracts-${{ steps.sha.outputs.short }} - name: Contracts @ ${{ steps.sha.outputs.short }} + tag_name: ${{ steps.sha.outputs.short }} + name: Proofbridge-Contracts @ ${{ steps.sha.outputs.short }} body: | Bundled WASMs, EVM artifacts, and deposit VK built from `${{ github.sha }}`. - Consumed by `scripts/docker-local/up.sh` (defaults to `contracts-latest`; - pin this tag by exporting `CONTRACTS_BUNDLE_TAG=contracts-${{ steps.sha.outputs.short }}`). + Consumed by `scripts/docker-local/up.sh` (defaults to `latest`; + pin this tag by exporting `CONTRACTS_BUNDLE_TAG=${{ steps.sha.outputs.short }}`). files: | ${{ steps.bundle.outputs.tarball }} ${{ steps.bundle.outputs.manifest }} make_latest: "false" # ── rolling pointer for docker-local ──────────────────────────── - - name: Update contracts-latest + - name: Update latest uses: softprops/action-gh-release@v2 with: - tag_name: contracts-latest - name: Contracts (latest main) + tag_name: latest + name: Proofbridge-Contracts body: | Rolling pointer to the most recent contracts build from `main`. Current commit: ${{ github.sha }} diff --git a/scripts/docker-local/.env.example b/scripts/docker-local/.env.example index 1f49451..1592ed5 100644 --- a/scripts/docker-local/.env.example +++ b/scripts/docker-local/.env.example @@ -14,6 +14,6 @@ DEV_EVM_ADDRESS= # local quickstart. DEV_STELLAR_ADDRESS= -# Pin a specific contracts build (immutable per-sha release). Defaults to -# `contracts-latest` if unset. -# CONTRACTS_BUNDLE_TAG=contracts-abc1234 +# Pin a specific contracts build (immutable per-sha release — the tag is +# the short commit sha). Defaults to `latest` if unset. +# CONTRACTS_BUNDLE_TAG=abc1234 diff --git a/scripts/docker-local/Dockerfile.deployer b/scripts/docker-local/Dockerfile.deployer index e37bab1..f727d76 100644 --- a/scripts/docker-local/Dockerfile.deployer +++ b/scripts/docker-local/Dockerfile.deployer @@ -4,7 +4,7 @@ # # Only the runtime deploy toolkit is baked in (stellar CLI + node + pnpm). # Contract artifacts (WASMs, EVM ABIs, deposit VK) are NOT built here — they -# are pulled by `up.sh` from the `contracts-latest` GitHub Release and +# are pulled by `up.sh` from the Proofbridge-Contracts `latest` GitHub Release and # bind-mounted into the container at the paths deploy.ts expects. # # Image build is ~1 min on a cold cache; rebuilds happen only when diff --git a/scripts/docker-local/README.md b/scripts/docker-local/README.md index 6cf64a3..e872cd1 100644 --- a/scripts/docker-local/README.md +++ b/scripts/docker-local/README.md @@ -11,7 +11,7 @@ relayer DB with chains/tokens/routes, and runs `backend-relayer` on - `curl` (used by `up.sh` to fetch the contracts bundle) No rust / foundry / nargo / stellar CLI needed on the host — contract -artifacts are downloaded from the public `contracts-latest` GitHub Release +artifacts are downloaded from the public Proofbridge-Contracts `latest` GitHub Release and bind-mounted into the deployer container. ## Usage @@ -57,16 +57,16 @@ Leaving either variable unset skips that chain. Reruns are idempotent: ### Pinning a specific build -`up.sh` defaults to the rolling `contracts-latest` tag, which is updated -by `.github/workflows/contracts-release.yml` on every push to `main`. -To pin a specific commit's artifacts: +`up.sh` defaults to the rolling `latest` tag on the Proofbridge-Contracts +release, which is updated by `.github/workflows/contracts-release.yml` on +every push to `main`. To pin a specific commit's artifacts: ```bash -CONTRACTS_BUNDLE_TAG=contracts- bash scripts/docker-local/up.sh +CONTRACTS_BUNDLE_TAG= bash scripts/docker-local/up.sh ``` -Every `main` build also publishes an immutable `contracts-` -release, so bisecting regressions is cheap. +Every `main` build also publishes an immutable `` release, +so bisecting regressions is cheap. ### Iterating on contracts locally @@ -132,7 +132,7 @@ URLs above. (anvil + stellar are ephemeral), written to a docker volume, and read by the relayer at start. `down -r` clears it; plain `down` keeps it. - To refresh artifacts without touching containers: delete `.artifacts/` - and re-run `up.sh`, or set `CONTRACTS_BUNDLE_TAG=contracts-latest` - explicitly to force a download. + and re-run `up.sh`, or set `CONTRACTS_BUNDLE_TAG=latest` explicitly + to force a download. - The relayer image reuses `apps/backend-relayer/Dockerfile` — the same one the CI e2e and production builds use. diff --git a/scripts/docker-local/docker-compose.yaml b/scripts/docker-local/docker-compose.yaml index 0a43eea..174d94f 100644 --- a/scripts/docker-local/docker-compose.yaml +++ b/scripts/docker-local/docker-compose.yaml @@ -73,8 +73,9 @@ services: DEV_STELLAR_ADDRESS: ${DEV_STELLAR_ADDRESS:-} volumes: - shared:/shared - # Contract artifacts are pulled by up.sh from the `contracts-latest` - # GitHub Release (or built locally with `up.sh --local`) and extracted + # Contract artifacts are pulled by up.sh from the Proofbridge-Contracts + # `latest` GitHub Release (or built locally with `up.sh --local`) and + # extracted # into ./.artifacts. deploy.ts reads from these paths verbatim. - ./.artifacts/contracts/stellar/target/wasm32v1-none/release:/repo/contracts/stellar/target/wasm32v1-none/release:ro - ./.artifacts/contracts/evm/out:/repo/contracts/evm/out:ro diff --git a/scripts/docker-local/entrypoint.sh b/scripts/docker-local/entrypoint.sh index 929abe4..636ff1f 100755 --- a/scripts/docker-local/entrypoint.sh +++ b/scripts/docker-local/entrypoint.sh @@ -34,8 +34,13 @@ done log "stellar RPC healthy." log "waiting for anvil at $EVM_RPC_URL…" +# Slim deployer image has no `cast` — talk to anvil via raw JSON-RPC. +# Compose already gates us on `anvil: service_healthy`, so this is a +# sanity check more than a real wait loop. for i in $(seq 1 30); do - if cast block-number --rpc-url "$EVM_RPC_URL" >/dev/null 2>&1; then + if curl -sf -X POST -H 'Content-Type: application/json' \ + -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ + "$EVM_RPC_URL" 2>/dev/null | grep -q '"result":"0x'; then break fi sleep 2 @@ -74,7 +79,7 @@ log "wrote admin secret → $ADMIN_SECRET_PATH" # ── deploy contracts ───────────────────────────────────────────────── # # WASMs, EVM artifacts, and the deposit VK are bind-mounted in from -# $ROOT_DIR (populated by up.sh from the contracts-latest GitHub Release, +# $ROOT_DIR (populated by up.sh from the Proofbridge-Contracts `latest` GitHub Release, # or from the repo's locally-built tree via `up.sh --local`). Sanity-check # their presence before running deploy so missing artifacts fail fast. diff --git a/scripts/docker-local/up.sh b/scripts/docker-local/up.sh index f3cbc7b..21979a5 100755 --- a/scripts/docker-local/up.sh +++ b/scripts/docker-local/up.sh @@ -5,9 +5,9 @@ set -euo pipefail # Relayer is exposed at http://localhost:2005 on success. # # Contract artifacts (Stellar WASMs, EVM ABIs, deposit VK) are pulled from -# the public `contracts-latest` GitHub Release by default — no host -# toolchain required. Override with: -# CONTRACTS_BUNDLE_TAG=contracts- pin a specific build +# the public Proofbridge-Contracts `latest` GitHub Release by default — no +# host toolchain required. Override with: +# CONTRACTS_BUNDLE_TAG= pin a specific build # up.sh --local use the repo's locally-built tree # (skips download; assumes you ran # `stellar contract build`, `forge @@ -29,7 +29,7 @@ if [[ -f "$SCRIPT_DIR/.env" ]]; then fi GH_REPO="${CONTRACTS_BUNDLE_REPO:-Explore-Beyond-Innovations/ProofBridge}" -BUNDLE_TAG="${CONTRACTS_BUNDLE_TAG:-contracts-latest}" +BUNDLE_TAG="${CONTRACTS_BUNDLE_TAG:-latest}" USE_LOCAL=0 for arg in "$@"; do @@ -90,7 +90,7 @@ download_bundle() { echo "[up.sh] downloading $BUNDLE_TAG from $GH_REPO…" if ! curl -fsSL "$url" -o "$tmp/bundle.tgz"; then echo "[up.sh] failed to fetch $url" >&2 - echo "[up.sh] (is the tag published? try \`CONTRACTS_BUNDLE_TAG=contracts-latest\` or \`--local\`)" >&2 + echo "[up.sh] (is the tag published? try \`CONTRACTS_BUNDLE_TAG=latest\` or \`--local\`)" >&2 exit 1 fi