179 lines
3.7 KiB
Protocol Buffer
179 lines
3.7 KiB
Protocol Buffer
// TODO: This setup requires that the BN (beacon node) holds the block in state
|
|
// during the interval between the `GenerateProposalRequest` and the
|
|
// `SubmitProposalRequest`.
|
|
//
|
|
// This is sub-optimal as if a validator client switches BN during this process
|
|
// the block will be lost.
|
|
//
|
|
// This "stateful" method is being used presently because it's easier and
|
|
// requires less maintainence as the `BeaconBlock` definition changes.
|
|
|
|
syntax = "proto3";
|
|
|
|
package ethereum.beacon.rpc.v1;
|
|
|
|
// Service that currently identifies a beacon node
|
|
service BeaconNodeService {
|
|
rpc Info(Empty) returns (NodeInfoResponse);
|
|
}
|
|
|
|
/// Service that handles block production
|
|
service BeaconBlockService {
|
|
rpc ProduceBeaconBlock(ProduceBeaconBlockRequest) returns (ProduceBeaconBlockResponse);
|
|
rpc PublishBeaconBlock(PublishBeaconBlockRequest) returns (PublishBeaconBlockResponse);
|
|
}
|
|
|
|
/// Service that provides the validator client with requisite knowledge about
|
|
//its public keys
|
|
service ValidatorService {
|
|
rpc ProposeBlockSlot(ProposeBlockSlotRequest) returns (ProposeBlockSlotResponse);
|
|
rpc ValidatorIndex(PublicKey) returns (IndexResponse);
|
|
// rpc ValidatorAssignment(ValidatorAssignmentRequest) returns (ValidatorAssignmentResponse);
|
|
}
|
|
|
|
/// Service that handles validator attestations
|
|
service AttestationService {
|
|
rpc ProduceAttestation(ProduceAttestationRequest) returns (ProduceAttestationResponse);
|
|
rpc PublishAttestation(PublishAttestationRequest) returns (PublishAttestationResponse);
|
|
}
|
|
|
|
/*
|
|
* Beacon Node Service Message
|
|
*/
|
|
message NodeInfoResponse {
|
|
string version = 1;
|
|
Fork fork = 2;
|
|
uint32 chain_id = 3;
|
|
uint64 genesis_time = 4;
|
|
uint64 genesis_slot = 5;
|
|
}
|
|
|
|
message Fork {
|
|
bytes previous_version = 1;
|
|
bytes current_version = 2;
|
|
uint64 epoch = 3;
|
|
}
|
|
|
|
message Empty {}
|
|
|
|
|
|
/*
|
|
* Block Production Service Messages
|
|
*/
|
|
|
|
// Validator requests an unsigned proposal.
|
|
message ProduceBeaconBlockRequest {
|
|
uint64 slot = 1;
|
|
}
|
|
|
|
// Beacon node returns an unsigned proposal.
|
|
message ProduceBeaconBlockResponse {
|
|
BeaconBlock block = 1;
|
|
}
|
|
|
|
// Validator submits a signed proposal.
|
|
message PublishBeaconBlockRequest {
|
|
BeaconBlock block = 1;
|
|
}
|
|
|
|
// Beacon node indicates a sucessfully submitted proposal.
|
|
message PublishBeaconBlockResponse {
|
|
bool success = 1;
|
|
bytes msg = 2;
|
|
}
|
|
|
|
message BeaconBlock {
|
|
bytes ssz = 1;
|
|
}
|
|
|
|
/*
|
|
* Validator Service Messages
|
|
*/
|
|
/*
|
|
message ValidatorAssignmentRequest {
|
|
uint64 epoch = 1;
|
|
bytes validator_index = 2;
|
|
}
|
|
|
|
// A validators duties for some epoch.
|
|
// TODO: add shard duties.
|
|
message ValidatorAssignment {
|
|
oneof block_production_slot_oneof {
|
|
bool block_production_slot_none = 1;
|
|
uint64 block_production_slot = 2;
|
|
}
|
|
}
|
|
*/
|
|
|
|
// Validator Assignment
|
|
|
|
message PublicKey {
|
|
bytes public_key = 1;
|
|
}
|
|
|
|
message IndexResponse {
|
|
uint64 index = 1;
|
|
}
|
|
|
|
|
|
// Propose slot
|
|
|
|
message ProposeBlockSlotRequest {
|
|
uint64 epoch = 1;
|
|
uint64 validator_index = 2;
|
|
}
|
|
|
|
message ProposeBlockSlotResponse {
|
|
oneof slot_oneof {
|
|
bool none = 1;
|
|
uint64 slot = 2;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
* Attestation Service Messages
|
|
*/
|
|
|
|
message ProduceAttestationRequest {
|
|
uint64 slot = 1;
|
|
uint64 shard = 2;
|
|
}
|
|
|
|
message ProduceAttestationResponse {
|
|
Attestation attestation_data = 1;
|
|
}
|
|
|
|
message PublishAttestationRequest {
|
|
FreeAttestation free_attestation = 1;
|
|
}
|
|
|
|
message PublishAttestationResponse {
|
|
bool success = 1;
|
|
bytes msg = 2;
|
|
}
|
|
|
|
message Crosslink {
|
|
uint64 epoch = 1;
|
|
bytes crosslink_data_root = 2;
|
|
|
|
}
|
|
|
|
message Attestation {
|
|
uint64 slot = 1;
|
|
uint64 shard = 2;
|
|
bytes beacon_block_root = 3;
|
|
bytes epoch_boundary_root = 4;
|
|
bytes crosslink_data_root = 5;
|
|
Crosslink latest_crosslink = 6;
|
|
uint64 justified_epoch = 7;
|
|
bytes justified_block_root = 8;
|
|
|
|
}
|
|
|
|
message FreeAttestation {
|
|
Attestation attestation_data = 1;
|
|
bytes signature = 2;
|
|
uint64 validator_index = 3;
|
|
}
|