-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Replace validator wait for activation stream with polling #14514
Merged
Merged
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f0850bc
wip, waitForNextEpoch Broken
james-prysm 0e031d4
fixing wait for activation and timings
james-prysm e2396be
updating tests wip
james-prysm d877fe5
fixing tests
james-prysm 4f51abd
deprecating wait for activation stream
james-prysm 1dbc751
Merge branch 'develop' into remove-validator-wait-activation
james-prysm 1312a8e
removing duplicate test
james-prysm 85bac27
Update validator/client/wait_for_activation.go
james-prysm efb99f0
Update CHANGELOG.md
james-prysm 2356639
Update CHANGELOG.md
james-prysm 645e79f
Update validator/client/wait_for_activation.go
james-prysm 2a2df19
Merge branch 'develop' into remove-validator-wait-activation
james-prysm 5f6e9f5
moving seconds until next epoch start to slottime and adding unit test
james-prysm e513b87
removing seconds into slot buffer, will need to test
james-prysm 6819a82
Merge branch 'develop' into remove-validator-wait-activation
james-prysm bca707e
fixing waittime bug
james-prysm 6732cc4
adding pr to changelog
james-prysm 9aa2121
Update validator/client/wait_for_activation.go
james-prysm cbb4713
Update validator/client/wait_for_activation.go
james-prysm a678545
fixing incorect log
james-prysm 17e89c3
refactoring based on feedback
james-prysm d23faec
Merge branch 'develop' into remove-validator-wait-activation
james-prysm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import ( | |
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" | ||
mathutil "github.com/prysmaticlabs/prysm/v5/math" | ||
prysmTime "github.com/prysmaticlabs/prysm/v5/time" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
// MaxSlotBuffer specifies the max buffer given to slots from | ||
|
@@ -286,3 +287,27 @@ func WithinVotingWindow(genesisTime uint64, slot primitives.Slot) bool { | |
func MaxSafeEpoch() primitives.Epoch { | ||
return primitives.Epoch(math.MaxUint64 / uint64(params.BeaconConfig().SlotsPerEpoch)) | ||
} | ||
|
||
// SecondsUntilNextEpochStart returns how many seconds until the next Epoch start from the current time and slot | ||
func SecondsUntilNextEpochStart(genesisTimeSec uint64) (uint64, error) { | ||
currentSlot := CurrentSlot(genesisTimeSec) | ||
firstSlotOfNextEpoch, err := EpochStart(ToEpoch(currentSlot) + 1) | ||
if err != nil { | ||
return 0, err | ||
} | ||
nextEpochStartTime, err := ToTime(genesisTimeSec, firstSlotOfNextEpoch) | ||
if err != nil { | ||
return 0, err | ||
} | ||
es := nextEpochStartTime.Unix() | ||
n := time.Now().Unix() | ||
waitTime := uint64(es - n) | ||
log.WithFields(logrus.Fields{ | ||
"current_slot": currentSlot, | ||
"next_epoch_start_slot": firstSlotOfNextEpoch, | ||
"slots_until_next_start": firstSlotOfNextEpoch - currentSlot, | ||
"total_wait_time": waitTime, | ||
"is_epoch_start": IsEpochStart(currentSlot), | ||
}).Warn("Waiting until next epoch before re-checking validator statuses...") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This log does not belong here |
||
return waitTime, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Our convention is to use
camelCase
for log fields