-
Notifications
You must be signed in to change notification settings - Fork 35
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
cache receipts #2103
cache receipts #2103
Conversation
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.
Few comments but approach seems reasonable to me
|
||
logs := rec.Receipt.Logs | ||
// filter out the logs that the sender can't read | ||
// doesn't apply to value transfers (when to=nil) |
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.
Value transfers have a To address I think, it's only contract creation where To=nil isn't it? Is it ok that this returns error for value transfers?
// event visibility logic | ||
canView := eventType.IsPublic() || | ||
(eventType.AutoPublic != nil && *eventType.AutoPublic) || | ||
(eventType.SenderCanView != nil && *eventType.SenderCanView) || |
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.
From the method signature it looks like this checks for a generic requester but actually you can only call this method when you've verified sender == requester. Worth clarifying somewhere with a comment or in the method name I think.
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 actually had a comment like that and removed it
go/enclave/storage/cache_service.go
Outdated
} | ||
|
||
func (cs *CacheService) ReadConvertedHeader(ctx context.Context, batchHash common.L2BatchHash, onCacheMiss func(any) (*types.Header, error)) (*types.Header, error) { | ||
return getCachedValue(ctx, cs.convertedGethHeaderCache, cs.logger, batchHash, blockHeaderCost, onCacheMiss) | ||
return getCachedValue(ctx, cs.convertedGethHeaderCache, cs.logger, batchHash, blockHeaderCost, onCacheMiss, false) |
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.
Worth a comment to say it's not added to the cache in this case and why I think, because unusual behaviour.
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.
that was a typo actually. should have been true
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.
lgtm
Why this change is needed
Retrieving tx receipts is expensive because the SQL query is complex.
The most common use case is that users will request receipts for recent transactions.
What changes were made as part of this PR
tx.content
column from the receipt SQL queryPR checks pre-merging
Please indicate below by ticking the checkbox that you have read and performed the required
PR checks