Skip to content

Commit

Permalink
Merge branch 'rc5' of github.com:prysmaticlabs/prysm into mainnet_cap…
Browse files Browse the repository at this point in the history
…ella_epoch
  • Loading branch information
terencechain committed Mar 20, 2023
2 parents 13ea226 + 275da0c commit ddb28b7
Show file tree
Hide file tree
Showing 49 changed files with 1,567 additions and 149 deletions.
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ filegroup(
url = "https://github.com/ethereum/EIPs/archive/5480440fe51742ed23342b68cf106cefd427e39d.tar.gz",
)

consensus_spec_version = "v1.3.0-rc.4"
consensus_spec_version = "v1.3.0-rc.5"

bls_test_version = "v0.1.1"

Expand All @@ -221,7 +221,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "519da3cbb181fe927e41b0d13c3aaad5f5f38fe0ba87ca51bd09a661c738bd6c",
sha256 = "266006512e71e62396e8f31be01639560c9d59a93c38220fd8f51fabefc8f5f3",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_version,
)

Expand All @@ -237,7 +237,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "894404302d3d4b0f3080d3221204c19de4e837f1b129f468a66747103174412e",
sha256 = "2ebf483830165909cb7961562fd369dedf079997a4832cc215a543898a73aa46",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_version,
)

Expand All @@ -253,7 +253,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "ca7a594a2f4be1103e01b5a1416f75a328b7555eae8b26308c07f80fa6d0f255",
sha256 = "333718ba5c907e0a99580caa8d28dd710543b3b271e4251581006d0e101fbce9",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_version,
)

Expand All @@ -268,7 +268,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "b4ed6c077c5f0857361412515b319fc8b26730c7d701d3245b5e6849b3974a4f",
sha256 = "78b6925b5a4208e32385fa4387d2c27b381a8ddd18d66d5a7787e7846b86bfc8",
strip_prefix = "consensus-specs-" + consensus_spec_version[1:],
url = "https://github.com/ethereum/consensus-specs/archive/refs/tags/%s.tar.gz" % consensus_spec_version,
)
Expand Down
12 changes: 5 additions & 7 deletions beacon-chain/blockchain/process_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,6 @@ func (s *Service) fillMissingPayloadIDRoutine(ctx context.Context, stateFeed *ev
for {
select {
case <-ticker.C():
s.cfg.StateNotifier.StateFeed().Send(&feed.Event{
Type: statefeed.MissedSlot,
})
if err := s.fillMissingBlockPayloadId(ctx); err != nil {
log.WithError(err).Error("Could not fill missing payload ID")
}
Expand All @@ -689,12 +686,13 @@ func (s *Service) fillMissingPayloadIDRoutine(ctx context.Context, stateFeed *ev
// fillMissingBlockPayloadId is called 4 seconds into the slot and calls FCU if we are proposing next slot
// and the cache has been missed
func (s *Service) fillMissingBlockPayloadId(ctx context.Context) error {
s.ForkChoicer().RLock()
highestReceivedSlot := s.cfg.ForkChoiceStore.HighestReceivedBlockSlot()
s.ForkChoicer().RUnlock()
if s.CurrentSlot() == highestReceivedSlot {
if s.CurrentSlot() == s.HeadSlot() {
return nil
}
s.cfg.StateNotifier.StateFeed().Send(&feed.Event{
Type: statefeed.MissedSlot,
})

// Head root should be empty when retrieving proposer index for the next slot.
_, id, has := s.cfg.ProposerSlotIndexCache.GetProposerPayloadIDs(s.CurrentSlot()+1, [32]byte{} /* head root */)
// There exists proposer for next slot, but we haven't called fcu w/ payload attribute yet.
Expand Down
2 changes: 1 addition & 1 deletion cmd/validator/accounts/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ go_test(
"//io/file:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"//testing/assert:go_default_library",
"//testing/mock:go_default_library",
"//testing/require:go_default_library",
"//testing/validator-mock:go_default_library",
"//time:go_default_library",
"//validator/accounts:go_default_library",
"//validator/accounts/iface:go_default_library",
Expand Down
14 changes: 7 additions & 7 deletions cmd/validator/accounts/exit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/golang/mock/gomock"
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v4/testing/assert"
mock2 "github.com/prysmaticlabs/prysm/v4/testing/mock"
"github.com/prysmaticlabs/prysm/v4/testing/require"
validatormock "github.com/prysmaticlabs/prysm/v4/testing/validator-mock"
"github.com/prysmaticlabs/prysm/v4/validator/accounts"
"github.com/prysmaticlabs/prysm/v4/validator/keymanager"
"google.golang.org/protobuf/types/known/timestamppb"
Expand All @@ -21,8 +21,8 @@ import (
func TestExitAccountsCli_OK(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockValidatorClient := mock2.NewMockValidatorClient(ctrl)
mockNodeClient := mock2.NewMockNodeClient(ctrl)
mockValidatorClient := validatormock.NewMockValidatorClient(ctrl)
mockNodeClient := validatormock.NewMockNodeClient(ctrl)

mockValidatorClient.EXPECT().
ValidatorIndex(gomock.Any(), gomock.Any()).
Expand Down Expand Up @@ -113,8 +113,8 @@ func TestExitAccountsCli_OK(t *testing.T) {
func TestExitAccountsCli_OK_AllPublicKeys(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockValidatorClient := mock2.NewMockValidatorClient(ctrl)
mockNodeClient := mock2.NewMockNodeClient(ctrl)
mockValidatorClient := validatormock.NewMockValidatorClient(ctrl)
mockNodeClient := validatormock.NewMockNodeClient(ctrl)

mockValidatorClient.EXPECT().
ValidatorIndex(gomock.Any(), gomock.Any()).
Expand Down Expand Up @@ -220,8 +220,8 @@ func TestExitAccountsCli_OK_AllPublicKeys(t *testing.T) {
func TestExitAccountsCli_OK_ForceExit(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
mockValidatorClient := mock2.NewMockValidatorClient(ctrl)
mockNodeClient := mock2.NewMockNodeClient(ctrl)
mockValidatorClient := validatormock.NewMockValidatorClient(ctrl)
mockNodeClient := validatormock.NewMockNodeClient(ctrl)

mockValidatorClient.EXPECT().
ValidatorIndex(gomock.Any(), gomock.Any()).
Expand Down
4 changes: 2 additions & 2 deletions config/features/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ func ConfigureBeaconChain(ctx *cli.Context) error {
logEnabled(enableVerboseSigVerification)
cfg.EnableVerboseSigVerification = true
}
if ctx.IsSet(EnableOptionalEngineMethods.Name) {
logEnabled(EnableOptionalEngineMethods)
if ctx.IsSet(enableOptionalEngineMethods.Name) {
logEnabled(enableOptionalEngineMethods)
cfg.EnableOptionalEngineMethods = true
}
Init(cfg)
Expand Down
9 changes: 6 additions & 3 deletions config/features/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,17 @@ var (
Name: "enable-verbose-sig-verification",
Usage: "Enables identifying invalid signatures if batch verification fails when processing block",
}
EnableOptionalEngineMethods = &cli.BoolFlag{
enableOptionalEngineMethods = &cli.BoolFlag{
Name: "enable-optional-engine-methods",
Usage: "Enables the optional engine methods",
}
)

// devModeFlags holds list of flags that are set when development mode is on.
var devModeFlags = []cli.Flag{}
var devModeFlags = []cli.Flag{
enableVerboseSigVerification,
enableOptionalEngineMethods,
}

// ValidatorFlags contains a list of all the feature flags that apply to the validator client.
var ValidatorFlags = append(deprecatedFlags, []cli.Flag{
Expand Down Expand Up @@ -155,7 +158,7 @@ var BeaconChainFlags = append(deprecatedBeaconFlags, append(deprecatedFlags, []c
enableStartupOptimistic,
enableFullSSZDataLogging,
enableVerboseSigVerification,
EnableOptionalEngineMethods,
enableOptionalEngineMethods,
}...)...)

// E2EBeaconChainFlags contains a list of the beacon chain feature flags to be tested in E2E.
Expand Down
8 changes: 6 additions & 2 deletions hack/update-mockgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Use a space to separate mock destination from its interfaces.

mock_path="testing/mock"
iface_mock_path="testing/validator-mock"

# github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1
# ------------------------------------------------------
Expand Down Expand Up @@ -55,14 +56,17 @@ done
# github.com/prysmaticlabs/prysm/v4/validator/client/iface
# --------------------------------------------------------
iface_mocks=(
"$mock_path/validator_client_mock.go ValidatorClient"
"$iface_mock_path/beacon_chain_client_mock.go BeaconChainClient"
"$iface_mock_path/node_client_mock.go NodeClient"
"$iface_mock_path/slasher_client_mock.go SlasherClient"
"$iface_mock_path/validator_client_mock.go ValidatorClient"
)

for ((i = 0; i < ${#iface_mocks[@]}; i++)); do
file=${iface_mocks[i]% *};
interfaces=${iface_mocks[i]#* };
echo "generating $file for interfaces: $interfaces";
GO11MODULE=on mockgen -package=mock -destination="$file" github.com/prysmaticlabs/prysm/v4/validator/client/iface "$interfaces"
GO11MODULE=on mockgen -package=validator_mock -destination="$file" github.com/prysmaticlabs/prysm/v4/validator/client/iface "$interfaces"
done

goimports -w "$mock_path/."
Expand Down
2 changes: 0 additions & 2 deletions testing/mock/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ go_library(
"keymanager_mock.go",
"node_service_mock.go",
"slasher_client_mock.go",
"validator_client_mock.go",
],
importpath = "github.com/prysmaticlabs/prysm/v4/testing/mock",
visibility = ["//visibility:public"],
deps = [
"//consensus-types/primitives:go_default_library",
"//proto/eth/service:go_default_library",
"//proto/eth/v1:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
Expand Down
21 changes: 21 additions & 0 deletions testing/validator-mock/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
load("@prysm//tools/go:def.bzl", "go_library")

package(default_testonly = True)

go_library(
name = "go_default_library",
srcs = [
"beacon_chain_client_mock.go",
"node_client_mock.go",
"slasher_client_mock.go",
"validator_client_mock.go",
],
importpath = "github.com/prysmaticlabs/prysm/v4/testing/validator-mock",
visibility = ["//visibility:public"],
deps = [
"//consensus-types/primitives:go_default_library",
"//proto/prysm/v1alpha1:go_default_library",
"@com_github_golang_mock//gomock:go_default_library",
"@org_golang_google_protobuf//types/known/emptypb:go_default_library",
],
)
Loading

0 comments on commit ddb28b7

Please sign in to comment.