-
Notifications
You must be signed in to change notification settings - Fork 83
Register in Random Beacon's Sortition Pool #3028
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
Changes from all commits
0bc5fa4
d982bc9
04f8647
dd64f26
69fcec0
5663c57
5942634
499eeb3
ac63879
ca98c08
cf474f0
d31e60a
cdb3d50
11a11da
a54b292
1c3fed3
7b9f648
4b35103
6ff3779
a2850e3
242a8f1
476b87e
4997b6e
d81b89e
0894f40
6c0ec08
f21af30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,8 @@ import ( | |
| "github.com/keep-network/keep-core/pkg/net/retransmission" | ||
| "github.com/keep-network/keep-core/pkg/operator" | ||
| "github.com/urfave/cli" | ||
|
|
||
| beaconChain "github.com/keep-network/keep-core/pkg/chain/random-beacon" | ||
| ) | ||
|
|
||
| // StartCommand contains the definition of the start command-line subcommand. | ||
|
|
@@ -90,6 +92,11 @@ func Start(c *cli.Context) error { | |
| return fmt.Errorf("error connecting to Ethereum node: [%v]", err) | ||
| } | ||
|
|
||
| beaconChainHandle, err := beaconChain.Connect(chainProvider) | ||
| if err != nil { | ||
| return fmt.Errorf("error initializing ethereum chain handle for Beacon: [%w]", err) | ||
| } | ||
|
|
||
| blockCounter, err := chainProvider.BlockCounter() | ||
| if err != nil { | ||
| return err | ||
|
|
@@ -99,26 +106,27 @@ func Start(c *cli.Context) error { | |
| if err != nil { | ||
| return fmt.Errorf("error obtaining stake monitor handle [%v]", err) | ||
| } | ||
| if c.Int(waitForStakeFlag) != 0 { | ||
| err = waitForStake(stakeMonitor, ethereumKey.Address.Hex(), c.Int(waitForStakeFlag)) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| } | ||
| hasMinimumStake, err := stakeMonitor.HasMinimumStake( | ||
| ethereumKey.Address.Hex(), | ||
| ) | ||
| if err != nil { | ||
| return fmt.Errorf("could not check the stake [%v]", err) | ||
| } | ||
| if !hasMinimumStake { | ||
| return fmt.Errorf( | ||
| "no minimum KEEP stake or operator is not authorized to use it; " + | ||
| "please make sure the operator address in the configuration " + | ||
| "is correct and it has KEEP tokens delegated and the operator " + | ||
| "contract has been authorized to operate on the stake", | ||
| ) | ||
| } | ||
| // FIXME: Update for V2 | ||
| // if c.Int(waitForStakeFlag) != 0 { | ||
| // err = waitForStake(stakeMonitor, ethereumKey.Address.Hex(), c.Int(waitForStakeFlag)) | ||
| // if err != nil { | ||
| // return err | ||
| // } | ||
| // } | ||
| // hasMinimumStake, err := stakeMonitor.HasMinimumStake( | ||
| // ethereumKey.Address.Hex(), | ||
| // ) | ||
| // if err != nil { | ||
| // return fmt.Errorf("could not check the stake [%v]", err) | ||
| // } | ||
| // if !hasMinimumStake { | ||
| // return fmt.Errorf( | ||
| // "no minimum KEEP stake or operator is not authorized to use it; " + | ||
| // "please make sure the operator address in the configuration " + | ||
| // "is correct and it has KEEP tokens delegated and the operator " + | ||
| // "contract has been authorized to operate on the stake", | ||
| // ) | ||
| // } | ||
|
|
||
| networkPrivateKey, _ := key.OperatorKeyToNetworkKey( | ||
| operator.ChainKeyToOperatorKey(ethereumKey), | ||
|
|
@@ -152,6 +160,7 @@ func Start(c *cli.Context) error { | |
| chainProvider, | ||
| netProvider, | ||
| persistence, | ||
| beaconChainHandle, | ||
|
Member
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. Instead of passing it as a separate parameter, I would replace |
||
| ) | ||
| if err != nil { | ||
| return fmt.Errorf("error initializing beacon: [%v]", err) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| This directory contains legacy code from V1. It should be removed. | ||
| This directory contains legacy code from V1. It should be moved to fit the new directories structure. | ||
|
Member
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. I would clear up this directory and remove everything that is not needed for v2, assuming there is a way to make the compilation pass. |
||
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.
I think we should remove it. It is hard to say what we should wait for here - stake, authorization, or maybe staking provider<>operator mapping?