Skip to content

fix: use explicit --oracle flag instead of indexFeedId in withdraw, c…#10

Open
millw14 wants to merge 1 commit intoaeyakovenko:masterfrom
millw14:fix/oracle-account-pyth
Open

fix: use explicit --oracle flag instead of indexFeedId in withdraw, c…#10
millw14 wants to merge 1 commit intoaeyakovenko:masterfrom
millw14:fix/oracle-account-pyth

Conversation

@millw14
Copy link

@millw14 millw14 commented Mar 6, 2026

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.

…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.
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.

1 participant