-
Notifications
You must be signed in to change notification settings - Fork 917
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
[Feature] enable/disable validator accounts #7746
[Feature] enable/disable validator accounts #7746
Conversation
… and disable feature
validator/accounts/accounts.go
Outdated
) | ||
|
||
// AccountConfig specifies parameters to run to delete, enable, disable accounts. | ||
type AccountConfig struct { |
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.
This might be overkill.
Happy to create an ActivationAccountConfig if we want to keep each config distinct.
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.
This is OK, just concerned what the PublicKeys [][]byte are for, as it is not clear what to use them for. Could we specify DeletePublicKeys
and EnablePublicKeys
and DisablePublicKeys
? Better to repeat ourselves and be more explicit with these config structs
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.
Also rename to AccountsConfig
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.
Just to be clear @rauljordan, are you suggesting:
type AccountsConfig struct {
Wallet *wallet.Wallet
Keymanager keymanager.IKeymanager
DeletePublicKeys [][]byte
EnablePublicKeys [][]byte
DisablePublicKeys [][]byte
}
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.
Yep
@@ -0,0 +1,289 @@ | |||
package accounts |
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.
Let's rename this file to accounts_enable_disable.go to align with the other files in the package
validator/accounts/accounts.go
Outdated
) | ||
|
||
// AccountConfig specifies parameters to run to delete, enable, disable accounts. | ||
type AccountConfig struct { |
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.
This is OK, just concerned what the PublicKeys [][]byte are for, as it is not clear what to use them for. Could we specify DeletePublicKeys
and EnablePublicKeys
and DisablePublicKeys
? Better to repeat ourselves and be more explicit with these config structs
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func DisableAccountCli(cliCtx *cli.Context) 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.
func DisableAccountCli(cliCtx *cli.Context) error { | |
func DisableAccountsCli(cliCtx *cli.Context) error { |
validator/accounts/accounts.go
Outdated
) | ||
|
||
// AccountConfig specifies parameters to run to delete, enable, disable accounts. | ||
type AccountConfig struct { |
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.
Also rename to AccountsConfig
…lete distinct attributes
…counts list, backup and delete
…enable-disable-validator-keys
…bdarice/prysm into feature/enable-disable-validator-keys
…bdarice/prysm into feature/enable-disable-validator-keys
…enable-disable-validator-keys
@@ -111,6 +113,7 @@ func NewKeymanager(ctx context.Context, cfg *SetupConfig) (*Keymanager, error) { | |||
func NewInteropKeymanager(_ context.Context, offset, numValidatorKeys uint64) (*Keymanager, error) { | |||
k := &Keymanager{ | |||
accountsChangedFeed: new(event.Feed), | |||
opts: DefaultKeymanagerOpts(), |
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.
@rauljordan this was the fix for E2E
Codecov Report
@@ Coverage Diff @@
## master #7746 +/- ##
==========================================
- Coverage 62.09% 61.95% -0.15%
==========================================
Files 431 432 +1
Lines 30451 30683 +232
==========================================
+ Hits 18909 19010 +101
- Misses 8601 8707 +106
- Partials 2941 2966 +25 |
formattedPubKeys[i] = fmt.Sprintf("%#x", bytesutil.Trunc(pubKeyBytes)) | ||
} | ||
allAccountStr := strings.Join(formattedPubKeys, ", ") | ||
if !cliCtx.IsSet(flags.DisablePublicKeysFlag.Name) { |
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.
Is this correct?
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.
good catch.. strange, I did manually test with the flag too lol.
"github.com/urfave/cli/v2" | ||
) | ||
|
||
func DisableAccountsCli(cliCtx *cli.Context) 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.
Is Godoc happy with these exported functions w/o functional comments?
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.
Added docstring
What type of PR is this?
Feature
What does this PR do? Why is it needed?
This PR adds CLI commands to enable and disable accounts.
Disabled accounts won't be able to be used as validator credentials to attest to the network.
A user can re-enable previously disabled accounts making them valid again in the validator set.
This feature can facilitate moving validator keys from/to other clients or servers without having to use the current
delete
.CLI example
validator accounts enable --enable-public-keys=0xdeafbeef,0xdeadbeef2
validator accounts disable --disable-public-keys=0xdeafbeef,0xdeadbeef2
Which issues(s) does this PR fix?
Fixes #7485
Other notes for review
Manual Tests:
accounts list
still display all accountsaccounts delete
still display all accountsaccounts disable
only displays active accounts + will correctly disable accounts selectedaccounts enable
only displays disabled accounts + will correctly enable accounts selectedaccounts backup
still display all accountsaccounts enable --enable-public-keys
accounts disable --disable-public-keys
accounts disable
on a Medalla validators and making sure that it doesn't attest anymoreaccounts enable
on a Medalla validators and making sure that it will re-attest again/v2/validator/wallet
in WebUI