Skip to content

fix(contracts): unify contract ID env var naming across deploy paths - #110

Merged
Busiii-adetiba merged 1 commit into
SynapsVault:mainfrom
08038165041:fix/contract-id-env-naming
Oct 16, 2026
Merged

Busiii-adetiba merged 1 commit into
SynapsVault:mainfrom
08038165041:fix/contract-id-env-naming

Conversation

@08038165041

Copy link
Copy Markdown

Summary

The three deployed Soroban contract IDs were written under three different key spellings — vault_registry (bash deployer), VAULT_REGISTRY_CONTRACT_ID (SDK deployer) and STELLAR_CONTRACT_VAULT_REGISTRY (init output). rollback-contracts.cjs only recognised keys ending in _CONTRACT_ID/_CONTRACT, so contract-ids.env files produced by the bash path could never be rolled back, and the backend read a name the deploy scripts did not write.

This standardises on the naming scheme the backend reads — STELLAR_CONTRACT_<NAME> — across every deploy path, and makes rollback understand files produced by any of them.

Changes

  • scripts/03-deploy-contracts.sh: writes STELLAR_CONTRACT_VAULT_REGISTRY, STELLAR_CONTRACT_ACCESS_LEASE, STELLAR_CONTRACT_SUBSCRIPTION to contract-ids.env.
  • scripts/deploy-contracts.cjs: new contractEnvName() emits the same canonical keys (previously *_CONTRACT_ID).
  • scripts/04-init-contracts.sh: consumes and prints the canonical keys.
  • scripts/rollback-contracts.cjs:
    • New canonicalContractKey() normalises recognised keys from either deploy path — canonical STELLAR_CONTRACT_*, legacy *_CONTRACT_ID/*_CONTRACT, bare names (vault_registry) and the REGISTRY_CONTRACT_ID alias — to canonical names.
    • updateEnvFile() updates canonical keys in place, keeps legacy aliases present in the target .env in sync, and appends any missing canonical keys.
  • .env.example and docs (ENVIRONMENT-VARIABLES.md, DEPLOY-BACKEND-GUIDE.md, contract-deploy-guide.md) updated to the canonical scheme; legacy names documented as deprecated aliases.
  • test/contract-scripts.test.cjs updated and extended.

Acceptance criteria

  • Agree on one naming scheme matching what the backend reads
  • Update all scripts, docs and .env.example to use it
  • Rollback works with files produced by either deploy path

Closes #17
Closes #18
Closes #19
Closes #20

03-deploy-contracts.sh, deploy-contracts.cjs and 04-init-contracts.sh
each wrote a different key for the same contract IDs, so rollback could
not consume files produced by the bash deploy path.

Adopt the canonical STELLAR_CONTRACT_<NAME> scheme the backend reads
(STELLAR_CONTRACT_VAULT_REGISTRY, STELLAR_CONTRACT_ACCESS_LEASE,
STELLAR_CONTRACT_SUBSCRIPTION) and use it everywhere:

- 03-deploy-contracts.sh / deploy-contracts.cjs now write those keys.
- 04-init-contracts.sh consumes and prints them.
- rollback-contracts.cjs normalises recognised keys from any deploy path
  (canonical, *_CONTRACT_ID/_CONTRACT, bare names, REGISTRY aliases) to the
  canonical names, keeps legacy aliases in the target .env in sync, and
  appends the canonical keys.
- Update .env.example and docs; legacy names documented as deprecated aliases.
- Update unit tests.

Closes SynapsVault#17
Closes SynapsVault#18
Closes SynapsVault#19
Closes SynapsVault#20
@drips-wave

drips-wave Bot commented Oct 16, 2026

Copy link
Copy Markdown

@08038165041 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

@Busiii-adetiba
Busiii-adetiba merged commit 0b7d588 into SynapsVault:main Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment