-
Notifications
You must be signed in to change notification settings - Fork 260
fix(pulse): reset priceLastUpdatedAt when price IDs are added in updateSubscription #2674
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
fix(pulse): reset priceLastUpdatedAt when price IDs are added in updateSubscription #2674
Conversation
…ubscription Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Closing due to inactivity for more than 7 days. |
bool priceIdsChanged = _clearRemovedPriceUpdates( | ||
subscriptionId, | ||
currentParams.priceIds, | ||
newParams.priceIds | ||
); | ||
|
||
// Reset priceLastUpdatedAt to 0 if price IDs have changed | ||
if (priceIdsChanged) { | ||
_state.subscriptionStatuses[subscriptionId].priceLastUpdatedAt = 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more accurate to reset priceLastUpdatedAt only when new prices are added (not just on any change to price ids.)
Co-Authored-By: Tejas Badadare <tejas@dourolabs.xyz>
…evin/1747071611-reset-pricelastupdatedat-on-subscription-update
Reset priceLastUpdatedAt when price IDs are added in updateSubscription
Description
This PR fixes an issue in the
Scheduler.sol
contract wherepriceLastUpdatedAt
was not being reset when thepriceIds
list was added to in theupdateSubscription
function. This could prevent immediate calls toupdatePriceFeeds
after a subscription update because:heartbeatSeconds
enforces a minimum time sincepriceLastUpdatedAt
publishTime
greater thanpriceLastUpdatedAt
The fix modifies the
_clearRemovedPriceUpdates
function to return a boolean indicating whether price IDs have been added, and then resetspriceLastUpdatedAt
to 0 inupdateSubscription
when this occurs.Changes
_clearRemovedPriceUpdates
to return a boolean indicating if price IDs were addedupdateSubscription
to resetpriceLastUpdatedAt
to 0 when price IDs are addedPulseScheduler.t.sol
to verify the fix works as expectedTesting
testUpdateSubscriptionResetsPriceLastUpdatedAt
that verifies:priceLastUpdatedAt
is reset to 0 when price IDs are addedRequested by
Tejas Badadare (tejas@dourolabs.xyz)
Link to Devin run
https://app.devin.ai/sessions/143f676aadca48d8a5e491864dff0917