Skip to content

Commit 2c28d6f

Browse files
committed
fix(check-build): collapse foundry/forge checks and add changelog
Address review feedback on OffchainLabs#4677: - rename forge_max_version -> forge_version_needed (compare_versions uses exact match, not a ceiling) - collapse Foundry/forge installation blocks into one cascade so the user sees a single appropriate error - print success message when forge version matches (previously the matched branch printed the "not compatible" error) - add changelog/tenderdeve-nit-4379.md
1 parent a3cd404 commit 2c28d6f

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

changelog/tenderdeve-nit-4379.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
### Internal
2+
- Validate forge version (1.0.0) in `scripts/check-build.sh` and emit a clear remediation message when an incompatible version is installed

scripts/check-build.sh

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ NC='\033[0m' # No Color
1111
node_version_needed="v24"
1212
rust_version_needed="1.93.0"
1313
golangci_lint_version_needed="2.5.0"
14-
forge_max_version="1.0.0"
14+
forge_version_needed="1.0.0"
1515

1616
if [[ -f go.mod ]]; then
1717
go_version_needed=$(grep "^go " go.mod | awk '{print $2}')
@@ -188,29 +188,26 @@ else
188188
EXIT_CODE=1
189189
fi
190190

191-
# Check Foundry installation
192-
if command_exists foundryup; then
193-
echo -e "${GREEN}Foundry is installed.${NC}"
194-
else
195-
echo -e "${RED}Foundry is not installed.${NC}"
196-
EXIT_CODE=1
197-
fi
198-
199-
# Check forge installation and version compatibility
191+
# Check Foundry / forge installation and version compatibility
200192
# Newer forge versions (> 1.0.0) use solar instead of solc for Yul compilation,
201193
# which causes `make build` to fail.
202-
if command_exists forge; then
194+
if ! command_exists foundryup; then
195+
echo -e "${RED}Foundry is not installed.${NC}"
196+
EXIT_CODE=1
197+
elif ! command_exists forge; then
198+
echo -e "${RED}forge is not installed. Run: foundryup --version $forge_version_needed${NC}"
199+
EXIT_CODE=1
200+
else
203201
FORGE_INSTALLED_VERSION=$(forge --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)
204202
if [[ -z "$FORGE_INSTALLED_VERSION" ]]; then
205203
echo -e "${RED}Could not parse forge version from \`forge --version\`.${NC}"
206204
EXIT_CODE=1
207205
elif compare_versions "$forge_version_needed" "$FORGE_INSTALLED_VERSION" "exact"; then
208-
echo -e "${RED}forge version $FORGE_INSTALLED_VERSION is not compatible. Version $forge_max_version is required (newer versions use solar instead of solc for Yul compilation). Run: foundryup --version $forge_max_version${NC}"
206+
echo -e "${GREEN}forge version $FORGE_INSTALLED_VERSION is installed.${NC}"
207+
else
208+
echo -e "${RED}forge version $FORGE_INSTALLED_VERSION is not compatible. Version $forge_version_needed is required (newer versions use solar instead of solc for Yul compilation). Run: foundryup --version $forge_version_needed${NC}"
209209
EXIT_CODE=1
210210
fi
211-
else
212-
echo -e "${RED}forge is not installed. Install Foundry and run: foundryup --version $forge_max_version${NC}"
213-
EXIT_CODE=1
214211
fi
215212

216213
if [ $EXIT_CODE != 0 ]; then

0 commit comments

Comments
 (0)