-
Notifications
You must be signed in to change notification settings - Fork 523
Cache creators in cow base #2939
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2939 +/- ##
==========================================
+ Coverage 47.27% 47.31% +0.03%
==========================================
Files 356 356
Lines 57239 57249 +10
==========================================
+ Hits 27062 27089 +27
+ Misses 27108 27099 -9
+ Partials 3069 3061 -8
Continue to review full report at Codecov.
|
tsachiherman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me.
algorandskiy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, only concerning on FoundAddress type name
| } | ||
|
|
||
| // FoundAddress is a wrapper for an address and a boolean. | ||
| type FoundAddress struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it exported? The struct name sound a bit weird. Maybe cachedCreator or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FoundAddress is also used in evalIndexer.go where this type needs to be exposed to Indexer. I think this name is ok for caching as well. FoundAddress encodes an address that is found (or not found). That is exactly what we want to cache.
tsachiherman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do we need to cache non-existent addresses ? It looks like the Exists it's a mutually exclusive with the Address.
|
Maybe caching responses for non-existent assets is silly, but it lets indexer preload such responses in a batch. |
tsachiherman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do better here on both the struct naming as well on the cached content, but I can't see a (good) reason to block this one right away. We could iterate on the above in the future.
Summary
The evaluator shouldn't ask the ledger who is the creator of an asset multiple times. This PR adds a cache for ledger's responses in cow base.
Test Plan
Added a test. Is there a better way to write a mock test?