-
Notifications
You must be signed in to change notification settings - Fork 2
Pin versioned deploy constants per soldeer tag (dex pattern) #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+117
−0
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
baf2b25
feat: pin versioned deploy constants per soldeer tag
claude fbf9de3
fix: add curl timeouts to deploy-constants registry check
claude 8f46ba7
ci: retrigger fuzz [3b-attempt]
thedavidmeister 60e042c
Merge remote-tracking branch 'origin/main' into 2026-06-20-versioned-…
thedavidmeister File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/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: <names...> - one or more expected constants are absent | ||
| # SKIP: <reason> - 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 --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 | ||
| ) | ||
|
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
test/src/lib/deploy/LibDecimalFloatDeployTaggedConstants.t.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 `*_<version>` 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; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.