feat(target_chains/ethereum): don't store update in contract storage in parsePriceFeedUpdates #2574
+56
−100
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes the
updatePriceFeedsIfNecessary
call from the Pyth contract'sparsePriceFeedUpdates
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 viaupdatePriceFeedsIfNecessary
.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'supdatePriceFeeds
function, but we want to lock down reading the feeds to the user's whitelisted addresses. Thus, we are removing theupdatePriceFeedsIfNecessary
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?