-
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
Substantial VC cleanup #13593
Substantial VC cleanup #13593
Conversation
@@ -62,7 +62,7 @@ func (b *BeaconCommitteeSelection) UnmarshalJSON(input []byte) error { | |||
return nil | |||
} | |||
|
|||
type ValidatorClient interface { | |||
type Coordinator interface { |
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'm not sold on the word coordinator
, to me coordinator would also define when these are called as well.
Most of these functions are actions for participating in consensus, what about ConsensusToolkit
or ConsensusAgent
or ConsensusOperator
or RoleOperator
/DutyOperator
- ( since the validator gets the duties first to perform the tasks in it.) there's probably some design pattern to enforce that the duties are up to date in the state to perform the actions inside.
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 reverted this change. We should probably split the interface into a few smaller interfaces, each responsible for its own this. Mixing GetDuties
with EventStreamIsRunning
doesn't feel right.
log.Info("Established secure gRPC connection") | ||
} | ||
s.beaconNodeHealthClient = ethpb.NewHealthClient(grpcConn) | ||
s.healthClient = ethpb.NewHealthClient(grpcConn) |
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.
we need a todo to get rid of this thing i think
# Conflicts: # validator/client/service.go # validator/client/validator.go # validator/rpc/server.go
genesisTime uint64 | ||
highestValidSlot primitives.Slot |
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.
why did we move some of these fields around? is it a linting issue?
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 moved fields so that they are grouped together by functionality
validator/rpc/handlers_keymanager.go
Outdated
@@ -414,7 +414,7 @@ func (s *Server) ListRemoteKeys(w http.ResponseWriter, r *http.Request) { | |||
for i := 0; i < len(pubKeys); i++ { | |||
keystoreResponse[i] = &RemoteKey{ | |||
Pubkey: hexutil.Encode(pubKeys[i][:]), | |||
Url: s.validatorService.Web3SignerConfig.BaseEndpoint, | |||
Url: s.validatorService.SignerConfig().BaseEndpoint, |
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.
maybe it makes more sense as RemoteSignerConfig()
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.
done
@@ -270,5 +240,5 @@ func (s *Server) Stop() error { | |||
|
|||
// Status returns nil or credentialError. | |||
func (s *Server) Status() error { | |||
return s.credentialError | |||
return nil |
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.
does this function do anything? lol is there a reason to keep it or at least add some log?
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 part of the Service
interface contract. It returns an error when something is wrong with the service. Which means that currently we always treat the service as healthy. If we want to add some logic here, it would be better to do it in another PR.
# Conflicts: # testing/validator-mock/chain_client_mock.go # testing/validator-mock/prysm_beacon_chain_client_mock.go # validator/client/attest_test.go # validator/client/beacon-api/beacon_api_validator_client.go # validator/client/beacon-api/duties_test.go # validator/client/propose_test.go # validator/client/service.go # validator/client/validator.go # validator/client/validator_test.go # validator/node/node.go # validator/rpc/auth_token.go # validator/rpc/beacon.go # validator/rpc/handlers_keymanager.go # validator/rpc/handlers_keymanager_test.go # validator/rpc/handlers_slashing.go # validator/rpc/handlers_slashing_test.go # validator/rpc/server.go
@@ -109,7 +110,7 @@ func NewServer(ctx context.Context, cfg *Config) *Server { | |||
if err := server.initializeAuthToken(); err != nil { | |||
log.WithError(err).Error("Could not initialize web auth token") | |||
} | |||
validatorWebAddr := fmt.Sprintf("%s:%d", server.validatorGatewayHost, server.validatorGatewayPort) | |||
validatorWebAddr := fmt.Sprintf("%s:%d", server.grpcGatewayHost, server.grpcGatewayPort) |
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.
we should look at changing this naming again in the future. we want to get rid of gateway asap
@@ -268,6 +240,11 @@ func (v *ValidatorService) Keymanager() (keymanager.IKeymanager, error) { | |||
return v.validator.Keymanager() | |||
} | |||
|
|||
// RemoteSignerConfig returns the web3signer configuration | |||
func (v *ValidatorService) RemoteSignerConfig() *remoteweb3signer.SetupConfig { | |||
return v.web3SignerConfig |
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.
should we change this name too?
* Cleanup part 1 * Cleanup part 2 * Cleanup part 3 * remove lock field init * doc for SignerConfig * remove vars * use full Keymanager word in function * revert interface rename * linter * fix build issues * review (cherry picked from commit 30cc23c)
What type of PR is this?
Cleanup
What does this PR do? Why is it needed?
Certain parts of the validator client's code have not been for a long time. The code is messy, non-elegant and oftentimes hard to update. This PR is the first one in a series of PRs that aim to improve the overall code quality of the module.
Changes overview:
RenamedValidatorClient
interface toCoordinator
. Given thatValidator Client
is the name for the whole component of Prysm, it is confusing that the interface has the same name. The main reason for choosing this particular name is that functions defined on this interface define the behavior of the VC and actions performed on managed keys.Beacon
part fromBeaconChainClient
andPrysmBeaconChainClient
because it's obvious we mean the beacon chain, not some other chain.SyncChecker
andGenesisFetcher
interfaces and their implementations.