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

[solana push oracle] Idempotent updates #1452

Merged
merged 2 commits into from
Apr 12, 2024
Merged

[solana push oracle] Idempotent updates #1452

merged 2 commits into from
Apr 12, 2024

Conversation

jayantk
Copy link
Contributor

@jayantk jayantk commented Apr 12, 2024

If someone tries to update a feed with a stale price, ignore the update instead of throwing an error.

Copy link

vercel bot commented Apr 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
example-oracle-amm ⬜️ Ignored (Inspect) Apr 12, 2024 8:31pm
xc-admin-frontend ⬜️ Ignored (Inspect) Apr 12, 2024 8:31pm

None,
)
.await
.unwrap();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that the account state is checked to be feed_1_recent directly below this already. I changed the update message ^ to feed_1_old to validate that the on-chain state is unchanged.


require!(
price_feed_account.price_message.feed_id == feed_id,
PushOracleError::PriceFeedMessageMismatch
Copy link
Contributor

@guibescos guibescos Apr 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems inefficient to deserialize PriceUpdateV2... though I agree it feels better to have this check here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me check how many CUs we spend doing this

@guibescos
Copy link
Contributor

Let's merge since the logic is good and we'll think later about the CU optimizations if needed

@jayantk jayantk merged commit a607335 into main Apr 12, 2024
5 checks passed
@jayantk jayantk deleted the idempotent branch April 12, 2024 21:37
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.

2 participants