Repository navigation
feat(harness): keep account keys between deploys - #312
Merged
Merged
Conversation
Every deploy made new random keys for the thirteen harness accounts and kept them only in deployed.<network>.json, which the next deploy overwrote. A deploy now reads the keys from scripts/harness/.env.keys.<network>, adds a key only for an account without one, and writes the file with mode 0600 before any transaction. `npm run keys` does the same without deploying and prints public keys only. Funding skips accounts that already exist, the issuer's existing asset contract is reused, and the previous record is kept as deployed.<network>.<timestamp>.json. The harness unit tests need no network and run in the root test run.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6 of 7 tasks
Env files usually live at the root, where they are easier to find, and the root .gitignore already ignores them.
4 tasks
luchobonatti
approved these changes
Oct 22, 2026
| } | ||
| } | ||
|
|
||
| async function exists(server: rpc.Server, publicKey: string): Promise<boolean> { |
Member
There was a problem hiding this comment.
exists() treats any RPC error as a missing account, so a timeout ends in a confusing "already exists" at funding. Maybe return false only on "Account not found" and rethrow the rest?
| ) as Deployment["accounts"], | ||
| } | ||
| saveDeployment(record) | ||
| const kept = saveDeployment(record) |
Member
There was a problem hiding this comment.
The record still carries every secret (line 243) and each deploy now keeps another 0644 copy. With the keys file as the source of truth, maybe store public keys only, or write the records 0600?
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #309
Every deploy made new random keys for the thirteen harness accounts and kept
them only in
deployed.<network>.json, which the next deploy overwrote. Thatlost every key of a testnet deployment. Keys now live in their own file, which
deploys read and complete but never replace, and old records are kept.
Changes
npm run keyscreates or completes that file without deploying and prints public keys only.Deviations
contract already exists).npm run testnow runs the harness unit tests, so CI does.Acceptance criteria
.env.keys.<network>at the repository root, creates and saves only the missing ones before any transaction, and never replaces an existing onenpm run keyscreates or completes the file without deploying, and prints the public keys onlydeployed.<network>.<timestamp>.jsoninstead of overwriting itTest plan
Automated tests
npm run test:unit -w scripts/harness: 4 files, 17 tests pass, no network.npm run test: 76 files, 1725 tests pass, the harness unit tests included.npm run lint -w scripts/harnessandnpm run typecheck -w scripts/harness: no errors (typecheck afternpm run build:clients).npm run format:check: clean.CI's build job fails on every PR since 2026-10-22: the newest quickstart image moves the local network to protocol 30, where the current CLI cannot deploy. Pinning the local network to protocol 29 fixes it; that change waits for a push with the
workflowscope.Manual verification
docker run --rm -d -p 8000:8000 --name stellar-local stellar/quickstart:v678-b1525.1-latest --local --enable core,rpc.HARNESS_NETWORK=local npm run deploy -w scripts/harness:account keys in .env.keys.local (13 new),funded 13 accounts; 0 already existed. The file is-rw-------.HARNESS_NETWORK=local npm run keys -w scripts/harness:(0 new)and thirteen public keys, no secret.(0 new),funded 0 accounts; 13 already existed, the same asset contract, new vault contracts, andkept the previous record as deployed.local.2026-10-22T13-37-20-150Z.json.test:happy-path(24 tests) andtest:guards(37 tests) pass against the second deployment.Breaking changes
None.
Checklist
Screenshots
None.