Skip to content

Commit

Permalink
rchain v0.9.12 .proto files
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Aug 24, 2019
1 parent 104b904 commit 049c153
Show file tree
Hide file tree
Showing 4 changed files with 292 additions and 179 deletions.
216 changes: 40 additions & 176 deletions protobuf/CasperMessage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,197 +18,37 @@ import "Either.proto";
option (scalapb.options) = {
package_name: "coop.rchain.casper.protocol"
flat_package: true
single_file: true
preamble: "sealed trait CasperMessage"
};

// --------- DeployService --------

// Use `DoDeploy` to queue deployments of Rholang code and then
// `createBlock` to make a new block with the results of running them
// all.
//
// To get results back, use `listenForDataAtName`.
service DeployService {
// Queue deployment of Rholang code (or fail to parse).
// Returns on success DeployServiceResponse
rpc DoDeploy(DeployData) returns (Either) {}
// Add a block including all pending deploys.
// Returns on success DeployServiceResponse
rpc createBlock(google.protobuf.Empty) returns (Either) {}
// Get details about a particular block.
// Returns on success BlockQueryResponse
rpc showBlock(BlockQuery) returns (Either) {}
// Get dag
// Returns on success VisualizeBlocksResponse
rpc visualizeDag(VisualizeDagQuery) returns (Either) {}
// Returns on success BlockInfoWithoutTuplespace
rpc showMainChain(BlocksQuery) returns (stream Either) {}
// Get a summary of blocks on the blockchain.
// Returns on success BlockInfoWithoutTuplespace
rpc showBlocks(BlocksQuery) returns (stream Either) {}
// Find data sent to a name.
// Returns on success ListeningNameDataResponse
rpc listenForDataAtName(DataAtNameQuery) returns (Either) {}
// Find processes receiving on a name.
// Returns on success ListeningNameContinuationResponse
rpc listenForContinuationAtName(ContinuationAtNameQuery) returns (Either) {}
// Find block from a deploy.
// Returns on success BlockQueryResponse
rpc findBlockWithDeploy(FindDeployInBlockQuery) returns (Either) {}
// Preview new top-level unforgeable names (for example, to compute signatures over them).
// Returns on success PrivateNamePreviewResponse
rpc previewPrivateNames(PrivateNamePreviewQuery) returns (Either) {}
message HasBlockRequest {
option (scalapb.message).extends = "CasperMessage";
bytes hash = 1;
}


/**
* Note: deploys are uniquely keyed by `user`, `timestamp`.
*
* **TODO**: details of signatures and payment. See RHOL-781
*/
message DeployData {
bytes deployer = 1; //public key
string term = 2; //rholang source code to deploy (will be parsed into `Par`)
int64 timestamp = 3; //millisecond timestamp
bytes sig = 4; //signature of (hash(term) + timestamp) using private key
string sigAlgorithm = 5; //name of the algorithm used to sign
int64 phloPrice = 7; //phlo price
int64 phloLimit = 8; //phlo limit for the deployment
int64 validAfterBlockNumber = 10;
message HasBlock {
option (scalapb.message).extends = "CasperMessage";
bytes hash = 1;
}

message BlockRequest {
//Fields are redundant to allow for validity check.
//Such a check can definitively distinguish this
//from other message types with similar serializations.
string base16Hash = 1;
bytes hash = 2;
option (scalapb.message).extends = "CasperMessage";
bytes hash = 1;
}

message ForkChoiceTipRequest {
option (scalapb.message).extends = "CasperMessage";
}

message FindDeployInBlockQuery {
bytes user = 1;
int64 timestamp = 2;
}

message BlockQuery {
string hash = 1;
}

message BlocksQuery {
int32 depth = 1;
}

message DataAtNameQuery {
int32 depth = 1;
Par name = 2;
}

message ContinuationAtNameQuery {
int32 depth = 1;
repeated Par names = 2;
}

message DeployServiceResponse {
string message = 1;
}

message MaybeBlockMessage {
BlockMessage block = 1;
}

message BlockQueryResponse {
BlockInfo blockInfo = 1;
}

message VisualizeDagQuery {
int32 depth = 1;
bool showJustificationLines = 2;
}

message VisualizeBlocksResponse {
string content = 1;
}

message ListeningNameDataResponse {
repeated DataWithBlockInfo blockResults = 1;
int32 length = 2;
}

message ListeningNameContinuationResponse {
repeated ContinuationsWithBlockInfo blockResults = 1;
int32 length = 2;
}

message DataWithBlockInfo {
repeated Par postBlockData = 1;
BlockInfoWithoutTuplespace block = 2;
}

message ContinuationsWithBlockInfo {
repeated WaitingContinuationInfo postBlockContinuations = 1;
BlockInfoWithoutTuplespace block = 2;
}

message WaitingContinuationInfo {
repeated BindPattern postBlockPatterns = 1;
Par postBlockContinuation = 2;
}

message BlockInfoWithoutTuplespace {
string blockHash = 1;
string blockSize = 2;
int64 blockNumber = 3;
int64 version = 4;
int32 deployCount = 5;
string tupleSpaceHash = 6; // Same as postStateHash of BlockMessage
int64 timestamp = 7;
float faultTolerance = 8;
string mainParentHash = 9;
repeated string parentsHashList = 10;
string sender = 11;
}

// For node clients, see BlockMessage for actual Casper protocol Block representation
message BlockInfo {
string blockHash = 1;
string blockSize = 2;
int64 blockNumber = 3;
int64 version = 4;
int32 deployCount = 5;
string tupleSpaceHash = 6; // Same as postStateHash of BlockMessage
string tupleSpaceDump = 7;
int64 timestamp = 8;
float faultTolerance = 9;
string mainParentHash = 10;
repeated string parentsHashList = 11;
string sender = 12;
string shardId = 13;
repeated string bondsValidatorList = 14;
repeated string deployCost = 15;
}

message PrivateNamePreviewQuery {
bytes user = 1; // public key a la DeployData
int64 timestamp = 2; // millisecond timestamp
int32 nameQty = 3; // how many names to preview? (max: 1024)
}

message PrivateNamePreviewResponse {
repeated bytes ids = 1; // a la GPrivate
}


// --------- End DeployService --------

// ---------- Signing Protocol ---------
message ApprovedBlockCandidate {
BlockMessage block = 1;
int32 requiredSigs = 2;
}

message UnapprovedBlock {
option (scalapb.message).extends = "CasperMessage";
ApprovedBlockCandidate candidate = 1;
int64 timestamp = 2;
int64 duration = 3;
Expand All @@ -221,20 +61,24 @@ message Signature {
}

message BlockApproval {
option (scalapb.message).extends = "CasperMessage";
ApprovedBlockCandidate candidate = 1;
Signature sig = 2;
}

message ApprovedBlock {
option (scalapb.message).extends = "CasperMessage";
ApprovedBlockCandidate candidate = 1;
repeated Signature sigs = 2;
}

message ApprovedBlockRequest {
option (scalapb.message).extends = "CasperMessage";
string identifier = 1;
}

message NoApprovedBlockAvailable {
option (scalapb.message).extends = "CasperMessage";
string identifier = 1;
string nodeIdentifer = 2;
}
Expand All @@ -243,6 +87,7 @@ message NoApprovedBlockAvailable {

// --------- Core Protocol --------
message BlockMessage {
option (scalapb.message).extends = "CasperMessage";
bytes blockHash = 1; // obtained by hashing the information in the header
Header header = 2;
Body body = 3;
Expand Down Expand Up @@ -280,11 +125,28 @@ message Header {
bytes extraBytes = 8;
}

/**
* Note: deploys are uniquely keyed by `user`, `timestamp`.
*
* **TODO**: details of signatures and payment. See RHOL-781
*/
message DeployData {
bytes deployer = 1; //public key
string term = 2; //rholang source code to deploy (will be parsed into `Par`)
int64 timestamp = 3; //millisecond timestamp
bytes sig = 4; //signature of (hash(term) + timestamp) using private key
string sigAlgorithm = 5; //name of the algorithm used to sign
int64 phloPrice = 7; //phlo price
int64 phloLimit = 8; //phlo limit for the deployment
int64 validAfterBlockNumber = 10;
}

message ProcessedDeploy {
DeployData deploy = 1;
PCost cost = 2 ;
repeated Event log = 3; //the new terms and comm. rule reductions from this deploy
bool errored = 4; //true if deploy encountered a user error
repeated Event deployLog = 3; //the new terms and comm. rule reductions from this deploy
repeated Event paymentLog = 4; //the comm. rule reductions from the payment for the deploy
bool errored = 5; //true if deploy encountered a user error
}

message Body {
Expand Down Expand Up @@ -319,13 +181,15 @@ message Event {
message ProduceEvent {
bytes channelsHash = 1;
bytes hash = 2;
int32 sequenceNumber = 3;
bool persistent = 3;
int32 sequenceNumber = 4;
}

message ConsumeEvent {
repeated bytes channelsHashes = 1;
bytes hash = 2;
int32 sequenceNumber = 3;
bool persistent = 3;
int32 sequenceNumber = 4;
}

message CommEvent {
Expand Down
Loading

0 comments on commit 049c153

Please sign in to comment.