Skip to content
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

commit/tokenprice: add async tokenprice observer #668

Merged
merged 6 commits into from
Feb 26, 2025
Merged

Conversation

makramkd
Copy link
Collaborator

@makramkd makramkd commented Feb 26, 2025

Add an asynchronous token price observer implementation that follows what is being done in merkleroot and chainfee.

In the future, we'd want to potentially explore having these caches on a node-level rather than a plugin level to get even more performance gains.

The token price integration test couldn't be added because it requires docker, in a follow up will fix that and add it to this CI.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The changes here are pretty much all logging related, I wanted to add contextual logging where possible to be able to visualize rounds better.

@@ -54,26 +59,58 @@ func (p *processor) ObserveFChain(lggr logger.Logger) map[cciptypes.ChainSelecto
return fChain
}

func (p *processor) ObserveFeedTokenPrices(ctx context.Context, lggr logger.Logger) cciptypes.TokenPriceMap {
if p.tokenPriceReader == nil {
type observer interface {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Intentionally written to be as close as possible to the existing async observers

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not creating a new file for the async observer? We would match the style used for chainfee. but this is nit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Its alright, this code will get deleted soon-ish anyway once we do the per-node cache.

Comment on lines 32 to 35
- cmd: cd integration-tests/smoke/ccip && go test ccip_gas_price_updates_test.go -timeout 12m -test.parallel=2 -count=1 -json
name: "Gas Price Updates Test"
- cmd: cd integration-tests/smoke/ccip && go test ccip_token_price_updates_test.go -timeout 12m -test.parallel=2 -count=1 -json
name: "Token Price Updates Test"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added for additional coverage.

can only run in docker at the moment
@makramkd makramkd marked this pull request as ready for review February 26, 2025 13:06
@makramkd makramkd requested a review from a team as a code owner February 26, 2025 13:06
Copy link
Contributor

@0xnogo 0xnogo left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

Metric mk/CCIP-5260 main
Coverage 71.7% 71.7%

@makramkd
Copy link
Collaborator Author

@makramkd
Copy link
Collaborator Author

Token prices test passes in CL. Merging.

@makramkd makramkd merged commit f8239cb into main Feb 26, 2025
17 checks passed
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.

2 participants