erigon-pulse/interfaces/p2psentry/sentry.proto
mempirate ca926ce94d
net_peerCount for remote sentries (#2192)
* net_peerCount for remote sentries

* cleanup

* Simplify NetPeerCount using SentryClient

* Refactor id -> count
2021-06-18 14:34:15 +01:00

142 lines
3.0 KiB
Protocol Buffer

syntax = "proto3";
import "google/protobuf/empty.proto";
import "types/types.proto";
package sentry;
option go_package = "./sentry;sentry";
enum MessageId {
// ======= eth 65 protocol ===========
STATUS_65 = 0;
GET_BLOCK_HEADERS_65 = 1;
BLOCK_HEADERS_65 = 2;
BLOCK_HASHES_65 = 3;
GET_BLOCK_BODIES_65 = 4;
BLOCK_BODIES_65 = 5;
GET_NODE_DATA_65 = 6;
NODE_DATA_65 = 7;
GET_RECEIPTS_65 = 8;
RECEIPTS_65 = 9;
NEW_BLOCK_HASHES_65 = 10;
NEW_BLOCK_65 = 11;
TRANSACTIONS_65 = 12;
NEW_POOLED_TRANSACTION_HASHES_65 = 13;
GET_POOLED_TRANSACTIONS_65 = 14;
POOLED_TRANSACTIONS_65 = 15;
// ======= eth 66 protocol ===========
// eth64 announcement messages (no id)
STATUS_66 = 17;
NEW_BLOCK_HASHES_66 = 18;
NEW_BLOCK_66 = 19;
TRANSACTIONS_66 = 20;
// eth65 announcement messages (no id)
NEW_POOLED_TRANSACTION_HASHES_66 = 21;
// eth66 messages with request-id
GET_BLOCK_HEADERS_66 = 22;
GET_BLOCK_BODIES_66 = 23;
GET_NODE_DATA_66 = 24;
GET_RECEIPTS_66 = 25;
GET_POOLED_TRANSACTIONS_66 = 26;
BLOCK_HEADERS_66 = 27;
BLOCK_BODIES_66 = 28;
NODE_DATA_66 = 29;
RECEIPTS_66 = 30;
POOLED_TRANSACTIONS_66 = 31;
// ======= eth 67 protocol ===========
// ...
}
message OutboundMessageData {
MessageId id = 1;
bytes data = 2;
}
message SendMessageByMinBlockRequest {
OutboundMessageData data = 1;
uint64 min_block = 2;
}
message SendMessageByIdRequest {
OutboundMessageData data = 1;
types.H512 peer_id = 2;
}
message SendMessageToRandomPeersRequest {
OutboundMessageData data = 1;
uint64 max_peers = 2;
}
message SentPeers {repeated types.H512 peers = 1;}
enum PenaltyKind {Kick = 0;}
message PenalizePeerRequest {
types.H512 peer_id = 1;
PenaltyKind penalty = 2;
}
message PeerMinBlockRequest {
types.H512 peer_id = 1;
uint64 min_block = 2;
}
message InboundMessage {
MessageId id = 1;
bytes data = 2;
types.H512 peer_id = 3;
}
message Forks {
types.H256 genesis = 1;
repeated uint64 forks = 2;
}
message StatusData {
uint64 network_id = 1;
types.H256 total_difficulty = 2;
types.H256 best_hash = 3;
Forks fork_data = 4;
uint64 max_block = 5;
}
enum Protocol {
ETH65 = 0;
ETH66 = 1;
}
message SetStatusReply {
Protocol protocol = 1;
}
message MessagesRequest {
repeated MessageId ids = 1;
}
message PeerCountRequest {}
message PeerCountReply { uint64 count = 1; }
service Sentry {
rpc PenalizePeer(PenalizePeerRequest) returns (google.protobuf.Empty);
rpc PeerMinBlock(PeerMinBlockRequest) returns (google.protobuf.Empty);
rpc SendMessageByMinBlock(SendMessageByMinBlockRequest) returns (SentPeers);
rpc SendMessageById(SendMessageByIdRequest) returns (SentPeers);
rpc SendMessageToRandomPeers(SendMessageToRandomPeersRequest)
returns (SentPeers);
rpc SendMessageToAll(OutboundMessageData) returns (SentPeers);
rpc SetStatus(StatusData) returns (SetStatusReply);
rpc Messages(MessagesRequest) returns (stream InboundMessage);
rpc PeerCount(PeerCountRequest) returns (PeerCountReply);
}