Skip to content

feat: add network validation and deployer balance check to deploy script - #189

Merged
phertyameen merged 2 commits into
bridgelet-org:mainfrom
BigBen-7:feat/issue-83-deploy-network-validation
Jun 25, 2026
Merged

feat: add network validation and deployer balance check to deploy script#189
phertyameen merged 2 commits into
bridgelet-org:mainfrom
BigBen-7:feat/issue-83-deploy-network-validation

Conversation

@BigBen-7

Copy link
Copy Markdown
Contributor

Summary

Hardens scripts/deploy-testnet.sh with three pre-flight guards before any deployment attempt:

  1. --network flag — script now accepts --network testnet|mainnet|futurenet (default: testnet). The hard-coded testnet string is replaced with $NETWORK throughout.

  2. NODE_ENV cross-check — when NODE_ENV is set in the shell, the script validates it matches --network. Prevents accidentally deploying to mainnet from a testnet-configured shell.

    ❌ Network mismatch: --network=testnet but NODE_ENV=mainnet
       Set NODE_ENV=testnet or pass --network=mainnet to align them.
    
  3. Mainnet countdown — a 5-second abort window is printed before any mainnet deployment.

  4. Deployer account existence check — resolves the deployer Stellar CLI identity and confirms the account exists on the target network. Prints a Friendbot funding URL if not found.

  5. Minimum balance check — requires ≥ 5 XLM (50,000,000 stroops) to cover base reserves and transaction fees. Errors with human-readable balance if too low.

Note: This PR touches only the validation/setup section of deploy-testnet.sh. Issue #85 adds artifacts/deployed.json output and sweep_controller deployment in a separate PR to keep diffs reviewable independently. When both are merged the file will need a trivial merge.

Test plan

  • bash -n scripts/deploy-testnet.sh — syntax check passes
  • Running with mismatched NODE_ENV exits with clear error message
  • Running --network mainnet triggers the countdown warning
  • Missing deployer identity produces actionable error
  • Low balance check logic reviewed

Closes #83

…gelet-org#83)

- Accept --network flag (default: testnet); errors on unknown args
- When NODE_ENV is set, validate it matches --network to prevent
  accidental cross-environment deployments (e.g. testnet shell → mainnet)
- Emit a 5-second countdown warning when --network=mainnet is used
- Pre-flight: resolve the 'deployer' Stellar CLI identity and confirm
  the account exists on the target network; print a friendbot URL if not
- Pre-flight: parse native balance and require ≥ 5 XLM (50_000_000 stroops)
  to cover base reserves + transaction fees before attempting deployment
- Pass $NETWORK variable through to stellar contract deploy so the script
  is no longer hard-coded to testnet

Closes bridgelet-org#83
@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@BigBen-7 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@phertyameen

Copy link
Copy Markdown
Contributor

@ please resolve conflict

@BigBen-7

Copy link
Copy Markdown
Contributor Author

@phertyameen resolved.

@phertyameen
phertyameen merged commit 0f2c881 into bridgelet-org:main Jun 25, 2026
1 check passed
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.

Improve deployment script with network validation

2 participants