diff --git a/WORKSPACE b/WORKSPACE index 458c5b914..377452a5e 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -76,6 +76,8 @@ http_archive( http_archive( name = "io_bazel_rules_docker", + patch_args = ["-p1"], + patches = ["//third_party:rules_docker_bad_checksum.patch"], sha256 = "1286175a94c0b1335efe1d75d22ea06e89742557d3fac2a0366f242a6eac6f5a", strip_prefix = "rules_docker-ba4310833230294fa69b7d6ea1787ac684631a7d", urls = ["https://github.com/bazelbuild/rules_docker/archive/ba4310833230294fa69b7d6ea1787ac684631a7d.tar.gz"], diff --git a/beacon-chain/rpc/validator/proposer.go b/beacon-chain/rpc/validator/proposer.go index 6ae0f66ad..9b5d6f577 100644 --- a/beacon-chain/rpc/validator/proposer.go +++ b/beacon-chain/rpc/validator/proposer.go @@ -229,28 +229,19 @@ func (vs *Server) eth1DataMajorityVote(ctx context.Context, beaconState iface.Be return vs.ChainStartFetcher.ChainStartEth1Data(), nil } - inRangeVotes, err := vs.inRangeVotes(ctx, beaconState, lastBlockByEarliestValidTime.Number, lastBlockByLatestValidTime.Number) - if err != nil { - return nil, err - } - if len(inRangeVotes) == 0 { - if lastBlockDepositCount >= vs.HeadFetcher.HeadETH1Data().DepositCount { - hash, err := vs.Eth1BlockFetcher.BlockHashByHeight(ctx, lastBlockByLatestValidTime.Number) - if err != nil { - log.WithError(err).Error("Could not get hash of last block by latest valid time") - return vs.randomETH1DataVote(ctx) - } - return ðpb.Eth1Data{ - BlockHash: hash.Bytes(), - DepositCount: lastBlockDepositCount, - DepositRoot: lastBlockDepositRoot[:], - }, nil + if lastBlockDepositCount >= vs.HeadFetcher.HeadETH1Data().DepositCount { + hash, err := vs.Eth1BlockFetcher.BlockHashByHeight(ctx, lastBlockByLatestValidTime.Number) + if err != nil { + log.WithError(err).Error("Could not get hash of last block by latest valid time") + return vs.randomETH1DataVote(ctx) } - return vs.HeadFetcher.HeadETH1Data(), nil + return ðpb.Eth1Data{ + BlockHash: hash.Bytes(), + DepositCount: lastBlockDepositCount, + DepositRoot: lastBlockDepositRoot[:], + }, nil } - - chosenVote := chosenEth1DataMajorityVote(inRangeVotes) - return &chosenVote.data.eth1Data, nil + return vs.HeadFetcher.HeadETH1Data(), nil } func (vs *Server) slotStartTime(slot types.Slot) uint64 { diff --git a/beacon-chain/rpc/validator/proposer_test.go b/beacon-chain/rpc/validator/proposer_test.go index ef8018f95..f43d500a2 100644 --- a/beacon-chain/rpc/validator/proposer_test.go +++ b/beacon-chain/rpc/validator/proposer_test.go @@ -1092,6 +1092,7 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { depositCache.InsertDeposit(context.Background(), dc.Deposit, dc.Eth1BlockHeight, dc.Index, depositTrie.Root()) t.Run("choose highest count", func(t *testing.T) { + t.Skip() p := mockPOW.NewPOWChain(). InsertBlock(50, earliestValidTime, []byte("earliest")). InsertBlock(51, earliestValidTime+1, []byte("first")). @@ -1128,6 +1129,7 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { }) t.Run("highest count at earliest valid time - choose highest count", func(t *testing.T) { + t.Skip() p := mockPOW.NewPOWChain(). InsertBlock(50, earliestValidTime, []byte("earliest")). InsertBlock(52, earliestValidTime+2, []byte("second")). @@ -1163,6 +1165,7 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { }) t.Run("highest count at latest valid time - choose highest count", func(t *testing.T) { + t.Skip() p := mockPOW.NewPOWChain(). InsertBlock(50, earliestValidTime, []byte("earliest")). InsertBlock(51, earliestValidTime+1, []byte("first")). @@ -1198,6 +1201,7 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { }) t.Run("highest count before range - choose highest count within range", func(t *testing.T) { + t.Skip() p := mockPOW.NewPOWChain(). InsertBlock(49, earliestValidTime-1, []byte("before_range")). InsertBlock(50, earliestValidTime, []byte("earliest")). @@ -1234,6 +1238,7 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { }) t.Run("highest count after range - choose highest count within range", func(t *testing.T) { + t.Skip() p := mockPOW.NewPOWChain(). InsertBlock(50, earliestValidTime, []byte("earliest")). InsertBlock(51, earliestValidTime+1, []byte("first")). @@ -1270,6 +1275,7 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { }) t.Run("highest count on unknown block - choose known block with highest count", func(t *testing.T) { + t.Skip() p := mockPOW.NewPOWChain(). InsertBlock(50, earliestValidTime, []byte("earliest")). InsertBlock(51, earliestValidTime+1, []byte("first")). @@ -1433,6 +1439,7 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { }) t.Run("same count - choose more recent block", func(t *testing.T) { + t.Skip() p := mockPOW.NewPOWChain(). InsertBlock(50, earliestValidTime, []byte("earliest")). InsertBlock(51, earliestValidTime+1, []byte("first")). @@ -1468,6 +1475,7 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { }) t.Run("highest count on block with less deposits - choose another block", func(t *testing.T) { + t.Skip() p := mockPOW.NewPOWChain(). InsertBlock(50, earliestValidTime, []byte("earliest")). InsertBlock(51, earliestValidTime+1, []byte("first")). @@ -1504,6 +1512,7 @@ func TestProposer_Eth1Data_MajorityVote(t *testing.T) { }) t.Run("only one block at earliest valid time - choose this block", func(t *testing.T) { + t.Skip() p := mockPOW.NewPOWChain().InsertBlock(50, earliestValidTime, []byte("earliest")) beaconState, err := stateV0.InitializeFromProto(&pbp2p.BeaconState{ diff --git a/third_party/rules_docker_bad_checksum.patch b/third_party/rules_docker_bad_checksum.patch new file mode 100644 index 000000000..04167862d --- /dev/null +++ b/third_party/rules_docker_bad_checksum.patch @@ -0,0 +1,13 @@ +diff --git a/repositories/go_repositories.bzl b/repositories/go_repositories.bzl +index 58054f7..12e93eb 100644 +--- a/repositories/go_repositories.bzl ++++ b/repositories/go_repositories.bzl +@@ -39,7 +39,7 @@ def go_deps(): + name = "com_github_google_go_containerregistry", + urls = ["https://api.github.com/repos/google/go-containerregistry/tarball/8a2841911ffee4f6892ca0083e89752fb46c48dd"], # v0.1.4 + strip_prefix = "google-go-containerregistry-8a28419", +- sha256 = "60b9a600affa5667bd444019a4e218b7752d8500cfa923c1ac54ce2f88f773e2", ++ sha256 = "cadb09cb5bcbe00688c73d716d1c9e774d6e4959abec4c425a1b995faf33e964", + importpath = "github.com/google/go-containerregistry", + type = "tar.gz", + ) \ No newline at end of file