Monitor Random Beacon sortition pool status: join pool and update pool#3077
Merged
Conversation
This was referenced Jul 8, 2022
Moved `local.go` to `sortition/internal/local` to keep it in a separate package from `sortition`. `connectLocal` renamed to `Connect`, `registerOperator` and `setEligibleStake` are now exported.
MonitorPool periodically checks the status of the operator in the sortition pool. If the operator is supposed to be in the sortition pool but is not there yet, the function attempts to add the operator to the pool. If the operator is already in the pool and its status is no longer up to date, the function attempts to update the operator's status in the pool.
Simplified if/else condition in IsOperatorUpToDate. The behavior is the same as before.
Two errors were not handled properly: one from JoinSortitionPool and another from UpdateOperatorStatus. Now, they are handled just by logging them. The operation will be retried on the next monitoring loop pass.
The new file name clearly indicates what is inside of the file.
The client monitors the sortition pool status now. There is a complication with ethereum chain - the v2 implementation does not support v1 ethereum chain functions and the v1 implementation does not support v2 functions. For now, both instances are passed. In the future, we will decide if we want to port features to v2 gradually or cut the entire v1 chain in one move altogether. Note that from now on, `RandomBeacon` contract address must be specified in the config file. Old contract addresses still need to be there but the values do not matter.
Member
Author
|
All changes pushed, I am undrafting this PR @lukasz-zimnoch |
It makes sense to make the Chain structure exported because the exported Connect function returns it anyway.
This makes more sense given we have `ethereum_v1` package. We will also avoid conflicts in the set of next PRs.
In the previous commit, we renamed `legacyChainProvider` to `chainProviderV1` so `beaconChainV1` makes more sense. This will also allow us avoid conflicts in the next PRs.
dimpar
reviewed
Jul 11, 2022
|
|
||
| if isOperatorUpToDate { | ||
| if isOperatorInPool { | ||
| logger.Infof("sortition pool operator status is up to date") |
Contributor
There was a problem hiding this comment.
I think we can use just logger.Info, not logger.Infof cause there's nothing to format here. Same comment for other places like this in this file.
Member
Author
There was a problem hiding this comment.
Yeah, good point. Let's fix it when working on #3008.
lukasz-zimnoch
approved these changes
Jul 11, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Depends on #3070Closes #3006
Closes #3007
MonitorPoolperiodically checks the status of the operator in the sortition pool. If the operator is supposed to be in the sortition pool but is not there yet, the function attempts to add the operator to the pool. If the operator is already in the pool and its status is no longer up to date, the function attempts to update the operator's status in the pool.There was a complication with
ethereumchain - the v2 implementation does not support v1ethereumchain functions and the v1 implementation does not support v2 functions. For now, both instances are passed when creating aNode. In the future, we will decide if we want to port features to v2 gradually or cut the entire v1 chain in one move altogether.