Skip to content

Commit

Permalink
Merge branch 'develop' into e2e-refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
farazdagi committed Mar 25, 2021
2 parents ec3fa52 + e56ab29 commit 20c49cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions endtoend/components/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,25 @@ import (
const depositGasLimit = 4000000

var _ e2etypes.ComponentRunner = (*ValidatorNode)(nil)
var _ e2etypes.ComponentRunner = (*ValidatorNodes)(nil)
var _ e2etypes.ComponentRunner = (*ValidatorNodeSet)(nil)

// ValidatorNodes represents set of validator nodes.
type ValidatorNodes struct {
// ValidatorNodeSet represents set of validator nodes.
type ValidatorNodeSet struct {
e2etypes.ComponentRunner
config *e2etypes.E2EConfig
started chan struct{}
}

// NewValidatorNodes creates and returns a set of validator nodes.
func NewValidatorNodes(config *e2etypes.E2EConfig) *ValidatorNodes {
return &ValidatorNodes{
// NewValidatorNodeSet creates and returns a set of validator nodes.
func NewValidatorNodeSet(config *e2etypes.E2EConfig) *ValidatorNodeSet {
return &ValidatorNodeSet{
config: config,
started: make(chan struct{}, 1),
}
}

// Start starts the configured amount of validators, also sending and mining their validator deposits.
// Should only be used on initialization.
func (s *ValidatorNodes) Start(ctx context.Context) error {
// Start starts the configured amount of validators, also sending and mining their deposits.
func (s *ValidatorNodeSet) Start(ctx context.Context) error {
// Always using genesis count since using anything else would be difficult to test for.
validatorNum := int(params.BeaconConfig().MinGenesisActiveValidatorCount)
beaconNodeNum := e2e.TestParams.BeaconNodeCount
Expand Down Expand Up @@ -91,7 +90,7 @@ func (s *ValidatorNodes) Start(ctx context.Context) error {
}

// Started checks whether validator node set is started and all nodes are ready to be queried.
func (s *ValidatorNodes) Started() <-chan struct{} {
func (s *ValidatorNodeSet) Started() <-chan struct{} {
return s.started
}

Expand All @@ -116,7 +115,7 @@ func NewValidatorNode(config *e2etypes.E2EConfig, validatorNum, index, offset in
}
}

// StartNewValidatorNode starts a validator client with the passed in configuration.
// StartNewValidatorNode starts a validator client.
func (v *ValidatorNode) Start(ctx context.Context) error {
binaryPath, found := bazel.FindBinary("cmd/validator", "validator")
if !found {
Expand Down
2 changes: 1 addition & 1 deletion endtoend/endtoend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (r *testRunner) run() {
})

// Validator nodes.
validatorNodes := components.NewValidatorNodes(config)
validatorNodes := components.NewValidatorNodeSet(config)
g.Go(func() error {
if err := helpers.ComponentsStarted(ctx, []e2etypes.ComponentRunner{beaconNodes}); err != nil {
return fmt.Errorf("validator nodes require beacon nodes to run: %w", err)
Expand Down

0 comments on commit 20c49cb

Please sign in to comment.