feat(price-pusher): allow mnemonic from MNEMONIC env var#3689
Open
0xghost42 wants to merge 2 commits into
Open
feat(price-pusher): allow mnemonic from MNEMONIC env var#36890xghost42 wants to merge 2 commits into
0xghost42 wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 7 Skipped Deployments
|
…-network#1015) Previously the price pusher required `--mnemonic-file` pointing at a file on disk containing the signing mnemonic. On platforms that provide encrypted env vars (DigitalOcean, Fly.io, etc.) this forces operators to first write the secret to disk before launching the process. Make `--mnemonic-file` optional and fall back to the `MNEMONIC` environment variable when the flag is not supplied. If both are supplied, the file takes precedence (explicit beats implicit). If neither is supplied, the existing required-arg error is replaced with a clearer message naming both sources. The helper lives in `utils.ts` so all four chain commands (evm, sui, aptos, injective) share identical resolution behaviour.
Per review feedback: - Bump @pythnetwork/price-pusher to 10.5.0 (minor) — backward-compatible feature addition (MNEMONIC env var fallback). 10.4.0 was consumed by pyth-network#3687 hermes-access-token. - Add tests/utils.test.ts covering all three readMnemonic paths plus the file-precedence-over-env behaviour: file source, env fallback, empty-string path (treated as not supplied), file > env precedence, missing-both error, empty-env error. - Wire `test:unit` script into apps/price_pusher/package.json so the workspace runner picks it up. `pnpm --filter @pythnetwork/price-pusher exec test-unit` — 6 passing.
ea1abb5 to
f1a68c4
Compare
Author
|
Pushed
Type check ( |
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 #1015.
Make
--mnemonic-fileoptional in the price pusher and fall back to aMNEMONICenvironment variable when the flag is not supplied. This makes deployments on platforms that inject secrets as encrypted env vars (DigitalOcean, Fly.io, etc.) much simpler, since operators no longer need to write the mnemonic to disk before launching the process.Maintainer pre-approval: @jayantk on the original issue — "happily accept a PR".
Change
apps/price_pusher/src/options.ts:--mnemonic-fileis nowrequired: false, with an updated description noting the env var fallback.apps/price_pusher/src/utils.ts: newreadMnemonic(mnemonicFile)helper. Resolution order: file (if supplied) →MNEMONICenv var → clear error naming both sources.apps/price_pusher/src/{evm,sui,aptos,injective}/command.ts: replace per-commandfs.readFileSync(mnemonicFile, "utf8").trim()with the shared helper; drop now-unusedfsimport.apps/price_pusher/README.md: short note on the two supported sources and the precedence rule.Verification
pnpm exec tsc --noEmitfromapps/price_pusherpasses.pnpm turbo fix --filter @pythnetwork/price-pusheris clean (formatting + biome).--mnemonic-file <path>only → reads file (unchanged from today).MNEMONIC=…env var only → reads env.No mnemonic provided. Pass --mnemonic-file or set the MNEMONIC environment variable.Out of scope
I did not touch the
solana,fuel,near, ortoncommands — they use different key-loading paths (keypair files / explicit private keys) and don't accept--mnemonic-filetoday. Happy to extend to those in a follow-up if useful.