From baf2b250142f70afd2a31d906a83bfbfa0da1933 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 20 Jun 2026 18:57:02 +0000 Subject: [PATCH 1/3] feat: pin versioned deploy constants per soldeer tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adopt raindex's versioned-deploy-constants pattern so a bytecode-changing PR isn't blocked on the single "current" deploy constant. Today any source change to the deployed contracts forces bumping ZOLTU_DEPLOYED_DECIMAL_FLOAT_ADDRESS / DECIMAL_FLOAT_CONTRACT_HASH, which then makes LibDecimalFloatDeployProd red until the new bytecode is deployed — a premerge chicken-and-egg. Pinning a frozen constant suite per published soldeer tag records each release so the deploy verification tracks published versions, not the bleeding edge. - LibDecimalFloatDeploy.sol: add frozen *_0_1_1 deploy constants for the published 0.1.1 soldeer tag (log tables + DecimalFloat address/codehash). - script/check-published-deploy-constants.sh: query the soldeer registry and list any published tag missing its pinned suite (prints OK/MISSING/SKIP). - LibDecimalFloatDeployTaggedConstants.t.sol: FFI test asserting every published tag has its full suite; skips if the registry is unreachable. Additive only (no bytecode change) — existing deploy/prod tests are unaffected. Co-Authored-By: Claude Opus 4.8 --- script/check-published-deploy-constants.sh | 50 +++++++++++++++++++ src/lib/deploy/LibDecimalFloatDeploy.sol | 23 +++++++++ ...LibDecimalFloatDeployTaggedConstants.t.sol | 43 ++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 script/check-published-deploy-constants.sh create mode 100644 test/src/lib/deploy/LibDecimalFloatDeployTaggedConstants.t.sol diff --git a/script/check-published-deploy-constants.sh b/script/check-published-deploy-constants.sh new file mode 100644 index 0000000..9c9ced6 --- /dev/null +++ b/script/check-published-deploy-constants.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LicenseRef-DCL-1.0 +# SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd +# +# Prints "OK" iff every version published to the soldeer registry for +# `rain-math-float` has a full suite of pinned deploy constants in +# LibDecimalFloatDeploy.sol: a log-tables address + codehash and a DecimalFloat +# address + codehash, each suffixed with the version. +# +# Consumed by LibDecimalFloatDeployTaggedConstants.t.sol via FFI. Output is one +# of: +# 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) +# +# Always exits 0 so the test sees the message rather than an ffi failure. + +lib="src/lib/deploy/LibDecimalFloatDeploy.sol" + +versions=$( + curl -fsS "https://api.soldeer.xyz/api/v1/revision?project_name=rain-math-float" 2>/dev/null \ + | grep -oE '"version":"[0-9][0-9.]*"' | cut -d'"' -f4 | sort -u +) + +if [ -z "$versions" ]; then + printf 'SKIP: could not fetch published soldeer versions' + exit 0 +fi + +# The deploy constants that must be pinned for every published version, suffixed +# with the version (dots replaced by underscores). +bases="ZOLTU_DEPLOYED_LOG_TABLES_ADDRESS \ +LOG_TABLES_DATA_CONTRACT_HASH \ +ZOLTU_DEPLOYED_DECIMAL_FLOAT_ADDRESS \ +DECIMAL_FLOAT_CONTRACT_HASH" + +missing="" +for v in $versions; do + suffix=$(printf '%s' "$v" | tr . _) + for b in $bases; do + name="${b}_${suffix}" + grep -qE "constant ${name} =" "$lib" || missing="${missing} ${name}" + done +done + +if [ -n "$missing" ]; then + printf 'MISSING:%s' "$missing" +else + printf 'OK' +fi diff --git a/src/lib/deploy/LibDecimalFloatDeploy.sol b/src/lib/deploy/LibDecimalFloatDeploy.sol index dd0f8bd..d896a95 100644 --- a/src/lib/deploy/LibDecimalFloatDeploy.sol +++ b/src/lib/deploy/LibDecimalFloatDeploy.sol @@ -31,6 +31,29 @@ library LibDecimalFloatDeploy { /// Zoltu's deterministic deployment proxy. bytes32 constant DECIMAL_FLOAT_CONTRACT_HASH = 0x7a93d0311f7782b44157ba40e94ec936085ebe001c7893bdd74911c8351d3def; + /// @dev Deploy constants pinned to each version published to the soldeer + /// registry. These are frozen literals — not aliases of the "current" + /// constants above — so each keeps referencing its own release's deployment + /// after the current constants advance to a newer version. + /// `script/check-published-deploy-constants.sh` (run by + /// `LibDecimalFloatDeployTaggedConstantsTest`) queries the registry and + /// fails if any published version is missing its suite, so publishing a new + /// tag forces pinning that tag's deploy constants here. + + /// @dev Log tables address at the published `0.1.1` soldeer tag. + address constant ZOLTU_DEPLOYED_LOG_TABLES_ADDRESS_0_1_1 = address(0xc51a14251b0dcF0ae24A96b7153991378938f5F5); + + /// @dev Log tables codehash at the published `0.1.1` soldeer tag. + bytes32 constant LOG_TABLES_DATA_CONTRACT_HASH_0_1_1 = + 0x2573004ac3a9ee7fc8d73654d76386f1b6b99e34cdf86a689c4691e47143420f; + + /// @dev DecimalFloat address at the published `0.1.1` soldeer tag. + address constant ZOLTU_DEPLOYED_DECIMAL_FLOAT_ADDRESS_0_1_1 = address(0xBee0eEFaffD046c9602109eB30A858Be301CC926); + + /// @dev DecimalFloat codehash at the published `0.1.1` soldeer tag. + bytes32 constant DECIMAL_FLOAT_CONTRACT_HASH_0_1_1 = + 0x7a93d0311f7782b44157ba40e94ec936085ebe001c7893bdd74911c8351d3def; + /// Combines all log and anti-log tables into a single bytes array for /// deployment. These are using packed encoding to minimize size and remove /// the complexity of full ABI encoding. diff --git a/test/src/lib/deploy/LibDecimalFloatDeployTaggedConstants.t.sol b/test/src/lib/deploy/LibDecimalFloatDeployTaggedConstants.t.sol new file mode 100644 index 0000000..f1b2487 --- /dev/null +++ b/test/src/lib/deploy/LibDecimalFloatDeployTaggedConstants.t.sol @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: LicenseRef-DCL-1.0 +// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd +pragma solidity =0.8.25; + +import {Test} from "forge-std-1.16.1/src/Test.sol"; + +/// @title LibDecimalFloatDeployTaggedConstantsTest +/// @notice Every version published to the soldeer registry for `rain-math-float` +/// must have a full suite of pinned deploy constants in `LibDecimalFloatDeploy`: +/// a log-tables address + codehash and a DecimalFloat address + codehash for +/// each published version. `script/check-published-deploy-constants.sh` queries +/// the live registry (via FFI) and lists any missing constants, so publishing a +/// new tag without pinning its constants fails this test. Skips if the registry +/// is unreachable rather than failing on network flakiness. +contract LibDecimalFloatDeployTaggedConstantsTest is Test { + function testAllPublishedSoldeerTagsHaveAFullConstantSuite() external { + string[] memory cmd = new string[](2); + cmd[0] = "bash"; + cmd[1] = "script/check-published-deploy-constants.sh"; + bytes memory out = vm.ffi(cmd); + + // The registry could not be reached; there is nothing to verify. + if (_startsWith(out, bytes("SKIP"))) { + vm.skip(true); + return; + } + + // On failure the actual value lists the missing `*_` constants. + assertEq(string(out), "OK", "a published soldeer tag is missing pinned deploy constants"); + } + + function _startsWith(bytes memory s, bytes memory prefix) private pure returns (bool) { + if (s.length < prefix.length) { + return false; + } + for (uint256 i = 0; i < prefix.length; i++) { + if (s[i] != prefix[i]) { + return false; + } + } + return true; + } +} From fbf9de3700cb22acac1645e44a35dcc621eaac3b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 20 Jun 2026 19:08:25 +0000 Subject: [PATCH 2/3] fix: add curl timeouts to deploy-constants registry check A stalled registry call could otherwise hang the FFI test indefinitely. --connect-timeout/--max-time + a bounded retry. (CodeRabbit) Co-Authored-By: Claude Opus 4.8 --- script/check-published-deploy-constants.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/check-published-deploy-constants.sh b/script/check-published-deploy-constants.sh index 9c9ced6..e268064 100644 --- a/script/check-published-deploy-constants.sh +++ b/script/check-published-deploy-constants.sh @@ -18,7 +18,8 @@ lib="src/lib/deploy/LibDecimalFloatDeploy.sol" versions=$( - curl -fsS "https://api.soldeer.xyz/api/v1/revision?project_name=rain-math-float" 2>/dev/null \ + curl -fsS --connect-timeout 5 --max-time 20 --retry 2 --retry-delay 1 \ + "https://api.soldeer.xyz/api/v1/revision?project_name=rain-math-float" 2>/dev/null \ | grep -oE '"version":"[0-9][0-9.]*"' | cut -d'"' -f4 | sort -u ) From 8f46ba71bed90afb2f5db524e4e25750a8dd7715 Mon Sep 17 00:00:00 2001 From: David Meister Date: Sat, 20 Jun 2026 21:34:15 +0000 Subject: [PATCH 3/3] ci: retrigger fuzz [3b-attempt] Co-Authored-By: Claude