Skip to content

feat(target_chains/ethereum): don't store update in contract storage in parsePriceFeedUpdates #2574

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

Merged
merged 3 commits into from
Apr 14, 2025

Conversation

tejasbadadare
Copy link
Contributor

@tejasbadadare tejasbadadare commented Apr 10, 2025

Summary

This PR removes the updatePriceFeedsIfNecessary call from the Pyth contract's parsePriceFeedUpdates API. Now the function will just parse and return the PriceFeed struct in-memory, and will not store the update in contract storage.

Rationale

The Pyth ethereum contract's parsePriceFeedUpdates function currently has a side effect where if the input update is fresher than the one stored in the contract, it will store the new update via updatePriceFeedsIfNecessary.

In our new Pulse Scheduler design, we want to avoid free-riding our push feeds. This side-effect of the parse function conflicts with this, since anyone can fetch the new price via Pyth's queryPriceFeeds. We need to call the parse function in Scheduler's updatePriceFeeds function, but we want to lock down reading the feeds to the user's whitelisted addresses. Thus, we are removing the updatePriceFeedsIfNecessary call from the parse function.

This will be a potentially breaking change in behavior for users, but this behavior was initially intended as an optimization (if someone is bringing new data, let's store it), without regard for free-riding. We don't expect people are calling parse and then queryPriceFeed, since that would be a misuse/incorrect integration of our contract.

How has this been tested?

  • Current tests cover my changes
    • Removed tests that checked that parsePriceFeedUpdates would update the price feed state.
  • Added new tests
  • Manually tested the code

Sorry, something went wrong.

Copy link

vercel bot commented Apr 10, 2025

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

Name Status Preview Comments Updated (UTC)
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 14, 2025 4:43pm
5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Visit Preview Apr 14, 2025 4:43pm
component-library ⬜️ Ignored (Inspect) Visit Preview Apr 14, 2025 4:43pm
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Apr 14, 2025 4:43pm
insights ⬜️ Ignored (Inspect) Visit Preview Apr 14, 2025 4:43pm
staking ⬜️ Ignored (Inspect) Visit Preview Apr 14, 2025 4:43pm

@tejasbadadare tejasbadadare merged commit f32eaf8 into main Apr 14, 2025
10 checks passed
@tejasbadadare tejasbadadare deleted the tb/pyth-ethereum/dont-store-in-parse branch April 14, 2025 17:03
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.

None yet

2 participants