mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Use Custom Type ValidatorIndex Across Prysm (#8478)
* Use ValidtorIndex across Prysm. Build ok * First take at fixing tests * Clean up e2e, fuzz... etc * Fix new lines * Update beacon-chain/cache/proposer_indices_test.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update beacon-chain/core/helpers/rewards_penalties.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update beacon-chain/core/helpers/shuffle.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update validator/graffiti/parse_graffiti_test.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Raul's feedback * Fix downcast int -> uint64 * Victor's feedback Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -6,12 +6,18 @@ go_library(
|
||||
srcs = ["parse_graffiti.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/validator/graffiti",
|
||||
visibility = ["//validator:__subpackages__"],
|
||||
deps = ["@in_gopkg_yaml_v2//:go_default_library"],
|
||||
deps = [
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
"@in_gopkg_yaml_v2//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["parse_graffiti_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = ["//shared/testutil/require:go_default_library"],
|
||||
deps = [
|
||||
"//shared/testutil/require:go_default_library",
|
||||
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -3,13 +3,14 @@ package graffiti
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
type Graffiti struct {
|
||||
Default string `yaml:"default,omitempty"`
|
||||
Random []string `yaml:"random,omitempty"`
|
||||
Specific map[uint64]string `yaml:"specific,omitempty"`
|
||||
Default string `yaml:"default,omitempty"`
|
||||
Random []string `yaml:"random,omitempty"`
|
||||
Specific map[types.ValidatorIndex]string `yaml:"specific,omitempty"`
|
||||
}
|
||||
|
||||
// ParseGraffitiFile parses the graffiti file and returns the graffiti struct.
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
)
|
||||
|
||||
@@ -69,7 +70,7 @@ specific:
|
||||
require.NoError(t, err)
|
||||
|
||||
wanted := &Graffiti{
|
||||
Specific: map[uint64]string{
|
||||
Specific: map[types.ValidatorIndex]string{
|
||||
1234: "Yolo",
|
||||
555: "What's up",
|
||||
703727: "Meow",
|
||||
@@ -107,7 +108,7 @@ specific:
|
||||
"Mr B was here",
|
||||
"Mr C was here",
|
||||
},
|
||||
Specific: map[uint64]string{
|
||||
Specific: map[types.ValidatorIndex]string{
|
||||
1234: "Yolo",
|
||||
555: "What's up",
|
||||
703727: "Meow",
|
||||
|
||||
Reference in New Issue
Block a user