github.com/prysmaticlabs/prysm@v1.4.4/proto/eth/v1/validator_service.proto (about)

     1  // Copyright 2020 Prysmatic Labs.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  syntax = "proto3";
    15  
    16  package ethereum.eth.v1;
    17  
    18  import "google/api/annotations.proto";
    19  import "google/protobuf/descriptor.proto";
    20  import "google/protobuf/empty.proto";
    21  
    22  import "proto/eth/ext/options.proto";
    23  import "proto/eth/v1/attestation.proto";
    24  import "proto/eth/v1/beacon_block.proto";
    25  
    26  option csharp_namespace = "Ethereum.Eth.v1";
    27  option go_package = "github.com/prysmaticlabs/prysm/proto/eth/v1";
    28  option java_multiple_files = true;
    29  option java_outer_classname = "ValidatorServiceProto";
    30  option java_package = "org.ethereum.eth.v1";
    31  option php_namespace = "Ethereum\\Eth\\v1";
    32  
    33  // Beacon chain validator API
    34  //
    35  // The beacon chain validator API is a set of endpoints to be used by validators for performing their roles.
    36  //
    37  // This service is defined in the upstream Ethereum consensus APIs repository (eth2.0-APIs/apis/validator).
    38  service BeaconValidator {
    39    // GetAttesterDuties requests the beacon node to provide a set of attestation duties, which should be performed
    40    // by validators, for a particular epoch. Duties should only need to be checked once per epoch, however
    41    // a chain reorganization (of > MIN_SEED_LOOKAHEAD epochs) could occur, resulting in a change of duties.
    42    // For full safety, you should monitor chain reorganization events.
    43    rpc GetAttesterDuties(AttesterDutiesRequest) returns (AttesterDutiesResponse) {
    44      option (google.api.http) = { get: "/eth/v1/validator/duties/attester/{epoch}" };
    45    }
    46  
    47    // GetProposerDuties requests beacon node to provide all validators that are scheduled to
    48    // propose a block in the given epoch
    49    rpc GetProposerDuties(ProposerDutiesRequest) returns (ProposerDutiesResponse) {
    50      option (google.api.http) = { get: "/eth/v1/validator/duties/proposer/{epoch}" };
    51    }
    52  
    53    // GetBlock requests the beacon node to produce a valid unsigned beacon block,
    54    // which can then be signed by a proposer and submitted.
    55    rpc GetBlock(ProposerBlockRequest) returns (ProposerBlockResponse) {
    56      option (google.api.http) = { get: "/eth/v1/validator/blocks/{slot}" };
    57    }
    58  
    59    // GetAttestationData requests that the beacon node provides the attestation data for
    60    // the requested committee index and slot based on the nodes current head.
    61    rpc GetAttestationData(AttestationDataRequest) returns (AttestationDataResponse) {
    62      option (google.api.http) = { get: "/eth/v1/validator/attestation_data" };
    63    }
    64  
    65    // GetAggregateAttestation aggregates all attestations matching the given attestation data root and slot,
    66    // returning the aggregated result.
    67    rpc GetAggregateAttestation(AggregateAttestationRequest) returns (AttestationResponse) {
    68      option (google.api.http) = { get: "/eth/v1/validator/aggregate_attestation" };
    69    }
    70  
    71    // SubmitAggregateAndProofs verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.
    72    //
    73    // Response usage:
    74    // - 200: Successful response
    75    //
    76    // - 400: Invalid request syntax.
    77    //
    78    // - 500: Beacon node internal error.
    79    rpc SubmitAggregateAndProofs(AggregateAndProofsSubmit) returns (google.protobuf.Empty) {
    80      option (google.api.http) = {
    81        post: "/eth/v1/validator/aggregate_and_proofs"
    82        body: "data"
    83      };
    84    }
    85  
    86    // SubmitBeaconCommitteeSubscription requests the beacon node to search using discv5 for peers related to
    87    // the provided subnet information and replaces current peers with those ones if necessary.
    88    //
    89    // If validator is_aggregator, beacon node must:
    90    //   - announce subnet topic subscription on gossipsub.
    91    //   - aggregate attestations received on that subnet.
    92    //
    93    // Response usage:
    94    // - 200: Slot signature is valid and beacon node has prepared the attestation subnet.
    95    //   Note that, we cannot be certain Beacon node will find peers for that subnet for various reasons.
    96    //
    97    // - 500: Beacon node internal error.
    98    //
    99    // - 503: Beacon node is currently syncing, try again later.
   100    rpc SubmitBeaconCommitteeSubscription(BeaconCommitteeSubscribeSubmit) returns (google.protobuf.Empty) {
   101      option (google.api.http) = {
   102        post: "/eth/v1/validator/beacon_committee_subscriptions"
   103        body: "data"
   104      };
   105    }
   106  }
   107  
   108  message AttesterDutiesRequest {
   109    // Epoch to request, should only be allowed 1 epoch ahead.
   110    uint64 epoch = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Epoch"];
   111  
   112    // Validator index to request duties for.
   113    repeated uint64 index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
   114  }
   115  
   116  message AttesterDutiesResponse {
   117    bytes dependent_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
   118    repeated AttesterDuty data = 2;
   119  }
   120  
   121  message AttesterDuty {
   122    // 48 byte BLS public key for the validator who's assigned to perform a duty.
   123    bytes pubkey = 1 [(ethereum.eth.ext.ssz_size) = "48"];
   124  
   125    // The index of the validator in the beacon state.
   126    uint64 validator_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
   127  
   128    // The index of the committee where the validator belongs to.
   129    uint64 committee_index = 3  [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.CommitteeIndex"];
   130  
   131    // The length of the committee the validator belongs to.
   132    uint64 committee_length = 4;
   133  
   134    // The total amount of committees for this slot.
   135    uint64 committees_at_slot = 5;
   136  
   137    // The index of the committee the validator belongs to.
   138    uint64 validator_committee_index = 6  [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.CommitteeIndex"];
   139  
   140    // The slot this duty is for.
   141    uint64 slot = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
   142  }
   143  
   144  message ProposerDutiesRequest {
   145    // Epoch to request duties for.
   146    uint64 epoch = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Epoch"];
   147  }
   148  
   149  message ProposerDutiesResponse {
   150    bytes dependent_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
   151    repeated ProposerDuty data = 2;
   152  }
   153  
   154  message ProposerDuty {
   155    // 48 byte BLS public key for the validator who's assigned to perform a duty.
   156    bytes pubkey = 1 [(ethereum.eth.ext.ssz_size) = "48"];
   157  
   158    // The index of the validator in the beacon state.
   159    uint64 validator_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
   160  
   161    // The slot this duty is for.
   162    uint64 slot = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
   163  }
   164  
   165  message ProposerBlockRequest {
   166    // The slot to request a block for.
   167    uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
   168  
   169    // The validators RANDAO reveal 96 byte value.
   170    bytes randao_reveal = 2 [(ethereum.eth.ext.ssz_size) = "96"];
   171  
   172    // 32 byte field of arbitrary data. This field may contain any data and
   173    // is not used for anything other than a fun message.
   174    bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
   175  }
   176  
   177  message ProposerBlockResponse {
   178    BeaconBlock data = 1;
   179  }
   180  
   181  message AttestationDataRequest {
   182    // Slot for which the attestation data should be retrieved for.
   183    uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
   184  
   185    // Committee index for which the attestation data should be retrieved for.
   186    uint64 committee_index = 2  [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.CommitteeIndex"];
   187  }
   188  
   189  message AttestationDataResponse {
   190    AttestationData data = 1;
   191  }
   192  
   193  message AggregateAttestationRequest {
   194    // The root of the attestation data requesting the aggregate for.
   195    bytes attestation_data_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
   196  
   197    // The slot for the requested aggregate attestation.
   198    uint64 slot = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
   199  }
   200  
   201  message AttestationResponse {
   202    Attestation data = 1;
   203  }
   204  
   205  message AggregateAndProofsSubmit {
   206    repeated SignedAggregateAttestationAndProof data = 1;
   207  }
   208  
   209  message BeaconCommitteeSubscribeSubmit {
   210    repeated BeaconCommitteeSubscribe data = 1;
   211  }
   212  
   213  message BeaconCommitteeSubscribe {
   214    // The validator index to subscribe for.
   215    uint64 validator_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
   216  
   217    // The committee index to be subscribed to.
   218    uint64 committee_index = 2  [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.CommitteeIndex"];
   219  
   220    // The total amount of committees for the given slot.
   221    uint64 committees_at_slot = 3;
   222  
   223    // The slot to be subscribed to.
   224    uint64 slot = 4 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
   225  
   226    // If subscribing for aggregator, the beacon node will aggregate all attestations received.
   227    bool is_aggregator = 5;
   228  }