mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Independent eth1 voting (#8811)
This commit is contained in:
parent
f1d7c0f2c9
commit
424e115331
@ -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"],
|
||||
|
@ -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 {
|
||||
|
@ -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{
|
||||
|
13
third_party/rules_docker_bad_checksum.patch
vendored
Normal file
13
third_party/rules_docker_bad_checksum.patch
vendored
Normal file
@ -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",
|
||||
)
|
Loading…
Reference in New Issue
Block a user