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.

156 lines
5.5 KiB

  1. syntax = "proto3";
  2. package tendermint.types;
  3. option go_package = "github.com/tendermint/tendermint/proto/types";
  4. import "third_party/proto/gogoproto/gogo.proto";
  5. import "google/protobuf/timestamp.proto";
  6. import "proto/libs/bits/types.proto";
  7. import "proto/crypto/merkle/types.proto";
  8. import "proto/version/version.proto";
  9. // BlockIdFlag indicates which BlcokID the signature is for
  10. enum BlockIDFlag {
  11. option (gogoproto.goproto_enum_stringer) = true;
  12. option (gogoproto.goproto_enum_prefix) = false;
  13. BLOCKD_ID_FLAG_UNKNOWN = 0;
  14. BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"];
  15. BLOCK_ID_FLAG_COMMIT = 2 [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"];
  16. BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"];
  17. }
  18. // SignedMsgType is a type of signed message in the consensus.
  19. enum SignedMsgType {
  20. option (gogoproto.goproto_enum_stringer) = true;
  21. option (gogoproto.goproto_enum_prefix) = false;
  22. SIGNED_MSG_TYPE_UNKNOWN = 0;
  23. // Votes
  24. PREVOTE_TYPE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"];
  25. PRECOMMIT_TYPE = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"];
  26. // Proposals
  27. PROPOSAL_TYPE = 32 [(gogoproto.enumvalue_customname) = "ProposalType"];
  28. }
  29. // PartsetHeader
  30. message PartSetHeader {
  31. uint32 total = 1;
  32. bytes hash = 2;
  33. }
  34. message Part {
  35. uint32 index = 1;
  36. bytes bytes = 2;
  37. tendermint.crypto.merkle.Proof proof = 3 [(gogoproto.nullable) = false];
  38. }
  39. // BlockID
  40. message BlockID {
  41. bytes hash = 1;
  42. PartSetHeader parts_header = 2 [(gogoproto.nullable) = false];
  43. }
  44. // --------------------------------
  45. // Header defines the structure of a Tendermint block header.
  46. message Header {
  47. // basic block info
  48. tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false];
  49. string chain_id = 2 [(gogoproto.customname) = "ChainID"];
  50. int64 height = 3;
  51. google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  52. // prev block info
  53. BlockID last_block_id = 5 [(gogoproto.nullable) = false];
  54. // hashes of block data
  55. bytes last_commit_hash = 6; // commit from validators from the last block
  56. bytes data_hash = 7; // transactions
  57. // hashes from the app output from the prev block
  58. bytes validators_hash = 8; // validators for the current block
  59. bytes next_validators_hash = 9; // validators for the next block
  60. bytes consensus_hash = 10; // consensus params for current block
  61. bytes app_hash = 11; // state after txs from the previous block
  62. bytes last_results_hash = 12; // root hash of all results from the txs from the previous block
  63. // consensus info
  64. bytes evidence_hash = 13; // evidence included in the block
  65. bytes proposer_address = 14; // original proposer of the block
  66. }
  67. // Data contains the set of transactions included in the block
  68. message Data {
  69. // Txs that will be applied by state @ block.Height+1.
  70. // NOTE: not all txs here are valid. We're just agreeing on the order first.
  71. // This means that block.AppHash does not include these txs.
  72. repeated bytes txs = 1;
  73. // Volatile
  74. bytes hash = 2;
  75. }
  76. // Vote represents a prevote, precommit, or commit vote from validators for
  77. // consensus.
  78. message Vote {
  79. SignedMsgType type = 1;
  80. int64 height = 2;
  81. int32 round = 3;
  82. BlockID block_id = 4
  83. [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil.
  84. google.protobuf.Timestamp timestamp = 5
  85. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  86. bytes validator_address = 6;
  87. int32 validator_index = 7;
  88. bytes signature = 8;
  89. }
  90. // Commit contains the evidence that a block was committed by a set of validators.
  91. message Commit {
  92. int64 height = 1;
  93. int32 round = 2;
  94. BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"];
  95. repeated CommitSig signatures = 4 [(gogoproto.nullable) = false];
  96. bytes hash = 5;
  97. tendermint.libs.bits.BitArray bit_array = 6;
  98. }
  99. // CommitSig is a part of the Vote included in a Commit.
  100. message CommitSig {
  101. BlockIDFlag block_id_flag = 1;
  102. bytes validator_address = 2;
  103. google.protobuf.Timestamp timestamp = 3
  104. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  105. bytes signature = 4;
  106. }
  107. message Proposal {
  108. SignedMsgType type = 1;
  109. int64 height = 2;
  110. int32 round = 3;
  111. int32 pol_round = 4;
  112. BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false];
  113. google.protobuf.Timestamp timestamp = 6
  114. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  115. bytes signature = 7;
  116. }
  117. message SignedHeader {
  118. Header header = 1;
  119. Commit commit = 2;
  120. }
  121. message BlockMeta {
  122. BlockID block_id = 1 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false];
  123. int64 block_size = 2;
  124. Header header = 3 [(gogoproto.nullable) = false];
  125. int64 num_txs = 4;
  126. }
  127. // TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree.
  128. message TxProof {
  129. bytes root_hash = 1;
  130. bytes data = 2;
  131. tendermint.crypto.merkle.Proof Proof = 3;
  132. }