mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Utilize Archived Data in GetValidatorParticipation RPC Server (#3526)
* archive participation begin implementation * validator participation compute * comments * compute participation common func * full test for archiving data * gazelle * complete tests * gaz * remove double negative grammar in comment * use archive in rpc * uses the archive! * error if nothing found in archive * comment * use head fetcher and root * tests pass * archive active set changes appropriately * archive committees * archive info * done with committee info archiving * archived set changes stored * fix build * test for archive balances and active indices * further abstractions * only archive epoch end * tests all pass * tests pass now * archive done * test for activated validators * tests for exited * amend message * use different proto * finalization fetcher * gaz * use root * use ctx * use new ethapis * use proper hash * match apis compatibility * match apis * properly use participation * fix tests * use right commit
This commit is contained in:
@@ -1259,7 +1259,7 @@ go_repository(
|
||||
|
||||
go_repository(
|
||||
name = "com_github_prysmaticlabs_ethereumapis",
|
||||
commit = "10e0aa6523a7cf0804fb79096b41d7d8d7df37e5",
|
||||
commit = "b39a0c15028a20e7ef54e666d92b8d7fd61f5f0e",
|
||||
importpath = "github.com/prysmaticlabs/ethereumapis",
|
||||
)
|
||||
|
||||
|
||||
@@ -72,20 +72,20 @@ func TestArchiverService_ComputesAndSavesParticipation(t *testing.T) {
|
||||
triggerNewHeadEvent(t, svc, [32]byte{})
|
||||
|
||||
attestedBalance := uint64(1)
|
||||
currentEpoch := helpers.CurrentEpoch(headState)
|
||||
wanted := ðpb.ValidatorParticipation{
|
||||
Epoch: helpers.SlotToEpoch(headState.Slot),
|
||||
VotedEther: attestedBalance,
|
||||
EligibleEther: validatorCount * params.BeaconConfig().MaxEffectiveBalance,
|
||||
GlobalParticipationRate: float32(attestedBalance) / float32(validatorCount*params.BeaconConfig().MaxEffectiveBalance),
|
||||
}
|
||||
|
||||
retrieved, err := svc.beaconDB.ArchivedValidatorParticipation(svc.ctx, wanted.Epoch)
|
||||
retrieved, err := svc.beaconDB.ArchivedValidatorParticipation(svc.ctx, currentEpoch)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if !proto.Equal(wanted, retrieved) {
|
||||
t.Errorf("Wanted participation for epoch %d %v, retrieved %v", wanted.Epoch, wanted, retrieved)
|
||||
t.Errorf("Wanted participation for epoch %d %v, retrieved %v", currentEpoch, wanted, retrieved)
|
||||
}
|
||||
testutil.AssertLogsContain(t, hook, "archived validator participation")
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ import (
|
||||
// computing the attesting balance, and how much attested compared to the total balances.
|
||||
func ComputeValidatorParticipation(state *pb.BeaconState) (*ethpb.ValidatorParticipation, error) {
|
||||
currentEpoch := helpers.SlotToEpoch(state.Slot)
|
||||
finalized := currentEpoch == state.FinalizedCheckpoint.Epoch
|
||||
|
||||
atts, err := MatchAttestations(state, currentEpoch)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not retrieve head attestations")
|
||||
@@ -26,8 +24,6 @@ func ComputeValidatorParticipation(state *pb.BeaconState) (*ethpb.ValidatorParti
|
||||
return nil, errors.Wrap(err, "could not retrieve total balances")
|
||||
}
|
||||
return ðpb.ValidatorParticipation{
|
||||
Epoch: currentEpoch,
|
||||
Finalized: finalized,
|
||||
GlobalParticipationRate: float32(attestedBalances) / float32(totalBalances),
|
||||
VotedEther: attestedBalances,
|
||||
EligibleEther: totalBalances,
|
||||
|
||||
@@ -57,7 +57,6 @@ func TestComputeValidatorParticipation(t *testing.T) {
|
||||
}
|
||||
|
||||
wanted := ðpb.ValidatorParticipation{
|
||||
Epoch: epoch,
|
||||
VotedEther: attestedBalance,
|
||||
EligibleEther: validatorCount * params.BeaconConfig().MaxEffectiveBalance,
|
||||
GlobalParticipationRate: float32(attestedBalance) / float32(validatorCount*params.BeaconConfig().MaxEffectiveBalance),
|
||||
|
||||
@@ -177,8 +177,6 @@ func TestStore_ArchivedValidatorParticipation(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
epoch := uint64(10)
|
||||
part := ðpb.ValidatorParticipation{
|
||||
Epoch: epoch,
|
||||
Finalized: true,
|
||||
GlobalParticipationRate: 0.99,
|
||||
EligibleEther: 12202000,
|
||||
VotedEther: 12079998,
|
||||
|
||||
@@ -443,6 +443,7 @@ func (b *BeaconNode) registerRPCService(ctx *cli.Context) error {
|
||||
BeaconDB: b.db,
|
||||
Broadcaster: b.fetchP2P(ctx),
|
||||
HeadFetcher: chainService,
|
||||
FinalizationFetcher: chainService,
|
||||
BlockReceiver: chainService,
|
||||
AttestationReceiver: chainService,
|
||||
StateFeedListener: chainService,
|
||||
|
||||
@@ -30,6 +30,7 @@ type BeaconChainServer struct {
|
||||
ctx context.Context
|
||||
chainStartFetcher powchain.ChainStartFetcher
|
||||
headFetcher blockchain.HeadFetcher
|
||||
finalizationFetcher blockchain.FinalizationFetcher
|
||||
stateFeedListener blockchain.ChainFeeds
|
||||
pool operations.Pool
|
||||
incomingAttestation chan *ethpb.Attestation
|
||||
@@ -476,17 +477,72 @@ func (bs *BeaconChainServer) ListValidatorAssignments(
|
||||
}
|
||||
|
||||
// GetValidatorParticipation retrieves the validator participation information for a given epoch,
|
||||
// it returns the information about validator's participation rate
|
||||
//
|
||||
// TODO(#3064): Implement validator participation for a specific epoch. Current implementation returns latest,
|
||||
// this is blocked by DB refactor.
|
||||
// it returns the information about validator's participation rate in voting on the proof of stake
|
||||
// rules based on their balance compared to the total active validator balance.
|
||||
func (bs *BeaconChainServer) GetValidatorParticipation(
|
||||
ctx context.Context, req *ethpb.GetValidatorParticipationRequest,
|
||||
) (*ethpb.ValidatorParticipation, error) {
|
||||
) (*ethpb.ValidatorParticipationResponse, error) {
|
||||
headState := bs.headFetcher.HeadState()
|
||||
currentEpoch := helpers.SlotToEpoch(headState.Slot)
|
||||
|
||||
var requestedEpoch uint64
|
||||
var isGenesis bool
|
||||
switch q := req.QueryFilter.(type) {
|
||||
case *ethpb.GetValidatorParticipationRequest_Genesis:
|
||||
isGenesis = q.Genesis
|
||||
case *ethpb.GetValidatorParticipationRequest_Epoch:
|
||||
requestedEpoch = q.Epoch
|
||||
default:
|
||||
requestedEpoch = currentEpoch
|
||||
}
|
||||
|
||||
if requestedEpoch > helpers.SlotToEpoch(headState.Slot) {
|
||||
return nil, status.Errorf(
|
||||
codes.FailedPrecondition,
|
||||
"cannot request data from an epoch in the future: req.Epoch %d, currentEpoch %d", requestedEpoch, currentEpoch,
|
||||
)
|
||||
}
|
||||
// If the request is from genesis or another past epoch, we look into our archived
|
||||
// data to find it and return it if it exists.
|
||||
if isGenesis {
|
||||
participation, err := bs.beaconDB.ArchivedValidatorParticipation(ctx, 0)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "could not fetch archived participation: %v", err)
|
||||
}
|
||||
if participation == nil {
|
||||
return nil, status.Error(codes.NotFound, "could not find archival data for epoch 0")
|
||||
}
|
||||
return ðpb.ValidatorParticipationResponse{
|
||||
Epoch: 0,
|
||||
Finalized: true,
|
||||
Participation: participation,
|
||||
}, nil
|
||||
} else if requestedEpoch < helpers.SlotToEpoch(headState.Slot) {
|
||||
participation, err := bs.beaconDB.ArchivedValidatorParticipation(ctx, requestedEpoch)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "could not fetch archived participation: %v", err)
|
||||
}
|
||||
if participation == nil {
|
||||
return nil, status.Errorf(codes.NotFound, "could not find archival data for epoch %d", requestedEpoch)
|
||||
}
|
||||
finalizedEpoch := bs.finalizationFetcher.FinalizedCheckpt().Epoch
|
||||
// If the epoch we requested is <= the finalized epoch, we consider it finalized as well.
|
||||
finalized := requestedEpoch <= finalizedEpoch
|
||||
return ðpb.ValidatorParticipationResponse{
|
||||
Epoch: requestedEpoch,
|
||||
Finalized: finalized,
|
||||
Participation: participation,
|
||||
}, nil
|
||||
}
|
||||
// Else if the request is for the current epoch, we compute validator participation
|
||||
// right away and return the result based on the head state.
|
||||
participation, err := epoch.ComputeValidatorParticipation(headState)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "could not compute participation: %v", err)
|
||||
}
|
||||
return participation, nil
|
||||
return ðpb.ValidatorParticipationResponse{
|
||||
Epoch: currentEpoch,
|
||||
Finalized: false, // The current epoch can never be finalized.
|
||||
Participation: participation,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -862,7 +862,66 @@ func TestBeaconChainServer_ListAssignmentsCanFilterPubkeysIndicesWithPages(t *te
|
||||
}
|
||||
}
|
||||
|
||||
func TestBeaconChainServer_GetValidatorsParticipation(t *testing.T) {
|
||||
func TestBeaconChainServer_GetValidatorsParticipation_FromArchive(t *testing.T) {
|
||||
db := dbTest.SetupDB(t)
|
||||
defer dbTest.TeardownDB(t, db)
|
||||
ctx := context.Background()
|
||||
epoch := uint64(4)
|
||||
part := ðpb.ValidatorParticipation{
|
||||
GlobalParticipationRate: 1.0,
|
||||
VotedEther: 20,
|
||||
EligibleEther: 20,
|
||||
}
|
||||
if err := db.SaveArchivedValidatorParticipation(ctx, epoch, part); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
bs := &BeaconChainServer{
|
||||
beaconDB: db,
|
||||
headFetcher: &mock.ChainService{
|
||||
State: &pbp2p.BeaconState{Slot: helpers.StartSlot(epoch + 1)},
|
||||
},
|
||||
finalizationFetcher: &mock.ChainService{
|
||||
FinalizedCheckPoint: ðpb.Checkpoint{
|
||||
Epoch: epoch + 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
if _, err := bs.GetValidatorParticipation(ctx, ðpb.GetValidatorParticipationRequest{
|
||||
QueryFilter: ðpb.GetValidatorParticipationRequest_Epoch{
|
||||
Epoch: epoch + 2,
|
||||
},
|
||||
}); err == nil {
|
||||
t.Error("Expected error when requesting future epoch, received nil")
|
||||
}
|
||||
// We request data from epoch 0, which we didn't archive, so we should expect an error.
|
||||
if _, err := bs.GetValidatorParticipation(ctx, ðpb.GetValidatorParticipationRequest{
|
||||
QueryFilter: ðpb.GetValidatorParticipationRequest_Genesis{
|
||||
Genesis: true,
|
||||
},
|
||||
}); err == nil {
|
||||
t.Error("Expected error when data from archive is not found, received nil")
|
||||
}
|
||||
|
||||
want := ðpb.ValidatorParticipationResponse{
|
||||
Epoch: epoch,
|
||||
Finalized: true,
|
||||
Participation: part,
|
||||
}
|
||||
res, err := bs.GetValidatorParticipation(ctx, ðpb.GetValidatorParticipationRequest{
|
||||
QueryFilter: ðpb.GetValidatorParticipationRequest_Epoch{
|
||||
Epoch: epoch,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !proto.Equal(want, res) {
|
||||
t.Errorf("Wanted %v, received %v", want, res)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBeaconChainServer_GetValidatorsParticipation_CurrentEpoch(t *testing.T) {
|
||||
helpers.ClearAllCaches()
|
||||
db := dbTest.SetupDB(t)
|
||||
defer dbTest.TeardownDB(t, db)
|
||||
@@ -912,19 +971,18 @@ func TestBeaconChainServer_GetValidatorsParticipation(t *testing.T) {
|
||||
headFetcher: &mock.ChainService{State: s},
|
||||
}
|
||||
|
||||
res, err := bs.GetValidatorParticipation(ctx, ðpb.GetValidatorParticipationRequest{Epoch: epoch})
|
||||
res, err := bs.GetValidatorParticipation(ctx, ðpb.GetValidatorParticipationRequest{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
wanted := ðpb.ValidatorParticipation{
|
||||
Epoch: epoch,
|
||||
VotedEther: attestedBalance,
|
||||
EligibleEther: validatorCount * params.BeaconConfig().MaxEffectiveBalance,
|
||||
GlobalParticipationRate: float32(attestedBalance) / float32(validatorCount*params.BeaconConfig().MaxEffectiveBalance),
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(res, wanted) {
|
||||
if !reflect.DeepEqual(res.Participation, wanted) {
|
||||
t.Error("Incorrect validator participation respond")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ type Service struct {
|
||||
beaconDB db.Database
|
||||
stateFeedListener blockchain.ChainFeeds
|
||||
headFetcher blockchain.HeadFetcher
|
||||
finalizationFetcher blockchain.FinalizationFetcher
|
||||
genesisTimeFetcher blockchain.GenesisTimeFetcher
|
||||
attestationReceiver blockchain.AttestationReceiver
|
||||
blockReceiver blockchain.BlockReceiver
|
||||
@@ -72,6 +73,7 @@ type Config struct {
|
||||
BeaconDB db.Database
|
||||
StateFeedListener blockchain.ChainFeeds
|
||||
HeadFetcher blockchain.HeadFetcher
|
||||
FinalizationFetcher blockchain.FinalizationFetcher
|
||||
AttestationReceiver blockchain.AttestationReceiver
|
||||
BlockReceiver blockchain.BlockReceiver
|
||||
POWChainService powchain.Chain
|
||||
@@ -96,6 +98,7 @@ func NewService(ctx context.Context, cfg *Config) *Service {
|
||||
beaconDB: cfg.BeaconDB,
|
||||
stateFeedListener: cfg.StateFeedListener,
|
||||
headFetcher: cfg.HeadFetcher,
|
||||
finalizationFetcher: cfg.FinalizationFetcher,
|
||||
genesisTimeFetcher: cfg.GenesisTimeFetcher,
|
||||
attestationReceiver: cfg.AttestationReceiver,
|
||||
blockReceiver: cfg.BlockReceiver,
|
||||
@@ -190,11 +193,12 @@ func (s *Service) Start() {
|
||||
genesisTimeFetcher: s.genesisTimeFetcher,
|
||||
}
|
||||
beaconChainServer := &BeaconChainServer{
|
||||
beaconDB: s.beaconDB,
|
||||
pool: s.attestationsPool,
|
||||
headFetcher: s.headFetcher,
|
||||
chainStartFetcher: s.chainStartFetcher,
|
||||
canonicalStateChan: s.canonicalStateChan,
|
||||
beaconDB: s.beaconDB,
|
||||
pool: s.attestationsPool,
|
||||
headFetcher: s.headFetcher,
|
||||
finalizationFetcher: s.finalizationFetcher,
|
||||
chainStartFetcher: s.chainStartFetcher,
|
||||
canonicalStateChan: s.canonicalStateChan,
|
||||
}
|
||||
pb.RegisterProposerServiceServer(s.grpcServer, proposerServer)
|
||||
pb.RegisterAttesterServiceServer(s.grpcServer, attesterServer)
|
||||
|
||||
5
proto/beacon/p2p/v1/messages.pb.go
generated
5
proto/beacon/p2p/v1/messages.pb.go
generated
@@ -5,11 +5,10 @@ package ethereum_beacon_p2p_v1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
5
proto/beacon/p2p/v1/types.pb.go
generated
5
proto/beacon/p2p/v1/types.pb.go
generated
@@ -5,13 +5,12 @@ package ethereum_beacon_p2p_v1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
github_com_prysmaticlabs_go_bitfield "github.com/prysmaticlabs/go-bitfield"
|
||||
v1alpha1 "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
||||
io "io"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
5
proto/beacon/rpc/v1/services.pb.go
generated
5
proto/beacon/rpc/v1/services.pb.go
generated
@@ -7,15 +7,14 @@ import (
|
||||
context "context"
|
||||
encoding_binary "encoding/binary"
|
||||
fmt "fmt"
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
types "github.com/gogo/protobuf/types"
|
||||
_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"
|
||||
v1alpha1 "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
grpc "google.golang.org/grpc"
|
||||
io "io"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
3
proto/beacon/rpc/v1_gateway/services.pb.go
generated
3
proto/beacon/rpc/v1_gateway/services.pb.go
generated
@@ -6,14 +6,13 @@ package ethereum_beacon_rpc_v1
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
math "math"
|
||||
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
empty "github.com/golang/protobuf/ptypes/empty"
|
||||
_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"
|
||||
v1alpha1 "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
grpc "google.golang.org/grpc"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
@@ -144,8 +144,8 @@ func TestProtoCompatability(t *testing.T) {
|
||||
b: &upstreampb.GetValidatorParticipationRequest{},
|
||||
},
|
||||
{
|
||||
a: &pb.ValidatorParticipation{},
|
||||
b: &upstreampb.ValidatorParticipation{},
|
||||
a: &pb.ValidatorParticipationResponse{},
|
||||
b: &upstreampb.ValidatorParticipationResponse{},
|
||||
},
|
||||
{
|
||||
a: &pb.AttestationPoolResponse{},
|
||||
@@ -193,6 +193,10 @@ func TestProtoCompatability(t *testing.T) {
|
||||
a: &pb.Validator{},
|
||||
b: &upstreampb.Validator{},
|
||||
},
|
||||
{
|
||||
a: &pb.ValidatorParticipation{},
|
||||
b: &upstreampb.ValidatorParticipation{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
5
proto/eth/v1alpha1/archive.pb.go
generated
5
proto/eth/v1alpha1/archive.pb.go
generated
@@ -5,11 +5,10 @@ package eth
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
5
proto/eth/v1alpha1/attestation.pb.go
generated
5
proto/eth/v1alpha1/attestation.pb.go
generated
@@ -5,12 +5,11 @@ package eth
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
github_com_prysmaticlabs_go_bitfield "github.com/prysmaticlabs/go-bitfield"
|
||||
io "io"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
5
proto/eth/v1alpha1/beacon_block.pb.go
generated
5
proto/eth/v1alpha1/beacon_block.pb.go
generated
@@ -5,11 +5,10 @@ package eth
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
847
proto/eth/v1alpha1/beacon_chain.pb.go
generated
847
proto/eth/v1alpha1/beacon_chain.pb.go
generated
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
import "proto/eth/v1alpha1/archive.proto";
|
||||
import "proto/eth/v1alpha1/attestation.proto";
|
||||
import "proto/eth/v1alpha1/beacon_block.proto";
|
||||
import "proto/eth/v1alpha1/validator.proto";
|
||||
@@ -118,7 +119,7 @@ service BeaconChain {
|
||||
//
|
||||
// This method returns information about the global participation of
|
||||
// validator attestations.
|
||||
rpc GetValidatorParticipation(GetValidatorParticipationRequest) returns (ValidatorParticipation) {
|
||||
rpc GetValidatorParticipation(GetValidatorParticipationRequest) returns (ValidatorParticipationResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/eth/v1alpha1/validators/participation"
|
||||
};
|
||||
@@ -238,15 +239,19 @@ message ChainHead {
|
||||
}
|
||||
|
||||
message GetValidatorBalancesRequest {
|
||||
// Retrieve validator balance at the given epoch.
|
||||
uint64 epoch = 1;
|
||||
oneof query_filter {
|
||||
// Optional criteria to retrieve balances at a specific epoch.
|
||||
uint64 epoch = 1;
|
||||
|
||||
// Optional criteria to retrieve the genesis list of balances.
|
||||
bool genesis = 2;
|
||||
}
|
||||
// Validator 48 byte BLS public keys to filter validators for the given
|
||||
// epoch.
|
||||
repeated bytes public_keys = 2 [(gogoproto.moretags) = "ssz-size:\"?,48\""];
|
||||
repeated bytes public_keys = 3 [(gogoproto.moretags) = "ssz-size:\"?,48\""];
|
||||
|
||||
// Validator indices to filter validators for the given epoch.
|
||||
repeated uint64 indices = 3;
|
||||
repeated uint64 indices = 4;
|
||||
}
|
||||
|
||||
message ValidatorBalances {
|
||||
@@ -398,26 +403,24 @@ message ValidatorAssignments {
|
||||
}
|
||||
|
||||
message GetValidatorParticipationRequest {
|
||||
// Epoch to request participation information.
|
||||
uint64 epoch = 1;
|
||||
oneof query_filter {
|
||||
// Epoch to request participation information.
|
||||
uint64 epoch = 1;
|
||||
|
||||
// Whether or not to query for the genesis information.
|
||||
bool genesis = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidatorParticipation {
|
||||
message ValidatorParticipationResponse {
|
||||
// Epoch which this message is applicable.
|
||||
uint64 epoch = 1;
|
||||
|
||||
// Whether or not epoch has been finalized.
|
||||
bool finalized = 2;
|
||||
|
||||
// Percentage of validator participation in the given epoch. This field
|
||||
// contains a value between 0 and 1.
|
||||
float global_participation_rate = 3;
|
||||
|
||||
// The total amount of ether, in gwei, that has been used in voting.
|
||||
uint64 voted_ether = 4;
|
||||
|
||||
// The total amount of ether, in gwei, that is eligible for voting.
|
||||
uint64 eligible_ether = 5;
|
||||
// The actual participation metrics.
|
||||
ValidatorParticipation participation = 3;
|
||||
}
|
||||
|
||||
message AttestationPoolResponse {
|
||||
|
||||
5
proto/eth/v1alpha1/node.pb.go
generated
5
proto/eth/v1alpha1/node.pb.go
generated
@@ -6,13 +6,12 @@ package eth
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
types "github.com/gogo/protobuf/types"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
grpc "google.golang.org/grpc"
|
||||
io "io"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
3
proto/eth/v1alpha1/slasher.pb.go
generated
3
proto/eth/v1alpha1/slasher.pb.go
generated
@@ -6,11 +6,10 @@ package eth
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
math "math"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
types "github.com/gogo/protobuf/types"
|
||||
grpc "google.golang.org/grpc"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
346
proto/eth/v1alpha1/validator.pb.go
generated
346
proto/eth/v1alpha1/validator.pb.go
generated
@@ -5,15 +5,15 @@ package eth
|
||||
|
||||
import (
|
||||
context "context"
|
||||
encoding_binary "encoding/binary"
|
||||
fmt "fmt"
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
types "github.com/gogo/protobuf/types"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
grpc "google.golang.org/grpc"
|
||||
io "io"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -421,6 +421,69 @@ func (m *Validator) GetWithdrawableEpoch() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
type ValidatorParticipation struct {
|
||||
GlobalParticipationRate float32 `protobuf:"fixed32,1,opt,name=global_participation_rate,json=globalParticipationRate,proto3" json:"global_participation_rate,omitempty"`
|
||||
VotedEther uint64 `protobuf:"varint,2,opt,name=voted_ether,json=votedEther,proto3" json:"voted_ether,omitempty"`
|
||||
EligibleEther uint64 `protobuf:"varint,3,opt,name=eligible_ether,json=eligibleEther,proto3" json:"eligible_ether,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ValidatorParticipation) Reset() { *m = ValidatorParticipation{} }
|
||||
func (m *ValidatorParticipation) String() string { return proto.CompactTextString(m) }
|
||||
func (*ValidatorParticipation) ProtoMessage() {}
|
||||
func (*ValidatorParticipation) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_86a2b3961d336368, []int{5}
|
||||
}
|
||||
func (m *ValidatorParticipation) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ValidatorParticipation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ValidatorParticipation.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *ValidatorParticipation) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ValidatorParticipation.Merge(m, src)
|
||||
}
|
||||
func (m *ValidatorParticipation) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ValidatorParticipation) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ValidatorParticipation.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ValidatorParticipation proto.InternalMessageInfo
|
||||
|
||||
func (m *ValidatorParticipation) GetGlobalParticipationRate() float32 {
|
||||
if m != nil {
|
||||
return m.GlobalParticipationRate
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ValidatorParticipation) GetVotedEther() uint64 {
|
||||
if m != nil {
|
||||
return m.VotedEther
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ValidatorParticipation) GetEligibleEther() uint64 {
|
||||
if m != nil {
|
||||
return m.EligibleEther
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*DutiesRequest)(nil), "ethereum.eth.v1alpha1.DutiesRequest")
|
||||
proto.RegisterType((*DutiesResponse)(nil), "ethereum.eth.v1alpha1.DutiesResponse")
|
||||
@@ -428,66 +491,72 @@ func init() {
|
||||
proto.RegisterType((*BlockRequest)(nil), "ethereum.eth.v1alpha1.BlockRequest")
|
||||
proto.RegisterType((*AttestationDataRequest)(nil), "ethereum.eth.v1alpha1.AttestationDataRequest")
|
||||
proto.RegisterType((*Validator)(nil), "ethereum.eth.v1alpha1.Validator")
|
||||
proto.RegisterType((*ValidatorParticipation)(nil), "ethereum.eth.v1alpha1.ValidatorParticipation")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("proto/eth/v1alpha1/validator.proto", fileDescriptor_86a2b3961d336368) }
|
||||
|
||||
var fileDescriptor_86a2b3961d336368 = []byte{
|
||||
// 863 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4f, 0x6f, 0xdc, 0x44,
|
||||
0x14, 0x97, 0x37, 0x7f, 0x9a, 0xbc, 0x6e, 0x28, 0x99, 0xa4, 0xd1, 0x6a, 0x69, 0x93, 0xd5, 0x34,
|
||||
0xa9, 0x02, 0x65, 0x6d, 0x9a, 0x16, 0x84, 0xca, 0x01, 0xd8, 0x34, 0x0a, 0x12, 0x12, 0xa0, 0xad,
|
||||
0xc4, 0xa1, 0x1c, 0xac, 0xb1, 0xfd, 0x76, 0x3d, 0xca, 0xac, 0xc7, 0xf5, 0xcc, 0xa6, 0x6c, 0x24,
|
||||
0x24, 0xc4, 0x57, 0xe0, 0x00, 0x07, 0x2e, 0x7c, 0x13, 0x8e, 0x1c, 0x91, 0xb8, 0x47, 0x28, 0xe2,
|
||||
0x13, 0xe4, 0x13, 0x20, 0xcf, 0xd8, 0xb1, 0x43, 0x77, 0x95, 0xbd, 0x79, 0xde, 0xfb, 0xcd, 0xef,
|
||||
0xfd, 0xe6, 0xcd, 0xfc, 0x9e, 0x81, 0xa6, 0x99, 0xd4, 0xd2, 0x43, 0x1d, 0x7b, 0xa7, 0x8f, 0x99,
|
||||
0x48, 0x63, 0xf6, 0xd8, 0x3b, 0x65, 0x82, 0x47, 0x4c, 0xcb, 0xcc, 0x35, 0x49, 0x72, 0x17, 0x75,
|
||||
0x8c, 0x19, 0x8e, 0x47, 0x2e, 0xea, 0xd8, 0x2d, 0x61, 0xed, 0xee, 0x90, 0xeb, 0x78, 0x1c, 0xb8,
|
||||
0xa1, 0x1c, 0x79, 0x43, 0x39, 0x94, 0x9e, 0x41, 0x07, 0xe3, 0x81, 0x59, 0x59, 0xde, 0xfc, 0xcb,
|
||||
0xb2, 0xb4, 0xef, 0x0d, 0xa5, 0x1c, 0x0a, 0xf4, 0x58, 0xca, 0x3d, 0x96, 0x24, 0x52, 0x33, 0xcd,
|
||||
0x65, 0xa2, 0x8a, 0xec, 0x3b, 0x45, 0xf6, 0x8a, 0x03, 0x47, 0xa9, 0x9e, 0x14, 0xc9, 0xbd, 0x29,
|
||||
0x22, 0x03, 0x64, 0xa1, 0x4c, 0xfc, 0x40, 0xc8, 0xf0, 0xa4, 0x80, 0xed, 0x4e, 0x81, 0x31, 0xad,
|
||||
0x51, 0xd9, 0x52, 0x16, 0x45, 0xbf, 0x83, 0xb5, 0xe7, 0x63, 0xcd, 0x51, 0xf5, 0xf1, 0xd5, 0x18,
|
||||
0x95, 0x26, 0x9b, 0xb0, 0x84, 0xa9, 0x0c, 0xe3, 0x96, 0xd3, 0x71, 0xf6, 0x17, 0xfb, 0x76, 0x41,
|
||||
0x9e, 0xc2, 0xed, 0x74, 0x1c, 0x08, 0x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, 0xa0, 0xe0, 0x43, 0x1e, 0x70, 0xc1, 0xf5, 0xc4, 0xb7, 0x8e, 0x59, 0x32, 0x8c, 0xed, 0x0a,
|
||||
0x73, 0x54, 0x41, 0x8e, 0x8c, 0x8d, 0xf2, 0xe7, 0x57, 0x63, 0x30, 0xbb, 0x96, 0x8b, 0xe7, 0x57,
|
||||
0xed, 0x32, 0xd0, 0xfb, 0x00, 0xf8, 0x3d, 0xd7, 0x05, 0xe8, 0x96, 0x01, 0xad, 0xe6, 0x11, 0x9b,
|
||||
0xee, 0x02, 0xb9, 0x3a, 0x6b, 0x20, 0xb0, 0x80, 0xad, 0xd8, 0xf7, 0x56, 0xcf, 0x18, 0xf8, 0xc1,
|
||||
0xef, 0x4b, 0xb0, 0xd1, 0x33, 0x33, 0xe2, 0x2b, 0x19, 0x61, 0x75, 0x51, 0x3f, 0x3a, 0xb0, 0x7a,
|
||||
0x8c, 0xda, 0xba, 0x8d, 0xec, 0xde, 0x60, 0x46, 0xf3, 0x8a, 0xda, 0x7b, 0x73, 0x59, 0x96, 0x3e,
|
||||
0xfc, 0xe9, 0xef, 0x7f, 0x7f, 0x6e, 0x74, 0xc8, 0xf6, 0x8c, 0x71, 0xea, 0x59, 0x37, 0x93, 0x33,
|
||||
0x58, 0x39, 0x46, 0x6d, 0xdc, 0x40, 0x1e, 0xcc, 0xa0, 0xae, 0x7b, 0xa5, 0x4d, 0x67, 0x81, 0xcc,
|
||||
0xf9, 0x0c, 0x94, 0xee, 0x99, 0xe2, 0x3b, 0xe4, 0xfe, 0xac, 0xe2, 0xc6, 0x92, 0xe4, 0x15, 0x34,
|
||||
0xad, 0x2d, 0xd1, 0xd6, 0x9f, 0x83, 0xba, 0xbd, 0xe5, 0xda, 0xe1, 0xec, 0x96, 0xc3, 0xd9, 0x3d,
|
||||
0xca, 0x87, 0x73, 0x59, 0x92, 0xde, 0x50, 0xf2, 0x57, 0x07, 0xc8, 0x31, 0xea, 0xff, 0x39, 0x94,
|
||||
0x74, 0x67, 0x54, 0x9e, 0xee, 0xe4, 0xf6, 0xc3, 0xf9, 0xe0, 0xf4, 0x91, 0x11, 0xb5, 0x47, 0x1e,
|
||||
0xcc, 0x12, 0x55, 0x9b, 0x64, 0xe4, 0x07, 0x20, 0x45, 0x37, 0x6a, 0x34, 0x33, 0x7b, 0x52, 0xc3,
|
||||
0xcc, 0xec, 0x49, 0x51, 0x9e, 0xce, 0x53, 0xbe, 0x77, 0xf8, 0xe7, 0xc5, 0xb6, 0xf3, 0xd7, 0xc5,
|
||||
0xb6, 0xf3, 0xcf, 0xc5, 0xb6, 0xf3, 0xf2, 0xc3, 0xda, 0xff, 0x34, 0xcd, 0x26, 0x6a, 0xc4, 0x34,
|
||||
0x0f, 0x05, 0x0b, 0x94, 0x5d, 0x79, 0x6f, 0xfe, 0xdd, 0x3e, 0x41, 0x1d, 0x07, 0xcb, 0x26, 0xfe,
|
||||
0xe4, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x54, 0x0f, 0xd1, 0x2d, 0xca, 0x07, 0x00, 0x00,
|
||||
// 935 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0x41, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xc7, 0xb5, 0x4e, 0xd2, 0x26, 0x13, 0xa7, 0x25, 0x93, 0x34, 0x18, 0xd3, 0x26, 0xd6, 0x36,
|
||||
0xae, 0x02, 0xc5, 0xbb, 0x34, 0x2d, 0x08, 0x85, 0x03, 0xe0, 0x34, 0x0a, 0x12, 0x12, 0x54, 0x5b,
|
||||
0x89, 0x43, 0x39, 0xac, 0x66, 0x77, 0x9f, 0xbd, 0xa3, 0x8c, 0x3d, 0xdb, 0x9d, 0xb1, 0x8b, 0x23,
|
||||
0x21, 0x21, 0xbe, 0x02, 0x07, 0x38, 0xf4, 0xc2, 0x37, 0xe1, 0xc8, 0x11, 0x89, 0x7b, 0x84, 0x22,
|
||||
0x3e, 0x41, 0x3e, 0x01, 0xda, 0x37, 0xbb, 0xde, 0x35, 0xd8, 0x6a, 0x6e, 0x3b, 0xef, 0xfd, 0xe6,
|
||||
0xbd, 0xff, 0xbe, 0x79, 0xf3, 0x86, 0xd8, 0x49, 0x2a, 0xb5, 0x74, 0x41, 0xc7, 0xee, 0xf8, 0x11,
|
||||
0x13, 0x49, 0xcc, 0x1e, 0xb9, 0x63, 0x26, 0x78, 0xc4, 0xb4, 0x4c, 0x1d, 0x74, 0xd2, 0x3b, 0xa0,
|
||||
0x63, 0x48, 0x61, 0x34, 0x70, 0x40, 0xc7, 0x4e, 0x81, 0x35, 0x3b, 0x7d, 0xae, 0xe3, 0x51, 0xe0,
|
||||
0x84, 0x72, 0xe0, 0xf6, 0x65, 0x5f, 0xba, 0x48, 0x07, 0xa3, 0x1e, 0xae, 0x4c, 0xdc, 0xec, 0xcb,
|
||||
0x44, 0x69, 0xde, 0xed, 0x4b, 0xd9, 0x17, 0xe0, 0xb2, 0x84, 0xbb, 0x6c, 0x38, 0x94, 0x9a, 0x69,
|
||||
0x2e, 0x87, 0x2a, 0xf7, 0xbe, 0x9b, 0x7b, 0xa7, 0x31, 0x60, 0x90, 0xe8, 0x49, 0xee, 0x6c, 0xcf,
|
||||
0x11, 0x19, 0x00, 0x0b, 0xe5, 0xd0, 0x0f, 0x84, 0x0c, 0xcf, 0x72, 0x6c, 0x7f, 0x0e, 0xc6, 0xb4,
|
||||
0x06, 0x65, 0x52, 0x19, 0xca, 0xfe, 0x8e, 0x6c, 0x3c, 0x1d, 0x69, 0x0e, 0xca, 0x83, 0x97, 0x23,
|
||||
0x50, 0x9a, 0x6e, 0x93, 0x15, 0x48, 0x64, 0x18, 0x37, 0xac, 0x96, 0x75, 0xb0, 0xec, 0x99, 0x05,
|
||||
0x7d, 0x42, 0xd6, 0x93, 0x51, 0x20, 0x78, 0xe8, 0x9f, 0xc1, 0x44, 0x35, 0x6a, 0xad, 0xa5, 0x83,
|
||||
0x7a, 0x77, 0xeb, 0xea, 0x62, 0xef, 0xb6, 0x52, 0xe7, 0x1d, 0xc5, 0xcf, 0xe1, 0xc8, 0xfe, 0xec,
|
||||
0x83, 0x27, 0x9f, 0xd8, 0x1e, 0x31, 0xdc, 0x57, 0x30, 0x51, 0xf6, 0x2f, 0x35, 0x72, 0xab, 0x88,
|
||||
0xae, 0x12, 0x39, 0x54, 0x40, 0xbb, 0xe4, 0x46, 0x84, 0x96, 0x86, 0xd5, 0x5a, 0x3a, 0x58, 0x3f,
|
||||
0x7c, 0xdf, 0x99, 0x5b, 0x4e, 0x67, 0x76, 0x5b, 0xb6, 0x9c, 0x78, 0xf9, 0xce, 0xe6, 0xef, 0x16,
|
||||
0x59, 0xce, 0x0c, 0xf4, 0x43, 0x42, 0x4a, 0x55, 0x28, 0xb8, 0xde, 0xdd, 0xbc, 0xba, 0xd8, 0xdb,
|
||||
0x28, 0x45, 0x65, 0x92, 0xd6, 0xa6, 0x92, 0xe8, 0x7b, 0xe4, 0xad, 0x4a, 0x0d, 0x7c, 0x25, 0xa4,
|
||||
0x6e, 0xd4, 0xf0, 0x47, 0x6f, 0x57, 0xec, 0xcf, 0x85, 0xd4, 0xf4, 0x21, 0xd9, 0x9c, 0x41, 0x63,
|
||||
0x96, 0x46, 0x8d, 0x25, 0x64, 0xab, 0x31, 0x9e, 0x67, 0x76, 0xea, 0x90, 0x2d, 0xac, 0xbd, 0x9f,
|
||||
0xa4, 0x32, 0x91, 0x8a, 0x09, 0x13, 0x7a, 0x19, 0xf1, 0x4d, 0x74, 0x3d, 0xcb, 0x3d, 0x59, 0x70,
|
||||
0xfb, 0x05, 0xa9, 0x77, 0x33, 0x63, 0x51, 0x75, 0x4a, 0x96, 0x71, 0x83, 0x29, 0x3a, 0x7e, 0xd3,
|
||||
0x8f, 0xc9, 0x46, 0xca, 0x86, 0x11, 0x93, 0x7e, 0x0a, 0x63, 0x60, 0x02, 0x85, 0xce, 0xfd, 0xc1,
|
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x6c, 0x96,
|
||||
0xcc, 0x49, 0x89, 0x9c, 0xe0, 0x35, 0xca, 0xda, 0xaf, 0x12, 0x01, 0x77, 0xdd, 0xc8, 0xdb, 0xaf,
|
||||
0xdc, 0x85, 0xe8, 0x3d, 0x42, 0xe0, 0x7b, 0xae, 0x73, 0xe8, 0x26, 0x42, 0x6b, 0x99, 0xc5, 0xb8,
|
||||
0x3b, 0x84, 0x4e, 0xff, 0x35, 0x10, 0x90, 0x63, 0xab, 0xa6, 0xdf, 0xaa, 0x1e, 0xc4, 0xed, 0xd7,
|
||||
0x16, 0xd9, 0x99, 0x1e, 0xcf, 0x33, 0x96, 0x6a, 0x1e, 0xf2, 0x04, 0xb3, 0xd1, 0x23, 0xf2, 0x4e,
|
||||
0x5f, 0xc8, 0x80, 0x09, 0x3f, 0xa9, 0xda, 0xfd, 0x94, 0x69, 0xc0, 0xa3, 0xab, 0x79, 0x6f, 0x1b,
|
||||
0x60, 0x66, 0x9f, 0xc7, 0x34, 0xd0, 0x3d, 0xb2, 0x3e, 0x96, 0x1a, 0x22, 0x1f, 0x2f, 0x71, 0xde,
|
||||
0x26, 0x04, 0x4d, 0x27, 0x99, 0x85, 0xb6, 0xc9, 0x2d, 0x53, 0xa7, 0x4c, 0x22, 0x32, 0xa6, 0xec,
|
||||
0x1b, 0x85, 0x15, 0xb1, 0xc3, 0xdf, 0x56, 0xc8, 0x56, 0x17, 0x47, 0xd8, 0xd7, 0x32, 0x82, 0xb2,
|
||||
0x8f, 0x7e, 0xb4, 0xc8, 0xda, 0x29, 0x68, 0x33, 0x0c, 0xe8, 0xfe, 0x1b, 0x66, 0x05, 0x36, 0x79,
|
||||
0xb3, 0x7d, 0xad, 0x89, 0x62, 0x3f, 0xf8, 0xe9, 0xaf, 0x7f, 0x7e, 0xae, 0xb5, 0xe8, 0xee, 0x82,
|
||||
0x69, 0xef, 0x9a, 0x61, 0x43, 0xcf, 0xc9, 0xea, 0x29, 0x68, 0xbc, 0xac, 0xf4, 0xfe, 0x82, 0xd0,
|
||||
0xd5, 0xab, 0xdc, 0xb4, 0x17, 0x41, 0xf8, 0x7f, 0x88, 0xda, 0x6d, 0x4c, 0xbe, 0x47, 0xef, 0x2d,
|
||||
0x4a, 0x8e, 0x13, 0x83, 0xbe, 0x24, 0x75, 0x33, 0x35, 0xc0, 0xe4, 0xbf, 0x46, 0xe8, 0xe6, 0x8e,
|
||||
0x63, 0xde, 0x0e, 0xa7, 0x78, 0x3b, 0x9c, 0x93, 0xec, 0xed, 0x28, 0x52, 0xda, 0x6f, 0x48, 0xf9,
|
||||
0xab, 0x45, 0xe8, 0x29, 0xe8, 0xff, 0x0c, 0x10, 0xda, 0x59, 0x90, 0x79, 0xfe, 0xa0, 0x69, 0x3e,
|
||||
0xb8, 0x1e, 0x6e, 0x3f, 0x44, 0x51, 0x6d, 0x7a, 0x7f, 0x91, 0xa8, 0xca, 0xa0, 0xa5, 0x3f, 0x10,
|
||||
0x9a, 0x57, 0xa3, 0x12, 0x66, 0x61, 0x4d, 0x2a, 0xcc, 0xc2, 0x9a, 0xe4, 0xe9, 0xed, 0xeb, 0xa4,
|
||||
0xef, 0x1e, 0xff, 0x71, 0xb9, 0x6b, 0xfd, 0x79, 0xb9, 0x6b, 0xfd, 0x7d, 0xb9, 0x6b, 0xbd, 0xf8,
|
||||
0xa8, 0xf2, 0xdc, 0x27, 0xe9, 0x44, 0x0d, 0x98, 0xe6, 0xa1, 0x60, 0x81, 0x32, 0x2b, 0xf7, 0xff,
|
||||
0x8f, 0xef, 0xa7, 0xa0, 0xe3, 0xe0, 0x06, 0xda, 0x1f, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x3a,
|
||||
0xed, 0xda, 0x36, 0x69, 0x08, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -940,6 +1009,43 @@ func (m *Validator) MarshalTo(dAtA []byte) (int, error) {
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *ValidatorParticipation) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *ValidatorParticipation) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.GlobalParticipationRate != 0 {
|
||||
dAtA[i] = 0xd
|
||||
i++
|
||||
encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.GlobalParticipationRate))))
|
||||
i += 4
|
||||
}
|
||||
if m.VotedEther != 0 {
|
||||
dAtA[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintValidator(dAtA, i, uint64(m.VotedEther))
|
||||
}
|
||||
if m.EligibleEther != 0 {
|
||||
dAtA[i] = 0x18
|
||||
i++
|
||||
i = encodeVarintValidator(dAtA, i, uint64(m.EligibleEther))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeVarintValidator(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
@@ -1092,6 +1198,27 @@ func (m *Validator) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ValidatorParticipation) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.GlobalParticipationRate != 0 {
|
||||
n += 5
|
||||
}
|
||||
if m.VotedEther != 0 {
|
||||
n += 1 + sovValidator(uint64(m.VotedEther))
|
||||
}
|
||||
if m.EligibleEther != 0 {
|
||||
n += 1 + sovValidator(uint64(m.EligibleEther))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovValidator(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
@@ -1913,6 +2040,109 @@ func (m *Validator) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ValidatorParticipation) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowValidator
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: ValidatorParticipation: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ValidatorParticipation: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 5 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field GlobalParticipationRate", wireType)
|
||||
}
|
||||
var v uint32
|
||||
if (iNdEx + 4) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:]))
|
||||
iNdEx += 4
|
||||
m.GlobalParticipationRate = float32(math.Float32frombits(v))
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field VotedEther", wireType)
|
||||
}
|
||||
m.VotedEther = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowValidator
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.VotedEther |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field EligibleEther", wireType)
|
||||
}
|
||||
m.EligibleEther = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowValidator
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.EligibleEther |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipValidator(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthValidator
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthValidator
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipValidator(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
@@ -145,3 +145,17 @@ message Validator {
|
||||
// may be zero if the validator has not exited.
|
||||
uint64 withdrawable_epoch = 8;
|
||||
}
|
||||
|
||||
// ValidatorParticipation stores participation metrics during a given epoch.
|
||||
message ValidatorParticipation {
|
||||
// Percentage of validator participation in the given epoch. This field
|
||||
// contains a value between 0 and 1.
|
||||
float global_participation_rate = 1;
|
||||
|
||||
// The total amount of ether, in gwei, that has been used in voting.
|
||||
uint64 voted_ether = 2;
|
||||
|
||||
// The total amount of ether, in gwei, that is eligible for voting.
|
||||
uint64 eligible_ether = 3;
|
||||
}
|
||||
|
||||
|
||||
3
proto/sharding/p2p/v1/messages.pb.go
generated
3
proto/sharding/p2p/v1/messages.pb.go
generated
@@ -5,10 +5,9 @@ package ethereum_sharding_p2p_v1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
io "io"
|
||||
math "math"
|
||||
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
||||
@@ -95,7 +95,7 @@ func compareHeads(clients map[string]pb.BeaconChainClient) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
logParticipation(endpt1, p)
|
||||
logParticipation(endpt1, p.Participation)
|
||||
}
|
||||
|
||||
for endpt2, client := range clients {
|
||||
@@ -113,7 +113,7 @@ func compareHeads(clients map[string]pb.BeaconChainClient) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
logParticipation(endpt2, p)
|
||||
logParticipation(endpt2, p.Participation)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,8 +134,6 @@ func logHead(endpt string, head *pb.ChainHead) {
|
||||
func logParticipation(endpt string, p *pb.ValidatorParticipation) {
|
||||
log.WithFields(
|
||||
logrus.Fields{
|
||||
"Finalized": p.Finalized,
|
||||
"Epoch": p.Epoch,
|
||||
"VotedEther": p.VotedEther,
|
||||
"TotalEther": p.EligibleEther,
|
||||
"ParticipationRate": p.GlobalParticipationRate,
|
||||
|
||||
Reference in New Issue
Block a user