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.

173 lines
5.5 KiB

proto: update proto generation to use buf (#7975) * Hard-code go_package option for .proto files Signed-off-by: Thane Thomson <connect@thanethomson.com> * Automatically relocate generated ABCI types after proto-gen Signed-off-by: Thane Thomson <connect@thanethomson.com> * Skip building gogoproto (i.e. only build our types) Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove unnecessary proto generation scripts Signed-off-by: Thane Thomson <connect@thanethomson.com> * Upgrade buf config from v1beta1 to v1 Signed-off-by: Thane Thomson <connect@thanethomson.com> * Add simple proto generation script Signed-off-by: Thane Thomson <connect@thanethomson.com> * Replace buf-based protobuf generation with simple protoc-based approach Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove custom buf-based Docker image generation config and Dockerfile Signed-off-by: Thane Thomson <connect@thanethomson.com> * Adopt Cosmos SDK's approach to Protobuf linting and breakage checking in CI Signed-off-by: Thane Thomson <connect@thanethomson.com> * Suppress command echo when running proto checks Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix proto-check workflow YAML indentation Signed-off-by: Thane Thomson <connect@thanethomson.com> * Restore proto-format target Signed-off-by: Thane Thomson <connect@thanethomson.com> * Replace custom BASH script with make equivalent Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove proto linting/breaking changes CI checks after discussion today Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove dangling reference to CI workflow that no longer exists Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update contributing guidelines relating to protos Signed-off-by: Thane Thomson <connect@thanethomson.com> * Use buf instead for generating protos Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove unused buf config for gogoprotobuf Signed-off-by: Thane Thomson <connect@thanethomson.com> * Add reminder for if we migrate fully to buf Signed-off-by: Thane Thomson <connect@thanethomson.com> * Restore protopackage script for #8065 Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix permissions on protopackage script Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update contributing guidelines to show building of protos using buf Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix breaking changes check and add disclaimer Signed-off-by: Thane Thomson <connect@thanethomson.com> * Expand on contributing guidelines for clarity Signed-off-by: Thane Thomson <connect@thanethomson.com> * Re-remove old proto workflows Signed-off-by: Thane Thomson <connect@thanethomson.com> * Add buf-based proto linting workflow in CI Signed-off-by: Thane Thomson <connect@thanethomson.com> * Superficially reorder proto targets Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix proto lints Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix GA workflow YAML indentation Signed-off-by: Thane Thomson <connect@thanethomson.com> * Temporarily use forked version of mlc Use forked version of markdown-link-check until https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/126 lands. Signed-off-by: Thane Thomson <connect@thanethomson.com> * Temporarily disable markdown link checker Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove gogo protos - superseded by version from buf registry Signed-off-by: Thane Thomson <connect@thanethomson.com>
2 years ago
  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
  14. [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"];
  15. BLOCK_ID_FLAG_ABSENT = 1
  16. [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"];
  17. BLOCK_ID_FLAG_COMMIT = 2
  18. [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"];
  19. BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"];
  20. }
  21. // SignedMsgType is a type of signed message in the consensus.
  22. enum SignedMsgType {
  23. option (gogoproto.goproto_enum_stringer) = true;
  24. option (gogoproto.goproto_enum_prefix) = false;
  25. SIGNED_MSG_TYPE_UNKNOWN = 0
  26. [(gogoproto.enumvalue_customname) = "UnknownType"];
  27. // Votes
  28. SIGNED_MSG_TYPE_PREVOTE = 1
  29. [(gogoproto.enumvalue_customname) = "PrevoteType"];
  30. SIGNED_MSG_TYPE_PRECOMMIT = 2
  31. [(gogoproto.enumvalue_customname) = "PrecommitType"];
  32. // Proposals
  33. SIGNED_MSG_TYPE_PROPOSAL = 32
  34. [(gogoproto.enumvalue_customname) = "ProposalType"];
  35. }
  36. // PartsetHeader
  37. message PartSetHeader {
  38. uint32 total = 1;
  39. bytes hash = 2;
  40. }
  41. message Part {
  42. uint32 index = 1;
  43. bytes bytes = 2;
  44. tendermint.crypto.Proof proof = 3 [(gogoproto.nullable) = false];
  45. }
  46. // BlockID
  47. message BlockID {
  48. bytes hash = 1;
  49. PartSetHeader part_set_header = 2 [(gogoproto.nullable) = false];
  50. }
  51. // --------------------------------
  52. // Header defines the structure of a Tendermint block header.
  53. message Header {
  54. // basic block info
  55. tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false];
  56. string chain_id = 2 [(gogoproto.customname) = "ChainID"];
  57. int64 height = 3;
  58. google.protobuf.Timestamp time = 4
  59. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  60. // prev block info
  61. BlockID last_block_id = 5 [(gogoproto.nullable) = false];
  62. // hashes of block data
  63. bytes last_commit_hash = 6; // commit from validators from the last block
  64. bytes data_hash = 7; // transactions
  65. // hashes from the app output from the prev block
  66. bytes validators_hash = 8; // validators for the current block
  67. bytes next_validators_hash = 9; // validators for the next block
  68. bytes consensus_hash = 10; // consensus params for current block
  69. bytes app_hash = 11; // state after txs from the previous block
  70. bytes last_results_hash =
  71. 12; // root hash of all results from the txs from the previous block
  72. // consensus info
  73. bytes evidence_hash = 13; // evidence included in the block
  74. bytes proposer_address = 14; // original proposer of the block
  75. }
  76. // Data contains the set of transactions included in the block
  77. message Data {
  78. // Txs that will be applied by state @ block.Height+1.
  79. // NOTE: not all txs here are valid. We're just agreeing on the order first.
  80. // This means that block.AppHash does not include these txs.
  81. repeated bytes txs = 1;
  82. }
  83. // Vote represents a prevote, precommit, or commit vote from validators for
  84. // consensus.
  85. message Vote {
  86. SignedMsgType type = 1;
  87. int64 height = 2;
  88. int32 round = 3;
  89. BlockID block_id = 4 [
  90. (gogoproto.nullable) = false,
  91. (gogoproto.customname) = "BlockID"
  92. ]; // zero if vote is nil.
  93. google.protobuf.Timestamp timestamp = 5
  94. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  95. bytes validator_address = 6;
  96. int32 validator_index = 7;
  97. bytes signature = 8;
  98. }
  99. // Commit contains the evidence that a block was committed by a set of
  100. // validators.
  101. message Commit {
  102. int64 height = 1;
  103. int32 round = 2;
  104. BlockID block_id = 3
  105. [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"];
  106. repeated CommitSig signatures = 4 [(gogoproto.nullable) = false];
  107. }
  108. // CommitSig is a part of the Vote included in a Commit.
  109. message CommitSig {
  110. BlockIDFlag block_id_flag = 1;
  111. bytes validator_address = 2;
  112. google.protobuf.Timestamp timestamp = 3
  113. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  114. bytes signature = 4;
  115. }
  116. message Proposal {
  117. SignedMsgType type = 1;
  118. int64 height = 2;
  119. int32 round = 3;
  120. int32 pol_round = 4;
  121. BlockID block_id = 5
  122. [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false];
  123. google.protobuf.Timestamp timestamp = 6
  124. [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
  125. bytes signature = 7;
  126. }
  127. message SignedHeader {
  128. Header header = 1;
  129. Commit commit = 2;
  130. }
  131. message LightBlock {
  132. SignedHeader signed_header = 1;
  133. tendermint.types.ValidatorSet validator_set = 2;
  134. }
  135. message BlockMeta {
  136. BlockID block_id = 1
  137. [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false];
  138. int64 block_size = 2;
  139. Header header = 3 [(gogoproto.nullable) = false];
  140. int64 num_txs = 4;
  141. }
  142. // TxProof represents a Merkle proof of the presence of a transaction in the
  143. // Merkle tree.
  144. message TxProof {
  145. bytes root_hash = 1;
  146. bytes data = 2;
  147. tendermint.crypto.Proof proof = 3;
  148. }