Skip to content

Conversation

@pdyraga
Copy link
Member

@pdyraga pdyraga commented Jul 8, 2022

Depends on #3070

Closes #3006
Closes #3007

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.

There was 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 when creating a Node. 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.

@pdyraga pdyraga self-assigned this Jul 8, 2022
@pdyraga pdyraga requested a review from a team July 8, 2022 11:19
@pdyraga pdyraga added this to the v2.0.0-m1 milestone Jul 8, 2022
Base automatically changed from sortition to main July 8, 2022 12:57
pdyraga added 6 commits July 8, 2022 15:22
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.
pdyraga added 4 commits July 8, 2022 15:28
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.
@pdyraga pdyraga marked this pull request as ready for review July 8, 2022 14:30
@pdyraga
Copy link
Member Author

pdyraga commented Jul 8, 2022

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.
pdyraga added 2 commits July 11, 2022 10:09
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.

if isOperatorUpToDate {
if isOperatorInPool {
logger.Infof("sortition pool operator status is up to date")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good point. Let's fix it when working on #3008.

@lukasz-zimnoch lukasz-zimnoch merged commit 1a26e7c into main Jul 11, 2022
@lukasz-zimnoch lukasz-zimnoch deleted the sortition-2 branch July 11, 2022 09:05
@pdyraga pdyraga modified the milestones: v2.0.0-m0, v2.0.0-m4 Sep 30, 2022
@pdyraga pdyraga removed their assignment Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Random Beacon sortition pool state Register in Random Beacon sortition pool

3 participants