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.

140 lines
5.1 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/version/version.proto";
  8. // BlockIdFlag indicates which BlcokID the signature is for
  9. enum BlockIDFlag {
  10. option (gogoproto.goproto_enum_stringer) = false;
  11. option (gogoproto.goproto_enum_prefix) = false;
  12. BLOCKD_ID_FLAG_UNKNOWN = 0;
  13. BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"];
  14. BLOCK_ID_FLAG_COMMIT = 2 [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"];
  15. BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"];
  16. }
  17. // SignedMsgType is a type of signed message in the consensus.
  18. enum SignedMsgType {
  19. option (gogoproto.goproto_enum_stringer) = false;
  20. option (gogoproto.goproto_enum_prefix) = false;
  21. SIGNED_MSG_TYPE_UNKNOWN = 0;
  22. PREVOTE_TYPE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"];
  23. PRECOMMIT_TYPE = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"];
  24. PROPOSAL_TYPE = 3 [(gogoproto.enumvalue_customname) = "ProposalType"];
  25. }
  26. // PartsetHeader
  27. message PartSetHeader {
  28. option (gogoproto.populate) = true;
  29. option (gogoproto.equal) = true;
  30. uint32 total = 1;
  31. bytes hash = 2;
  32. }
  33. // BlockID
  34. message BlockID {
  35. option (gogoproto.populate) = true;
  36. option (gogoproto.equal) = true;
  37. bytes hash = 1;
  38. PartSetHeader parts_header = 2 [(gogoproto.nullable) = false];
  39. }
  40. // --------------------------------
  41. // Header defines the structure of a Tendermint block header.
  42. message Header {
  43. option (gogoproto.populate) = true;
  44. option (gogoproto.equal) = true;
  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. 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. uint32 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. }