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
Compute state up to slot #5035
Compute state up to slot #5035
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5035 +/- ##
==========================================
+ Coverage 42.99% 44.10% +1.10%
==========================================
Files 267 214 -53
Lines 20111 16628 -3483
==========================================
- Hits 8647 7333 -1314
+ Misses 9987 8000 -1987
+ Partials 1477 1295 -182 |
// ComputeStateUpToSlot returns a processed state up to input target slot. | ||
// If the last processed block is at slot 32, given input target slot at 40, this | ||
// returns processed state up to slot 40 via empty slots. | ||
func (s *State) ComputeStateUpToSlot(ctx context.Context, targetSlot uint64) (*state.BeaconState, error) { |
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.
Ok , what if you have two blocks at slot 30 ? how would you know which state to return ?
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 returns the canonical one (ie ancestor of the canonical chain from the node's point of view)
Will update the comment
Added replay function to compute state up to slot, this is really useful if one's interest to know the state at of a given slot. This functionality will also be used for both hot and cold mgmt. Also added tests to go with this