Skip to content

[ANCHOR-1016] Move testnet reset scripts into Anchor Platform repo - #1757

Merged
amandagonsalves merged 18 commits into
developfrom
philip/testnet-reset
Jun 18, 2026
Merged

amandagonsalves merged 18 commits into
developfrom
philip/testnet-reset

Conversation

@philipliu

@philipliu philipliu commented Jun 16, 2025 •

Copy link
Copy Markdown
Contributor

Description

Updates testnet_reset.sh.

Context

It previously only deployed the contracts.

Testing

  • Testing the script locally
[INFO] Starting testnet reset...
[INFO] Checking prerequisites...
[SUCCESS] Prerequisites check passed
[INFO] Loading environment...
[SUCCESS] Environment loaded
[INFO] Funding test accounts...
[INFO] Funding: GDAHPZ2NSYIIHZXM56Y36SBVTV5QKFIZGYMMBHOU53ETUSWTP62B63EQ
[INFO] Funding: GDJLBYYKMCXNVVNABOE66NYXQGIA5AC5D223Z2KF6ZEYK4UBCA7FKLTG
[INFO] Funding: GC6X2ANA2OS3O2ESHUV6X44NH6J46EP2EO2JB7563Y7DYOIXFKHMHJ5O
[INFO] Funding: GATEYCIMJZ2F6Y437QSYH4XFQ6HLD5YP4MBJZFFPZVEQDJOY4QTCB7BB
[INFO] Funding: GDC2U5GRKUSPGV5XENLBWKQZH2C4PG7ZEVMQOUA2QZKIRXE5FYYEMEF7
[INFO] Funding: GASI56WX7UKIDFPZRCQEI4OQE3V3QBGXEOB4ZY6ZMU5MZXPHQHIDA7JU
[INFO] Funding: GD4C2QRT7YL4WJFJPYQCYRXEDBB7ERHC3XZGWR6KXKRHPEFXXNXIVNFY
[INFO] Funding: GC56VTOVOJDRQAJRYLZW6DLQGVTQSYDTZU7ISNIZ2VJIE3FYWI2HMD5G
[INFO] Funding: GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B
[INFO] Funding: GABCKCYPAGDDQMSCTMSBO7C2L34NU3XXCW7LR4VVSWCCXMAJY3B4YCZP
[INFO] Ensuring signers are present with 1/1/1 thresholds...
[SUCCESS] Signers configured with 1/1/1 thresholds
[INFO] Setting up trustlines...
ℹ️ Signing transaction: 0e1dc31de70a5f9862d5de2368875a8257a66eb098f22bc936daf15f14ca5e27
[SUCCESS] Anchor USDC trustline created for TEST_CLIENT_WALLET_SECRET
ℹ️ Signing transaction: be5ed1e7ecd3bf2fc02685b080513ff8bee8402c56039d89238290b0b6ac4c8a
[SUCCESS] Circle USDC trustline created for TEST_CLIENT_WALLET_SECRET
ℹ️ Signing transaction: e0652c0f8fa4945d2b9ed427366f3584595577f4a9a01df88a3a7c8f2ee0f41d
[SUCCESS] Anchor USDC trustline created for TEST_WITHDRAW_FUND_CLIENT_SECRET_1
ℹ️ Signing transaction: b3dfa7fd5be1a3ff9fa1ca8da035e518d7024a00638ff8784344f9077efb78ee
[SUCCESS] Circle USDC trustline created for TEST_WITHDRAW_FUND_CLIENT_SECRET_1
ℹ️ Signing transaction: b49e9eca4e316420e58ff06a691460b56667caeea809b3bbba239c5ff5b393c4
[SUCCESS] Anchor USDC trustline created for TEST_WITHDRAW_FUND_CLIENT_SECRET_2
ℹ️ Signing transaction: e9198dea0e49b3aa380d49672304aa9c36291fe6f02ec2a3a2ac531cd6bf5909
[SUCCESS] Circle USDC trustline created for TEST_WITHDRAW_FUND_CLIENT_SECRET_2
ℹ️ Signing transaction: 6c7314f40975a7c22c341ec1a8f742b8cea644ad9264ca93b634b80e3d59e653
[SUCCESS] Anchor USDC trustline created for TEST_DEPOSIT_FUND_CLIENT_SECRET_1
ℹ️ Signing transaction: b2ceb0c32e3fb16f8f69d4040a5de9660efca2cb57a05327c5be57bb907f5b39
[SUCCESS] Circle USDC trustline created for TEST_DEPOSIT_FUND_CLIENT_SECRET_1
ℹ️ Signing transaction: ff676d254b2bd9ef2a52cf3e99c2a4a6c91a6f9ec375e6c63d02aae37f8d64f6
[SUCCESS] Anchor USDC trustline created for TEST_DEPOSIT_FUND_CLIENT_SECRET_2
ℹ️ Signing transaction: 7760582d6c371067b0aa23745b6b0945ab3c6b6377ebd0444746be40ce1bb5bb
[SUCCESS] Circle USDC trustline created for TEST_DEPOSIT_FUND_CLIENT_SECRET_2
ℹ️ Signing transaction: e39f57886861fb44e5cab67f1770532de18d3dcdc5d15eb729058aa097b06660
[SUCCESS] Anchor USDC trustline created for TESTANCHOR_DISTRIBUTION_SECRET
ℹ️ Signing transaction: 7166c3faa7717323b0b4b77c9d79e18d64ada72784a543817550b7042d7143c8
[SUCCESS] Circle USDC trustline created for TESTANCHOR_DISTRIBUTION_SECRET
ℹ️ Signing transaction: f715b70a711cff87ac7ead4180ea4d94248c23fb64c480e30e7977cacd31f247
[SUCCESS] SRT trustline created for TESTANCHOR_DISTRIBUTION_SECRET
[INFO] Issuing USDC and funding accounts...
[INFO] Funding: GDQOE23CFSUMSVQK4Y5JHPPYK73VYCNHZHA7ENKCV37P6SUEO6XQBKPP
[INFO] Sending 1000 USDC to TEST_CLIENT_WALLET_SECRET (GDJLBYYKMCXNVVNABOE66NYXQGIA5AC5D223Z2KF6ZEYK4UBCA7FKLTG)...
ℹ️ Signing transaction: a076c49830e9ebdad6a0c34f764fd7c55ccd91c965d1752c62bc83293b9b0c9d
[SUCCESS] Sent 1000 USDC to TEST_CLIENT_WALLET_SECRET
[INFO] Sending 1000 USDC to TEST_WITHDRAW_FUND_CLIENT_SECRET_1 (GDC2U5GRKUSPGV5XENLBWKQZH2C4PG7ZEVMQOUA2QZKIRXE5FYYEMEF7)...
ℹ️ Signing transaction: 3d8a3286fbee7e7b743e47bcd1b7bf7cf10b1718cfabb184c4aebde06b81a662
[SUCCESS] Sent 1000 USDC to TEST_WITHDRAW_FUND_CLIENT_SECRET_1
[INFO] Sending 1000 USDC to TEST_WITHDRAW_FUND_CLIENT_SECRET_2 (GASI56WX7UKIDFPZRCQEI4OQE3V3QBGXEOB4ZY6ZMU5MZXPHQHIDA7JU)...
ℹ️ Signing transaction: 7c1b487fa7caece602bed65058930ebd3b4d3065d2c1308c5db18460d31f8efa
[SUCCESS] Sent 1000 USDC to TEST_WITHDRAW_FUND_CLIENT_SECRET_2
[INFO] Sending 1000 USDC to TEST_DEPOSIT_FUND_CLIENT_SECRET_1 (GD4C2QRT7YL4WJFJPYQCYRXEDBB7ERHC3XZGWR6KXKRHPEFXXNXIVNFY)...
ℹ️ Signing transaction: 62dd6cfe9d48cc0045135a78700fafddf4d6a0792b94110d6b95369c2a479165
[SUCCESS] Sent 1000 USDC to TEST_DEPOSIT_FUND_CLIENT_SECRET_1
[INFO] Sending 1000 USDC to TEST_DEPOSIT_FUND_CLIENT_SECRET_2 (GC56VTOVOJDRQAJRYLZW6DLQGVTQSYDTZU7ISNIZ2VJIE3FYWI2HMD5G)...
ℹ️ Signing transaction: 250728ac22edf919a647b1306f05461751f01a991176b2022791ce5b4979def7
[SUCCESS] Sent 1000 USDC to TEST_DEPOSIT_FUND_CLIENT_SECRET_2
[INFO] Issuing SRT and funding test anchor distribution account...
[INFO] Funding: GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B
[INFO] Sending 1000000 SRT to test anchor distribution account...
ℹ️ Signing transaction: e94cdf15a9f2e81ac9805facd7ada1af2e97b581994622479813f8eb7404462e
[SUCCESS] Sent 1000000 SRT to test anchor distribution account
[INFO] Deploying contracts...
[INFO] Using GDJLBYYKMCXNVVNABOE66NYXQGIA5AC5D223Z2KF6ZEYK4UBCA7FKLTG as contract deployer
ℹ️ CARGO_BUILD_RUSTFLAGS=--remap-path-prefix=/Users/philipliu/.cargo/registry/src= cargo rustc --manifest-path=contracts/account/Cargo.toml --crate-type=cdylib --target=wasm32-unknown-unknown --release
    Finished `release` profile [optimized] target(s) in 0.04s
ℹ️ Build Summary:
  Wasm File: target/wasm32-unknown-unknown/release/account.wasm
  Wasm Hash: ae95eb9d4bab6a01022af3bda941cf7603809adb173f82d46f70bd22b005c068
  Exported Functions: 4 found
    • _
    • __check_auth
    • __constructor
    • upgrade
✅ Build Complete
ℹ️ CARGO_BUILD_RUSTFLAGS=--remap-path-prefix=/Users/philipliu/.cargo/registry/src= cargo rustc --manifest-path=contracts/web-auth/Cargo.toml --crate-type=cdylib --target=wasm32-unknown-unknown --release
    Finished `release` profile [optimized] target(s) in 0.04s
ℹ️ Build Summary:
  Wasm File: target/wasm32-unknown-unknown/release/web_auth.wasm
  Wasm Hash: 32a79785d469f8c5e04ab11d1b8f680b511575c995419b0806a16278cbd5240c
  Exported Functions: 4 found
    • _
    • __constructor
    • upgrade
    • web_auth_verify
✅ Build Complete
[INFO] Deploying account contract...
[SUCCESS] Account contract deployed:    0: [Diagnostic Event] topics:[error, Error(Storage, ExistingValue)], data:["contract already exists", Bytes(317c7a069bdc2cfbfe62cd3ea4a49562e4f9c92feb6dad7764c5a8c1199bfa9c)]
[INFO] Deploying web auth contract...
[SUCCESS] Web auth contract deployed:    0: [Diagnostic Event] topics:[error, Error(Storage, ExistingValue)], data:["contract already exists", Bytes(f6b07a2a2f47a2b751d2fbf65aeb0c644b588d27f98090b9948cd4c526408a68)]
[INFO] Deploying USDC asset contract...
[WARNING] USDC asset contract deployment skipped (already exists)
[SUCCESS] Contracts deployed
[SUCCESS] ✨ Testnet setup completed!

Documentation

N/A

Known limitations

N/A

@philipliu
philipliu force-pushed the philip/testnet-reset branch from 422f479 to 4b125da Compare June 18, 2025 15:37
@philipliu
philipliu marked this pull request as ready for review June 18, 2025 15:52
Comment thread scripts/testnet_reset.sh Outdated

@JiahuiWho JiahuiWho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@lijamie98

Copy link
Copy Markdown
Contributor

The PR looks fine to me overall.

I don't see the script where we check the circle USDC balance though. (here) Is it no longer needed in our tests?

@lijamie98

Copy link
Copy Markdown
Contributor

Can we add a GH action to run the testnet reset?

Comment thread .env.example Outdated
@lijamie98 lijamie98 changed the title Update testnet reset script 【DRAFT] Update testnet reset script Aug 27, 2025
@lijamie98
lijamie98 marked this pull request as draft August 27, 2025 23:54
@philipliu
philipliu force-pushed the philip/testnet-reset branch from b0811f9 to 4402839 Compare December 19, 2025 23:25
@philipliu philipliu changed the title 【DRAFT] Update testnet reset script [DRAFT] Update testnet reset script Dec 19, 2025
@amandagonsalves amandagonsalves changed the title [DRAFT] Update testnet reset script [ANCHOR-1016] Move testnet reset scripts into Anchor Platform repo Jun 10, 2026
* add new github actions workflow for manual testnet resets

* update workflow to install rust, stellar cli, and stellar sdk dependencies

* add environment variables for various testnet accounts and secrets
* add python3 and stellar-sdk prerequisites

* update .env loading to be optional, relying on environment variables if not present

* add public_key helper function to derive stellar public keys from secret keys

* refactor all script sections to use dynamically derived public keys from secret keys

* update usdc funding amount
Comment thread .github/workflows/on_testnet_reset.yml Fixed
amandagonsalves and others added 2 commits June 15, 2026 15:38
…ntain permissions'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* delete `CLIENT_WALLET_PK_BYTES` environment variable

* add `pk_bytes` helper function to derive raw public key bytes

* update contract deployment to derive signer public key from a secret

* delete unused public keys from `.env.example`

* add `OTHER_SEP10_SIGNING_SECRET` for testing purposes

* update `TESTANCHOR_DISTRIBUTION_SECRET` to `TESTANCHOR_RECEIVE_SECRET`
@amandagonsalves
amandagonsalves marked this pull request as ready for review June 17, 2026 19:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

There are critical correctness and security issues in the reset script (payment amounts and set -e deploy handling) and the workflow currently passes secret seeds via non-secret GitHub Actions variables.

Pull request overview

This PR expands the testnet reset automation so it does more than contract deployment, and adds a manual GitHub Actions workflow to run the reset from CI.

Changes:

  • Reworks scripts/testnet_reset.sh to fund accounts, set up trustlines, issue test assets, and deploy Soroban contracts.
  • Adds a workflow_dispatch GitHub Actions workflow to run the reset script on demand.
  • Updates .env.example with additional environment variables used by the reset process.
File summaries
File Description
scripts/testnet_reset.sh Adds end-to-end testnet setup logic (funding, trustlines, asset issuance, contract deploy).
.github/workflows/on_testnet_reset.yml Introduces a manual CI workflow to execute the reset script.
.env.example Updates the sample environment variables to match the new reset flow.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 9

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread .github/workflows/on_testnet_reset.yml Outdated
Comment thread scripts/testnet_reset.sh
@amandagonsalves amandagonsalves self-assigned this Jun 17, 2026
* refactor secrets in ci workflow

* update rust wasm target

* refactor secret key handling in script

* update friendbot funding to handle errors

* refactor contract deployment for robustness
* update usdc funding logic

* update TESTANCHOR_DISTRIBUTION_SECRET usdc amount to 10000

* update other accounts usdc amount to 0.1

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

The reset script currently has multiple correctness and reliability issues (notably amount/log mismatches and deploy error handling that masks real failures) that could cause incorrect funding and false-success runs.

Copilot's findings
  • Files reviewed: 3/3 changed files
  • Comments generated: 11

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread scripts/testnet_reset.sh
Comment thread .github/workflows/on_testnet_reset.yml Outdated
amandagonsalves and others added 3 commits June 17, 2026 17:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* delete unused recipient variables from testnet funding list

* add specific funding amount (100 USDC) for TEST_CLIENT_WALLET_SECRET
@amandagonsalves
amandagonsalves merged commit fee2f60 into develop Jun 18, 2026
11 checks passed
@amandagonsalves
amandagonsalves deleted the philip/testnet-reset branch June 18, 2026 15:12
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.

6 participants