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
Add cache to Eth1 RPC functions #5347
Conversation
@@ -72,8 +80,9 @@ func (s *Service) BlockTimeByHeight(ctx context.Context, height *big.Int) (uint6 | |||
// This is a naive implementation that will use O(ETH1_FOLLOW_DISTANCE) calls to cache | |||
// or ETH1. This is called for multiple times but only changes every | |||
// SlotsPerEth1VotingPeriod (1024 slots) so the whole method should be cached. | |||
// How should caching the whole method be done? |
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.
? do we need this 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.
Just for personal tracking as I try to figure out whats needed, will remove before the PR is ready for review.
@@ -29,6 +29,8 @@ import ( | |||
|
|||
// eth1DataNotification is a latch to stop flooding logs with the same warning. | |||
var eth1DataNotification bool | |||
var cachedEth1VotingStartTime uint64 | |||
var cachedEth1Data *ethpb.Eth1Data |
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.
This caching is very simple, should we cache it on the beacon node side or is on the validator end fine?
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.
It should be fine if it lives in the beacon node side, that way many validator clients connected to one beacon node can benefit
Codecov Report
@@ Coverage Diff @@
## master #5347 +/- ##
===========================================
+ Coverage 12.56% 41.51% +28.94%
===========================================
Files 112 233 +121
Lines 8740 19385 +10645
===========================================
+ Hits 1098 8047 +6949
- Misses 7454 9949 +2495
- Partials 188 1389 +1201 |
…ticlabs#5876) * Revert "Add cache to Eth1 RPC functions (prysmaticlabs#5347)" This reverts commit 159ef3d.
Resolves #5340
This PR improves the RPC functions by adding a cache to both.