Skip to content

Commit

Permalink
cmd: rename TestConfig to addValidatorTestConfig
Browse files Browse the repository at this point in the history
This struct doesn't need to be exported, and is also only used in add-validator tests.
  • Loading branch information
gsora committed Jul 11, 2023
1 parent 1832a6e commit e4a0d49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions cmd/addvalidators.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
eth2v1 "github.com/attestantio/go-eth2-client/api/v1"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
k1 "github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/spf13/cobra"

"github.com/obolnetwork/charon/app/errors"
"github.com/obolnetwork/charon/app/k1util"
"github.com/obolnetwork/charon/app/log"
Expand All @@ -33,7 +35,6 @@ import (
"github.com/obolnetwork/charon/eth2util/registration"
"github.com/obolnetwork/charon/tbls"
"github.com/obolnetwork/charon/tbls/tblsconv"
"github.com/spf13/cobra"
)

// addValidatorsConfig is config for the `add-validators` command.
Expand All @@ -47,11 +48,11 @@ type addValidatorsConfig struct {
ManifestFile string // Path to the cluster manifest file
ClusterDir string // Path to the cluster directory

TestConfig TestConfig
TestConfig addValidatorTestConfig
}

// TestConfig defines additional test-only config.
type TestConfig struct {
// addValidatorTestConfig defines additional test-only config.
type addValidatorTestConfig struct {
// Lock provides the lock explicitly, skips loading from disk.
Lock *cluster.Lock
// Manifest provides the cluster manifest explicitly, skips loading from disk.
Expand Down Expand Up @@ -464,7 +465,7 @@ func genNewVals(numOps, threshold int, forkVersion []byte, conf addValidatorsCon
}

// getP2PKeys returns a list of p2p private keys either by loading from disk or from test config.
func getP2PKeys(clusterDir string, numOps int, testConfig TestConfig) ([]*k1.PrivateKey, error) {
func getP2PKeys(clusterDir string, numOps int, testConfig addValidatorTestConfig) ([]*k1.PrivateKey, error) {
if len(testConfig.P2PKeys) > 0 {
return testConfig.P2PKeys, nil
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/addvalidators_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func TestRunAddValidators(t *testing.T) {
NumVals: 1,
WithdrawalAddrs: []string{feeRecipientAddr},
FeeRecipientAddrs: []string{feeRecipientAddr},
TestConfig: TestConfig{
TestConfig: addValidatorTestConfig{
Lock: &lock,
P2PKeys: p2pKeys,
},
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestRunAddValidators(t *testing.T) {
NumVals: 1,
WithdrawalAddrs: []string{feeRecipientAddr},
FeeRecipientAddrs: []string{feeRecipientAddr},
TestConfig: TestConfig{
TestConfig: addValidatorTestConfig{
Lock: &lock,
P2PKeys: p2pKeys,
},
Expand Down

0 comments on commit e4a0d49

Please sign in to comment.