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.

157 lines
5.5 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/crypto/proof.proto";
  7. import "tendermint/version/types.proto";
  8. import "tendermint/types/validator.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. BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"];
  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 [(gogoproto.enumvalue_customname) = "UnknownType"];
  23. // Votes
  24. SIGNED_MSG_TYPE_PREVOTE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"];
  25. SIGNED_MSG_TYPE_PRECOMMIT = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"];
  26. // Proposals
  27. SIGNED_MSG_TYPE_PROPOSAL = 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.Proof proof = 3 [(gogoproto.nullable) = false];
  38. }
  39. // BlockID
  40. message BlockID {
  41. bytes hash = 1;
  42. PartSetHeader part_set_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. }
  74. // Vote represents a prevote, precommit, or commit vote from validators for
  75. // consensus.
  76. message Vote {
  77. SignedMsgType type = 1;
  78. int64 height = 2;
  79. int32 round = 3;
  80. BlockID block_id = 4
  81. [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil.
  82. google.protobuf.Timestamp timestamp = 5
  83. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  84. bytes validator_address = 6;
  85. int32 validator_index = 7;
  86. bytes signature = 8;
  87. }
  88. // Commit contains the evidence that a block was committed by a set of validators.
  89. message Commit {
  90. int64 height = 1;
  91. int32 round = 2;
  92. BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"];
  93. repeated CommitSig signatures = 4 [(gogoproto.nullable) = false];
  94. }
  95. // CommitSig is a part of the Vote included in a Commit.
  96. message CommitSig {
  97. BlockIDFlag block_id_flag = 1;
  98. bytes validator_address = 2;
  99. google.protobuf.Timestamp timestamp = 3
  100. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  101. bytes signature = 4;
  102. }
  103. message Proposal {
  104. SignedMsgType type = 1;
  105. int64 height = 2;
  106. int32 round = 3;
  107. int32 pol_round = 4;
  108. BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false];
  109. google.protobuf.Timestamp timestamp = 6
  110. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  111. bytes signature = 7;
  112. }
  113. message SignedHeader {
  114. Header header = 1;
  115. Commit commit = 2;
  116. }
  117. message LightBlock {
  118. SignedHeader signed_header = 1;
  119. tendermint.types.ValidatorSet validator_set = 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.Proof proof = 3;
  132. }