Refactor Exported Names to Follow Golang Best Practices (#13075)

* Fix exported names that start with a package name

* A few more renames

* Fix exported names that start with a package name

* A few more renames

* Radek's feedback

* Fix conflict

* fix keymanager test

* Fix comments

---------

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
terencechain
2023-10-20 09:45:33 -07:00
committed by GitHub
parent 65ce27292c
commit 9387a36b66
146 changed files with 1625 additions and 1625 deletions

View File

@@ -23,7 +23,7 @@ func init() {
transition.SkipSlotCache.Disable()
}
type ForkConfig struct {
type Config struct {
PostFork string `json:"post_fork"`
ForkEpoch int `json:"fork_epoch"`
ForkBlock *int `json:"fork_block"`
@@ -44,7 +44,7 @@ func RunForkTransitionTest(t *testing.T, config string) {
helpers.ClearCache()
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
require.NoError(t, err)
config := &ForkConfig{}
config := &Config{}
require.NoError(t, utils.UnmarshalYaml(file, config), "Failed to Unmarshal")
preforkBlocks := make([]*ethpb.SignedBeaconBlock, 0)

View File

@@ -50,7 +50,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) {
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
require.NoError(t, err)
metaYaml := &SanityConfig{}
metaYaml := &Config{}
require.NoError(t, utils.UnmarshalYaml(file, metaYaml), "Failed to Unmarshal")
var transitionError error

View File

@@ -1,6 +1,6 @@
package sanity
// SanityConfig --
type SanityConfig struct {
// Config --
type Config struct {
BlocksCount int `json:"blocks_count"`
}

View File

@@ -18,7 +18,7 @@ import (
"github.com/prysmaticlabs/prysm/v4/testing/util"
)
type ForkConfig struct {
type Config struct {
PostFork string `json:"post_fork"`
ForkEpoch int `json:"fork_epoch"`
ForkBlock *int `json:"fork_block"`
@@ -39,7 +39,7 @@ func RunForkTransitionTest(t *testing.T, config string) {
helpers.ClearCache()
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
require.NoError(t, err)
config := &ForkConfig{}
config := &Config{}
require.NoError(t, utils.UnmarshalYaml(file, config), "Failed to Unmarshal")
preforkBlocks := make([]*ethpb.SignedBeaconBlockAltair, 0)

View File

@@ -50,7 +50,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) {
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
require.NoError(t, err)
metaYaml := &SanityConfig{}
metaYaml := &Config{}
require.NoError(t, utils.UnmarshalYaml(file, metaYaml), "Failed to Unmarshal")
var transitionError error

View File

@@ -1,6 +1,6 @@
package sanity
// SanityConfig --
type SanityConfig struct {
// Config --
type Config struct {
BlocksCount int `json:"blocks_count"`
}

View File

@@ -18,7 +18,7 @@ import (
"github.com/prysmaticlabs/prysm/v4/testing/util"
)
type ForkConfig struct {
type Config struct {
PostFork string `json:"post_fork"`
ForkEpoch int `json:"fork_epoch"`
ForkBlock *int `json:"fork_block"`
@@ -39,7 +39,7 @@ func RunForkTransitionTest(t *testing.T, config string) {
helpers.ClearCache()
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
require.NoError(t, err)
config := &ForkConfig{}
config := &Config{}
require.NoError(t, utils.UnmarshalYaml(file, config), "Failed to Unmarshal")
preforkBlocks := make([]*ethpb.SignedBeaconBlockBellatrix, 0)

View File

@@ -50,7 +50,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) {
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
require.NoError(t, err)
metaYaml := &SanityConfig{}
metaYaml := &Config{}
require.NoError(t, utils.UnmarshalYaml(file, metaYaml), "Failed to Unmarshal")
var transitionError error

View File

@@ -1,6 +1,6 @@
package sanity
// SanityConfig --
type SanityConfig struct {
// Config --
type Config struct {
BlocksCount int `json:"blocks_count"`
}

View File

@@ -18,7 +18,7 @@ import (
"github.com/prysmaticlabs/prysm/v4/testing/util"
)
type ForkConfig struct {
type Config struct {
PostFork string `json:"post_fork"`
ForkEpoch int `json:"fork_epoch"`
ForkBlock *int `json:"fork_block"`
@@ -36,7 +36,7 @@ func RunForkTransitionTest(t *testing.T, config string) {
helpers.ClearCache()
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
require.NoError(t, err)
config := &ForkConfig{}
config := &Config{}
require.NoError(t, utils.UnmarshalYaml(file, config), "Failed to Unmarshal")
preforkBlocks := make([]*ethpb.SignedBeaconBlockCapella, 0)

View File

@@ -46,7 +46,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) {
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
require.NoError(t, err)
metaYaml := &SanityConfig{}
metaYaml := &Config{}
require.NoError(t, utils.UnmarshalYaml(file, metaYaml), "Failed to Unmarshal")
var transitionError error

View File

@@ -1,6 +1,6 @@
package sanity
// SanityConfig --
type SanityConfig struct {
// Config --
type Config struct {
BlocksCount int `json:"blocks_count"`
}

View File

@@ -50,7 +50,7 @@ func RunBlockProcessingTest(t *testing.T, config, folderPath string) {
file, err := util.BazelFileBytes(testsFolderPath, folder.Name(), "meta.yaml")
require.NoError(t, err)
metaYaml := &SanityConfig{}
metaYaml := &Config{}
require.NoError(t, utils.UnmarshalYaml(file, metaYaml), "Failed to Unmarshal")
var transitionError error

View File

@@ -1,6 +1,6 @@
package sanity
// SanityConfig --
type SanityConfig struct {
// Config --
type Config struct {
BlocksCount int `json:"blocks_count"`
}

View File

@@ -29,7 +29,7 @@ func RunShuffleTests(t *testing.T, config string) {
testCaseFile, err := util.BazelFileBytes(path.Join(testsFolderPath, folder.Name(), "mapping.yaml"))
require.NoError(t, err, "Could not read YAML tests directory")
testCase := &ShuffleTestCase{}
testCase := &TestCase{}
require.NoError(t, yaml.Unmarshal(testCaseFile, testCase), "Could not unmarshal YAML file into test struct")
require.NoError(t, runShuffleTest(t, testCase), "Shuffle test failed")
})
@@ -38,7 +38,7 @@ func RunShuffleTests(t *testing.T, config string) {
// RunShuffleTest uses validator set specified from a YAML file, runs the validator shuffle
// algorithm, then compare the output with the expected output from the YAML file.
func runShuffleTest(t *testing.T, testCase *ShuffleTestCase) error {
func runShuffleTest(t *testing.T, testCase *TestCase) error {
baseSeed, err := hex.DecodeString(testCase.Seed[2:])
if err != nil {
return err

View File

@@ -2,8 +2,8 @@ package shuffle
import "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
// ShuffleTestCase --
type ShuffleTestCase struct {
// TestCase --
type TestCase struct {
Seed string `yaml:"seed"`
Count uint64 `yaml:"count"`
Mapping []primitives.ValidatorIndex `yaml:"mapping"`