Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Move price registry sync to start of Observation#586

Merged
jarnaud merged 3 commits intoccip-developfrom
CCIP-1646-2
Mar 7, 2024
Merged

Move price registry sync to start of Observation#586
jarnaud merged 3 commits intoccip-developfrom
CCIP-1646-2

Conversation

@jarnaud
Copy link
Contributor

@jarnaud jarnaud commented Mar 6, 2024

Motivation

Solution

@jarnaud jarnaud requested a review from a team as a code owner March 6, 2024 16:22
@jarnaud jarnaud self-assigned this Mar 6, 2024
}

// Ensure that the source price registry is synchronized with the onRamp.
if err = r.ensurePriceRegistrySynchronization(ctx); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Mentioned that in a previous PR so copypasting :D

in that case prepareTokenExecData and eventually ensurePriceRegistrySynchronization are never called.

@dimkouv @jarnaud why is that a problem? At this moment, the source price registry is used only in a single place, so what's the point of eagerly synchronizing that? I understand that in case of adding any other reference to the source price registry might end up trying to call a stale object which is bad. On the other hand, we will keep refreshing cache with every observation even if we don't need to do anything with tokens, but maybe this is not a bad thing

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not really problem, but in order to figure this out (if there's a problem) I had to look at the call stack to make sure the price registry is not used before the ensurePriceRegistrySynchronization call.

Results are cached so I believe it's good to make the logic cleaner to avoid future bugs.

@jarnaud jarnaud merged commit 1beda3a into ccip-develop Mar 7, 2024
@jarnaud jarnaud deleted the CCIP-1646-2 branch March 7, 2024 11:42
asoliman92 pushed a commit that referenced this pull request Jul 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants