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.

146 lines
5.4 KiB

  1. syntax = "proto3";
  2. package tendermint.proto.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) = false;
  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) = false;
  21. option (gogoproto.goproto_enum_prefix) = false;
  22. SIGNED_MSG_TYPE_UNKNOWN = 0;
  23. PREVOTE_TYPE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"];
  24. PRECOMMIT_TYPE = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"];
  25. PROPOSAL_TYPE = 3 [(gogoproto.enumvalue_customname) = "ProposalType"];
  26. }
  27. // PartsetHeader
  28. message PartSetHeader {
  29. int64 total = 1;
  30. bytes hash = 2;
  31. }
  32. message Part {
  33. uint32 index = 1;
  34. bytes bytes = 2;
  35. tendermint.proto.crypto.merkle.SimpleProof proof = 3 [(gogoproto.nullable) = false];
  36. }
  37. // BlockID
  38. message BlockID {
  39. bytes hash = 1;
  40. PartSetHeader parts_header = 2 [(gogoproto.nullable) = false];
  41. }
  42. // --------------------------------
  43. // Header defines the structure of a Tendermint block header.
  44. message Header {
  45. // basic block info
  46. tendermint.proto.version.Consensus version = 1 [(gogoproto.nullable) = false];
  47. string chain_id = 2 [(gogoproto.customname) = "ChainID"];
  48. int64 height = 3;
  49. google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  50. // prev block info
  51. BlockID last_block_id = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "LastBlockID"];
  52. // hashes of block data
  53. bytes last_commit_hash = 6; // commit from validators from the last block
  54. bytes data_hash = 7; // transactions
  55. // hashes from the app output from the prev block
  56. bytes validators_hash = 8; // validators for the current block
  57. bytes next_validators_hash = 9; // validators for the next block
  58. bytes consensus_hash = 10; // consensus params for current block
  59. bytes app_hash = 11; // state after txs from the previous block
  60. bytes last_results_hash = 12; // root hash of all results from the txs from the previous block
  61. // consensus info
  62. bytes evidence_hash = 13; // evidence included in the block
  63. bytes proposer_address = 14; // original proposer of the block
  64. }
  65. // Data contains the set of transactions included in the block
  66. message Data {
  67. // Txs that will be applied by state @ block.Height+1.
  68. // NOTE: not all txs here are valid. We're just agreeing on the order first.
  69. // This means that block.AppHash does not include these txs.
  70. repeated bytes txs = 1;
  71. // Volatile
  72. bytes hash = 2;
  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. int64 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. int64 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. bytes hash = 5;
  95. tendermint.proto.libs.bits.BitArray bit_array = 6;
  96. }
  97. // CommitSig is a part of the Vote included in a Commit.
  98. message CommitSig {
  99. BlockIDFlag block_id_flag = 1;
  100. bytes validator_address = 2;
  101. google.protobuf.Timestamp timestamp = 3
  102. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  103. bytes signature = 4;
  104. }
  105. message Proposal {
  106. SignedMsgType type = 1;
  107. int64 height = 2;
  108. int32 round = 3;
  109. int32 pol_round = 4;
  110. BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false];
  111. google.protobuf.Timestamp timestamp = 6
  112. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  113. bytes signature = 7;
  114. }
  115. message SignedHeader {
  116. Header header = 1;
  117. Commit commit = 2;
  118. }
  119. message BlockMeta {
  120. BlockID block_id = 1 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false];
  121. int64 block_size = 2;
  122. Header header = 3 [(gogoproto.nullable) = false];
  123. int64 num_txs = 4;
  124. }