-
Notifications
You must be signed in to change notification settings - Fork 172
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
receipt cache limited by volumes #103
Conversation
630cc4c
to
a5d2767
Compare
a5d2767
to
40dd44d
Compare
op-node/sources/caching/blob_lru.go
Outdated
type SizeConstrainedCache[K comparable, V any] struct { | ||
m Metrics | ||
label string | ||
size int |
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.
Perhaps uint64 type should be used instead, it is uncertain if int type will overflow when counting byte size.
op-node/sources/eth_client.go
Outdated
} else { | ||
txHashes := eth.TransactionsToHashes(txs) | ||
job = NewReceiptsFetchingJob(s, s.client, s.maxBatchSize, eth.ToBlockID(info), info.ReceiptHash(), txHashes) | ||
_, err := job.Fetch(ctx) |
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.
There is no need to execute Fetch here, please refer to the comments above. The reason for caching the job instead of the receipts is that it saves the intermediate state, so even if it fails, it can continue to execute the next time.
49a8c69
to
352ccb6
Compare
352ccb6
to
329f0c3
Compare
329f0c3
to
fe8cf5a
Compare
Two concerns:
I'm not sure if it's worth it. |
Using higher memory should be good enough for now, we'll close this PR. |
The receipts cache was originally a LRUCache type that was limited by the number of elements, but there is a problem, meaning that if the recent block contains too many receipts, then the receipts cache can take up a lot of memory. To limit the memory usage of the receipts cache, this PR changes the cache type to SizeConstrainedCache, which is limited by the total volume of elements.