github.com/prysmaticlabs/prysm@v1.4.4/proto/prysm/v2/validator.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.prysm.v2;
    17  
    18  import "google/api/annotations.proto";
    19  import "google/protobuf/empty.proto";
    20  
    21  import "proto/eth/ext/options.proto";
    22  
    23  import "proto/eth/v1alpha1/validator.proto";
    24  import "proto/eth/v1alpha1/beacon_block.proto";
    25  import "proto/eth/v1alpha1/beacon_chain.proto";
    26  
    27  import "proto/prysm/v2/beacon_block.proto";
    28  import "proto/prysm/v2/sync_committee.proto";
    29  
    30  option csharp_namespace = "Ethereum.Prysm.V2";
    31  option go_package = "github.com/prysmaticlabs/prysm/proto/prysm/v2;v2";
    32  option java_multiple_files = true;
    33  option java_outer_classname = "ValidatorProto";
    34  option java_package = "org.ethereum.prysm.v2";
    35  option php_namespace = "Ethereum\\Prysm\\v2";
    36  
    37  // Beacon node validator API
    38  //
    39  // The beacon node validator API enables a validator to connect
    40  // and perform its obligations on the Ethereum Beacon Chain.
    41  service BeaconNodeValidatorAltair {
    42    // Retrieves the latest valid beacon block to be proposed on the beacon chain.
    43    //
    44    // The server returns a new beacon block, without proposer signature, that can be
    45    // proposed on the beacon chain. The block should be filled with all the necessary
    46    // data for proposer to sign. This block is versioned from Altair onwards.
    47    rpc GetBlock(ethereum.eth.v1alpha1.BlockRequest) returns (BeaconBlockAltair) {
    48      option (google.api.http) = {
    49        get: "/eth/v2prysm/validator/block"
    50      };
    51    }
    52  
    53    // Sends the newly signed beacon block to beacon node.
    54    //
    55    // The validator sends the newly signed beacon block to the beacon node so the beacon block can
    56    // be included in the beacon chain. The beacon node is expected to validate and process the
    57    // beacon block into its state. This block is versioned from Altair onwards.
    58    rpc ProposeBlock(SignedBeaconBlockAltair) returns (ethereum.eth.v1alpha1.ProposeResponse) {
    59      option (google.api.http) = {
    60        post: "/prysm/v2/validator/block"
    61        body: "*"
    62      };
    63    }
    64  
    65    // Retrieves a sync committee message block root to be signed over as part of sync committee duty.
    66    rpc GetSyncMessageBlockRoot(google.protobuf.Empty) returns (SyncMessageBlockRootResponse) {
    67      option (google.api.http) = {
    68        get: "/prysm/v2/validator/sync_message_block_root"
    69      };
    70    }
    71  
    72    // Submits a sync committee message to be broadcasted over network. This is part of sync committee duty.
    73    rpc SubmitSyncMessage(SyncCommitteeMessage) returns (google.protobuf.Empty) {
    74      option (google.api.http) = {
    75        post: "/prysm/v2/validator/sync_message"
    76        body: "*"
    77      };
    78    }
    79  
    80    // Retrieves the sync subcommittee index of a given validator.
    81    //
    82    // The server returns the sync subcommittee index given the validator public key,
    83    // if the validator does not exist in the sync committee then an error would be returned.
    84    // The subcommittee index is used for the aggregation of sync committee message.
    85    rpc GetSyncSubcommitteeIndex(SyncSubcommitteeIndexRequest) returns (SyncSubcommitteeIndexResponse) {
    86      option (google.api.http) = {
    87        get: "/prysm/v2/sync_subcommittee_index"
    88      };
    89    }
    90  
    91    // Retrieve sync committee contribution to the beacon node to aggregate all matching sync committee messages with the same slot and root.
    92    // the beacon node responses with a sync committee contribution object for the validator to sign over.
    93    rpc GetSyncCommitteeContribution(SyncCommitteeContributionRequest) returns (SyncCommitteeContribution) {
    94      option (google.api.http) = {
    95        post: "/prysm/v2/validator/contribution_and_proof"
    96        body: "*"
    97      };
    98    }
    99  
   100    // Submit a signed sync committee contribution and proof object, the beacon node will broadcast the
   101    // signed contribution and proof object.
   102    rpc SubmitSignedContributionAndProof(SignedContributionAndProof) returns (google.protobuf.Empty) {
   103      option (google.api.http) = {
   104        post: "/prysm/v2/validator/signed_contribution_and_proof"
   105        body: "*"
   106      };
   107    }
   108  
   109    // Server-side stream of all signed blocks as they are received by
   110    // the beacon chain node.
   111    rpc StreamBlocks(ethereum.eth.v1alpha1.StreamBlocksRequest) returns (stream StreamBlocksResponse) {
   112      option (google.api.http) = {
   113              get: "/prysm/v2/validator/blocks/stream"
   114          };
   115    }
   116  }
   117  
   118  // SyncMessageBlockRootResponse for beacon chain validator to retrieve and
   119  // to sign over the block root as part of sync committee duty to facilitate light client.
   120  message SyncMessageBlockRootResponse {
   121    // The block root of the head block.
   122    bytes root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
   123  }
   124  
   125  // SyncSubcommitteeIndexRequest requests sync subcommittee index given the validator public key.
   126  message SyncSubcommitteeIndexRequest {
   127    // The validator's public key.
   128    bytes public_key = 1 [(ethereum.eth.ext.ssz_size) = "48"];
   129    // The slot of validator's assignment.
   130    uint64 slot = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
   131  }
   132  
   133  message SyncCommitteeContributionRequest {
   134    // Slot for which the aggregation request applies.
   135    uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
   136    // 48 byte public key of the validator.
   137    bytes public_key = 2 [(ethereum.eth.ext.ssz_size) = "48", (ethereum.eth.ext.spec_name) = "pubkey"];
   138    // Subnet ID of where this contribution and proof should be broadcast to.
   139    uint64 subnet_id = 3;
   140  }
   141  
   142  // SyncSubcommitteeIndexResponse responds index of the sync subcommittee of a given validator.
   143  message SyncSubcommitteeIndexResponse {
   144    // The subcommittee index itself.
   145    // If the total validator count is not sufficient, there could be more than one index.
   146    repeated uint64 indices = 1;
   147  }
   148  
   149  message StreamBlocksResponse {
   150    oneof block {
   151      // Representing a phase 0 block.
   152      ethereum.eth.v1alpha1.SignedBeaconBlock phase0_block = 1 ;
   153  
   154      // Representing an altair block.
   155      SignedBeaconBlockAltair altair_block = 2;
   156    }
   157  }