Skip to content

Conversation

@Sulios
Copy link

@Sulios Sulios commented Nov 25, 2025

Note

Refactors deploy_exchange.sh for safer env handling, stricter validation, robust forge execution, and direct JSON parsing.

  • Scripts:
    • deploy/scripts/deploy_exchange.sh:
      • Add argument validation, usage help, and environment file existence checks.
      • Rename environment files (.env -> .env.mainnet) and select via case.
      • Source env vars safely and require PK before deploy.
      • Update forge invocation: quoted parameters, removed --with-gas-price, pass deploy args explicitly.
      • Add exit-status handling with detailed failure output.
      • Parse JSON output directly with jq (no grep), validate exchange address.
      • Clearer deploy logs and success/failure messages.

Written by Cursor Bugbot for commit bf77d59. This will update automatically on new commits. Configure here.

# Define the environment file names.
LOCAL_ENV=".env.local"
TESTNET_ENV=".env.testnet"
MAINNET_ENV=".env.mainnet" # Renamed from '.env' for clarity/safety
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Mainnet environment file renamed breaks existing deployments

The mainnet environment file was renamed from .env to .env.mainnet, breaking existing deployments. Users with the previously expected .env file will encounter a "file not found" error when deploying to mainnet, as the script now looks for .env.mainnet instead.

Fix in Cursor Fix in Web

EXCHANGE=$(echo "$OUTPUT" | jq -r '.returns.exchange.value')

echo "Complete!"
if [ -z "$EXCHANGE" ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Null value not detected in exchange address validation

The validation checks if $EXCHANGE is empty, but jq -r returns the string "null" when the JSON path doesn't exist, not an empty string. This allows the script to report success with "Exchange deployed: null" when the deployment actually failed to return a valid address.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant