From 8eca835860d0415f2029fda492caa711cac9c18d Mon Sep 17 00:00:00 2001 From: David Meister Date: Sun, 28 Jun 2026 09:26:53 +0000 Subject: [PATCH 1/2] feat(deploy): add shared check-published-deploy-constants script Parameterizes the deploy-constants completeness check that raindex currently hardcodes in script/check-published-deploy-constants.sh. Exposes check-published-deploy-constants on sol-shell PATH so any consumer repo can run it via: nix develop github:rainlanguage/rainix#sol-shell \ -c check-published-deploy-constants ... Co-Authored-By: Claude --- flake.nix | 11 ++++ lib/check-published-deploy-constants.sh | 60 +++++++++++++++++++ .../devshell/sol-shell/sol-tasks.test.bats | 5 ++ 3 files changed, 76 insertions(+) create mode 100644 lib/check-published-deploy-constants.sh diff --git a/flake.nix b/flake.nix index 23aa1fc..7daf0e2 100644 --- a/flake.nix +++ b/flake.nix @@ -273,6 +273,15 @@ additionalBuildInputs = [ pkgs.git ]; }; + rainix-check-deploy-constants = mkTask { + name = "check-published-deploy-constants"; + body = '' + set -euo pipefail + exec ${./lib/check-published-deploy-constants.sh} "$@" + ''; + additionalBuildInputs = [ pkgs.curl pkgs.gnugrep ]; + }; + rainix-rs-static = mkTask { name = "rainix-rs-static"; body = '' @@ -286,6 +295,7 @@ sol-tasks = [ rainix-sol-artifacts rainix-sol-single-contract + rainix-check-deploy-constants ]; rs-tasks = [ @@ -586,6 +596,7 @@ inherit rainix-sol-artifacts rainix-sol-single-contract + rainix-check-deploy-constants rainix-rs-static prettier-bundle sol-shell-test diff --git a/lib/check-published-deploy-constants.sh b/lib/check-published-deploy-constants.sh new file mode 100644 index 0000000..b26a718 --- /dev/null +++ b/lib/check-published-deploy-constants.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LicenseRef-DCL-1.0 +# SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd +# +# Checks that every version published to the soldeer registry for a given +# package has a full suite of pinned deploy constants in the specified Solidity +# file. For each published version and each constant prefix, asserts that both +# a DEPLOYED_ADDRESS_ and DEPLOYED_CODEHASH_ constant exist (where +# is the version string with dots replaced by underscores). +# +# Usage: +# check-published-deploy-constants [ ...] +# +# Arguments: +# soldeer-package soldeer package name to query (e.g. "raindex") +# deploy-lib-path path to the Solidity file holding the constants +# prefix... one or more constant name prefixes +# +# Output (always exits 0): +# OK every published version has its full constant suite +# MISSING: one or more expected constants are absent +# SKIP: the registry could not be reached (nothing verified) + +set -euo pipefail + +if [ "$#" -lt 3 ]; then + printf 'Usage: check-published-deploy-constants [...]\n' >&2 + exit 1 +fi + +package="$1" +lib="$2" +shift 2 + +versions=$( + curl -fsS "https://api.soldeer.xyz/api/v1/revision?project_name=${package}" 2>/dev/null \ + | grep -oE '"version":"[0-9][0-9.]*"' | cut -d'"' -f4 | sort -u +) || true + +if [ -z "$versions" ]; then + printf 'SKIP: could not fetch published soldeer versions' + exit 0 +fi + +missing="" +for v in $versions; do + suffix=$(printf '%s' "$v" | tr . _) + for p in "$@"; do + for kind in ADDRESS CODEHASH; do + name="${p}_${kind}_${suffix}" + grep -qE "constant ${name} =" "$lib" || missing="${missing} ${name}" + done + done +done + +if [ -n "$missing" ]; then + printf 'MISSING:%s' "$missing" +else + printf 'OK' +fi diff --git a/test/bats/devshell/sol-shell/sol-tasks.test.bats b/test/bats/devshell/sol-shell/sol-tasks.test.bats index 298eab0..510917e 100644 --- a/test/bats/devshell/sol-shell/sol-tasks.test.bats +++ b/test/bats/devshell/sol-shell/sol-tasks.test.bats @@ -8,3 +8,8 @@ run command -v rainix-sol-artifacts [ "$status" -eq 0 ] } + +@test "check-published-deploy-constants should be available on PATH" { + run command -v check-published-deploy-constants + [ "$status" -eq 0 ] +} From c882a42ff1837d7db9b5179ed743393d8ae331e1 Mon Sep 17 00:00:00 2001 From: David Meister Date: Sun, 28 Jun 2026 13:05:15 +0000 Subject: [PATCH 2/2] fix(ci): rainix-check-shell [3b-attempt] nixfmt format additionalBuildInputs list Co-Authored-By: Claude --- flake.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 7daf0e2..f822d8b 100644 --- a/flake.nix +++ b/flake.nix @@ -279,7 +279,10 @@ set -euo pipefail exec ${./lib/check-published-deploy-constants.sh} "$@" ''; - additionalBuildInputs = [ pkgs.curl pkgs.gnugrep ]; + additionalBuildInputs = [ + pkgs.curl + pkgs.gnugrep + ]; }; rainix-rs-static = mkTask {