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

Config cache #551

Merged
merged 32 commits into from
Feb 11, 2025
Merged

Config cache #551

merged 32 commits into from
Feb 11, 2025

Conversation

0xnogo
Copy link
Contributor

@0xnogo 0xnogo commented Feb 4, 2025

This PR modifies the CCIPChainReader to use a cache layer for static configuration data. Instead of making contract calls for each configuration request, static data like offramp config, RMN config, and fee quoter config is now cached with a configurable refresh period.

The OnRampGetDynamicConfig and OnRampGetDestChainConfig are called from the src chain, so cannot be batched. We can eventually cache them (probably in an upcoming PR).

@0xnogo 0xnogo marked this pull request as ready for review February 5, 2025 13:28
@0xnogo 0xnogo requested a review from a team as a code owner February 5, 2025 13:28
pkg/reader/cache.go Outdated Show resolved Hide resolved
pkg/reader/cache.go Outdated Show resolved Hide resolved
@0xnogo 0xnogo enabled auto-merge (squash) February 7, 2025 16:40
)

return contractreader.ExtendedBatchGetLatestValuesRequest{
consts.ContractNameOffRamp: {
Copy link
Contributor

Choose a reason for hiding this comment

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

worth adding some warning comment that changing the order will fail the processing function. I suggest adding some unit test to make sure that the order doesn't change as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The order here is not important. The processing is happening in a for loop with a switch statement. So even if the order changes, we would still be able to process the batched result correctly.

Copy link

Metric ng/config-caching main
Coverage 76.0% 75.6%

@0xnogo 0xnogo merged commit b2a6a3d into main Feb 11, 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.

4 participants