diff --git a/changelog/tenderdeve-nit-4379.md b/changelog/tenderdeve-nit-4379.md new file mode 100644 index 00000000000..4d175f81ae8 --- /dev/null +++ b/changelog/tenderdeve-nit-4379.md @@ -0,0 +1,2 @@ +### Internal +- Validate forge version (1.0.0) in `scripts/check-build.sh` and emit a clear remediation message when an incompatible version is installed diff --git a/scripts/check-build.sh b/scripts/check-build.sh index 5c6d4f8ed90..1a7cd10b8c3 100755 --- a/scripts/check-build.sh +++ b/scripts/check-build.sh @@ -11,6 +11,7 @@ NC='\033[0m' # No Color node_version_needed="v24" rust_version_needed="1.93.0" golangci_lint_version_needed="2.5.0" +forge_version_needed="1.0.0" if [[ -f go.mod ]]; then go_version_needed=$(grep "^go " go.mod | awk '{print $2}') @@ -187,12 +188,26 @@ else EXIT_CODE=1 fi -# Check Foundry installation -if command_exists foundryup; then - echo -e "${GREEN}Foundry is installed.${NC}" -else +# Check Foundry / forge installation and version compatibility +# Newer forge versions (> 1.0.0) use solar instead of solc for Yul compilation, +# which causes `make build` to fail. +if ! command_exists foundryup; then echo -e "${RED}Foundry is not installed.${NC}" EXIT_CODE=1 +elif ! command_exists forge; then + echo -e "${RED}forge is not installed. Run: foundryup --version $forge_version_needed${NC}" + EXIT_CODE=1 +else + FORGE_INSTALLED_VERSION=$(forge --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1) + if [[ -z "$FORGE_INSTALLED_VERSION" ]]; then + echo -e "${RED}Could not parse forge version from \`forge --version\`.${NC}" + EXIT_CODE=1 + elif compare_versions "$forge_version_needed" "$FORGE_INSTALLED_VERSION" "exact"; then + echo -e "${GREEN}forge version $FORGE_INSTALLED_VERSION is installed.${NC}" + else + 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}" + EXIT_CODE=1 + fi fi if [ $EXIT_CODE != 0 ]; then