Skip to content

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.

@vercel
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
@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.

3 participants