Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

Lou-Kamades
Copy link
Contributor

No description provided.

@Lou-Kamades Lou-Kamades force-pushed the lou/fallback-oracle-client branch from d7a7492 to d6846ec Compare December 6, 2023 18:44
@github-actions github-actions bot added the client TS client changes label Dec 6, 2023
@Lou-Kamades Lou-Kamades force-pushed the lou/fallback-oracle-client branch from d6846ec to 27a81e2 Compare December 6, 2023 18:48
@Lou-Kamades Lou-Kamades force-pushed the lou/fallback-oracle-client branch from b36aab7 to 59daa80 Compare December 6, 2023 18:55
Copy link
Contributor

@ckamm ckamm left a 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>> {
Copy link
Contributor

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,
Copy link
Contributor

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)
Copy link
Contributor

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()

@Lou-Kamades Lou-Kamades changed the title Use fallback oracles in Rust + TS clients WIP: Use fallback oracles in Rust + TS clients Dec 19, 2023
@Lou-Kamades Lou-Kamades closed this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client TS client changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants