fix(testnet/events-capture): derive per-suite root SK to unblock run-all/run-local#113
Merged
Merged
Conversation
…all/run-local
The harness required a wrapper-level MASTER_SECRET to derive operator/alice/bob
keys ahead of subscriber bring-up. Wiring suites 1 and 3 under one root in
run-local.sh shared the same PP operator key — suite 3's POST /dashboard/council/join
hit provider-platform's "PP already active for this council" check and 409'd.
Layer one more SHA-256 stage on top of masterSeedFromSecret:
perSuiteSeed = SHA-256(rootSeed || `suite/${scriptName}`)
perSuiteSecret = Keypair.fromRawEd25519Seed(perSuiteSeed).secret()
Re-export MASTER_SECRET to the per-suite SK before script.main() runs so the
script's own Deno.env.get("MASTER_SECRET") + masterSeedFromSecret(...) derives
matching role keys. Same root + same scriptName ⇒ identical per-suite SK
(reproducible across re-runs). Different scriptName ⇒ disjoint role keys.
parseArgs falls back to a freshly-minted random root when MASTER_SECRET is
unset, restoring the pre-harness behavior of the underlying scripts and letting
run-all.sh (deployed Tempo, no MASTER_SECRET exported) invoke the harness
without wrapper changes.
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
MASTER_SECRETto derive operator/alice/bob keys ahead of subscriber bring-up.run-local.sh allruns suite 1 (testnet-main) and suite 3 (lifecycle-testnet-verify) back-to-back under the single root the wrapper exports, both suites derive the same PP operator key — suite 3'sPOST /dashboard/council/jointhen hits provider-platform's "PP already active for this council" check and 409s.run-all.shhas a related failure mode: it doesn't exportMASTER_SECRETat all, so the harness throws at parse-args time.masterSeedFromSecretkeyed on thescriptName, and fall back to a freshly-minted random root whenMASTER_SECRETis unset.What changed in
testnet/events-capture/harness.tsderivePerSuiteSecret(rootSecret, scriptName)—SHA-256(rootSeed ||suite/${scriptName})→ 32 bytes → Stellar SK viaKeypair.fromRawEd25519Seed(...).secret(). Matches the SHA-256-of-concatenation style already inlib/master-seed.ts.main(), the harness re-exportsMASTER_SECRETto the per-suite SK so the script's ownDeno.env.get("MASTER_SECRET") + masterSeedFromSecret(...)derives matching role keys.parseArgs()no longer throws whenMASTER_SECRETis unset — it mints an ephemeral root, restoring the pre-harness shape of the underlying scripts and lettingrun-all.shinvoke the harness without wrapper changes.Properties
MASTER_SECRETonce at the wrapper level → reproducible across re-runs; leave it unset → ephemeral per-invocation.scriptName⇒ identical per-suite SK (reproducibility).scriptName⇒ disjoint role keys (suite 1 and suite 3 isolated).Test plan
deno fmt --checkclean (testnet)deno lintclean (testnet)deno check events-capture/harness.tsclean./testnet/run-local.sh allagainst local stack — full sweep PASS:GAFWC4R3...) and suite 3 (GAX77SRV...) — per-suite derivation confirmed working../testnet/run-all.shagainst deployed testnet — to verify the deployed-Tempo path still works end-to-end with the no-MASTER_SECRETfallback.