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

Improve caching of contract currency details #136

Merged
merged 6 commits into from
Oct 29, 2024

Conversation

marklandgrebe-cb
Copy link
Contributor

@marklandgrebe-cb marklandgrebe-cb commented Oct 24, 2024

Fixes

Improve caching of contract currency details.

Motivation

To improve /block latency. A major bottleneck is that contractCurrencyMap is created fresh for each transaction, so it only caches within a single transaction's logs. That's why we see repeated GetContractCurrency calls for the same contracts across different transactions.

Solution

Add an LRU cache that stores contract currency details across blocks. Also, don't go to the node for allow listed tokens to get symbol and decimals (if env var USE_TOKEN_WHITE_LIST_METADATA="true"), as they can be retrieved from the config.

@cb-heimdall
Copy link

cb-heimdall commented Oct 24, 2024

✅ Heimdall Review Status

Requirement Status More Info
Reviews 3/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

potterbm-cb
potterbm-cb previously approved these changes Oct 28, 2024
@marklandgrebe-cb marklandgrebe-cb merged commit eb55c7e into master Oct 29, 2024
10 checks passed
@marklandgrebe-cb marklandgrebe-cb deleted the improve-contract-currency-caching branch October 29, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants