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.

162 lines
5.7 KiB

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