From ca4a601536f4bd717ce680088f1922608face91a Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 09:18:38 -0600 Subject: [PATCH 01/11] validator cmd --- cmd/validator/BUILD.bazel | 138 +++++++++++++++++ .../validator}/flags/BUILD.bazel | 7 +- {validator => cmd/validator}/flags/flags.go | 3 +- {validator => cmd/validator}/flags/interop.go | 0 {validator => cmd/validator}/log.go | 0 {validator => cmd/validator}/main.go | 2 +- {validator => cmd/validator}/usage.go | 2 +- {validator => cmd/validator}/usage_test.go | 0 validator/BUILD.bazel | 140 +----------------- validator/accounts/BUILD.bazel | 5 +- validator/accounts/accounts_backup.go | 5 +- validator/accounts/accounts_delete.go | 5 +- validator/accounts/accounts_enable_disable.go | 5 +- validator/accounts/accounts_exit.go | 7 +- validator/accounts/accounts_import.go | 7 +- validator/accounts/accounts_list.go | 5 +- validator/accounts/cmd_accounts.go | 5 +- validator/accounts/cmd_wallet.go | 5 +- validator/accounts/prompt/BUILD.bazel | 2 +- validator/accounts/prompt/prompt.go | 5 +- validator/accounts/wallet/BUILD.bazel | 2 +- validator/accounts/wallet/wallet.go | 7 +- validator/accounts/wallet_create.go | 5 +- validator/accounts/wallet_create_test.go | 9 +- validator/accounts/wallet_edit_test.go | 5 +- validator/accounts/wallet_recover.go | 9 +- validator/accounts/wallet_recover_test.go | 5 +- validator/db/BUILD.bazel | 5 +- validator/node/BUILD.bazel | 9 +- validator/node/node.go | 2 +- validator/node/node_test.go | 7 +- validator/rpc/BUILD.bazel | 2 +- validator/rpc/accounts_test.go | 2 +- validator/slashing-protection/BUILD.bazel | 9 +- validator/slashing-protection/cli_export.go | 5 +- validator/slashing-protection/cli_import.go | 5 +- .../cli_import_export_test.go | 5 +- validator/slashing-protection/cmd.go | 5 +- 38 files changed, 243 insertions(+), 203 deletions(-) create mode 100644 cmd/validator/BUILD.bazel rename {validator => cmd/validator}/flags/BUILD.bazel (61%) rename {validator => cmd/validator}/flags/flags.go (99%) rename {validator => cmd/validator}/flags/interop.go (100%) rename {validator => cmd/validator}/log.go (100%) rename {validator => cmd/validator}/main.go (98%) rename {validator => cmd/validator}/usage.go (98%) rename {validator => cmd/validator}/usage_test.go (100%) diff --git a/cmd/validator/BUILD.bazel b/cmd/validator/BUILD.bazel new file mode 100644 index 000000000000..3e49c7b17e90 --- /dev/null +++ b/cmd/validator/BUILD.bazel @@ -0,0 +1,138 @@ +load("@prysm//tools/go:def.bzl", "go_library") +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_test") +load("@io_bazel_rules_docker//go:image.bzl", "go_image") +load("@io_bazel_rules_docker//container:container.bzl", "container_bundle", "container_image") +load("//tools:go_image.bzl", "go_image_alpine", "go_image_debug") +load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push") + +go_library( + name = "go_default_library", + srcs = [ + "log.go", + "main.go", + "usage.go", + ], + importpath = "github.com/prysmaticlabs/prysm/cmd/validator", + visibility = ["//validator:__subpackages__"], + deps = [ + "//cmd/validator/flags:go_default_library", + "//shared/cmd:go_default_library", + "//shared/debug:go_default_library", + "//shared/featureconfig:go_default_library", + "//shared/fileutil:go_default_library", + "//shared/journald:go_default_library", + "//shared/logutil:go_default_library", + "//shared/maxprocs:go_default_library", + "//shared/tos:go_default_library", + "//shared/version:go_default_library", + "//validator/accounts:go_default_library", + "//validator/db:go_default_library", + "//validator/node:go_default_library", + "//validator/slashing-protection:go_default_library", + "@com_github_joonix_log//:go_default_library", + "@com_github_sirupsen_logrus//:go_default_library", + "@com_github_urfave_cli_v2//:go_default_library", + "@com_github_x_cray_logrus_prefixed_formatter//:go_default_library", + ], +) + +go_image( + name = "image", + base = select({ + "//tools:base_image_alpine": "//tools:alpine_cc_image", + "//tools:base_image_cc": "//tools:cc_image", + "//conditions:default": "//tools:cc_image", + }), + binary = ":validator", + tags = ["manual"], + visibility = ["//visibility:private"], +) + +container_image( + name = "image_with_creation_time", + base = "image", + stamp = True, +) + +container_bundle( + name = "image_bundle", + images = { + "gcr.io/prysmaticlabs/prysm/validator:latest": ":image_with_creation_time", + "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}": ":image_with_creation_time", + "index.docker.io/prysmaticlabs/prysm-validator:latest": ":image_with_creation_time", + "index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}": ":image_with_creation_time", + }, + tags = ["manual"], +) + +go_image_debug( + name = "image_debug", + image = ":image", + tags = ["manual"], +) + +container_bundle( + name = "image_bundle_debug", + images = { + "gcr.io/prysmaticlabs/prysm/validator:latest-debug": ":image_debug", + "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}-debug": ":image_debug", + "index.docker.io/prysmaticlabs/prysm-validator:latest-debug": ":image_debug", + "index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}-debug": ":image_debug", + }, + tags = ["manual"], +) + +go_image_alpine( + name = "image_alpine", + image = ":image", + tags = ["manual"], +) + +container_bundle( + name = "image_bundle_alpine", + images = { + "gcr.io/prysmaticlabs/prysm/validator:latest-alpine": ":image_alpine", + "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}-alpine": ":image_alpine", + "index.docker.io/prysmaticlabs/prysm-validator:latest-alpine": ":image_alpine", + "index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}-alpine": ":image_alpine", + }, + tags = ["manual"], +) + +docker_push( + name = "push_images", + bundle = ":image_bundle", + tags = ["manual"], +) + +docker_push( + name = "push_images_debug", + bundle = ":image_bundle_debug", + tags = ["manual"], +) + +docker_push( + name = "push_images_alpine", + bundle = ":image_bundle_alpine", + tags = ["manual"], +) + +go_binary( + name = "validator", + embed = [":go_default_library"], + pure = "off", # Enabled unless there is a valid reason to include cgo dep. + visibility = [ + "//endtoend:__pkg__", + "//validator:__subpackages__", + ], +) + +go_test( + name = "go_default_test", + srcs = ["usage_test.go"], + embed = [":go_default_library"], + deps = [ + "//shared/featureconfig:go_default_library", + "@com_github_urfave_cli_v2//:go_default_library", + ], +) diff --git a/validator/flags/BUILD.bazel b/cmd/validator/flags/BUILD.bazel similarity index 61% rename from validator/flags/BUILD.bazel rename to cmd/validator/flags/BUILD.bazel index a90fc38c3e69..ce702f4a8e44 100644 --- a/validator/flags/BUILD.bazel +++ b/cmd/validator/flags/BUILD.bazel @@ -6,8 +6,11 @@ go_library( "flags.go", "interop.go", ], - importpath = "github.com/prysmaticlabs/prysm/validator/flags", - visibility = ["//validator:__subpackages__"], + importpath = "github.com/prysmaticlabs/prysm/cmd/validator/flags", + visibility = [ + "//cmd/validator:__subpackages__", + "//validator:__subpackages__", + ], deps = [ "//shared/fileutil:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", diff --git a/validator/flags/flags.go b/cmd/validator/flags/flags.go similarity index 99% rename from validator/flags/flags.go rename to cmd/validator/flags/flags.go index 544f1b3c6adb..0dd35a064fc0 100644 --- a/validator/flags/flags.go +++ b/cmd/validator/flags/flags.go @@ -7,8 +7,9 @@ import ( "runtime" "time" - "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/shared/fileutil" ) const ( diff --git a/validator/flags/interop.go b/cmd/validator/flags/interop.go similarity index 100% rename from validator/flags/interop.go rename to cmd/validator/flags/interop.go diff --git a/validator/log.go b/cmd/validator/log.go similarity index 100% rename from validator/log.go rename to cmd/validator/log.go diff --git a/validator/main.go b/cmd/validator/main.go similarity index 98% rename from validator/main.go rename to cmd/validator/main.go index d3d7f1aa1ab1..573b35806c73 100644 --- a/validator/main.go +++ b/cmd/validator/main.go @@ -11,6 +11,7 @@ import ( runtimeDebug "runtime/debug" joonix "github.com/joonix/log" + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/debug" "github.com/prysmaticlabs/prysm/shared/featureconfig" @@ -22,7 +23,6 @@ import ( "github.com/prysmaticlabs/prysm/shared/version" "github.com/prysmaticlabs/prysm/validator/accounts" "github.com/prysmaticlabs/prysm/validator/db" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/node" slashingprotection "github.com/prysmaticlabs/prysm/validator/slashing-protection" "github.com/sirupsen/logrus" diff --git a/validator/usage.go b/cmd/validator/usage.go similarity index 98% rename from validator/usage.go rename to cmd/validator/usage.go index a228118330fa..85050444b155 100644 --- a/validator/usage.go +++ b/cmd/validator/usage.go @@ -5,10 +5,10 @@ import ( "io" "sort" + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/debug" "github.com/prysmaticlabs/prysm/shared/featureconfig" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/urfave/cli/v2" ) diff --git a/validator/usage_test.go b/cmd/validator/usage_test.go similarity index 100% rename from validator/usage_test.go rename to cmd/validator/usage_test.go diff --git a/validator/BUILD.bazel b/validator/BUILD.bazel index 319f71ed06b2..1732df97c7b6 100644 --- a/validator/BUILD.bazel +++ b/validator/BUILD.bazel @@ -1,138 +1,6 @@ -load("@prysm//tools/go:def.bzl", "go_library") -load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_test") -load("@io_bazel_rules_docker//go:image.bzl", "go_image") -load("@io_bazel_rules_docker//container:container.bzl", "container_bundle", "container_image") -load("//tools:go_image.bzl", "go_image_alpine", "go_image_debug") -load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push") - -go_library( - name = "go_default_library", - srcs = [ - "log.go", - "main.go", - "usage.go", - ], - importpath = "github.com/prysmaticlabs/prysm/validator", - visibility = ["//validator:__subpackages__"], - deps = [ - "//shared/cmd:go_default_library", - "//shared/debug:go_default_library", - "//shared/featureconfig:go_default_library", - "//shared/fileutil:go_default_library", - "//shared/journald:go_default_library", - "//shared/logutil:go_default_library", - "//shared/maxprocs:go_default_library", - "//shared/tos:go_default_library", - "//shared/version:go_default_library", - "//validator/accounts:go_default_library", - "//validator/db:go_default_library", - "//validator/flags:go_default_library", - "//validator/node:go_default_library", - "//validator/slashing-protection:go_default_library", - "@com_github_joonix_log//:go_default_library", - "@com_github_sirupsen_logrus//:go_default_library", - "@com_github_urfave_cli_v2//:go_default_library", - "@com_github_x_cray_logrus_prefixed_formatter//:go_default_library", - ], -) - -go_image( - name = "image", - base = select({ - "//tools:base_image_alpine": "//tools:alpine_cc_image", - "//tools:base_image_cc": "//tools:cc_image", - "//conditions:default": "//tools:cc_image", - }), - binary = ":validator", - tags = ["manual"], - visibility = ["//visibility:private"], -) - -container_image( - name = "image_with_creation_time", - base = "image", - stamp = True, -) - -container_bundle( - name = "image_bundle", - images = { - "gcr.io/prysmaticlabs/prysm/validator:latest": ":image_with_creation_time", - "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}": ":image_with_creation_time", - "index.docker.io/prysmaticlabs/prysm-validator:latest": ":image_with_creation_time", - "index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}": ":image_with_creation_time", - }, - tags = ["manual"], -) - -go_image_debug( - name = "image_debug", - image = ":image", - tags = ["manual"], -) - -container_bundle( - name = "image_bundle_debug", - images = { - "gcr.io/prysmaticlabs/prysm/validator:latest-debug": ":image_debug", - "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}-debug": ":image_debug", - "index.docker.io/prysmaticlabs/prysm-validator:latest-debug": ":image_debug", - "index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}-debug": ":image_debug", - }, - tags = ["manual"], -) - -go_image_alpine( - name = "image_alpine", - image = ":image", - tags = ["manual"], -) - -container_bundle( - name = "image_bundle_alpine", - images = { - "gcr.io/prysmaticlabs/prysm/validator:latest-alpine": ":image_alpine", - "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}-alpine": ":image_alpine", - "index.docker.io/prysmaticlabs/prysm-validator:latest-alpine": ":image_alpine", - "index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}-alpine": ":image_alpine", - }, - tags = ["manual"], -) - -docker_push( - name = "push_images", - bundle = ":image_bundle", - tags = ["manual"], -) - -docker_push( - name = "push_images_debug", - bundle = ":image_bundle_debug", - tags = ["manual"], -) - -docker_push( - name = "push_images_alpine", - bundle = ":image_bundle_alpine", - tags = ["manual"], -) - -go_binary( +# validator/BUILD.bazel +alias( name = "validator", - embed = [":go_default_library"], - pure = "off", # Enabled unless there is a valid reason to include cgo dep. - visibility = [ - "//endtoend:__pkg__", - "//validator:__subpackages__", - ], -) - -go_test( - name = "go_default_test", - srcs = ["usage_test.go"], - embed = [":go_default_library"], - deps = [ - "//shared/featureconfig:go_default_library", - "@com_github_urfave_cli_v2//:go_default_library", - ], + actual = "//cmd/validator:validator", + deprecation = "This target has moved to cmd/validator", ) diff --git a/validator/accounts/BUILD.bazel b/validator/accounts/BUILD.bazel index 2bba3236e058..e1ba0b611cd0 100644 --- a/validator/accounts/BUILD.bazel +++ b/validator/accounts/BUILD.bazel @@ -22,11 +22,13 @@ go_library( ], importpath = "github.com/prysmaticlabs/prysm/validator/accounts", visibility = [ + "//cmd/validator:__subpackages__", "//validator:__pkg__", "//validator:__subpackages__", ], deps = [ "//beacon-chain/core/blocks:go_default_library", + "//cmd/validator/flags:go_default_library", "//shared/bls:go_default_library", "//shared/bytesutil:go_default_library", "//shared/cmd:go_default_library", @@ -41,7 +43,6 @@ go_library( "//validator/accounts/prompt:go_default_library", "//validator/accounts/wallet:go_default_library", "//validator/client:go_default_library", - "//validator/flags:go_default_library", "//validator/keymanager:go_default_library", "//validator/keymanager/derived:go_default_library", "//validator/keymanager/imported:go_default_library", @@ -76,6 +77,7 @@ go_test( ], embed = [":go_default_library"], deps = [ + "//cmd/validator/flags:go_default_library", "//proto/validator/accounts/v2:go_default_library", "//shared/bls:go_default_library", "//shared/bytesutil:go_default_library", @@ -89,7 +91,6 @@ go_test( "//shared/timeutils:go_default_library", "//validator/accounts/iface:go_default_library", "//validator/accounts/wallet:go_default_library", - "//validator/flags:go_default_library", "//validator/keymanager:go_default_library", "//validator/keymanager/derived:go_default_library", "//validator/keymanager/imported:go_default_library", diff --git a/validator/accounts/accounts_backup.go b/validator/accounts/accounts_backup.go index b15f52cf36fb..ee96f60aff50 100644 --- a/validator/accounts/accounts_backup.go +++ b/validator/accounts/accounts_backup.go @@ -12,6 +12,9 @@ import ( "github.com/logrusorgru/aurora" "github.com/manifoldco/promptui" "github.com/pkg/errors" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/fileutil" @@ -20,11 +23,9 @@ import ( "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" - "github.com/urfave/cli/v2" ) var ( diff --git a/validator/accounts/accounts_delete.go b/validator/accounts/accounts_delete.go index 639d6db50040..d14b61792380 100644 --- a/validator/accounts/accounts_delete.go +++ b/validator/accounts/accounts_delete.go @@ -7,16 +7,17 @@ import ( "strings" "github.com/pkg/errors" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/promptutil" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" - "github.com/urfave/cli/v2" ) // DeleteAccountCli deletes the accounts that the user requests to be deleted from the wallet. diff --git a/validator/accounts/accounts_enable_disable.go b/validator/accounts/accounts_enable_disable.go index 3fd610230dd1..8a245c624dbd 100644 --- a/validator/accounts/accounts_enable_disable.go +++ b/validator/accounts/accounts_enable_disable.go @@ -6,14 +6,15 @@ import ( "strings" "github.com/pkg/errors" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/promptutil" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" - "github.com/urfave/cli/v2" ) // DisableAccountsCli disables via CLI the accounts that the user requests to be disabled from the wallet diff --git a/validator/accounts/accounts_exit.go b/validator/accounts/accounts_exit.go index 4bde35bf5270..0f1ee333a697 100644 --- a/validator/accounts/accounts_exit.go +++ b/validator/accounts/accounts_exit.go @@ -9,7 +9,11 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" + "github.com/urfave/cli/v2" + "google.golang.org/grpc" + "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/grpcutils" @@ -19,10 +23,7 @@ import ( "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/client" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" - "github.com/urfave/cli/v2" - "google.golang.org/grpc" ) type performExitCfg struct { diff --git a/validator/accounts/accounts_import.go b/validator/accounts/accounts_import.go index f9588b1b4b56..0f905f0a4317 100644 --- a/validator/accounts/accounts_import.go +++ b/validator/accounts/accounts_import.go @@ -14,6 +14,10 @@ import ( "github.com/google/uuid" "github.com/pkg/errors" + "github.com/urfave/cli/v2" + keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/fileutil" @@ -21,11 +25,8 @@ import ( "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" - "github.com/urfave/cli/v2" - keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4" ) var derivationPathRegex = regexp.MustCompile(`m_12381_3600_(\d+)_(\d+)_(\d+)`) diff --git a/validator/accounts/accounts_list.go b/validator/accounts/accounts_list.go index 78bd9401111f..561c286a3d1c 100644 --- a/validator/accounts/accounts_list.go +++ b/validator/accounts/accounts_list.go @@ -10,16 +10,17 @@ import ( "github.com/logrusorgru/aurora" "github.com/pkg/errors" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/petnames" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" - "github.com/urfave/cli/v2" ) // ListAccountsCli displays all available validator accounts in a Prysm wallet. diff --git a/validator/accounts/cmd_accounts.go b/validator/accounts/cmd_accounts.go index 036a4d8f06cb..372c7cd592c6 100644 --- a/validator/accounts/cmd_accounts.go +++ b/validator/accounts/cmd_accounts.go @@ -3,11 +3,12 @@ package accounts import ( "os" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/tos" - "github.com/prysmaticlabs/prysm/validator/flags" - "github.com/urfave/cli/v2" ) // AccountCommands for Prysm validators. diff --git a/validator/accounts/cmd_wallet.go b/validator/accounts/cmd_wallet.go index e12a905391ab..80df948dda37 100644 --- a/validator/accounts/cmd_wallet.go +++ b/validator/accounts/cmd_wallet.go @@ -1,11 +1,12 @@ package accounts import ( + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/tos" - "github.com/prysmaticlabs/prysm/validator/flags" - "github.com/urfave/cli/v2" ) // WalletCommands for accounts for Prysm validators. diff --git a/validator/accounts/prompt/BUILD.bazel b/validator/accounts/prompt/BUILD.bazel index c8e9229ad3db..c2f658d8777b 100644 --- a/validator/accounts/prompt/BUILD.bazel +++ b/validator/accounts/prompt/BUILD.bazel @@ -9,9 +9,9 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/validator/accounts/prompt", visibility = ["//validator:__subpackages__"], deps = [ + "//cmd/validator/flags:go_default_library", "//shared/fileutil:go_default_library", "//shared/promptutil:go_default_library", - "//validator/flags:go_default_library", "//validator/keymanager/remote:go_default_library", "@com_github_logrusorgru_aurora//:go_default_library", "@com_github_manifoldco_promptui//:go_default_library", diff --git a/validator/accounts/prompt/prompt.go b/validator/accounts/prompt/prompt.go index 4532d7290cfb..54404ed57c37 100644 --- a/validator/accounts/prompt/prompt.go +++ b/validator/accounts/prompt/prompt.go @@ -8,11 +8,12 @@ import ( "github.com/logrusorgru/aurora" "github.com/manifoldco/promptui" "github.com/pkg/errors" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/prysmaticlabs/prysm/shared/promptutil" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" - "github.com/urfave/cli/v2" ) const ( diff --git a/validator/accounts/wallet/BUILD.bazel b/validator/accounts/wallet/BUILD.bazel index ead222acf3a3..841cb8c36acb 100644 --- a/validator/accounts/wallet/BUILD.bazel +++ b/validator/accounts/wallet/BUILD.bazel @@ -10,11 +10,11 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/validator/accounts/wallet", visibility = ["//validator:__subpackages__"], deps = [ + "//cmd/validator/flags:go_default_library", "//shared/fileutil:go_default_library", "//shared/promptutil:go_default_library", "//validator/accounts/iface:go_default_library", "//validator/accounts/prompt:go_default_library", - "//validator/flags:go_default_library", "//validator/keymanager:go_default_library", "//validator/keymanager/derived:go_default_library", "//validator/keymanager/imported:go_default_library", diff --git a/validator/accounts/wallet/wallet.go b/validator/accounts/wallet/wallet.go index b2e421eea40d..b17f45046881 100644 --- a/validator/accounts/wallet/wallet.go +++ b/validator/accounts/wallet/wallet.go @@ -10,17 +10,18 @@ import ( "strings" "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/prysmaticlabs/prysm/shared/promptutil" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" - "github.com/sirupsen/logrus" - "github.com/urfave/cli/v2" ) const ( diff --git a/validator/accounts/wallet_create.go b/validator/accounts/wallet_create.go index 028c9b503fdc..0ab2137ebed0 100644 --- a/validator/accounts/wallet_create.go +++ b/validator/accounts/wallet_create.go @@ -9,16 +9,17 @@ import ( "github.com/manifoldco/promptui" "github.com/pkg/errors" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/promptutil" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" - "github.com/urfave/cli/v2" ) // CreateWalletConfig defines the parameters needed to call the create wallet functions. diff --git a/validator/accounts/wallet_create_test.go b/validator/accounts/wallet_create_test.go index e7888df57f14..07a01cf80e3f 100644 --- a/validator/accounts/wallet_create_test.go +++ b/validator/accounts/wallet_create_test.go @@ -10,17 +10,18 @@ import ( "testing" "github.com/pkg/errors" + "github.com/sirupsen/logrus" + logTest "github.com/sirupsen/logrus/hooks/test" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" - "github.com/sirupsen/logrus" - logTest "github.com/sirupsen/logrus/hooks/test" - "github.com/urfave/cli/v2" ) const ( diff --git a/validator/accounts/wallet_edit_test.go b/validator/accounts/wallet_edit_test.go index 1b833cf9689a..15d56379895b 100644 --- a/validator/accounts/wallet_edit_test.go +++ b/validator/accounts/wallet_edit_test.go @@ -4,13 +4,14 @@ import ( "flag" "testing" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" - "github.com/urfave/cli/v2" ) func TestEditWalletConfiguration(t *testing.T) { diff --git a/validator/accounts/wallet_recover.go b/validator/accounts/wallet_recover.go index f7d9de372ca6..3655408b8a60 100644 --- a/validator/accounts/wallet_recover.go +++ b/validator/accounts/wallet_recover.go @@ -10,15 +10,16 @@ import ( "strings" "github.com/pkg/errors" + "github.com/tyler-smith/go-bip39" + "github.com/tyler-smith/go-bip39/wordlists" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/promptutil" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" - "github.com/tyler-smith/go-bip39" - "github.com/tyler-smith/go-bip39/wordlists" - "github.com/urfave/cli/v2" ) const ( diff --git a/validator/accounts/wallet_recover_test.go b/validator/accounts/wallet_recover_test.go index 877013d2c43d..b32b550dc80b 100644 --- a/validator/accounts/wallet_recover_test.go +++ b/validator/accounts/wallet_recover_test.go @@ -9,14 +9,15 @@ import ( "strconv" "testing" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" - "github.com/urfave/cli/v2" ) type recoverCfgStruct struct { diff --git a/validator/db/BUILD.bazel b/validator/db/BUILD.bazel index 85f971bdf511..1c2fe18bb083 100644 --- a/validator/db/BUILD.bazel +++ b/validator/db/BUILD.bazel @@ -11,7 +11,10 @@ go_library( "restore.go", ], importpath = "github.com/prysmaticlabs/prysm/validator/db", - visibility = ["//validator:__subpackages__"], + visibility = [ + "//cmd/validator:__subpackages__", + "//validator:__subpackages__", + ], deps = [ "//shared/cmd:go_default_library", "//shared/fileutil:go_default_library", diff --git a/validator/node/BUILD.bazel b/validator/node/BUILD.bazel index 10881e126c86..f2a1d200858a 100644 --- a/validator/node/BUILD.bazel +++ b/validator/node/BUILD.bazel @@ -7,10 +7,10 @@ go_test( srcs = ["node_test.go"], embed = [":go_default_library"], deps = [ + "//cmd/validator/flags:go_default_library", "//shared/testutil/require:go_default_library", "//validator/accounts:go_default_library", "//validator/accounts/wallet:go_default_library", - "//validator/flags:go_default_library", "//validator/keymanager:go_default_library", "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", @@ -24,8 +24,12 @@ go_library( "node.go", ], importpath = "github.com/prysmaticlabs/prysm/validator/node", - visibility = ["//validator:__subpackages__"], + visibility = [ + "//cmd/validator:__subpackages__", + "//validator:__subpackages__", + ], deps = [ + "//cmd/validator/flags:go_default_library", "//shared:go_default_library", "//shared/backuputil:go_default_library", "//shared/cmd:go_default_library", @@ -42,7 +46,6 @@ go_library( "//validator/accounts/wallet:go_default_library", "//validator/client:go_default_library", "//validator/db/kv:go_default_library", - "//validator/flags:go_default_library", "//validator/graffiti:go_default_library", "//validator/keymanager:go_default_library", "//validator/keymanager/imported:go_default_library", diff --git a/validator/node/node.go b/validator/node/node.go index a695f68b6885..7e3ba183a5cf 100644 --- a/validator/node/node.go +++ b/validator/node/node.go @@ -14,6 +14,7 @@ import ( "syscall" "github.com/pkg/errors" + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared" "github.com/prysmaticlabs/prysm/shared/backuputil" "github.com/prysmaticlabs/prysm/shared/cmd" @@ -30,7 +31,6 @@ import ( "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/client" "github.com/prysmaticlabs/prysm/validator/db/kv" - "github.com/prysmaticlabs/prysm/validator/flags" g "github.com/prysmaticlabs/prysm/validator/graffiti" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" diff --git a/validator/node/node_test.go b/validator/node/node_test.go index b169eded0265..07637620d82f 100644 --- a/validator/node/node_test.go +++ b/validator/node/node_test.go @@ -8,13 +8,14 @@ import ( "path/filepath" "testing" + logTest "github.com/sirupsen/logrus/hooks/test" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/validator/accounts" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" - logTest "github.com/sirupsen/logrus/hooks/test" - "github.com/urfave/cli/v2" ) // Test that the sharding node can build with default flag values. diff --git a/validator/rpc/BUILD.bazel b/validator/rpc/BUILD.bazel index 4114319bf1c6..0bc32548d3ca 100644 --- a/validator/rpc/BUILD.bazel +++ b/validator/rpc/BUILD.bazel @@ -75,6 +75,7 @@ go_test( ], embed = [":go_default_library"], deps = [ + "//cmd/validator/flags:go_default_library", "//proto/validator/accounts/v2:go_default_library", "//shared/bls:go_default_library", "//shared/event:go_default_library", @@ -89,7 +90,6 @@ go_test( "//validator/accounts/wallet:go_default_library", "//validator/client:go_default_library", "//validator/db/testing:go_default_library", - "//validator/flags:go_default_library", "//validator/keymanager:go_default_library", "//validator/keymanager/derived:go_default_library", "//validator/keymanager/imported:go_default_library", diff --git a/validator/rpc/accounts_test.go b/validator/rpc/accounts_test.go index 2ade06334e31..1b3b21793c1e 100644 --- a/validator/rpc/accounts_test.go +++ b/validator/rpc/accounts_test.go @@ -10,13 +10,13 @@ import ( "path/filepath" "testing" + "github.com/prysmaticlabs/prysm/cmd/validator/flags" pb "github.com/prysmaticlabs/prysm/proto/validator/accounts/v2" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/validator/accounts" "github.com/prysmaticlabs/prysm/validator/accounts/iface" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" constant "github.com/prysmaticlabs/prysm/validator/testing" diff --git a/validator/slashing-protection/BUILD.bazel b/validator/slashing-protection/BUILD.bazel index 5737834a399f..3991eaa4d786 100644 --- a/validator/slashing-protection/BUILD.bazel +++ b/validator/slashing-protection/BUILD.bazel @@ -12,8 +12,12 @@ go_library( "slasher_client.go", ], importpath = "github.com/prysmaticlabs/prysm/validator/slashing-protection", - visibility = ["//validator:__subpackages__"], + visibility = [ + "//cmd/validator:__subpackages__", + "//validator:__subpackages__", + ], deps = [ + "//cmd/validator/flags:go_default_library", "//proto/slashing:go_default_library", "//shared/cmd:go_default_library", "//shared/featureconfig:go_default_library", @@ -22,7 +26,6 @@ go_library( "//shared/tos:go_default_library", "//validator/accounts/prompt:go_default_library", "//validator/db/kv:go_default_library", - "//validator/flags:go_default_library", "//validator/slashing-protection/local/standard-protection-format:go_default_library", "@com_github_grpc_ecosystem_go_grpc_middleware//:go_default_library", "@com_github_grpc_ecosystem_go_grpc_middleware//retry:go_default_library", @@ -48,6 +51,7 @@ go_test( ], embed = [":go_default_library"], deps = [ + "//cmd/validator/flags:go_default_library", "//shared/bytesutil:go_default_library", "//shared/cmd:go_default_library", "//shared/fileutil:go_default_library", @@ -55,7 +59,6 @@ go_test( "//shared/testutil/require:go_default_library", "//validator/db/kv:go_default_library", "//validator/db/testing:go_default_library", - "//validator/flags:go_default_library", "//validator/slashing-protection/local/standard-protection-format/format:go_default_library", "//validator/testing:go_default_library", "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library", diff --git a/validator/slashing-protection/cli_export.go b/validator/slashing-protection/cli_export.go index 605076b9abe3..87acbb713534 100644 --- a/validator/slashing-protection/cli_export.go +++ b/validator/slashing-protection/cli_export.go @@ -5,13 +5,14 @@ import ( "path/filepath" "github.com/pkg/errors" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/db/kv" - "github.com/prysmaticlabs/prysm/validator/flags" export "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format" - "github.com/urfave/cli/v2" ) const ( diff --git a/validator/slashing-protection/cli_import.go b/validator/slashing-protection/cli_import.go index 1d181e36ce2e..9134a0300ee7 100644 --- a/validator/slashing-protection/cli_import.go +++ b/validator/slashing-protection/cli_import.go @@ -5,13 +5,14 @@ import ( "fmt" "github.com/pkg/errors" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/db/kv" - "github.com/prysmaticlabs/prysm/validator/flags" slashingProtectionFormat "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format" - "github.com/urfave/cli/v2" ) // ImportSlashingProtectionCLI reads an input slashing protection EIP-3076 diff --git a/validator/slashing-protection/cli_import_export_test.go b/validator/slashing-protection/cli_import_export_test.go index 059168463ea1..dca10e5a5856 100644 --- a/validator/slashing-protection/cli_import_export_test.go +++ b/validator/slashing-protection/cli_import_export_test.go @@ -7,16 +7,17 @@ import ( "path/filepath" "testing" + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/validator/db/kv" dbTest "github.com/prysmaticlabs/prysm/validator/db/testing" - "github.com/prysmaticlabs/prysm/validator/flags" "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format/format" mocks "github.com/prysmaticlabs/prysm/validator/testing" - "github.com/urfave/cli/v2" ) func setupCliCtx( diff --git a/validator/slashing-protection/cmd.go b/validator/slashing-protection/cmd.go index e53c4a498222..1700944f7a8f 100644 --- a/validator/slashing-protection/cmd.go +++ b/validator/slashing-protection/cmd.go @@ -1,11 +1,12 @@ package slashingprotection import ( + "github.com/urfave/cli/v2" + + "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/tos" - "github.com/prysmaticlabs/prysm/validator/flags" - "github.com/urfave/cli/v2" ) // Commands for slashing protection. From 4123b5e3e1373851a392438f7b5a548ef0df4193 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 09:22:33 -0600 Subject: [PATCH 02/11] imports --- validator/accounts/accounts_delete.go | 3 +-- validator/accounts/accounts_enable_disable.go | 3 +-- validator/accounts/accounts_exit.go | 5 ++--- validator/accounts/accounts_import.go | 5 ++--- validator/accounts/accounts_list.go | 3 +-- validator/accounts/cmd_accounts.go | 3 +-- validator/accounts/cmd_wallet.go | 3 +-- validator/accounts/prompt/prompt.go | 3 +-- validator/accounts/wallet/wallet.go | 5 ++--- validator/accounts/wallet_create.go | 3 +-- validator/accounts/wallet_create_test.go | 7 +++---- validator/accounts/wallet_edit_test.go | 3 +-- validator/accounts/wallet_recover.go | 7 +++---- validator/accounts/wallet_recover_test.go | 3 +-- validator/node/node_test.go | 5 ++--- validator/slashing-protection/cli_export.go | 3 +-- validator/slashing-protection/cli_import.go | 3 +-- validator/slashing-protection/cli_import_export_test.go | 3 +-- validator/slashing-protection/cmd.go | 3 +-- 19 files changed, 27 insertions(+), 46 deletions(-) diff --git a/validator/accounts/accounts_delete.go b/validator/accounts/accounts_delete.go index d14b61792380..b0cd746650e7 100644 --- a/validator/accounts/accounts_delete.go +++ b/validator/accounts/accounts_delete.go @@ -7,8 +7,6 @@ import ( "strings" "github.com/pkg/errors" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/promptutil" @@ -18,6 +16,7 @@ import ( "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" + "github.com/urfave/cli/v2" ) // DeleteAccountCli deletes the accounts that the user requests to be deleted from the wallet. diff --git a/validator/accounts/accounts_enable_disable.go b/validator/accounts/accounts_enable_disable.go index 8a245c624dbd..07f99325a317 100644 --- a/validator/accounts/accounts_enable_disable.go +++ b/validator/accounts/accounts_enable_disable.go @@ -6,8 +6,6 @@ import ( "strings" "github.com/pkg/errors" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/promptutil" @@ -15,6 +13,7 @@ import ( "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" + "github.com/urfave/cli/v2" ) // DisableAccountsCli disables via CLI the accounts that the user requests to be disabled from the wallet diff --git a/validator/accounts/accounts_exit.go b/validator/accounts/accounts_exit.go index 0f1ee333a697..04ed21283e20 100644 --- a/validator/accounts/accounts_exit.go +++ b/validator/accounts/accounts_exit.go @@ -9,9 +9,6 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" - "github.com/urfave/cli/v2" - "google.golang.org/grpc" - "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bytesutil" @@ -24,6 +21,8 @@ import ( "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/client" "github.com/prysmaticlabs/prysm/validator/keymanager" + "github.com/urfave/cli/v2" + "google.golang.org/grpc" ) type performExitCfg struct { diff --git a/validator/accounts/accounts_import.go b/validator/accounts/accounts_import.go index 0f905f0a4317..f0ac79e397a6 100644 --- a/validator/accounts/accounts_import.go +++ b/validator/accounts/accounts_import.go @@ -14,9 +14,6 @@ import ( "github.com/google/uuid" "github.com/pkg/errors" - "github.com/urfave/cli/v2" - keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/bytesutil" @@ -27,6 +24,8 @@ import ( "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" + "github.com/urfave/cli/v2" + keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4" ) var derivationPathRegex = regexp.MustCompile(`m_12381_3600_(\d+)_(\d+)_(\d+)`) diff --git a/validator/accounts/accounts_list.go b/validator/accounts/accounts_list.go index 561c286a3d1c..33904339f2c7 100644 --- a/validator/accounts/accounts_list.go +++ b/validator/accounts/accounts_list.go @@ -10,8 +10,6 @@ import ( "github.com/logrusorgru/aurora" "github.com/pkg/errors" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/petnames" @@ -21,6 +19,7 @@ import ( "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" + "github.com/urfave/cli/v2" ) // ListAccountsCli displays all available validator accounts in a Prysm wallet. diff --git a/validator/accounts/cmd_accounts.go b/validator/accounts/cmd_accounts.go index 372c7cd592c6..1805ba3469a3 100644 --- a/validator/accounts/cmd_accounts.go +++ b/validator/accounts/cmd_accounts.go @@ -3,12 +3,11 @@ package accounts import ( "os" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/tos" + "github.com/urfave/cli/v2" ) // AccountCommands for Prysm validators. diff --git a/validator/accounts/cmd_wallet.go b/validator/accounts/cmd_wallet.go index 80df948dda37..bb6702dabab2 100644 --- a/validator/accounts/cmd_wallet.go +++ b/validator/accounts/cmd_wallet.go @@ -1,12 +1,11 @@ package accounts import ( - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/tos" + "github.com/urfave/cli/v2" ) // WalletCommands for accounts for Prysm validators. diff --git a/validator/accounts/prompt/prompt.go b/validator/accounts/prompt/prompt.go index 54404ed57c37..5808db424764 100644 --- a/validator/accounts/prompt/prompt.go +++ b/validator/accounts/prompt/prompt.go @@ -8,12 +8,11 @@ import ( "github.com/logrusorgru/aurora" "github.com/manifoldco/promptui" "github.com/pkg/errors" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/prysmaticlabs/prysm/shared/promptutil" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" + "github.com/urfave/cli/v2" ) const ( diff --git a/validator/accounts/wallet/wallet.go b/validator/accounts/wallet/wallet.go index b17f45046881..795dc3fac1e5 100644 --- a/validator/accounts/wallet/wallet.go +++ b/validator/accounts/wallet/wallet.go @@ -10,9 +10,6 @@ import ( "strings" "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/prysmaticlabs/prysm/shared/promptutil" @@ -22,6 +19,8 @@ import ( "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" + "github.com/sirupsen/logrus" + "github.com/urfave/cli/v2" ) const ( diff --git a/validator/accounts/wallet_create.go b/validator/accounts/wallet_create.go index 0ab2137ebed0..3be4014c4c9a 100644 --- a/validator/accounts/wallet_create.go +++ b/validator/accounts/wallet_create.go @@ -9,8 +9,6 @@ import ( "github.com/manifoldco/promptui" "github.com/pkg/errors" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/promptutil" "github.com/prysmaticlabs/prysm/validator/accounts/iface" @@ -20,6 +18,7 @@ import ( "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" + "github.com/urfave/cli/v2" ) // CreateWalletConfig defines the parameters needed to call the create wallet functions. diff --git a/validator/accounts/wallet_create_test.go b/validator/accounts/wallet_create_test.go index 07a01cf80e3f..2fe628f86b43 100644 --- a/validator/accounts/wallet_create_test.go +++ b/validator/accounts/wallet_create_test.go @@ -10,10 +10,6 @@ import ( "testing" "github.com/pkg/errors" - "github.com/sirupsen/logrus" - logTest "github.com/sirupsen/logrus/hooks/test" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/testutil/assert" @@ -22,6 +18,9 @@ import ( "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" + "github.com/sirupsen/logrus" + logTest "github.com/sirupsen/logrus/hooks/test" + "github.com/urfave/cli/v2" ) const ( diff --git a/validator/accounts/wallet_edit_test.go b/validator/accounts/wallet_edit_test.go index 15d56379895b..3e18f9c26dfb 100644 --- a/validator/accounts/wallet_edit_test.go +++ b/validator/accounts/wallet_edit_test.go @@ -4,14 +4,13 @@ import ( "flag" "testing" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/remote" + "github.com/urfave/cli/v2" ) func TestEditWalletConfiguration(t *testing.T) { diff --git a/validator/accounts/wallet_recover.go b/validator/accounts/wallet_recover.go index 3655408b8a60..8b369b7cc7f1 100644 --- a/validator/accounts/wallet_recover.go +++ b/validator/accounts/wallet_recover.go @@ -10,16 +10,15 @@ import ( "strings" "github.com/pkg/errors" - "github.com/tyler-smith/go-bip39" - "github.com/tyler-smith/go-bip39/wordlists" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/promptutil" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" + "github.com/tyler-smith/go-bip39" + "github.com/tyler-smith/go-bip39/wordlists" + "github.com/urfave/cli/v2" ) const ( diff --git a/validator/accounts/wallet_recover_test.go b/validator/accounts/wallet_recover_test.go index b32b550dc80b..47ba145b242a 100644 --- a/validator/accounts/wallet_recover_test.go +++ b/validator/accounts/wallet_recover_test.go @@ -9,8 +9,6 @@ import ( "strconv" "testing" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" @@ -18,6 +16,7 @@ import ( "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" + "github.com/urfave/cli/v2" ) type recoverCfgStruct struct { diff --git a/validator/node/node_test.go b/validator/node/node_test.go index 07637620d82f..24fd4d97b9a8 100644 --- a/validator/node/node_test.go +++ b/validator/node/node_test.go @@ -8,14 +8,13 @@ import ( "path/filepath" "testing" - logTest "github.com/sirupsen/logrus/hooks/test" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/testutil/require" "github.com/prysmaticlabs/prysm/validator/accounts" "github.com/prysmaticlabs/prysm/validator/accounts/wallet" "github.com/prysmaticlabs/prysm/validator/keymanager" + logTest "github.com/sirupsen/logrus/hooks/test" + "github.com/urfave/cli/v2" ) // Test that the sharding node can build with default flag values. diff --git a/validator/slashing-protection/cli_export.go b/validator/slashing-protection/cli_export.go index 87acbb713534..d19aa83b30ec 100644 --- a/validator/slashing-protection/cli_export.go +++ b/validator/slashing-protection/cli_export.go @@ -5,14 +5,13 @@ import ( "path/filepath" "github.com/pkg/errors" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/db/kv" export "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format" + "github.com/urfave/cli/v2" ) const ( diff --git a/validator/slashing-protection/cli_import.go b/validator/slashing-protection/cli_import.go index 9134a0300ee7..5505c5554356 100644 --- a/validator/slashing-protection/cli_import.go +++ b/validator/slashing-protection/cli_import.go @@ -5,14 +5,13 @@ import ( "fmt" "github.com/pkg/errors" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/fileutil" "github.com/prysmaticlabs/prysm/validator/accounts/prompt" "github.com/prysmaticlabs/prysm/validator/db/kv" slashingProtectionFormat "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format" + "github.com/urfave/cli/v2" ) // ImportSlashingProtectionCLI reads an input slashing protection EIP-3076 diff --git a/validator/slashing-protection/cli_import_export_test.go b/validator/slashing-protection/cli_import_export_test.go index dca10e5a5856..849ba8bdc97a 100644 --- a/validator/slashing-protection/cli_import_export_test.go +++ b/validator/slashing-protection/cli_import_export_test.go @@ -7,8 +7,6 @@ import ( "path/filepath" "testing" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/fileutil" @@ -18,6 +16,7 @@ import ( dbTest "github.com/prysmaticlabs/prysm/validator/db/testing" "github.com/prysmaticlabs/prysm/validator/slashing-protection/local/standard-protection-format/format" mocks "github.com/prysmaticlabs/prysm/validator/testing" + "github.com/urfave/cli/v2" ) func setupCliCtx( diff --git a/validator/slashing-protection/cmd.go b/validator/slashing-protection/cmd.go index 1700944f7a8f..0ef5fb9424de 100644 --- a/validator/slashing-protection/cmd.go +++ b/validator/slashing-protection/cmd.go @@ -1,12 +1,11 @@ package slashingprotection import ( - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/tos" + "github.com/urfave/cli/v2" ) // Commands for slashing protection. From fdd462a278da94ef23274adbb79bf4322febcd89 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 09:23:49 -0600 Subject: [PATCH 03/11] more imports --- cmd/validator/flags/flags.go | 3 +-- validator/accounts/accounts_backup.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/validator/flags/flags.go b/cmd/validator/flags/flags.go index 0dd35a064fc0..544f1b3c6adb 100644 --- a/cmd/validator/flags/flags.go +++ b/cmd/validator/flags/flags.go @@ -7,9 +7,8 @@ import ( "runtime" "time" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/shared/fileutil" + "github.com/urfave/cli/v2" ) const ( diff --git a/validator/accounts/accounts_backup.go b/validator/accounts/accounts_backup.go index ee96f60aff50..69c10014d4a5 100644 --- a/validator/accounts/accounts_backup.go +++ b/validator/accounts/accounts_backup.go @@ -12,8 +12,6 @@ import ( "github.com/logrusorgru/aurora" "github.com/manifoldco/promptui" "github.com/pkg/errors" - "github.com/urfave/cli/v2" - "github.com/prysmaticlabs/prysm/cmd/validator/flags" "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/bytesutil" @@ -26,6 +24,7 @@ import ( "github.com/prysmaticlabs/prysm/validator/keymanager" "github.com/prysmaticlabs/prysm/validator/keymanager/derived" "github.com/prysmaticlabs/prysm/validator/keymanager/imported" + "github.com/urfave/cli/v2" ) var ( From 13388ad7fef7c490a37f27a32a507079418dd238 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 09:27:50 -0600 Subject: [PATCH 04/11] e2e viz --- endtoend/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endtoend/BUILD.bazel b/endtoend/BUILD.bazel index 4cb74685b990..22fc36ea83a5 100644 --- a/endtoend/BUILD.bazel +++ b/endtoend/BUILD.bazel @@ -16,7 +16,7 @@ go_test( "//beacon-chain", "//slasher", "//tools/bootnode", - "//validator", + "//cmd/validator", "@com_github_ethereum_go_ethereum//cmd/geth", ], shard_count = 2, From 730b5a6cd9cbd12df90691645ed0e9c28418c7b4 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 09:52:46 -0600 Subject: [PATCH 05/11] alias --- validator/BUILD.bazel | 72 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/validator/BUILD.bazel b/validator/BUILD.bazel index 1732df97c7b6..66a837d63a59 100644 --- a/validator/BUILD.bazel +++ b/validator/BUILD.bazel @@ -4,3 +4,75 @@ alias( actual = "//cmd/validator:validator", deprecation = "This target has moved to cmd/validator", ) + +alias( + name = "validator:push_images_debug", + actual = "//cmd/validator:push_images_debug", + deprecation = "This target has moved to cmd/validator:push_images_debug", +) + +alias( + name = "validator:push_images_alpine", + actual = "//cmd/validator:push_images_alpine", + deprecation = "This target has moved to cmd/validator:push_images_alpine", +) + +alias( + name = "validator:push_images", + actual = "//cmd/validator:push_images", + deprecation = "This target has moved to cmd/validator:push_images", +) + +alias( + name = "validator:image_bundle_debug + actual = "//cmd/validator:image_bundle_debug", + deprecation = "This target has moved to cmd/validator:image_bundle_debug", +) + +alias( + name = "validator:image_debug", + actual = "//cmd/validator:image_debug", + deprecation = "This target has moved to cmd/validator:image_debug", +) + +alias( + name = "validator:image_bundle_alpine", + actual = "//cmd/validator:image_bundle_alpine", + deprecation = "This target has moved to cmd/validator:image_bundle_alpine", +) + +alias( + name = "validator:image_bundle", + actual = "//cmd/validator:image_bundle", + deprecation = "This target has moved to cmd/validator:image_bundle", +) + +alias( + name = "validator:image_with_creation_time", + actual = "//cmd/validator:image_with_creation_time", + deprecation = "This target has moved to cmd/validator:image_with_creation_time +) + +alias( + name = "validator:image_alpine", + actual = "//cmd/validator:image_alpine", + deprecation = "This target has moved to cmd/validator:image_alpine", +) + +alias( + name = "validator:image", + actual = "//cmd/validator:image", + deprecation = "This target has moved to cmd/validator:image", +) + +alias( + name = "validator:go_default_test", + actual = "//cmd/validator:go_default_test", + deprecation = "This target has moved to cmd/validator:go_default_test", +) + +alias( + name = "validator", + actual = "//cmd/validator:go_default_library", + deprecation = "This target has moved to cmd/validator:go_default_library", +) \ No newline at end of file From e15fdc2c89564b1057d7fbd88ee197bbead3c813 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 10:19:31 -0600 Subject: [PATCH 06/11] use native alias --- tools/target_migration.bzl | 3 ++ validator/BUILD.bazel | 95 ++++++++------------------------------ 2 files changed, 21 insertions(+), 77 deletions(-) create mode 100644 tools/target_migration.bzl diff --git a/tools/target_migration.bzl b/tools/target_migration.bzl new file mode 100644 index 000000000000..fe6960920277 --- /dev/null +++ b/tools/target_migration.bzl @@ -0,0 +1,3 @@ +def moved_targets(targets, new_package): + for target in targets: + native.alias(name=target, actual=new_package+target, deprecation="This target has moved to %s%s"%(actual,target)) \ No newline at end of file diff --git a/validator/BUILD.bazel b/validator/BUILD.bazel index 66a837d63a59..a41f51aef8bd 100644 --- a/validator/BUILD.bazel +++ b/validator/BUILD.bazel @@ -1,78 +1,19 @@ -# validator/BUILD.bazel -alias( - name = "validator", - actual = "//cmd/validator:validator", - deprecation = "This target has moved to cmd/validator", +load("//tools:target_migration.bzl", "moved_targets") + +moved_targets( + [ + ":push_images_debug", + ":push_images_alpine", + ":push_images", + ":image_bundle_debug", + ":image_debug", + ":image_bundle_alpine", + ":image_bundle", + ":image_with_creation_time", + ":image_alpine", + ":image", + ":go_default_test", + ":validator", + ], + "//cmd/validator", ) - -alias( - name = "validator:push_images_debug", - actual = "//cmd/validator:push_images_debug", - deprecation = "This target has moved to cmd/validator:push_images_debug", -) - -alias( - name = "validator:push_images_alpine", - actual = "//cmd/validator:push_images_alpine", - deprecation = "This target has moved to cmd/validator:push_images_alpine", -) - -alias( - name = "validator:push_images", - actual = "//cmd/validator:push_images", - deprecation = "This target has moved to cmd/validator:push_images", -) - -alias( - name = "validator:image_bundle_debug - actual = "//cmd/validator:image_bundle_debug", - deprecation = "This target has moved to cmd/validator:image_bundle_debug", -) - -alias( - name = "validator:image_debug", - actual = "//cmd/validator:image_debug", - deprecation = "This target has moved to cmd/validator:image_debug", -) - -alias( - name = "validator:image_bundle_alpine", - actual = "//cmd/validator:image_bundle_alpine", - deprecation = "This target has moved to cmd/validator:image_bundle_alpine", -) - -alias( - name = "validator:image_bundle", - actual = "//cmd/validator:image_bundle", - deprecation = "This target has moved to cmd/validator:image_bundle", -) - -alias( - name = "validator:image_with_creation_time", - actual = "//cmd/validator:image_with_creation_time", - deprecation = "This target has moved to cmd/validator:image_with_creation_time -) - -alias( - name = "validator:image_alpine", - actual = "//cmd/validator:image_alpine", - deprecation = "This target has moved to cmd/validator:image_alpine", -) - -alias( - name = "validator:image", - actual = "//cmd/validator:image", - deprecation = "This target has moved to cmd/validator:image", -) - -alias( - name = "validator:go_default_test", - actual = "//cmd/validator:go_default_test", - deprecation = "This target has moved to cmd/validator:go_default_test", -) - -alias( - name = "validator", - actual = "//cmd/validator:go_default_library", - deprecation = "This target has moved to cmd/validator:go_default_library", -) \ No newline at end of file From 25d4c4c887133d385df32d5f1f32ccbcaea6b79a Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 10:27:07 -0600 Subject: [PATCH 07/11] add actual --- tools/target_migration.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/target_migration.bzl b/tools/target_migration.bzl index fe6960920277..5cfed15c0ef9 100644 --- a/tools/target_migration.bzl +++ b/tools/target_migration.bzl @@ -1,3 +1,3 @@ def moved_targets(targets, new_package): for target in targets: - native.alias(name=target, actual=new_package+target, deprecation="This target has moved to %s%s"%(actual,target)) \ No newline at end of file + alias(name=target, actual=new_package+target, deprecation="This target has moved to %s%s"%(actual,target)) \ No newline at end of file From 938a15a016e4e4ce045268aa79c4d0aefd1b4f2d Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Tue, 2 Mar 2021 11:00:04 -0600 Subject: [PATCH 08/11] fix macro --- tools/target_migration.bzl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/target_migration.bzl b/tools/target_migration.bzl index fe6960920277..25a3b6810791 100644 --- a/tools/target_migration.bzl +++ b/tools/target_migration.bzl @@ -1,3 +1,7 @@ def moved_targets(targets, new_package): for target in targets: - native.alias(name=target, actual=new_package+target, deprecation="This target has moved to %s%s"%(actual,target)) \ No newline at end of file + native.alias( + name=target[1:], + actual=new_package+target, + deprecation="This target has moved to %s%s"%(new_package,target), + ) From 9bdebf662af5a12202889fdb23612ed8a9d3c682 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 11:39:41 -0600 Subject: [PATCH 09/11] work on fix e2e --- endtoend/components/validator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endtoend/components/validator.go b/endtoend/components/validator.go index 7cd6d27d80a5..ba9550832890 100644 --- a/endtoend/components/validator.go +++ b/endtoend/components/validator.go @@ -45,7 +45,7 @@ func StartValidatorClients(t *testing.T, config *types.E2EConfig) { // StartNewValidatorClient starts a validator client with the passed in configuration. func StartNewValidatorClient(t *testing.T, config *types.E2EConfig, validatorNum, index, offset int) { - binaryPath, found := bazel.FindBinary("validator", "validator") + binaryPath, found := bazel.FindBinary("cmd/validator", "validator") if !found { t.Fatal("validator binary not found") } From b7cefadc0853ca88fefebef2954265c5e122e82a Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 11:57:02 -0600 Subject: [PATCH 10/11] add viz --- cmd/validator/BUILD.bazel | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/validator/BUILD.bazel b/cmd/validator/BUILD.bazel index 3e49c7b17e90..a575292e6041 100644 --- a/cmd/validator/BUILD.bazel +++ b/cmd/validator/BUILD.bazel @@ -45,17 +45,19 @@ go_image( }), binary = ":validator", tags = ["manual"], - visibility = ["//visibility:private"], + visibility = ["//validator:__pkg__"], ) container_image( name = "image_with_creation_time", + visibility = ["//validator:__pkg__"], base = "image", stamp = True, ) container_bundle( name = "image_bundle", + visibility = ["//validator:__pkg__"], images = { "gcr.io/prysmaticlabs/prysm/validator:latest": ":image_with_creation_time", "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}": ":image_with_creation_time", @@ -67,12 +69,14 @@ container_bundle( go_image_debug( name = "image_debug", + visibility = ["//validator:__pkg__"], image = ":image", tags = ["manual"], ) container_bundle( name = "image_bundle_debug", + visibility = ["//validator:__pkg__"], images = { "gcr.io/prysmaticlabs/prysm/validator:latest-debug": ":image_debug", "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}-debug": ":image_debug", @@ -84,12 +88,14 @@ container_bundle( go_image_alpine( name = "image_alpine", + visibility = ["//validator:__pkg__"], image = ":image", tags = ["manual"], ) container_bundle( name = "image_bundle_alpine", + visibility = ["//validator:__pkg__"], images = { "gcr.io/prysmaticlabs/prysm/validator:latest-alpine": ":image_alpine", "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}-alpine": ":image_alpine", @@ -101,18 +107,21 @@ container_bundle( docker_push( name = "push_images", + visibility = ["//validator:__pkg__"], bundle = ":image_bundle", tags = ["manual"], ) docker_push( name = "push_images_debug", + visibility = ["//validator:__pkg__"], bundle = ":image_bundle_debug", tags = ["manual"], ) docker_push( name = "push_images_alpine", + visibility = ["//validator:__pkg__"], bundle = ":image_bundle_alpine", tags = ["manual"], ) @@ -129,6 +138,7 @@ go_binary( go_test( name = "go_default_test", + visibility = ["//validator:__pkg__"], srcs = ["usage_test.go"], embed = [":go_default_library"], deps = [ From 56f95f08d8d91481c6a923d839fd4939478cf0bb Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 2 Mar 2021 12:06:37 -0600 Subject: [PATCH 11/11] gaz --- cmd/validator/BUILD.bazel | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/validator/BUILD.bazel b/cmd/validator/BUILD.bazel index a575292e6041..495026ac1d0b 100644 --- a/cmd/validator/BUILD.bazel +++ b/cmd/validator/BUILD.bazel @@ -50,14 +50,13 @@ go_image( container_image( name = "image_with_creation_time", - visibility = ["//validator:__pkg__"], base = "image", stamp = True, + visibility = ["//validator:__pkg__"], ) container_bundle( name = "image_bundle", - visibility = ["//validator:__pkg__"], images = { "gcr.io/prysmaticlabs/prysm/validator:latest": ":image_with_creation_time", "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}": ":image_with_creation_time", @@ -65,18 +64,18 @@ container_bundle( "index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}": ":image_with_creation_time", }, tags = ["manual"], + visibility = ["//validator:__pkg__"], ) go_image_debug( name = "image_debug", - visibility = ["//validator:__pkg__"], image = ":image", tags = ["manual"], + visibility = ["//validator:__pkg__"], ) container_bundle( name = "image_bundle_debug", - visibility = ["//validator:__pkg__"], images = { "gcr.io/prysmaticlabs/prysm/validator:latest-debug": ":image_debug", "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}-debug": ":image_debug", @@ -84,18 +83,18 @@ container_bundle( "index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}-debug": ":image_debug", }, tags = ["manual"], + visibility = ["//validator:__pkg__"], ) go_image_alpine( name = "image_alpine", - visibility = ["//validator:__pkg__"], image = ":image", tags = ["manual"], + visibility = ["//validator:__pkg__"], ) container_bundle( name = "image_bundle_alpine", - visibility = ["//validator:__pkg__"], images = { "gcr.io/prysmaticlabs/prysm/validator:latest-alpine": ":image_alpine", "gcr.io/prysmaticlabs/prysm/validator:{DOCKER_TAG}-alpine": ":image_alpine", @@ -103,27 +102,28 @@ container_bundle( "index.docker.io/prysmaticlabs/prysm-validator:{DOCKER_TAG}-alpine": ":image_alpine", }, tags = ["manual"], + visibility = ["//validator:__pkg__"], ) docker_push( name = "push_images", - visibility = ["//validator:__pkg__"], bundle = ":image_bundle", tags = ["manual"], + visibility = ["//validator:__pkg__"], ) docker_push( name = "push_images_debug", - visibility = ["//validator:__pkg__"], bundle = ":image_bundle_debug", tags = ["manual"], + visibility = ["//validator:__pkg__"], ) docker_push( name = "push_images_alpine", - visibility = ["//validator:__pkg__"], bundle = ":image_bundle_alpine", tags = ["manual"], + visibility = ["//validator:__pkg__"], ) go_binary( @@ -138,9 +138,9 @@ go_binary( go_test( name = "go_default_test", - visibility = ["//validator:__pkg__"], srcs = ["usage_test.go"], embed = [":go_default_library"], + visibility = ["//validator:__pkg__"], deps = [ "//shared/featureconfig:go_default_library", "@com_github_urfave_cli_v2//:go_default_library",