mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 16:37:39 +00:00
61026103c6
* initial validator attesthead rewrite based on proposer rewrite * proceed with fetching committees and tree hashing the canonical head at assigned attester slot * complete filling the properties of attestation data and all associated root hashes * add when to attest todo * finish entire attester client logic * tests with mocks checked in * tests passing in client * stubbed out server implementation * fixed build due to old property * regen mocks with new mockgen version * fixed broken tests * complete bazel build fix * address some review comments * deep proto test * tests passing after checking for empty committee and crosslink root * address nishant comments
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package rpc
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
|
|
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
|
)
|
|
|
|
// AttesterServer defines a server implementation of the gRPC Attester service,
|
|
// providing RPC methods for validators acting as attesters to broadcast votes on beacon blocks.
|
|
type AttesterServer struct {
|
|
operationService operationService
|
|
}
|
|
|
|
// AttestHead is a function called by an attester in a sharding validator to vote
|
|
// on a block via an attestation object as defined in the Ethereum Serenity specification.
|
|
func (as *AttesterServer) AttestHead(ctx context.Context, att *pbp2p.Attestation) (*pb.AttestResponse, error) {
|
|
h, err := hashutil.HashProto(att)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("could not hash attestation: %v", err)
|
|
}
|
|
// Relays the attestation to chain service.
|
|
as.operationService.IncomingAttFeed().Send(att)
|
|
return &pb.AttestResponse{AttestationHash: h[:]}, nil
|
|
}
|
|
|
|
// AttestationInfoAtSlot --
|
|
//
|
|
// TODO(#1505): WIP.
|
|
func (as *AttesterServer) AttestationInfoAtSlot(ctx context.Context, req *pb.AttestationInfoRequest) (*pb.AttestationInfoResponse, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
// CrosslinkCommitteesAtSlot --
|
|
//
|
|
// TODO(#1505): WIP.
|
|
func (as *AttesterServer) CrosslinkCommitteesAtSlot(ctx context.Context, req *pb.CrosslinkCommitteeRequest) (*pb.CrosslinkCommitteeResponse, error) {
|
|
return nil, nil
|
|
}
|