diff --git a/beacon-chain/blockchain/core.go b/beacon-chain/blockchain/core.go index b5e52d70e6..f9e15642a9 100644 --- a/beacon-chain/blockchain/core.go +++ b/beacon-chain/blockchain/core.go @@ -300,7 +300,7 @@ func (b *BeaconChain) getAttestation(hash [32]byte) (*types.Attestation, error) return nil, err } - attestation := &pb.AttestationRecord{} + attestation := &pb.AggregatedAttestation{} err = proto.Unmarshal(enc, attestation) diff --git a/beacon-chain/blockchain/core_test.go b/beacon-chain/blockchain/core_test.go index feb5a120d1..58ec01f5bd 100644 --- a/beacon-chain/blockchain/core_test.go +++ b/beacon-chain/blockchain/core_test.go @@ -151,7 +151,7 @@ func TestSetActiveState(t *testing.T) { defer db.Close() data := &pb.ActiveState{ - PendingAttestations: []*pb.AttestationRecord{ + PendingAttestations: []*pb.AggregatedAttestation{ {Slot: 0, ShardBlockHash: []byte{1}}, {Slot: 1, ShardBlockHash: []byte{2}}, }, RecentBlockHashes: [][]byte{ @@ -370,7 +370,7 @@ func TestSaveAndRemoveAttestations(t *testing.T) { b, db := startInMemoryBeaconChain(t) defer db.Close() - attestation := types.NewAttestation(&pb.AttestationRecord{ + attestation := types.NewAttestation(&pb.AggregatedAttestation{ Slot: 1, ShardId: 1, AttesterBitfield: []byte{'A'}, @@ -390,7 +390,7 @@ func TestSaveAndRemoveAttestations(t *testing.T) { } // Adding a different attestation with the same key - newAttestation := types.NewAttestation(&pb.AttestationRecord{ + newAttestation := types.NewAttestation(&pb.AggregatedAttestation{ Slot: 2, ShardId: 2, AttesterBitfield: []byte{'B'}, @@ -440,7 +440,7 @@ func TestSaveAndRemoveAttestationHashList(t *testing.T) { t.Error(err) } - attestation := types.NewAttestation(&pb.AttestationRecord{ + attestation := types.NewAttestation(&pb.AggregatedAttestation{ Slot: 1, ShardId: 1, AttesterBitfield: []byte{'A'}, diff --git a/beacon-chain/blockchain/service.go b/beacon-chain/blockchain/service.go index 39dcd24198..8fc93d2eaf 100644 --- a/beacon-chain/blockchain/service.go +++ b/beacon-chain/blockchain/service.go @@ -127,6 +127,15 @@ func (c *ChainService) ContainsBlock(h [32]byte) (bool, error) { return c.chain.hasBlock(h) } +// GetBlockSlotNumber returns the slot number of a block. +func (c *ChainService) GetBlockSlotNumber(h [32]byte) (uint64, error) { + block, err := c.chain.getBlock(h) + if err != nil { + return 0, fmt.Errorf("could not get block from DB: %v", err) + } + return block.SlotNumber(), nil +} + // CurrentCrystallizedState of the canonical chain. func (c *ChainService) CurrentCrystallizedState() *types.CrystallizedState { return c.chain.CrystallizedState() @@ -228,14 +237,18 @@ func (c *ChainService) blockProcessing(done <-chan struct{}) { case <-done: log.Debug("Chain service context closed, exiting goroutine") return - // Listen for a newly received incoming block from the sync service. + // Listen for a newly received incoming attestation from the sync service. case attestation := <-c.incomingAttestationChan: h, err := attestation.Hash() if err != nil { log.Debugf("Could not hash incoming attestation: %v", err) } - log.Info("Relaying attestation 0x%v to p2p service", h) + if err := c.chain.saveAttestation(attestation); err != nil { + log.Errorf("Could not save attestation: %v", err) + continue + } + log.Infof("Relaying attestation 0x%x to subscriber", h) // TODO: Send attestation to P2P and broadcast attestation to rest of the peers. // Listen for a newly received incoming block from the sync service. @@ -260,7 +273,7 @@ func (c *ChainService) blockProcessing(done <-chan struct{}) { log.Errorf("Could not check existence of parent: %v", err) continue } - // Get parent slot number. + parentBlock, err := c.chain.getBlock(block.ParentHash()) if err != nil { log.Errorf("Could not get parent block: %v", err) @@ -271,7 +284,7 @@ func (c *ChainService) blockProcessing(done <-chan struct{}) { continue } - // If a candidate block exists and it is a lower slot, run theh fork choice rule. + // If a candidate block exists and it is a lower slot, run the fork choice rule. if c.candidateBlock != nilBlock && block.SlotNumber() > c.candidateBlock.SlotNumber() { c.updateHead() } diff --git a/beacon-chain/blockchain/service_test.go b/beacon-chain/blockchain/service_test.go index df2f0064fb..e400c6d2aa 100644 --- a/beacon-chain/blockchain/service_test.go +++ b/beacon-chain/blockchain/service_test.go @@ -264,9 +264,9 @@ func TestRunningChainService(t *testing.T) { CrystallizedStateHash: crystallizedStateHash[:], ParentHash: parentHash[:], PowChainRef: []byte("a"), - Attestations: []*pb.AttestationRecord{{ + Attestations: []*pb.AggregatedAttestation{{ Slot: 0, - AttesterBitfield: []byte{'A', 'B'}, + AttesterBitfield: []byte{128, 0}, ShardId: 0, }}, }) @@ -284,6 +284,21 @@ func TestRunningChainService(t *testing.T) { chainService.cancel() exitRoutine <- true + hash, err := block.Hash() + if err != nil { + t.Fatal("Can not hash the block") + } + slot, err := chainService.GetBlockSlotNumber(hash) + if err != nil { + t.Fatal("Can not get block slot number") + } + if slot != block.SlotNumber() { + t.Errorf("Block slot number mismatched, wanted 1, got slot %d", block.SlotNumber()) + } + if _, err := chainService.GetBlockSlotNumber([32]byte{}); err == nil { + t.Fatal("Get block slot number should have failed with nil hash") + } + testutil.AssertLogsContain(t, hook, "Finished processing state for candidate block") } @@ -345,69 +360,6 @@ func TestUpdateHead(t *testing.T) { } } -func TestProcessingBlockWithAttestations(t *testing.T) { - ctx := context.Background() - config := &database.DBConfig{DataDir: "", Name: "", InMemory: true} - db, err := database.NewDB(config) - if err != nil { - t.Fatalf("could not setup beaconDB: %v", err) - - } - endpoint := "ws://127.0.0.1" - client := &mockClient{} - web3Service, err := powchain.NewWeb3Service(ctx, &powchain.Web3ServiceConfig{Endpoint: endpoint, Pubkey: "", VrcAddr: common.Address{}}, client, client, client) - if err != nil { - t.Fatalf("unable to set up web3 service: %v", err) - } - beaconChain, err := NewBeaconChain(db.DB()) - if err != nil { - t.Fatalf("could not register blockchain service: %v", err) - } - - active := beaconChain.ActiveState() - activeHash, _ := active.Hash() - - crystallized := beaconChain.CrystallizedState() - crystallizedHash, _ := crystallized.Hash() - - cfg := &Config{ - BeaconBlockBuf: 0, - BeaconDB: db.DB(), - Chain: beaconChain, - Web3Service: web3Service, - } - - chainService, _ := NewChainService(ctx, cfg) - - exitRoutine := make(chan bool) - go func() { - chainService.blockProcessing(chainService.ctx.Done()) - <-exitRoutine - }() - - parentBlock := types.NewBlock(nil) - if err := chainService.SaveBlock(parentBlock); err != nil { - t.Fatal(err) - } - parentHash, _ := parentBlock.Hash() - - block := types.NewBlock(&pb.BeaconBlock{ - SlotNumber: 2, - ActiveStateHash: activeHash[:], - CrystallizedStateHash: crystallizedHash[:], - ParentHash: parentHash[:], - PowChainRef: []byte("a"), - Attestations: []*pb.AttestationRecord{ - {Slot: 0, ShardId: 0, AttesterBitfield: []byte{'0'}}, - }, - }) - - chainService.incomingBlockChan <- block - chainService.cancel() - exitRoutine <- true - -} - func TestProcessingBlocks(t *testing.T) { ctx := context.Background() config := &database.DBConfig{DataDir: "", Name: "", InMemory: true} @@ -467,9 +419,9 @@ func TestProcessingBlocks(t *testing.T) { SlotNumber: 4, ActiveStateHash: activeStateHash[:], CrystallizedStateHash: crystallizedStateHash[:], - Attestations: []*pb.AttestationRecord{{ + Attestations: []*pb.AggregatedAttestation{{ Slot: 0, - AttesterBitfield: []byte{0, 0}, + AttesterBitfield: []byte{16, 0}, ShardId: 0, }}, }) @@ -482,9 +434,9 @@ func TestProcessingBlocks(t *testing.T) { block2 := types.NewBlock(&pb.BeaconBlock{ ParentHash: block1Hash[:], SlotNumber: 5, - Attestations: []*pb.AttestationRecord{ - {Slot: 0, AttesterBitfield: []byte{0, 0}, ShardId: 0}, - {Slot: 1, AttesterBitfield: []byte{0, 0}, ShardId: 0}, + Attestations: []*pb.AggregatedAttestation{ + {Slot: 0, AttesterBitfield: []byte{8, 0}, ShardId: 0}, + {Slot: 1, AttesterBitfield: []byte{8, 0}, ShardId: 0}, }}) block2Hash, err := block2.Hash() if err != nil { @@ -495,10 +447,10 @@ func TestProcessingBlocks(t *testing.T) { block3 := types.NewBlock(&pb.BeaconBlock{ ParentHash: block2Hash[:], SlotNumber: 6, - Attestations: []*pb.AttestationRecord{ - {Slot: 0, AttesterBitfield: []byte{0, 0}, ShardId: 0}, - {Slot: 1, AttesterBitfield: []byte{0, 0}, ShardId: 0}, - {Slot: 2, AttesterBitfield: []byte{0, 0}, ShardId: 0}, + Attestations: []*pb.AggregatedAttestation{ + {Slot: 0, AttesterBitfield: []byte{4, 0}, ShardId: 0}, + {Slot: 1, AttesterBitfield: []byte{4, 0}, ShardId: 0}, + {Slot: 2, AttesterBitfield: []byte{4, 0}, ShardId: 0}, }}) chainService.incomingBlockChan <- block1 @@ -573,7 +525,7 @@ func TestProcessAttestationBadBlock(t *testing.T) { SlotNumber: 1, ActiveStateHash: activeStateHash[:], CrystallizedStateHash: crystallizedStateHash[:], - Attestations: []*pb.AttestationRecord{{ + Attestations: []*pb.AggregatedAttestation{{ Slot: 10, AttesterBitfield: []byte{}, ShardId: 0, @@ -636,9 +588,9 @@ func TestEnterCycleTransition(t *testing.T) { SlotNumber: 64, ActiveStateHash: activeStateHash[:], CrystallizedStateHash: crystallizedStateHash[:], - Attestations: []*pb.AttestationRecord{{ + Attestations: []*pb.AggregatedAttestation{{ Slot: 0, - AttesterBitfield: []byte{0, 0}, + AttesterBitfield: []byte{128, 0}, ShardId: 0, }}, }) @@ -708,6 +660,7 @@ func TestEnterDynastyTransition(t *testing.T) { LastFinalizedSlot: 2, ShardAndCommitteesForSlots: shardCommitteeForSlots, Validators: validators, + LastStateRecalc: 150, CrosslinkRecords: []*pb.CrosslinkRecord{ {Slot: 2}, {Slot: 2}, @@ -724,7 +677,7 @@ func TestEnterDynastyTransition(t *testing.T) { active := types.NewActiveState( &pb.ActiveState{ RecentBlockHashes: recentBlockhashes, - PendingAttestations: []*pb.AttestationRecord{ + PendingAttestations: []*pb.AggregatedAttestation{ {Slot: 100, AttesterBitfield: []byte{0}}, {Slot: 101, AttesterBitfield: []byte{0}}, {Slot: 102, AttesterBitfield: []byte{0}}, @@ -758,9 +711,9 @@ func TestEnterDynastyTransition(t *testing.T) { SlotNumber: params.MinDynastyLength + 1, ActiveStateHash: activeStateHash[:], CrystallizedStateHash: crystallizedStateHash[:], - Attestations: []*pb.AttestationRecord{{ + Attestations: []*pb.AggregatedAttestation{{ Slot: 200, - AttesterBitfield: []byte{0}, + AttesterBitfield: []byte{32}, ShardId: 0, }}, }) @@ -778,3 +731,52 @@ func TestEnterDynastyTransition(t *testing.T) { testutil.AssertLogsContain(t, hook, "Entering dynasty transition") } + +func TestIncomingAttestation(t *testing.T) { + hook := logTest.NewGlobal() + ctx := context.Background() + config := &database.DBConfig{DataDir: "", Name: "", InMemory: true} + db, err := database.NewDB(config) + if err != nil { + t.Fatalf("could not setup beaconDB: %v", err) + } + + endpoint := "ws://127.0.0.1" + client := &mockClient{} + web3Service, err := powchain.NewWeb3Service(ctx, &powchain.Web3ServiceConfig{Endpoint: endpoint, Pubkey: "", VrcAddr: common.Address{}}, client, client, client) + if err != nil { + t.Fatalf("unable to set up web3 service: %v", err) + } + beaconChain, err := NewBeaconChain(db.DB()) + if err != nil { + t.Fatalf("could not register blockchain service: %v", err) + } + + cfg := &Config{ + BeaconBlockBuf: 0, + BeaconDB: db.DB(), + Chain: beaconChain, + Web3Service: web3Service, + } + + chainService, _ := NewChainService(ctx, cfg) + + exitRoutine := make(chan bool) + go func() { + chainService.blockProcessing(chainService.ctx.Done()) + <-exitRoutine + }() + + attestation := types.NewAttestation( + &pb.AggregatedAttestation{ + Slot: 1, + ShardId: 1, + ShardBlockHash: []byte{'A'}, + }) + + chainService.incomingAttestationChan <- attestation + chainService.cancel() + exitRoutine <- true + + testutil.AssertLogsContain(t, hook, "Relaying attestation") +} diff --git a/beacon-chain/casper/incentives.go b/beacon-chain/casper/incentives.go index e613f3499e..b1726f5a13 100644 --- a/beacon-chain/casper/incentives.go +++ b/beacon-chain/casper/incentives.go @@ -11,7 +11,7 @@ var log = logrus.WithField("prefix", "casper") // CalculateRewards adjusts validators balances by applying rewards or penalties // based on FFG incentive structure. -func CalculateRewards(attestations []*pb.AttestationRecord, validators []*pb.ValidatorRecord, dynasty uint64, totalDeposit uint64) ([]*pb.ValidatorRecord, error) { +func CalculateRewards(attestations []*pb.AggregatedAttestation, validators []*pb.ValidatorRecord, dynasty uint64, totalDeposit uint64) ([]*pb.ValidatorRecord, error) { activeValidators := ActiveValidatorIndices(validators, dynasty) attesterDeposits := GetAttestersTotalDeposit(attestations) diff --git a/beacon-chain/casper/incentives_test.go b/beacon-chain/casper/incentives_test.go index b494b6f0f7..f23392ee9f 100644 --- a/beacon-chain/casper/incentives_test.go +++ b/beacon-chain/casper/incentives_test.go @@ -22,7 +22,7 @@ func TestComputeValidatorRewardsAndPenalties(t *testing.T) { } // Binary representation of bitfield: 11001000 10010100 10010010 10110011 00110001 - testAttesterBitfield := []*pb.AttestationRecord{{AttesterBitfield: []byte{200, 148, 146, 179, 49}}} + testAttesterBitfield := []*pb.AggregatedAttestation{{AttesterBitfield: []byte{200, 148, 146, 179, 49}}} rewardedValidators, err := CalculateRewards( testAttesterBitfield, data.Validators, diff --git a/beacon-chain/casper/validator.go b/beacon-chain/casper/validator.go index c70d64e56a..c05927b8f1 100644 --- a/beacon-chain/casper/validator.go +++ b/beacon-chain/casper/validator.go @@ -92,12 +92,10 @@ func SampleAttestersAndProposers(seed common.Hash, validators []*pb.ValidatorRec } // GetAttestersTotalDeposit from the pending attestations. -func GetAttestersTotalDeposit(attestations []*pb.AttestationRecord) uint64 { +func GetAttestersTotalDeposit(attestations []*pb.AggregatedAttestation) uint64 { var numOfBits int for _, attestation := range attestations { - for _, byte := range attestation.AttesterBitfield { - numOfBits += int(utils.BitSetCount(byte)) - } + numOfBits += int(utils.BitSetCount(attestation.AttesterBitfield)) } // Assume there's no slashing condition, the following logic will change later phase. return uint64(numOfBits) * params.DefaultBalance @@ -113,7 +111,7 @@ func GetShardAndCommitteesForSlot(shardCommittees []*pb.ShardAndCommitteeArray, // AreAttesterBitfieldsValid validates that the length of the attester bitfield matches the attester indices // defined in the Crystallized State. -func AreAttesterBitfieldsValid(attestation *pb.AttestationRecord, attesterIndices []uint32) bool { +func AreAttesterBitfieldsValid(attestation *pb.AggregatedAttestation, attesterIndices []uint32) bool { // Validate attester bit field has the correct length. if utils.BitLength(len(attesterIndices)) != len(attestation.AttesterBitfield) { log.Debugf("attestation has incorrect bitfield length. Found %v, expected %v", @@ -137,3 +135,24 @@ func AreAttesterBitfieldsValid(attestation *pb.AttestationRecord, attesterIndice return true } + +// GetProposerIndexAndShard returns the index and the shardID of a proposer from a given slot. +func GetProposerIndexAndShard(shardCommittees []*pb.ShardAndCommitteeArray, lcs uint64, slot uint64) (uint64, uint64, error) { + if lcs < params.CycleLength { + lcs = 0 + } else { + lcs = lcs - params.CycleLength + } + + slotCommittees, err := GetShardAndCommitteesForSlot( + shardCommittees, + lcs, + slot) + if err != nil { + return 0, 0, err + } + + proposerShardID := slotCommittees.ArrayShardAndCommittee[0].ShardId + proposerIndex := slot % uint64(len(slotCommittees.ArrayShardAndCommittee[0].Committee)) + return proposerShardID, proposerIndex, nil +} diff --git a/beacon-chain/casper/validator_test.go b/beacon-chain/casper/validator_test.go index 4a768b41b0..3a0a7be19b 100644 --- a/beacon-chain/casper/validator_test.go +++ b/beacon-chain/casper/validator_test.go @@ -67,7 +67,7 @@ func TestRotateValidatorSet(t *testing.T) { func TestHasVoted(t *testing.T) { // Setting bit field to 11111111. - pendingAttestation := &pb.AttestationRecord{ + pendingAttestation := &pb.AggregatedAttestation{ AttesterBitfield: []byte{255}, } @@ -79,7 +79,7 @@ func TestHasVoted(t *testing.T) { } // Setting bit field to 01010101. - pendingAttestation = &pb.AttestationRecord{ + pendingAttestation = &pb.AggregatedAttestation{ AttesterBitfield: []byte{85}, } @@ -141,7 +141,7 @@ func TestValidatorIndices(t *testing.T) { } func TestAreAttesterBitfieldsValid(t *testing.T) { - attestation := &pb.AttestationRecord{ + attestation := &pb.AggregatedAttestation{ AttesterBitfield: []byte{'F'}, } @@ -154,7 +154,7 @@ func TestAreAttesterBitfieldsValid(t *testing.T) { } func TestAreAttesterBitfieldsValidFalse(t *testing.T) { - attestation := &pb.AttestationRecord{ + attestation := &pb.AggregatedAttestation{ AttesterBitfield: []byte{'F', 'F'}, } @@ -167,7 +167,7 @@ func TestAreAttesterBitfieldsValidFalse(t *testing.T) { } func TestAreAttesterBitfieldsValidZerofill(t *testing.T) { - attestation := &pb.AttestationRecord{ + attestation := &pb.AggregatedAttestation{ AttesterBitfield: []byte{'F'}, } @@ -180,7 +180,7 @@ func TestAreAttesterBitfieldsValidZerofill(t *testing.T) { } func TestAreAttesterBitfieldsValidNoZerofill(t *testing.T) { - attestation := &pb.AttestationRecord{ + attestation := &pb.AggregatedAttestation{ AttesterBitfield: []byte{'E'}, } @@ -191,3 +191,24 @@ func TestAreAttesterBitfieldsValidNoZerofill(t *testing.T) { t.Fatalf("expected validation to fail for bitfield %v and indices %v", attestation, indices) } } + +func TestGetProposerIndexAndShard(t *testing.T) { + shardCommittees := []*pb.ShardAndCommitteeArray{ + {ArrayShardAndCommittee: []*pb.ShardAndCommittee{ + {ShardId: 99, Committee: []uint32{0, 1, 2, 3, 4}}, + }}, + } + if _, _, err := GetProposerIndexAndShard(shardCommittees, 100, 0); err == nil { + t.Error("GetProposerIndexAndShard should have failed with invalid lcs") + } + shardID, index, err := GetProposerIndexAndShard(shardCommittees, 0, 0) + if err != nil { + t.Fatalf("GetProposerIndexAndShard failed with %v", err) + } + if shardID != 99 { + t.Errorf("Invalid shard ID. Wanted 99, got %d", shardID) + } + if index != 0 { + t.Errorf("Invalid proposer index. Wanted 0, got %d", index) + } +} diff --git a/beacon-chain/rpc/service_test.go b/beacon-chain/rpc/service_test.go index 38837444a3..3a277afebe 100644 --- a/beacon-chain/rpc/service_test.go +++ b/beacon-chain/rpc/service_test.go @@ -254,7 +254,7 @@ func TestAttestHead(t *testing.T) { ChainService: mockChain, }) req := &pb.AttestRequest{ - Attestation: &pbp2p.AttestationRecord{ + Attestation: &pbp2p.AggregatedAttestation{ Slot: 999, ShardId: 1, ShardBlockHash: []byte{'a'}, diff --git a/beacon-chain/simulator/service.go b/beacon-chain/simulator/service.go index 81b590cfe9..db04e48eca 100644 --- a/beacon-chain/simulator/service.go +++ b/beacon-chain/simulator/service.go @@ -214,7 +214,7 @@ func (sim *Simulator) run(delayChan <-chan time.Time, done <-chan struct{}) { } log.Debugf("Responding to full block request for hash: 0x%x", h) // Sends the full block body to the requester. - res := &pb.BeaconBlockResponse{Block: block.Proto()} + res := &pb.BeaconBlockResponse{Block: block.Proto(), Attestation: nil} sim.p2p.Send(res, msg.Peer) } } diff --git a/beacon-chain/sync/BUILD.bazel b/beacon-chain/sync/BUILD.bazel index 300318d61e..2e20296c3e 100644 --- a/beacon-chain/sync/BUILD.bazel +++ b/beacon-chain/sync/BUILD.bazel @@ -6,6 +6,7 @@ go_library( importpath = "github.com/prysmaticlabs/prysm/beacon-chain/sync", visibility = ["//beacon-chain:__subpackages__"], deps = [ + "//beacon-chain/casper:go_default_library", "//beacon-chain/types:go_default_library", "//proto/beacon/p2p/v1:go_default_library", "//shared/p2p:go_default_library", diff --git a/beacon-chain/sync/service.go b/beacon-chain/sync/service.go index 50f4fc6bfa..3162d18445 100644 --- a/beacon-chain/sync/service.go +++ b/beacon-chain/sync/service.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/ethereum/go-ethereum/event" + "github.com/prysmaticlabs/prysm/beacon-chain/casper" "github.com/prysmaticlabs/prysm/beacon-chain/types" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/p2p" @@ -18,8 +19,11 @@ type chainService interface { ContainsBlock(h [32]byte) (bool, error) HasStoredState() (bool, error) IncomingBlockFeed() *event.Feed + IncomingAttestationFeed() *event.Feed CheckForCanonicalBlockBySlot(slotnumber uint64) (bool, error) GetCanonicalBlockBySlotNumber(slotnumber uint64) (*types.Block, error) + GetBlockSlotNumber(h [32]byte) (uint64, error) + CurrentCrystallizedState() *types.CrystallizedState } // Service is the gateway and the bridge between the p2p network and the local beacon chain. @@ -158,12 +162,14 @@ func (ss *Service) run() { log.Error("Received malformed beacon block p2p message") continue } + block := types.NewBlock(response.Block) - h, err := block.Hash() + blockHash, err := block.Hash() if err != nil { log.Errorf("Could not hash received block: %v", err) } - blockExists, err := ss.chainService.ContainsBlock(h) + + blockExists, err := ss.chainService.ContainsBlock(blockHash) if err != nil { log.Errorf("Can not check for block in DB: %v", err) continue @@ -171,9 +177,30 @@ func (ss *Service) run() { if blockExists { continue } - log.WithField("blockHash", fmt.Sprintf("0x%x", h)).Debug("Sending newly received block to subscribers") - // We send out a message over a feed. + + // Verify attestation coming from proposer then forward block to the subscribers. + attestation := types.NewAttestation(response.Attestation) + cState := ss.chainService.CurrentCrystallizedState() + parentSlot, err := ss.chainService.GetBlockSlotNumber(block.ParentHash()) + if err != nil { + log.Errorf("Failed to get parent slot: %v", err) + continue + } + proposerShardID, _, err := casper.GetProposerIndexAndShard(cState.ShardAndCommitteesForSlots(), cState.LastStateRecalc(), parentSlot) + if err != nil { + log.Errorf("Failed to get proposer shard ID: %v", err) + continue + } + if err := attestation.VerifyAttestation(proposerShardID); err != nil { + log.Errorf("Failed to verify proposer attestation: %v", err) + continue + } + + log.WithField("blockHash", fmt.Sprintf("0x%x", blockHash)).Debug("Sending newly received block to subscribers") ss.chainService.IncomingBlockFeed().Send(block) + log.WithField("attestationHash", fmt.Sprintf("0x%x", attestation.Key())).Debug("Sending newly received attestation to subscribers") + ss.chainService.IncomingAttestationFeed().Send(attestation) + case msg := <-ss.blockRequestBySlot: request, ok := msg.Data.(*pb.BeaconBlockRequestBySlotNumber) if !ok { diff --git a/beacon-chain/sync/service_test.go b/beacon-chain/sync/service_test.go index f44f53b930..fdf41ee557 100644 --- a/beacon-chain/sync/service_test.go +++ b/beacon-chain/sync/service_test.go @@ -3,6 +3,7 @@ package sync import ( "context" "errors" + "fmt" "io/ioutil" "testing" @@ -52,6 +53,22 @@ func (ms *mockChainService) IncomingBlockFeed() *event.Feed { return new(event.Feed) } +func (ms *mockChainService) IncomingAttestationFeed() *event.Feed { + return new(event.Feed) +} + +func (ms *mockChainService) CurrentCrystallizedState() *types.CrystallizedState { + cState, err := types.NewGenesisCrystallizedState() + if err != nil { + fmt.Println(err) + } + return cState +} + +func (ms *mockChainService) GetBlockSlotNumber(h [32]byte) (uint64, error) { + return 0, nil +} + func (ms *mockChainService) CheckForCanonicalBlockBySlot(slotnumber uint64) (bool, error) { if ms.checkError { return ms.slotExists, errors.New("mock check canonical block error") @@ -121,9 +138,15 @@ func TestProcessBlock(t *testing.T) { PowChainRef: []byte{1, 2, 3, 4, 5}, ParentHash: make([]byte, 32), } + attestation := &pb.AggregatedAttestation{ + Slot: 0, + ShardId: 0, + ShardBlockHash: []byte{'A'}, + } responseBlock := &pb.BeaconBlockResponse{ - Block: data, + Block: data, + Attestation: attestation, } msg := p2p.Message{ @@ -316,6 +339,10 @@ func (ms *mockEmptyChainService) IncomingBlockFeed() *event.Feed { return new(event.Feed) } +func (ms *mockEmptyChainService) IncomingAttestationFeed() *event.Feed { + return new(event.Feed) +} + func (ms *mockEmptyChainService) setState(flag bool) { ms.hasStoredState = flag } @@ -328,6 +355,14 @@ func (ms *mockEmptyChainService) GetCanonicalBlockBySlotNumber(slotnumber uint64 return nil, nil } +func (ms *mockEmptyChainService) CurrentCrystallizedState() *types.CrystallizedState { + return types.NewCrystallizedState(nil) +} + +func (ms *mockEmptyChainService) GetBlockSlotNumber(h [32]byte) (uint64, error) { + return 0, nil +} + func TestStartEmptyState(t *testing.T) { hook := logTest.NewGlobal() cfg := DefaultConfig() diff --git a/beacon-chain/types/active_state.go b/beacon-chain/types/active_state.go index 733fd4eb14..c26131f8fd 100644 --- a/beacon-chain/types/active_state.go +++ b/beacon-chain/types/active_state.go @@ -29,7 +29,7 @@ func NewGenesisActiveState() *ActiveState { return &ActiveState{ data: &pb.ActiveState{ - PendingAttestations: []*pb.AttestationRecord{}, + PendingAttestations: []*pb.AggregatedAttestation{}, RecentBlockHashes: recentBlockHashes, }, blockVoteCache: make(map[[32]byte]*VoteCache), @@ -65,7 +65,7 @@ func (a *ActiveState) Hash() ([32]byte, error) { } // PendingAttestations returns attestations that have not yet been processed. -func (a *ActiveState) PendingAttestations() []*pb.AttestationRecord { +func (a *ActiveState) PendingAttestations() []*pb.AggregatedAttestation { return a.data.PendingAttestations } @@ -89,9 +89,9 @@ func (a *ActiveState) GetBlockVoteCache() map[[32]byte]*VoteCache { return a.blockVoteCache } -func (a *ActiveState) calculateNewAttestations(add []*pb.AttestationRecord, lastStateRecalc uint64) []*pb.AttestationRecord { +func (a *ActiveState) calculateNewAttestations(add []*pb.AggregatedAttestation, lastStateRecalc uint64) []*pb.AggregatedAttestation { existing := a.data.PendingAttestations - update := []*pb.AttestationRecord{} + update := []*pb.AggregatedAttestation{} for i := 0; i < len(existing); i++ { if existing[i].GetSlot() >= lastStateRecalc { update = append(update, existing[i]) @@ -198,7 +198,7 @@ func (a *ActiveState) CalculateNewActiveState(block *Block, cState *Crystallized } // getSignedParentHashes returns all the parent hashes stored in active state up to last cycle length. -func (a *ActiveState) getSignedParentHashes(block *Block, attestation *pb.AttestationRecord) [][32]byte { +func (a *ActiveState) getSignedParentHashes(block *Block, attestation *pb.AggregatedAttestation) [][32]byte { var signedParentHashes [][32]byte start := block.SlotNumber() - attestation.Slot end := block.SlotNumber() - attestation.Slot - uint64(len(attestation.ObliqueParentHashes)) + params.CycleLength diff --git a/beacon-chain/types/active_state_test.go b/beacon-chain/types/active_state_test.go index ccc8cc7cce..d685f0f7ea 100644 --- a/beacon-chain/types/active_state_test.go +++ b/beacon-chain/types/active_state_test.go @@ -26,7 +26,7 @@ func TestGenesisActiveState(t *testing.T) { func TestUpdateAttestations(t *testing.T) { aState := NewGenesisActiveState() - newAttestations := []*pb.AttestationRecord{ + newAttestations := []*pb.AggregatedAttestation{ { Slot: 0, ShardId: 0, @@ -45,7 +45,7 @@ func TestUpdateAttestations(t *testing.T) { func TestUpdateAttestationsAfterRecalc(t *testing.T) { aState := NewActiveState(&pb.ActiveState{ - PendingAttestations: []*pb.AttestationRecord{ + PendingAttestations: []*pb.AggregatedAttestation{ { Slot: 0, ShardId: 0, @@ -57,7 +57,7 @@ func TestUpdateAttestationsAfterRecalc(t *testing.T) { }, }, nil) - newAttestations := []*pb.AttestationRecord{ + newAttestations := []*pb.AggregatedAttestation{ { Slot: 10, ShardId: 2, @@ -138,7 +138,7 @@ func TestBlockVoteCache(t *testing.T) { } block := NewBlock(&pb.BeaconBlock{ SlotNumber: 1, - Attestations: []*pb.AttestationRecord{ + Attestations: []*pb.AggregatedAttestation{ { Slot: 0, ShardId: 0, @@ -185,7 +185,7 @@ func TestCalculateNewActiveState(t *testing.T) { } aState := NewActiveState(&pb.ActiveState{ - PendingAttestations: []*pb.AttestationRecord{ + PendingAttestations: []*pb.AggregatedAttestation{ { Slot: 0, ShardId: 0, diff --git a/beacon-chain/types/attestation.go b/beacon-chain/types/attestation.go index 3b5908b916..8655a4c1b6 100644 --- a/beacon-chain/types/attestation.go +++ b/beacon-chain/types/attestation.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/golang/protobuf/proto" + "github.com/prysmaticlabs/prysm/beacon-chain/params" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "golang.org/x/crypto/blake2b" ) @@ -13,15 +14,15 @@ import ( // Attestation is the primary source of load on the beacon chain, it's used to // attest to some parent block in the chain and block hash in a shard. type Attestation struct { - data *pb.AttestationRecord + data *pb.AggregatedAttestation } // NewAttestation explicitly sets the data field of a attestation. // Return attestation with default fields if data is nil. -func NewAttestation(data *pb.AttestationRecord) *Attestation { +func NewAttestation(data *pb.AggregatedAttestation) *Attestation { if data == nil { return &Attestation{ - data: &pb.AttestationRecord{ + data: &pb.AggregatedAttestation{ Slot: 0, ShardId: 0, JustifiedSlot: 0, @@ -37,7 +38,7 @@ func NewAttestation(data *pb.AttestationRecord) *Attestation { } // Proto returns the underlying protobuf data. -func (a *Attestation) Proto() *pb.AttestationRecord { +func (a *Attestation) Proto() *pb.AggregatedAttestation { return a.data } @@ -121,3 +122,43 @@ func (a *Attestation) ObliqueParentHashes() [][32]byte { func (a *Attestation) AggregateSig() []uint64 { return a.data.AggregateSig } + +// VerifyAttestation verifies the proposer's attestation of the block. +// Proposers broadcast the attestation along with the block to its peers. +func (a *Attestation) VerifyAttestation(proposerShardID uint64) error { + + // Verify the attestation attached with block response. + // Get proposer index and shardID. + + attestationMsg := AttestationMsg( + a.ObliqueParentHashes(), + a.ShardBlockHash(), + a.SlotNumber(), + proposerShardID, + a.JustifiedSlotNumber()) + + log.Infof("Constructed attestation message for incoming block 0x%x", attestationMsg) + + // TODO(#258): use attestationMsg to verify against signature and public key. Return error if incorrect. + + log.Info("successfully verified attestation with incoming block") + return nil +} + +// AttestationMsg hashes parentHashes + shardID + slotNumber + shardBlockHash + justifiedSlot +// into a message to use for verifying with aggregated public key and signature. +func AttestationMsg(parentHashes [][32]byte, blockHash []byte, slot uint64, shardID uint64, justifiedSlot uint64) [32]byte { + msg := make([]byte, binary.MaxVarintLen64) + binary.PutUvarint(msg, slot%params.CycleLength) + for _, parentHash := range parentHashes { + msg = append(msg, parentHash[:]...) + } + binary.PutUvarint(msg, shardID) + msg = append(msg, blockHash...) + binary.PutUvarint(msg, justifiedSlot) + + var hashMsg [32]byte + h := blake2b.Sum512(msg) + copy(hashMsg[:], h[:32]) + return hashMsg +} diff --git a/beacon-chain/types/attestation_test.go b/beacon-chain/types/attestation_test.go index c9ba8d9878..7d6ff74775 100644 --- a/beacon-chain/types/attestation_test.go +++ b/beacon-chain/types/attestation_test.go @@ -9,7 +9,7 @@ import ( ) func TestAttestation(t *testing.T) { - data := &pb.AttestationRecord{ + data := &pb.AggregatedAttestation{ Slot: 0, ShardId: 0, JustifiedSlot: 0, @@ -52,4 +52,7 @@ func TestAttestation(t *testing.T) { if !bytes.Equal(attestation.ShardBlockHash(), []byte{0}) { t.Errorf("mismatched shard block hash") } + if err := attestation.VerifyAttestation(0); err != nil { + t.Errorf("verify attestation failed: %v", err) + } } diff --git a/beacon-chain/types/block.go b/beacon-chain/types/block.go index b6d196777f..a41f387342 100644 --- a/beacon-chain/types/block.go +++ b/beacon-chain/types/block.go @@ -2,7 +2,6 @@ package types import ( - "encoding/binary" "fmt" "time" @@ -125,7 +124,7 @@ func (b *Block) AttestationCount() int { } // Attestations returns an array of attestations in the block. -func (b *Block) Attestations() []*pb.AttestationRecord { +func (b *Block) Attestations() []*pb.AggregatedAttestation { return b.data.Attestations } @@ -142,34 +141,49 @@ func (b *Block) isSlotValid() bool { return clock.Now().After(validTimeThreshold) } -// IsValid is called to decide if an incoming p2p block can be processed. -// It checks the slot against the system clock, and the validity of the included attestations. -// Existence of the parent block and the PoW chain block is checked outside of this function because they require additional dependencies. +// IsValid is called to decide if an incoming p2p block can be processed. It checks for following conditions: +// 1.) Ensure parent processed. +// 2.) Ensure pow_chain_ref processed. +// 3.) Ensure local time is large enough to process this block's slot. +// 4.) Verify that the parent block's proposer's attestation is included. func (b *Block) IsValid(aState *ActiveState, cState *CrystallizedState, parentSlot uint64) bool { _, err := b.Hash() if err != nil { - log.Debugf("Could not hash incoming block: %v", err) + log.Errorf("Could not hash incoming block: %v", err) return false } if b.SlotNumber() == 0 { - log.Debug("Can not process a genesis block") + log.Error("Can not process a genesis block") return false } if !b.isSlotValid() { - log.Debugf("slot of block is too high: %d", b.SlotNumber()) + log.Errorf("Slot of block is too high: %d", b.SlotNumber()) return false } + // verify proposer from last slot is in one of the AggregatedAttestation. + var proposerAttested bool + _, proposerIndex, err := casper.GetProposerIndexAndShard( + cState.ShardAndCommitteesForSlots(), + cState.LastStateRecalc(), + parentSlot) + if err != nil { + log.Errorf("Can not get proposer index %v", err) + return false + } for index, attestation := range b.Attestations() { if !b.isAttestationValid(index, aState, cState, parentSlot) { log.Debugf("attestation invalid: %v", attestation) return false } + if utils.BitSetCount(attestation.AttesterBitfield) == 1 && utils.CheckBit(attestation.AttesterBitfield, int(proposerIndex)) { + proposerAttested = true + } } - return true + return proposerAttested } // isAttestationValid validates an attestation in a block. @@ -207,26 +221,18 @@ func (b *Block) isAttestationValid(attestationIndex int, aState *ActiveState, cS // TODO(#258): Generate validators aggregated pub key. - // Hash parentHashes + shardID + slotNumber + shardBlockHash into a message to use to - // to verify with aggregated public key and aggregated attestation signature. - msg := make([]byte, binary.MaxVarintLen64) - var signedHashesStr []byte - for _, parentHash := range parentHashes { - signedHashesStr = append(signedHashesStr, parentHash[:]...) - signedHashesStr = append(signedHashesStr, byte(' ')) - } - binary.PutUvarint(msg, attestation.Slot%params.CycleLength) - msg = append(msg, signedHashesStr...) - binary.PutUvarint(msg, attestation.ShardId) - msg = append(msg, attestation.ShardBlockHash...) - binary.PutUvarint(msg, attestation.JustifiedSlot) - - msgHash := blake2b.Sum512(msg) + attestationMsg := AttestationMsg( + parentHashes, + attestation.ShardBlockHash, + attestation.Slot, + attestation.ShardId, + attestation.JustifiedSlot) log.Debugf("Attestation message for shard: %v, slot %v, block hash %v is: %v", - attestation.ShardId, attestation.Slot, attestation.ShardBlockHash, msgHash) + attestation.ShardId, attestation.Slot, attestation.ShardBlockHash, attestationMsg) // TODO(#258): Verify msgHash against aggregated pub key and aggregated signature. + return true } diff --git a/beacon-chain/types/block_test.go b/beacon-chain/types/block_test.go index 7e25fdb277..ce0de9d04a 100644 --- a/beacon-chain/types/block_test.go +++ b/beacon-chain/types/block_test.go @@ -76,12 +76,12 @@ func TestBlockValidity(t *testing.T) { b := NewBlock(&pb.BeaconBlock{ SlotNumber: 1, - Attestations: []*pb.AttestationRecord{ + Attestations: []*pb.AggregatedAttestation{ { Slot: 0, ShardId: 0, JustifiedSlot: 0, - AttesterBitfield: []byte{8, 8}, + AttesterBitfield: []byte{64, 0}, }, }, }) diff --git a/beacon-chain/types/crystallized_state.go b/beacon-chain/types/crystallized_state.go index 3d494e0ec4..5a774e8356 100644 --- a/beacon-chain/types/crystallized_state.go +++ b/beacon-chain/types/crystallized_state.go @@ -205,7 +205,7 @@ func (c *CrystallizedState) isDynastyTransition(slotNumber uint64) bool { } // getAttesterIndices fetches the attesters for a given attestation record. -func (c *CrystallizedState) getAttesterIndices(attestation *pb.AttestationRecord) ([]uint32, error) { +func (c *CrystallizedState) getAttesterIndices(attestation *pb.AggregatedAttestation) ([]uint32, error) { slotsStart := int64(c.LastStateRecalc()) - params.CycleLength slotIndex := (int64(attestation.Slot) - slotsStart) % params.CycleLength // TODO(#267): ShardAndCommitteesForSlots will return default value because the spec for dynasty transition is not finalized. @@ -351,7 +351,7 @@ func copyCrosslinks(existing []*pb.CrosslinkRecord) []*pb.CrosslinkRecord { // processCrosslinks checks if the proposed shard block has recevied // 2/3 of the votes. If yes, we update crosslink record to point to // the proposed shard block with latest dynasty and slot numbers. -func (c *CrystallizedState) processCrosslinks(pendingAttestations []*pb.AttestationRecord, slot uint64) ([]*pb.CrosslinkRecord, error) { +func (c *CrystallizedState) processCrosslinks(pendingAttestations []*pb.AggregatedAttestation, slot uint64) ([]*pb.CrosslinkRecord, error) { validators := c.data.Validators dynasty := c.data.CurrentDynasty crosslinkRecords := copyCrosslinks(c.data.CrosslinkRecords) diff --git a/beacon-chain/types/crystallized_state_test.go b/beacon-chain/types/crystallized_state_test.go index b04ad9ec1e..bc6370f5f5 100644 --- a/beacon-chain/types/crystallized_state_test.go +++ b/beacon-chain/types/crystallized_state_test.go @@ -144,7 +144,7 @@ func TestProcessCrosslinks(t *testing.T) { } // Set up pending attestations. - pAttestations := []*pb.AttestationRecord{ + pAttestations := []*pb.AggregatedAttestation{ { Slot: 0, ShardId: 0, diff --git a/beacon-chain/types/interfaces.go b/beacon-chain/types/interfaces.go index 782b6478b7..9d45b644fa 100644 --- a/beacon-chain/types/interfaces.go +++ b/beacon-chain/types/interfaces.go @@ -38,6 +38,7 @@ type BlockChainService interface { HasStoredState() (bool, error) ContainsBlock(h [32]byte) (bool, error) SaveBlock(b *Block) error + GetBlockSlotNumber(h [32]byte) (uint64, error) } // CrystallizedStateChainService is the interface for crystallized state related functions in local beacon chain. diff --git a/beacon-chain/utils/checkbit.go b/beacon-chain/utils/checkbit.go index 7d9a4ce2a8..60950145ac 100644 --- a/beacon-chain/utils/checkbit.go +++ b/beacon-chain/utils/checkbit.go @@ -16,13 +16,17 @@ func CheckBit(bitfield []byte, index int) bool { // BitSetCount counts the number of 1s in a byte using the following algo: // https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel -func BitSetCount(v byte) byte { - v = (v & 0x55) + ((v >> 1) & 0x55) - v = (v & 0x33) + ((v >> 2) & 0x33) - return (v + (v >> 4)) & 0xF +func BitSetCount(bytes []byte) int { + var total int + for _, b := range bytes { + b = (b & 0x55) + ((b >> 1) & 0x55) + b = (b & 0x33) + ((b >> 2) & 0x33) + total += int((b + (b >> 4)) & 0xF) + } + return total } -// BitLength returns the length of the bitfield for a given number of attesters in bytes. +// BitLength returns the length of the bitfield for a giben number of attesters in bytes. func BitLength(b int) int { return (b + 7) / 8 } diff --git a/beacon-chain/utils/checkbit_test.go b/beacon-chain/utils/checkbit_test.go index b96e5d3691..7bd76106a4 100644 --- a/beacon-chain/utils/checkbit_test.go +++ b/beacon-chain/utils/checkbit_test.go @@ -36,8 +36,8 @@ func TestBitSetCount(t *testing.T) { {a: 49, b: 3}, //00110001 } for _, tt := range tests { - if int(BitSetCount(tt.a)) != tt.b { - t.Errorf("BitSetCount(%d) = %v, want = %d", tt.a, int(BitSetCount(tt.a)), tt.b) + if int(BitSetCount([]byte{tt.a})) != tt.b { + t.Errorf("BitSetCount(%d) = %v, want = %d", tt.a, int(BitSetCount([]byte{tt.a})), tt.b) } } } diff --git a/proto/README.md b/proto/README.md index d5466c8198..2b5ba0e4e1 100644 --- a/proto/README.md +++ b/proto/README.md @@ -26,4 +26,4 @@ For example, when we build the testing go proto library generated at `bazel-bin/proto/testing/linux_amd64_stripped/ethereum_testing_go_proto\~/github.com/prysmaticlabs/prysm/proto/testing/test.pb.go`. This generated file can be copied, or you can use you protoc locally if you -prefer. \ No newline at end of file +prefer. diff --git a/proto/beacon/p2p/v1/messages.pb.go b/proto/beacon/p2p/v1/messages.pb.go index 316f87a9f6..4b3defc3c9 100644 --- a/proto/beacon/p2p/v1/messages.pb.go +++ b/proto/beacon/p2p/v1/messages.pb.go @@ -66,7 +66,7 @@ func (x Topic) String() string { return proto.EnumName(Topic_name, int32(x)) } func (Topic) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{0} + return fileDescriptor_messages_facf6369f1deca1c, []int{0} } type BeaconBlockHashAnnounce struct { @@ -80,7 +80,7 @@ func (m *BeaconBlockHashAnnounce) Reset() { *m = BeaconBlockHashAnnounce func (m *BeaconBlockHashAnnounce) String() string { return proto.CompactTextString(m) } func (*BeaconBlockHashAnnounce) ProtoMessage() {} func (*BeaconBlockHashAnnounce) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{0} + return fileDescriptor_messages_facf6369f1deca1c, []int{0} } func (m *BeaconBlockHashAnnounce) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BeaconBlockHashAnnounce.Unmarshal(m, b) @@ -118,7 +118,7 @@ func (m *BeaconBlockRequest) Reset() { *m = BeaconBlockRequest{} } func (m *BeaconBlockRequest) String() string { return proto.CompactTextString(m) } func (*BeaconBlockRequest) ProtoMessage() {} func (*BeaconBlockRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{1} + return fileDescriptor_messages_facf6369f1deca1c, []int{1} } func (m *BeaconBlockRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BeaconBlockRequest.Unmarshal(m, b) @@ -156,7 +156,7 @@ func (m *BeaconBlockRequestBySlotNumber) Reset() { *m = BeaconBlockReque func (m *BeaconBlockRequestBySlotNumber) String() string { return proto.CompactTextString(m) } func (*BeaconBlockRequestBySlotNumber) ProtoMessage() {} func (*BeaconBlockRequestBySlotNumber) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{2} + return fileDescriptor_messages_facf6369f1deca1c, []int{2} } func (m *BeaconBlockRequestBySlotNumber) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BeaconBlockRequestBySlotNumber.Unmarshal(m, b) @@ -184,17 +184,18 @@ func (m *BeaconBlockRequestBySlotNumber) GetSlotNumber() uint64 { } type BeaconBlockResponse struct { - Block *BeaconBlock `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Block *BeaconBlock `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` + Attestation *AggregatedAttestation `protobuf:"bytes,2,opt,name=attestation,proto3" json:"attestation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BeaconBlockResponse) Reset() { *m = BeaconBlockResponse{} } func (m *BeaconBlockResponse) String() string { return proto.CompactTextString(m) } func (*BeaconBlockResponse) ProtoMessage() {} func (*BeaconBlockResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{3} + return fileDescriptor_messages_facf6369f1deca1c, []int{3} } func (m *BeaconBlockResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BeaconBlockResponse.Unmarshal(m, b) @@ -221,25 +222,32 @@ func (m *BeaconBlockResponse) GetBlock() *BeaconBlock { return nil } +func (m *BeaconBlockResponse) GetAttestation() *AggregatedAttestation { + if m != nil { + return m.Attestation + } + return nil +} + type BeaconBlock struct { - ParentHash []byte `protobuf:"bytes,1,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` - SlotNumber uint64 `protobuf:"varint,2,opt,name=slot_number,json=slotNumber,proto3" json:"slot_number,omitempty"` - RandaoReveal []byte `protobuf:"bytes,3,opt,name=randao_reveal,json=randaoReveal,proto3" json:"randao_reveal,omitempty"` - PowChainRef []byte `protobuf:"bytes,4,opt,name=pow_chain_ref,json=powChainRef,proto3" json:"pow_chain_ref,omitempty"` - ActiveStateHash []byte `protobuf:"bytes,5,opt,name=active_state_hash,json=activeStateHash,proto3" json:"active_state_hash,omitempty"` - CrystallizedStateHash []byte `protobuf:"bytes,6,opt,name=crystallized_state_hash,json=crystallizedStateHash,proto3" json:"crystallized_state_hash,omitempty"` - Timestamp *timestamp.Timestamp `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Attestations []*AttestationRecord `protobuf:"bytes,8,rep,name=attestations,proto3" json:"attestations,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ParentHash []byte `protobuf:"bytes,1,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` + SlotNumber uint64 `protobuf:"varint,2,opt,name=slot_number,json=slotNumber,proto3" json:"slot_number,omitempty"` + RandaoReveal []byte `protobuf:"bytes,3,opt,name=randao_reveal,json=randaoReveal,proto3" json:"randao_reveal,omitempty"` + PowChainRef []byte `protobuf:"bytes,4,opt,name=pow_chain_ref,json=powChainRef,proto3" json:"pow_chain_ref,omitempty"` + ActiveStateHash []byte `protobuf:"bytes,5,opt,name=active_state_hash,json=activeStateHash,proto3" json:"active_state_hash,omitempty"` + CrystallizedStateHash []byte `protobuf:"bytes,6,opt,name=crystallized_state_hash,json=crystallizedStateHash,proto3" json:"crystallized_state_hash,omitempty"` + Timestamp *timestamp.Timestamp `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Attestations []*AggregatedAttestation `protobuf:"bytes,8,rep,name=attestations,proto3" json:"attestations,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BeaconBlock) Reset() { *m = BeaconBlock{} } func (m *BeaconBlock) String() string { return proto.CompactTextString(m) } func (*BeaconBlock) ProtoMessage() {} func (*BeaconBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{4} + return fileDescriptor_messages_facf6369f1deca1c, []int{4} } func (m *BeaconBlock) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BeaconBlock.Unmarshal(m, b) @@ -308,7 +316,7 @@ func (m *BeaconBlock) GetTimestamp() *timestamp.Timestamp { return nil } -func (m *BeaconBlock) GetAttestations() []*AttestationRecord { +func (m *BeaconBlock) GetAttestations() []*AggregatedAttestation { if m != nil { return m.Attestations } @@ -326,7 +334,7 @@ func (m *CrystallizedStateHashAnnounce) Reset() { *m = CrystallizedState func (m *CrystallizedStateHashAnnounce) String() string { return proto.CompactTextString(m) } func (*CrystallizedStateHashAnnounce) ProtoMessage() {} func (*CrystallizedStateHashAnnounce) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{5} + return fileDescriptor_messages_facf6369f1deca1c, []int{5} } func (m *CrystallizedStateHashAnnounce) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CrystallizedStateHashAnnounce.Unmarshal(m, b) @@ -364,7 +372,7 @@ func (m *CrystallizedStateRequest) Reset() { *m = CrystallizedStateReque func (m *CrystallizedStateRequest) String() string { return proto.CompactTextString(m) } func (*CrystallizedStateRequest) ProtoMessage() {} func (*CrystallizedStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{6} + return fileDescriptor_messages_facf6369f1deca1c, []int{6} } func (m *CrystallizedStateRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CrystallizedStateRequest.Unmarshal(m, b) @@ -402,7 +410,7 @@ func (m *CrystallizedStateResponse) Reset() { *m = CrystallizedStateResp func (m *CrystallizedStateResponse) String() string { return proto.CompactTextString(m) } func (*CrystallizedStateResponse) ProtoMessage() {} func (*CrystallizedStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{7} + return fileDescriptor_messages_facf6369f1deca1c, []int{7} } func (m *CrystallizedStateResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CrystallizedStateResponse.Unmarshal(m, b) @@ -450,7 +458,7 @@ func (m *CrystallizedState) Reset() { *m = CrystallizedState{} } func (m *CrystallizedState) String() string { return proto.CompactTextString(m) } func (*CrystallizedState) ProtoMessage() {} func (*CrystallizedState) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{8} + return fileDescriptor_messages_facf6369f1deca1c, []int{8} } func (m *CrystallizedState) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CrystallizedState.Unmarshal(m, b) @@ -558,7 +566,7 @@ func (m *ShardAndCommitteeArray) Reset() { *m = ShardAndCommitteeArray{} func (m *ShardAndCommitteeArray) String() string { return proto.CompactTextString(m) } func (*ShardAndCommitteeArray) ProtoMessage() {} func (*ShardAndCommitteeArray) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{9} + return fileDescriptor_messages_facf6369f1deca1c, []int{9} } func (m *ShardAndCommitteeArray) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShardAndCommitteeArray.Unmarshal(m, b) @@ -596,7 +604,7 @@ func (m *ActiveStateHashAnnounce) Reset() { *m = ActiveStateHashAnnounce func (m *ActiveStateHashAnnounce) String() string { return proto.CompactTextString(m) } func (*ActiveStateHashAnnounce) ProtoMessage() {} func (*ActiveStateHashAnnounce) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{10} + return fileDescriptor_messages_facf6369f1deca1c, []int{10} } func (m *ActiveStateHashAnnounce) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ActiveStateHashAnnounce.Unmarshal(m, b) @@ -634,7 +642,7 @@ func (m *ActiveStateRequest) Reset() { *m = ActiveStateRequest{} } func (m *ActiveStateRequest) String() string { return proto.CompactTextString(m) } func (*ActiveStateRequest) ProtoMessage() {} func (*ActiveStateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{11} + return fileDescriptor_messages_facf6369f1deca1c, []int{11} } func (m *ActiveStateRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ActiveStateRequest.Unmarshal(m, b) @@ -673,7 +681,7 @@ func (m *ShardAndCommittee) Reset() { *m = ShardAndCommittee{} } func (m *ShardAndCommittee) String() string { return proto.CompactTextString(m) } func (*ShardAndCommittee) ProtoMessage() {} func (*ShardAndCommittee) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{12} + return fileDescriptor_messages_facf6369f1deca1c, []int{12} } func (m *ShardAndCommittee) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ShardAndCommittee.Unmarshal(m, b) @@ -718,7 +726,7 @@ func (m *ActiveStateResponse) Reset() { *m = ActiveStateResponse{} } func (m *ActiveStateResponse) String() string { return proto.CompactTextString(m) } func (*ActiveStateResponse) ProtoMessage() {} func (*ActiveStateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{13} + return fileDescriptor_messages_facf6369f1deca1c, []int{13} } func (m *ActiveStateResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ActiveStateResponse.Unmarshal(m, b) @@ -746,18 +754,18 @@ func (m *ActiveStateResponse) GetActiveState() *ActiveState { } type ActiveState struct { - PendingAttestations []*AttestationRecord `protobuf:"bytes,1,rep,name=pending_attestations,json=pendingAttestations,proto3" json:"pending_attestations,omitempty"` - RecentBlockHashes [][]byte `protobuf:"bytes,2,rep,name=recent_block_hashes,json=recentBlockHashes,proto3" json:"recent_block_hashes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + PendingAttestations []*AggregatedAttestation `protobuf:"bytes,1,rep,name=pending_attestations,json=pendingAttestations,proto3" json:"pending_attestations,omitempty"` + RecentBlockHashes [][]byte `protobuf:"bytes,2,rep,name=recent_block_hashes,json=recentBlockHashes,proto3" json:"recent_block_hashes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ActiveState) Reset() { *m = ActiveState{} } func (m *ActiveState) String() string { return proto.CompactTextString(m) } func (*ActiveState) ProtoMessage() {} func (*ActiveState) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{14} + return fileDescriptor_messages_facf6369f1deca1c, []int{14} } func (m *ActiveState) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ActiveState.Unmarshal(m, b) @@ -777,7 +785,7 @@ func (m *ActiveState) XXX_DiscardUnknown() { var xxx_messageInfo_ActiveState proto.InternalMessageInfo -func (m *ActiveState) GetPendingAttestations() []*AttestationRecord { +func (m *ActiveState) GetPendingAttestations() []*AggregatedAttestation { if m != nil { return m.PendingAttestations } @@ -808,7 +816,7 @@ func (m *ValidatorRecord) Reset() { *m = ValidatorRecord{} } func (m *ValidatorRecord) String() string { return proto.CompactTextString(m) } func (*ValidatorRecord) ProtoMessage() {} func (*ValidatorRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{15} + return fileDescriptor_messages_facf6369f1deca1c, []int{15} } func (m *ValidatorRecord) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ValidatorRecord.Unmarshal(m, b) @@ -877,7 +885,7 @@ func (m *ValidatorRecord) GetEndDynasty() uint64 { return 0 } -type AttestationRecord struct { +type AggregatedAttestation struct { Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` ShardId uint64 `protobuf:"varint,2,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"` JustifiedSlot uint64 `protobuf:"varint,3,opt,name=justified_slot,json=justifiedSlot,proto3" json:"justified_slot,omitempty"` @@ -891,80 +899,80 @@ type AttestationRecord struct { XXX_sizecache int32 `json:"-"` } -func (m *AttestationRecord) Reset() { *m = AttestationRecord{} } -func (m *AttestationRecord) String() string { return proto.CompactTextString(m) } -func (*AttestationRecord) ProtoMessage() {} -func (*AttestationRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{16} +func (m *AggregatedAttestation) Reset() { *m = AggregatedAttestation{} } +func (m *AggregatedAttestation) String() string { return proto.CompactTextString(m) } +func (*AggregatedAttestation) ProtoMessage() {} +func (*AggregatedAttestation) Descriptor() ([]byte, []int) { + return fileDescriptor_messages_facf6369f1deca1c, []int{16} } -func (m *AttestationRecord) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AttestationRecord.Unmarshal(m, b) +func (m *AggregatedAttestation) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AggregatedAttestation.Unmarshal(m, b) } -func (m *AttestationRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AttestationRecord.Marshal(b, m, deterministic) +func (m *AggregatedAttestation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AggregatedAttestation.Marshal(b, m, deterministic) } -func (dst *AttestationRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_AttestationRecord.Merge(dst, src) +func (dst *AggregatedAttestation) XXX_Merge(src proto.Message) { + xxx_messageInfo_AggregatedAttestation.Merge(dst, src) } -func (m *AttestationRecord) XXX_Size() int { - return xxx_messageInfo_AttestationRecord.Size(m) +func (m *AggregatedAttestation) XXX_Size() int { + return xxx_messageInfo_AggregatedAttestation.Size(m) } -func (m *AttestationRecord) XXX_DiscardUnknown() { - xxx_messageInfo_AttestationRecord.DiscardUnknown(m) +func (m *AggregatedAttestation) XXX_DiscardUnknown() { + xxx_messageInfo_AggregatedAttestation.DiscardUnknown(m) } -var xxx_messageInfo_AttestationRecord proto.InternalMessageInfo +var xxx_messageInfo_AggregatedAttestation proto.InternalMessageInfo -func (m *AttestationRecord) GetSlot() uint64 { +func (m *AggregatedAttestation) GetSlot() uint64 { if m != nil { return m.Slot } return 0 } -func (m *AttestationRecord) GetShardId() uint64 { +func (m *AggregatedAttestation) GetShardId() uint64 { if m != nil { return m.ShardId } return 0 } -func (m *AttestationRecord) GetJustifiedSlot() uint64 { +func (m *AggregatedAttestation) GetJustifiedSlot() uint64 { if m != nil { return m.JustifiedSlot } return 0 } -func (m *AttestationRecord) GetJustifiedBlockHash() []byte { +func (m *AggregatedAttestation) GetJustifiedBlockHash() []byte { if m != nil { return m.JustifiedBlockHash } return nil } -func (m *AttestationRecord) GetShardBlockHash() []byte { +func (m *AggregatedAttestation) GetShardBlockHash() []byte { if m != nil { return m.ShardBlockHash } return nil } -func (m *AttestationRecord) GetAttesterBitfield() []byte { +func (m *AggregatedAttestation) GetAttesterBitfield() []byte { if m != nil { return m.AttesterBitfield } return nil } -func (m *AttestationRecord) GetObliqueParentHashes() [][]byte { +func (m *AggregatedAttestation) GetObliqueParentHashes() [][]byte { if m != nil { return m.ObliqueParentHashes } return nil } -func (m *AttestationRecord) GetAggregateSig() []uint64 { +func (m *AggregatedAttestation) GetAggregateSig() []uint64 { if m != nil { return m.AggregateSig } @@ -984,7 +992,7 @@ func (m *CrosslinkRecord) Reset() { *m = CrosslinkRecord{} } func (m *CrosslinkRecord) String() string { return proto.CompactTextString(m) } func (*CrosslinkRecord) ProtoMessage() {} func (*CrosslinkRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{17} + return fileDescriptor_messages_facf6369f1deca1c, []int{17} } func (m *CrosslinkRecord) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CrosslinkRecord.Unmarshal(m, b) @@ -1036,7 +1044,7 @@ func (m *AttestationHashes) Reset() { *m = AttestationHashes{} } func (m *AttestationHashes) String() string { return proto.CompactTextString(m) } func (*AttestationHashes) ProtoMessage() {} func (*AttestationHashes) Descriptor() ([]byte, []int) { - return fileDescriptor_messages_e19f4492e67c7db5, []int{18} + return fileDescriptor_messages_facf6369f1deca1c, []int{18} } func (m *AttestationHashes) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AttestationHashes.Unmarshal(m, b) @@ -1080,96 +1088,97 @@ func init() { proto.RegisterType((*ActiveStateResponse)(nil), "ethereum.beacon.p2p.v1.ActiveStateResponse") proto.RegisterType((*ActiveState)(nil), "ethereum.beacon.p2p.v1.ActiveState") proto.RegisterType((*ValidatorRecord)(nil), "ethereum.beacon.p2p.v1.ValidatorRecord") - proto.RegisterType((*AttestationRecord)(nil), "ethereum.beacon.p2p.v1.AttestationRecord") + proto.RegisterType((*AggregatedAttestation)(nil), "ethereum.beacon.p2p.v1.AggregatedAttestation") proto.RegisterType((*CrosslinkRecord)(nil), "ethereum.beacon.p2p.v1.CrosslinkRecord") proto.RegisterType((*AttestationHashes)(nil), "ethereum.beacon.p2p.v1.AttestationHashes") proto.RegisterEnum("ethereum.beacon.p2p.v1.Topic", Topic_name, Topic_value) } -func init() { proto.RegisterFile("messages.proto", fileDescriptor_messages_e19f4492e67c7db5) } +func init() { proto.RegisterFile("messages.proto", fileDescriptor_messages_facf6369f1deca1c) } -var fileDescriptor_messages_e19f4492e67c7db5 = []byte{ - // 1297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x5f, 0x6f, 0xdb, 0x36, - 0x10, 0x5f, 0x6c, 0xa7, 0x4e, 0xce, 0x4e, 0x62, 0x33, 0xfd, 0xa3, 0x64, 0x6b, 0x93, 0xa9, 0x2b, - 0x9a, 0xb6, 0xa8, 0xbb, 0xa5, 0xc0, 0xb0, 0xbd, 0x0c, 0xb0, 0x5d, 0x77, 0xed, 0x9a, 0x3a, 0x99, - 0xe4, 0x74, 0xeb, 0xb0, 0x42, 0xa0, 0x25, 0xda, 0x56, 0x23, 0x8b, 0x2e, 0x49, 0x27, 0xf0, 0x1e, - 0xf6, 0xb6, 0xcf, 0xb0, 0x87, 0x7d, 0xa4, 0x01, 0xfb, 0x36, 0x7b, 0x1f, 0x48, 0x51, 0xff, 0x6c, - 0x27, 0xc5, 0xde, 0xa4, 0xdf, 0xfd, 0xee, 0x78, 0xbc, 0xfb, 0xf1, 0x48, 0xd8, 0x1c, 0x13, 0xce, - 0xf1, 0x90, 0xf0, 0xc6, 0x84, 0x51, 0x41, 0xd1, 0x4d, 0x22, 0x46, 0x84, 0x91, 0xe9, 0xb8, 0xd1, - 0x27, 0xd8, 0xa5, 0x61, 0x63, 0x72, 0x38, 0x69, 0x9c, 0x7f, 0xb5, 0xbb, 0x37, 0xa4, 0x74, 0x18, - 0x90, 0x27, 0x8a, 0xd5, 0x9f, 0x0e, 0x9e, 0x08, 0x7f, 0x4c, 0xb8, 0xc0, 0xe3, 0x49, 0xe4, 0x68, - 0x3e, 0x86, 0x5b, 0x2d, 0xe5, 0xd1, 0x0a, 0xa8, 0x7b, 0xf6, 0x02, 0xf3, 0x51, 0x33, 0x0c, 0xe9, - 0x34, 0x74, 0x09, 0x42, 0x50, 0x1a, 0x61, 0x3e, 0x32, 0x56, 0xf6, 0x57, 0x0e, 0xaa, 0x96, 0xfa, - 0x36, 0x0f, 0x00, 0x65, 0xe8, 0x16, 0xf9, 0x30, 0x25, 0x5c, 0x2c, 0x65, 0x36, 0xe1, 0xce, 0x22, - 0xb3, 0x35, 0xb3, 0x03, 0x2a, 0xba, 0xd3, 0x71, 0x9f, 0x30, 0xb4, 0x07, 0x15, 0x1e, 0x50, 0xe1, - 0x84, 0xea, 0x57, 0x39, 0x97, 0x2c, 0xe0, 0x09, 0xc1, 0x3c, 0x81, 0xed, 0x5c, 0x08, 0x3e, 0xa1, - 0x21, 0x27, 0xe8, 0x5b, 0x58, 0xed, 0x4b, 0x40, 0x79, 0x54, 0x0e, 0xef, 0x36, 0x96, 0xef, 0xbd, - 0x91, 0xf5, 0x8d, 0x3c, 0xcc, 0x3f, 0x8a, 0x50, 0xc9, 0xc0, 0x32, 0x85, 0x09, 0x66, 0x24, 0x14, - 0x4e, 0x26, 0x7f, 0x88, 0x20, 0x59, 0x8b, 0xf9, 0x1c, 0x0b, 0xf3, 0x39, 0xa2, 0xbb, 0xb0, 0xc1, - 0x70, 0xe8, 0x61, 0xea, 0x30, 0x72, 0x4e, 0x70, 0x60, 0x14, 0x55, 0x8c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 0x3e, 0x3a, 0xee, 0x39, 0xdd, 0xd3, 0xd7, 0xad, - 0x8e, 0x55, 0x2b, 0xa2, 0x1d, 0xb8, 0x31, 0x47, 0xb4, 0x4f, 0x8e, 0xbb, 0x76, 0xa7, 0x56, 0x42, - 0x5f, 0xc0, 0x7e, 0xdb, 0x7a, 0x6b, 0xf7, 0x9a, 0x47, 0x47, 0x2f, 0x7f, 0xe9, 0x3c, 0x73, 0xec, - 0x5e, 0xb3, 0xd7, 0x99, 0xcb, 0x61, 0x55, 0xe6, 0xb8, 0x84, 0x15, 0x67, 0x72, 0x0d, 0xed, 0xc1, - 0xa7, 0x4b, 0xed, 0x7a, 0x99, 0xb2, 0x0c, 0xd0, 0x6c, 0xf7, 0x5e, 0xbe, 0xe9, 0x2c, 0x5d, 0x60, - 0x4d, 0x6e, 0x32, 0x67, 0x8f, 0x43, 0xaf, 0xcb, 0xdc, 0xe7, 0x2c, 0x3a, 0x28, 0xf4, 0xaf, 0xa9, - 0xd7, 0xe3, 0xd3, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x87, 0x6c, 0x40, 0x97, 0x0c, 0x00, - 0x00, +var fileDescriptor_messages_facf6369f1deca1c = []byte{ + // 1315 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x5f, 0x73, 0xd3, 0xc6, + 0x16, 0xbf, 0xfe, 0x13, 0x9c, 0x1c, 0x3b, 0x89, 0xbd, 0x21, 0xa0, 0xe4, 0x5e, 0x48, 0xae, 0xb8, + 0x0c, 0x09, 0x0c, 0xe6, 0x16, 0x66, 0x3a, 0xed, 0x4b, 0x67, 0x64, 0x63, 0x0a, 0x25, 0xb5, 0x41, + 0x72, 0x68, 0xe9, 0x0c, 0xa3, 0xae, 0xa5, 0xb5, 0x2d, 0x22, 0x6b, 0xcd, 0xee, 0x3a, 0x19, 0xf7, + 0xa1, 0xef, 0xf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xf8, 0x63, 0x17, 0x56, + 0xd6, 0x44, 0x39, 0xb3, 0xa2, 0xcd, 0x5f, 0x72, 0x50, 0xce, 0x08, 0xd1, 0xf7, 0x70, 0x7d, 0x4c, + 0x22, 0x3f, 0x88, 0x06, 0xee, 0xdc, 0x12, 0xcd, 0xfd, 0x93, 0x25, 0xba, 0xa3, 0x4d, 0x65, 0x30, + 0x2e, 0x47, 0x9a, 0x11, 0x4f, 0x4e, 0xa8, 0xba, 0x38, 0xd5, 0x55, 0x40, 0xb8, 0x0a, 0xbc, 0x62, + 0xd7, 0x62, 0x51, 0xfa, 0x64, 0x20, 0xdc, 0xfc, 0x39, 0x0f, 0xdb, 0x0b, 0xbd, 0x8b, 0x6e, 0x01, + 0x8c, 0x27, 0xbd, 0x30, 0xf0, 0xdc, 0x33, 0x32, 0xd5, 0xf9, 0xdc, 0x88, 0x91, 0x97, 0x64, 0x2a, + 0x17, 0xd2, 0x45, 0x20, 0x86, 0x3e, 0xc3, 0x17, 0x38, 0x8c, 0xbb, 0x28, 0x59, 0x48, 0x33, 0x5c, + 0xd5, 0x08, 0x3d, 0x04, 0x94, 0xa1, 0x62, 0xdf, 0x67, 0x84, 0x73, 0x7d, 0x31, 0xd6, 0x66, 0x12, + 0x2b, 0x16, 0xa0, 0x07, 0x50, 0xd3, 0x57, 0x68, 0x5c, 0xa1, 0x11, 0x89, 0x84, 0xbe, 0x21, 0xab, + 0xb1, 0xa0, 0x99, 0xe2, 0xc8, 0x80, 0x52, 0x0f, 0x87, 0x38, 0xf2, 0x88, 0x5e, 0x42, 0xc9, 0xaf, + 0xdc, 0x19, 0x6a, 0x57, 0xa4, 0x4b, 0x2a, 0x5e, 0x3e, 0x15, 0x05, 0x26, 0x2b, 0xea, 0x00, 0xca, + 0x24, 0xf2, 0x53, 0x4a, 0x29, 0xbe, 0xcf, 0x49, 0xe4, 0x6b, 0x82, 0xf9, 0x7b, 0x1e, 0x76, 0x57, + 0x26, 0x5e, 0xb6, 0xa5, 0xda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8, 0x6f, 0xb4, 0xac, 0x66, 0xa7, + 0xed, 0x36, 0x4e, 0x3a, 0xcd, 0x97, 0xee, 0x73, 0xcb, 0x79, 0xee, 0x5a, 0xed, 0x76, 0xe7, 0xb4, + 0xdd, 0x6c, 0x55, 0x73, 0xc8, 0x80, 0xeb, 0x73, 0x72, 0xbb, 0xf5, 0xfa, 0xb4, 0xe5, 0x74, 0xab, + 0x79, 0x74, 0x0f, 0xee, 0xac, 0x92, 0xb8, 0x8d, 0xb7, 0xae, 0x73, 0xd2, 0xe9, 0xba, 0xed, 0xd3, + 0xaf, 0x1b, 0x2d, 0xbb, 0x5a, 0x40, 0x7b, 0xb0, 0xbb, 0x40, 0x74, 0x5e, 0x75, 0xda, 0x4e, 0xab, + 0x5a, 0x44, 0xff, 0x83, 0xc3, 0xa6, 0xfd, 0xd6, 0xe9, 0x5a, 0x27, 0x27, 0x2f, 0xbe, 0x6b, 0x3d, + 0x75, 0x9d, 0xae, 0xd5, 0x6d, 0x2d, 0xf8, 0xb0, 0x26, 0x7d, 0x5c, 0xc1, 0x4a, 0x3c, 0xb9, 0x86, + 0x0e, 0xe0, 0xdf, 0x2b, 0xe5, 0xfa, 0x98, 0x92, 0x34, 0x60, 0x35, 0xbb, 0x2f, 0xde, 0xb4, 0x56, + 0x1e, 0xb0, 0x2e, 0x83, 0x9c, 0x93, 0x27, 0xa6, 0x37, 0xa4, 0xef, 0x0b, 0x12, 0x6d, 0x14, 0x7a, + 0xd7, 0xd4, 0x4b, 0xf2, 0xc9, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x69, 0x3b, 0xfd, 0xf5, + 0x0c, 0x00, 0x00, } diff --git a/proto/beacon/p2p/v1/messages.proto b/proto/beacon/p2p/v1/messages.proto index 11245e545b..ce391676dd 100644 --- a/proto/beacon/p2p/v1/messages.proto +++ b/proto/beacon/p2p/v1/messages.proto @@ -32,6 +32,7 @@ message BeaconBlockRequestBySlotNumber{ message BeaconBlockResponse { BeaconBlock block = 1; + AggregatedAttestation attestation = 2; } message BeaconBlock { @@ -42,7 +43,7 @@ message BeaconBlock { bytes active_state_hash = 5; bytes crystallized_state_hash = 6; google.protobuf.Timestamp timestamp = 7; - repeated AttestationRecord attestations = 8; + repeated AggregatedAttestation attestations = 8; } message CrystallizedStateHashAnnounce { @@ -93,7 +94,7 @@ message ActiveStateResponse { } message ActiveState { - repeated AttestationRecord pending_attestations = 1; + repeated AggregatedAttestation pending_attestations = 1; repeated bytes recent_block_hashes = 2; } @@ -107,7 +108,7 @@ message ValidatorRecord { uint64 end_dynasty = 7; } -message AttestationRecord { +message AggregatedAttestation { uint64 slot = 1; uint64 shard_id = 2; uint64 justified_slot = 3; diff --git a/proto/beacon/rpc/v1/services.pb.go b/proto/beacon/rpc/v1/services.pb.go index e25ec47560..edb21cf714 100644 --- a/proto/beacon/rpc/v1/services.pb.go +++ b/proto/beacon/rpc/v1/services.pb.go @@ -235,10 +235,10 @@ func (m *ProposeResponse) GetBlockHash() []byte { } type AttestRequest struct { - Attestation *v1.AttestationRecord `protobuf:"bytes,1,opt,name=attestation,proto3" json:"attestation,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Attestation *v1.AggregatedAttestation `protobuf:"bytes,1,opt,name=attestation,proto3" json:"attestation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AttestRequest) Reset() { *m = AttestRequest{} } @@ -265,7 +265,7 @@ func (m *AttestRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AttestRequest proto.InternalMessageInfo -func (m *AttestRequest) GetAttestation() *v1.AttestationRecord { +func (m *AttestRequest) GetAttestation() *v1.AggregatedAttestation { if m != nil { return m.Attestation } diff --git a/proto/beacon/rpc/v1/services.proto b/proto/beacon/rpc/v1/services.proto index b4cc04042f..5864327be5 100644 --- a/proto/beacon/rpc/v1/services.proto +++ b/proto/beacon/rpc/v1/services.proto @@ -44,7 +44,7 @@ message ProposeResponse { } message AttestRequest { - ethereum.beacon.p2p.v1.AttestationRecord attestation = 1; + ethereum.beacon.p2p.v1.AggregatedAttestation attestation = 1; } message AttestResponse { diff --git a/proto/testing/test.proto b/proto/testing/test.proto index 73069570f5..3652a9e96e 100644 --- a/proto/testing/test.proto +++ b/proto/testing/test.proto @@ -10,4 +10,4 @@ message TestMessage { message Puzzle { string challenge = 1; string answer = 2; -} \ No newline at end of file +} diff --git a/validator/attester/service.go b/validator/attester/service.go index 0aaa02f022..34662a675a 100644 --- a/validator/attester/service.go +++ b/validator/attester/service.go @@ -89,7 +89,7 @@ func (a *Attester) run(done <-chan struct{}, client pb.AttesterServiceClient) { latestBlockHash := blake2b.Sum512(data) req := &pb.AttestRequest{ - Attestation: &pbp2p.AttestationRecord{ + Attestation: &pbp2p.AggregatedAttestation{ Slot: latestBeaconBlock.GetSlotNumber(), ShardId: a.shardID, ShardBlockHash: latestBlockHash[:],