Skip to content

Conversation

@ali-behjati
Copy link
Collaborator

@ali-behjati ali-behjati commented Dec 13, 2022

This PR aims to make the gap metric more accurate. It might slightly improve the latency of prices as described below.

The problem is that multiple attesters might attest the same price that results in the same batch information but on different VAAs. This PR will use sequence number to store the most recent one. As in one second there are multiple slots, doing so will allow price service to pick a slightly more recent price to serve (if such a thing happens).

Why is it important for metrics? Because we often compare the trens of the attestation gap metric with the vaa received metrics. After doing this change, the trend difference of these two will show how many out of order VAAs we do have and is a useful information.

Why sequence number alone is not used? Because we might have multiple sources of data (Pythnet/Solana) and each have their own increasing sequence number. Using sequence number alone will make the switch between them difficult. The current solution will have no impact on switch.

}
);

if (!isAnyPriceNew) {
Copy link
Collaborator Author

@ali-behjati ali-behjati Dec 13, 2022

Choose a reason for hiding this comment

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

I removed this one to make the code more clear. I believe the performance overhead of the computations after that are negligible; specially now that we drop duplicate VAAs before this part.

@ali-behjati ali-behjati merged commit f45d675 into main Dec 13, 2022
@ali-behjati ali-behjati deleted the price-service/make-gap-metric-more-accurate branch December 13, 2022 14:52
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