fix: use explicit --oracle flag instead of indexFeedId in withdraw, c…#10
Open
millw14 wants to merge 1 commit intoaeyakovenko:masterfrom
Open
fix: use explicit --oracle flag instead of indexFeedId in withdraw, c…#10millw14 wants to merge 1 commit intoaeyakovenko:masterfrom
millw14 wants to merge 1 commit intoaeyakovenko:masterfrom
Conversation
…lose-account, trade-cpi indexFeedId stores the oracle account pubkey for Chainlink markets but a 32-byte feed ID hash for Pyth markets. Using it directly as the oracle account breaks withdraw, close-account, and trade-cpi on any Pyth market. Aligns with keeper-crank, trade-nocpi, liquidate-at-oracle, and best-price which already take --oracle as an explicit required flag.
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.
Problem
withdraw, close-account, and trade-cpi read indexFeedId from the slab config and pass it directly as the oracle account in the transaction's account list.
This works on Chainlink markets by coincidence — Chainlink's indexFeedId happens to be the oracle account pubkey. On Pyth markets, indexFeedId is a 32-byte feed ID hash, not a valid Solana account. The transaction fails with a confusing runtime error.
Six other commands (keeper-crank, trade-nocpi, liquidate-at-oracle, best-price, push-oracle-price, set-oracle-authority) already take --oracle as an explicit flag and don't have this bug. The inconsistency means only these three commands are broken.
No funds at risk — the on-chain program rejects the malformed account — but the CLI is non-functional for withdraw, close-account, and CPI trading on any Pyth-based market.
Fix
Add --oracle as a required flag to all three commands. Remove the implicit indexFeedId usage.
Changes
src/commands/withdraw.ts — add --oracle, replace mktConfig.indexFeedId
src/commands/close-account.ts — same
src/commands/trade-cpi.ts — same, drop unused parseConfig import
3 files changed, 10 insertions(+), 6 deletions(-). Nothing else touched.