Skip to content

Commit

Permalink
First iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Oct 11, 2023
1 parent 8b45fcf commit a8ba175
Showing 1 changed file with 13 additions and 63 deletions.
76 changes: 13 additions & 63 deletions proto/pocket/service/relay.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,53 +27,46 @@ message RelayRequestMetadata {
// RelayResponse is used to hold the response from a RelayRequest.
message RelayRequest {
RelayRequestMetadata meta = 1;
// Every different chain/service may have its own custom payload (e.g. HTTP, JSON, GRPC, non-chain services)
oneof relay_payload {
// TODO: Add other relay types in the future such as the ones below:
oneof payload {
JSONRPCPayload json_rpc_payload = 2;
RESTPayload rest_payload = 3;
// TODO: Add other relay types in the future such as the ones below:
// WebSocketsPayload websockets_payload = 4;
// GRPCPayload grpc_payload = 5;
// GraphQLPayload graphql_payload = 6;
}
}


// RelayResponseMetadata is used to hold the metadata for a RelayResponse
message RelayResponseMetadata {
session.SessionHeader session_header = 1; // The session header for the relay
map<string, string> headers = 2; // The headers of the response
uint32 status_code = 3;
string err = 4;
uint32 status_code = 3; // The status code of the response
string err = 4; // The error message of the response
bytes supplier_signature = 5; // The signature of the supplier on the response
}

// RelayResponse is used to hold the response to a RelayRequest.
message RelayResponse {
RelayResponseMetadata meta = 1;
// Every different chain/service may have its own custom payload (e.g. HTTP, JSON, GRPC, non-chain services)
oneof relay_payload {
// TODO: Add other relay types in the future such as the ones below:
oneof payload {
JSONRPCPayload json_rpc_payload = 2;
RESTPayload rest_payload = 3;
// WebSocketsPayload websockets_payload = 4;
// GRPCPayload grpc_payload = 5;
// GraphQLPayload graphql_payload = 6;
}
}


// map<string, string> headers = 1;
// uint32 status_code = 2;
// string err = 3;
// bytes payload = 4;
// string session_id = 5;
// string servicer_address = 6;
// bytes servicer_signature = 7;
// }

// JSONRPCPayload is used to hold the payload and request metadata for a JSON-RPC request.
// See the JSONRPC spec in the following link for more details: https://www.jsonrpc.org/specification#request_object
message JSONRPCPayload {
bytes id = 1; // JSONRPC version 2 expected a field named "id".
string jsonrpc = 2; // JSONRPC version 2 expects a field named "jsonrpc" with a value of "2.0".
string method = 3; // The method being invoked on the server.
bytes parameters = 4; // The parameters field can be empty, an array or a structure

map<string, string> parameters = 4; // The parameters field can be empty, an array or a structure
bytes data = 5;
}

// RESTRequestType is used to hold the type of REST request being made.
Expand All @@ -91,47 +84,4 @@ message RESTPayload {
string http_path = 2;
string contents = 3;
// TODO_INCOMPLETE: Add REST relay payload fields
}


// TODO_REFACTOR: See the commened out structure at the bottom of this file for what we should use in prod.

// Representation of Go's http.Request (simplified naïve implementation)
message RelayRequest {
map<string, string> headers = 1;
string method = 2;
string url = 3;
bytes payload = 4;
string session_id = 5;
string application_address = 6;
bytes application_signature = 7;
}


message RelayProof {
option (gogoproto.goproto_getters) = false;

string requestHash = 1 [(gogoproto.jsontag) = "request_hash"];
int64 entropy = 2 [(gogoproto.jsontag) = "entropy"];
int64 sessionBlockHeight = 3 [(gogoproto.jsontag) = "session_block_height"];
string servicerPubKey = 4 [(gogoproto.jsontag) = "servicer_pub_key"];
string blockchain = 5 [(gogoproto.jsontag) = "blockchain"];
AAT token = 6 [(gogoproto.jsontag) = "aat", (gogoproto.nullable) = false];
string signature = 7 [(gogoproto.jsontag) = "signature"];
}

message ChallengeProofInvalidData {
option (gogoproto.goproto_getters) = false;

repeated RelayResponse majorityResponses = 1 [(gogoproto.jsontag) = "majority_responses", (gogoproto.nullable) = false];
RelayResponse minorityResponse = 2 [(gogoproto.jsontag) = "minority_response", (gogoproto.nullable) = false];
bytes reporterAddress = 3 [(gogoproto.jsontag) = "reporters_address", (gogoproto.casttype) = "github.com/pokt-network/pocket-core/types.Address"];
}

message RelayResponse {
option (gogoproto.goproto_getters) = false;


string response = 1 [(gogoproto.jsontag) = "payload"];
RelayProof proof = 2 [(gogoproto.jsontag) = "proof", (gogoproto.nullable) = false];
}

0 comments on commit a8ba175

Please sign in to comment.