You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.2 KiB
101 lines
2.2 KiB
syntax = "proto3";
|
|
package message;
|
|
|
|
|
|
// Client is the service used for any client-facing requests.
|
|
service ClientService {
|
|
rpc Process(Message) returns (Response) {}
|
|
}
|
|
|
|
// ReceiverType indicates who is the receiver of this message.
|
|
enum ReceiverType {
|
|
NEWNODE = 0;
|
|
LEADER = 1;
|
|
VALIDATOR = 2;
|
|
CLIENT = 3;
|
|
LEADER_OR_VALIDATOR = 4;
|
|
}
|
|
|
|
// ServiceType indicates which service used to generate this message.
|
|
enum ServiceType {
|
|
CONSENSUS = 0;
|
|
STAKING = 1;
|
|
DRAND = 2;
|
|
CLIENT_SUPPORT = 3;
|
|
}
|
|
|
|
// MessageType indicates what is the type of this message.
|
|
enum MessageType {
|
|
NEWNODE_BEACON_STAKING = 0;
|
|
ANNOUNCE = 1;
|
|
PREPARE = 2;
|
|
PREPARED = 3;
|
|
COMMIT = 4;
|
|
COMMITTED = 5;
|
|
DRAND_INIT = 6;
|
|
DRAND_COMMIT = 7;
|
|
LOTTERY_REQUEST = 8; // it should be either ENTER or GETPLAYERS but it will be removed later.
|
|
}
|
|
|
|
// This is universal message for all communication protocols.
|
|
// There are different Requests for different message types.
|
|
// As we introduce a new type of message just add a new MessageType and new type of request in Message.
|
|
//
|
|
// The request field will be either one of the structure corresponding to the MessageType type.
|
|
message Message {
|
|
ReceiverType receiver_type = 1;
|
|
ServiceType service_type = 2;
|
|
MessageType type = 3;
|
|
bytes signature = 4;
|
|
oneof request {
|
|
StakingRequest staking = 5;
|
|
ConsensusRequest consensus = 6;
|
|
DrandRequest drand = 7;
|
|
// Refactor this later after demo.
|
|
LotteryRequest lottery_request = 8;
|
|
}
|
|
}
|
|
|
|
message Response {
|
|
ReceiverType receiver_type = 1;
|
|
ServiceType service_type = 2;
|
|
MessageType type = 3;
|
|
oneof response {
|
|
LotteryResponse lottery_response = 4;
|
|
}
|
|
}
|
|
|
|
message LotteryResponse {
|
|
repeated string players = 2;
|
|
repeated string balances = 3;
|
|
}
|
|
|
|
message LotteryRequest {
|
|
enum Type {
|
|
ENTER = 0;
|
|
RESULT = 1;
|
|
PICK_WINNER = 2;
|
|
}
|
|
Type type = 1;
|
|
string private_key = 2;
|
|
int64 amount = 3;
|
|
}
|
|
|
|
// Staking Request from new node to beacon node.
|
|
message StakingRequest {
|
|
bytes transaction = 1;
|
|
string node_id = 2;
|
|
}
|
|
|
|
message ConsensusRequest {
|
|
uint32 consensus_id = 1;
|
|
bytes block_hash = 2;
|
|
bytes sender_pubkey = 3;
|
|
bytes payload = 4;
|
|
}
|
|
|
|
message DrandRequest {
|
|
bytes sender_pubkey = 1;
|
|
bytes block_hash = 2;
|
|
bytes payload = 3;
|
|
} |