-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Use fallback oracles in Rust + TS clients #811
Conversation
d7a7492
to
d6846ec
Compare
d6846ec
to
27a81e2
Compare
b36aab7
to
59daa80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only covered rust part for now
pub async fn fetch_fallbacks_for_stale_oracles( | ||
&self, | ||
rpc: &RpcClientAsync, | ||
) -> anyhow::Result<Vec<Pubkey>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of function is what's needed, but I think it should use the AccountFetcher to retrieve the accounts, so users can use caching or websocket feeds or grpc to feed in the actual account data.
Also, there shouldn't be a need to re-fetch the banks, since the context has all the necessary info in tokens
I don't see it used yet. If it's using the AccountFetcher, it'd be fine to call it for every tx send.
User config could be
- use dynamic fallback accounts (default): call this function to check what oracles need fallbacks
- pass all fallbacks (your AllAvailable; which has trouble with the 64 accounts-per-tx limit)
- no dynamic fallbacks
Plus a separate config for a fixed list of fallbacks, ideally configured in a user-helpful way (symbol names?). That way even if you use dynamic fallback accounts, you can say "KIN oracle breaks randomly, I'd rather pass it all the time".
@@ -156,6 +164,8 @@ pub struct MangoGroupContext { | |||
pub address_lookup_tables: Vec<Pubkey>, | |||
|
|||
pub compute_estimates: ComputeEstimates, | |||
|
|||
pub fallback_oracle_context: FallbackOracleContext, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm doubtful of putting this user-side configuration into the MangoGroupContext - its intention is to cache the on chain state that's needed frequently and changes rarely.
.check_confidence(bank.name(), &bank.oracle_config) | ||
.is_err() | ||
|| state | ||
.check_staleness(bank.name(), &bank.oracle_config, now_slot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use check_confidence_and_maybe_staleness()
No description provided.