Merge PR #5669: proto: update tendermint proto files

This commit is contained in:
Marko 2020-02-20 11:38:07 +01:00 committed by GitHub
parent b54d07e5ce
commit 32b40fdb27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 169 additions and 155 deletions

View File

@ -238,25 +238,37 @@ proto-lint:
proto-check-breaking: proto-check-breaking:
@buf check breaking --against-input '.git#branch=master' @buf check breaking --against-input '.git#branch=master'
# Origin TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.33.1
# TODO: Update to the version of Tendermint that is being used in go.mod GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
version_branch = v0.33.0 COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master
tendermint = https://raw.githubusercontent.com/tendermint/tendermint/$(version_branch)
# Outputs TM_KV_TYPES = third_party/proto/tendermint/libs/kv
tmkv = third_party/proto/tendermint/libs/kv/types.proto TM_MERKLE_TYPES = third_party/proto/tendermint/crypto/merkle
tmmerkle = third_party/proto/tendermint/crypto/merkle/merkle.proto TM_ABCI_TYPES = third_party/proto/tendermint/abci/types
tmabci = third_party/proto/tendermint/abci/types/types.proto GOGO_PROTO_TYPES = third_party/proto/gogoproto
COSMOS_PROTO_TYPES = third_party/proto/cosmos-proto
SDK_PROTO_TYPES = third_party/proto/cosmos-sdk/types
AUTH_PROTO_TYPES = third_party/proto/cosmos-sdk/x/auth/types
VESTING_PROTO_TYPES = third_party/proto/cosmos-sdk/x/auth/vesting/types
SUPPLY_PROTO_TYPES = third_party/proto/cosmos-sdk/x/supply/types
# You *only* need to run this to rebuild protobufs from the tendermint source proto-update-deps:
proto-update-tendermint: @mkdir -p $(GOGO_PROTO_TYPES)
@curl $(tendermint)/abci/types/types.proto > $(tmabci) @curl -sSL $(GOGO_PROTO_URL)/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto
sed -i '' '8,9 s|github.com/tendermint|third_party/proto|g' $(tmabci)
sed -i '' '7 s|github.com/gogo/protobuf|third_party/proto|' $(tmabci) @mkdir -p $(COSMOS_PROTO_TYPES)
@curl $(tendermint)/libs/kv/types.proto > $(tmkv) @curl -sSL $(COSMOS_PROTO_URL)/cosmos.proto > $(COSMOS_PROTO_TYPES)/cosmos.proto
sed -i '' 's|github.com/gogo/protobuf|third_party/proto|' $(tmkv)
@curl $(tendermint)/crypto/merkle/merkle.proto > $(tmmerkle) @mkdir -p $(TM_ABCI_TYPES)
sed -i '' '7 s|github.com/gogo/protobuf|third_party/proto|' $(tmmerkle) @curl -sSL $(TM_URL)/abci/types/types.proto > $(TM_ABCI_TYPES)/types.proto
@sed -i '' '8 s|crypto/merkle/merkle.proto|third_party/proto/tendermint/crypto/merkle/merkle.proto|g' $(TM_ABCI_TYPES)/types.proto
@sed -i '' '9 s|libs/kv/types.proto|third_party/proto/tendermint/libs/kv/types.proto|g' $(TM_ABCI_TYPES)/types.proto
@mkdir -p $(TM_KV_TYPES)
@curl -sSL $(TM_URL)/libs/kv/types.proto > $(TM_KV_TYPES)/types.proto
@mkdir -p $(TM_MERKLE_TYPES)
@curl -sSL $(TM_URL)/crypto/merkle/merkle.proto > $(TM_MERKLE_TYPES)/merkle.proto
.PHONY: proto-all proto-gen proto-lint proto-check-breaking proto-update-tendermint .PHONY: proto-all proto-gen proto-lint proto-check-breaking proto-update-deps

View File

@ -142,4 +142,4 @@ extend google.protobuf.FieldOptions {
optional bool wktpointer = 65012; optional bool wktpointer = 65012;
optional string castrepeated = 65013; optional string castrepeated = 65013;
} }

View File

@ -1,6 +1,6 @@
syntax = "proto3"; syntax = "proto3";
package tendermint.abci.types; package tendermint.abci.types;
option go_package = "github.com/tendermint/tendermint/abci/types"; option go_package = "github.com/tendermint/tendermint/abci/types";
// For more information on gogo.proto, see: // For more information on gogo.proto, see:
// https://github.com/gogo/protobuf/blob/master/extensions.md // https://github.com/gogo/protobuf/blob/master/extensions.md
@ -14,31 +14,31 @@ import "google/protobuf/duration.proto";
// NOTE: When using custom types, mind the warnings. // NOTE: When using custom types, mind the warnings.
// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues // https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues
option (gogoproto.marshaler_all) = true; option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true; option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true; option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true; option (gogoproto.goproto_registration) = true;
// Generate tests // Generate tests
option (gogoproto.populate_all) = true; option (gogoproto.populate_all) = true;
option (gogoproto.equal_all) = true; option (gogoproto.equal_all) = true;
option (gogoproto.testgen_all) = true; option (gogoproto.testgen_all) = true;
//---------------------------------------- //----------------------------------------
// Request types // Request types
message Request { message Request {
oneof value { oneof value {
RequestEcho echo = 2; RequestEcho echo = 2;
RequestFlush flush = 3; RequestFlush flush = 3;
RequestInfo info = 4; RequestInfo info = 4;
RequestSetOption set_option = 5; RequestSetOption set_option = 5;
RequestInitChain init_chain = 6; RequestInitChain init_chain = 6;
RequestQuery query = 7; RequestQuery query = 7;
RequestBeginBlock begin_block = 8; RequestBeginBlock begin_block = 8;
RequestCheckTx check_tx = 9; RequestCheckTx check_tx = 9;
RequestDeliverTx deliver_tx = 19; RequestDeliverTx deliver_tx = 19;
RequestEndBlock end_block = 11; RequestEndBlock end_block = 11;
RequestCommit commit = 12; RequestCommit commit = 12;
} }
} }
@ -46,50 +46,49 @@ message RequestEcho {
string message = 1; string message = 1;
} }
message RequestFlush { message RequestFlush {}
}
message RequestInfo { message RequestInfo {
string version = 1; string version = 1;
uint64 block_version = 2; uint64 block_version = 2;
uint64 p2p_version = 3; uint64 p2p_version = 3;
} }
// nondeterministic // nondeterministic
message RequestSetOption { message RequestSetOption {
string key = 1; string key = 1;
string value = 2; string value = 2;
} }
message RequestInitChain { message RequestInitChain {
google.protobuf.Timestamp time = 1 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
string chain_id = 2; string chain_id = 2;
ConsensusParams consensus_params = 3; ConsensusParams consensus_params = 3;
repeated ValidatorUpdate validators = 4 [(gogoproto.nullable)=false]; repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false];
bytes app_state_bytes = 5; bytes app_state_bytes = 5;
} }
message RequestQuery { message RequestQuery {
bytes data = 1; bytes data = 1;
string path = 2; string path = 2;
int64 height = 3; int64 height = 3;
bool prove = 4; bool prove = 4;
} }
message RequestBeginBlock { message RequestBeginBlock {
bytes hash = 1; bytes hash = 1;
Header header = 2 [(gogoproto.nullable)=false]; Header header = 2 [(gogoproto.nullable) = false];
LastCommitInfo last_commit_info = 3 [(gogoproto.nullable)=false]; LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false];
repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false]; repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false];
} }
enum CheckTxType { enum CheckTxType {
New = 0; New = 0;
Recheck = 1; Recheck = 1;
} }
message RequestCheckTx { message RequestCheckTx {
bytes tx = 1; bytes tx = 1;
CheckTxType type = 2; CheckTxType type = 2;
} }
@ -101,26 +100,25 @@ message RequestEndBlock {
int64 height = 1; int64 height = 1;
} }
message RequestCommit { message RequestCommit {}
}
//---------------------------------------- //----------------------------------------
// Response types // Response types
message Response { message Response {
oneof value { oneof value {
ResponseException exception = 1; ResponseException exception = 1;
ResponseEcho echo = 2; ResponseEcho echo = 2;
ResponseFlush flush = 3; ResponseFlush flush = 3;
ResponseInfo info = 4; ResponseInfo info = 4;
ResponseSetOption set_option = 5; ResponseSetOption set_option = 5;
ResponseInitChain init_chain = 6; ResponseInitChain init_chain = 6;
ResponseQuery query = 7; ResponseQuery query = 7;
ResponseBeginBlock begin_block = 8; ResponseBeginBlock begin_block = 8;
ResponseCheckTx check_tx = 9; ResponseCheckTx check_tx = 9;
ResponseDeliverTx deliver_tx = 10; ResponseDeliverTx deliver_tx = 10;
ResponseEndBlock end_block = 11; ResponseEndBlock end_block = 11;
ResponseCommit commit = 12; ResponseCommit commit = 12;
} }
} }
@ -133,16 +131,15 @@ message ResponseEcho {
string message = 1; string message = 1;
} }
message ResponseFlush { message ResponseFlush {}
}
message ResponseInfo { message ResponseInfo {
string data = 1; string data = 1;
string version = 2; string version = 2;
uint64 app_version = 3; uint64 app_version = 3;
int64 last_block_height = 4; int64 last_block_height = 4;
bytes last_block_app_hash = 5; bytes last_block_app_hash = 5;
} }
@ -150,58 +147,62 @@ message ResponseInfo {
message ResponseSetOption { message ResponseSetOption {
uint32 code = 1; uint32 code = 1;
// bytes data = 2; // bytes data = 2;
string log = 3; string log = 3;
string info = 4; string info = 4;
} }
message ResponseInitChain { message ResponseInitChain {
ConsensusParams consensus_params = 1; ConsensusParams consensus_params = 1;
repeated ValidatorUpdate validators = 2 [(gogoproto.nullable)=false]; repeated ValidatorUpdate validators = 2 [(gogoproto.nullable) = false];
} }
message ResponseQuery { message ResponseQuery {
uint32 code = 1; uint32 code = 1;
// bytes data = 2; // use "value" instead. // bytes data = 2; // use "value" instead.
string log = 3; // nondeterministic string log = 3; // nondeterministic
string info = 4; // nondeterministic string info = 4; // nondeterministic
int64 index = 5; int64 index = 5;
bytes key = 6; bytes key = 6;
bytes value = 7; bytes value = 7;
tendermint.crypto.merkle.Proof proof = 8; tendermint.crypto.merkle.Proof proof = 8;
int64 height = 9; int64 height = 9;
string codespace = 10; string codespace = 10;
} }
message ResponseBeginBlock { message ResponseBeginBlock {
repeated Event events = 1 [(gogoproto.nullable)=false, (gogoproto.jsontag)="events,omitempty"]; repeated Event events = 1
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
} }
message ResponseCheckTx { message ResponseCheckTx {
uint32 code = 1; uint32 code = 1;
bytes data = 2; bytes data = 2;
string log = 3; // nondeterministic string log = 3; // nondeterministic
string info = 4; // nondeterministic string info = 4; // nondeterministic
int64 gas_wanted = 5; int64 gas_wanted = 5;
int64 gas_used = 6; int64 gas_used = 6;
repeated Event events = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="events,omitempty"]; repeated Event events = 7
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
string codespace = 8; string codespace = 8;
} }
message ResponseDeliverTx { message ResponseDeliverTx {
uint32 code = 1; uint32 code = 1;
bytes data = 2; bytes data = 2;
string log = 3; // nondeterministic string log = 3; // nondeterministic
string info = 4; // nondeterministic string info = 4; // nondeterministic
int64 gas_wanted = 5; int64 gas_wanted = 5;
int64 gas_used = 6; int64 gas_used = 6;
repeated Event events = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="events,omitempty"]; repeated Event events = 7
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
string codespace = 8; string codespace = 8;
} }
message ResponseEndBlock { message ResponseEndBlock {
repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable)=false]; repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable) = false];
ConsensusParams consensus_param_updates = 2; ConsensusParams consensus_param_updates = 2;
repeated Event events = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="events,omitempty"]; repeated Event events = 3
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"];
} }
message ResponseCommit { message ResponseCommit {
@ -215,8 +216,8 @@ message ResponseCommit {
// ConsensusParams contains all consensus-relevant parameters // ConsensusParams contains all consensus-relevant parameters
// that can be adjusted by the abci app // that can be adjusted by the abci app
message ConsensusParams { message ConsensusParams {
BlockParams block = 1; BlockParams block = 1;
EvidenceParams evidence = 2; EvidenceParams evidence = 2;
ValidatorParams validator = 3; ValidatorParams validator = 3;
} }
@ -230,8 +231,9 @@ message BlockParams {
message EvidenceParams { message EvidenceParams {
// Note: must be greater than 0 // Note: must be greater than 0
int64 max_age_num_blocks = 1; int64 max_age_num_blocks = 1;
google.protobuf.Duration max_age_duration = 2 [(gogoproto.nullable)=false, (gogoproto.stdduration)=true]; google.protobuf.Duration max_age_duration = 2
[(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
} }
// ValidatorParams contains limits on validators. // ValidatorParams contains limits on validators.
@ -240,13 +242,14 @@ message ValidatorParams {
} }
message LastCommitInfo { message LastCommitInfo {
int32 round = 1; int32 round = 1;
repeated VoteInfo votes = 2 [(gogoproto.nullable)=false]; repeated VoteInfo votes = 2 [(gogoproto.nullable) = false];
} }
message Event { message Event {
string type = 1; string type = 1;
repeated tendermint.libs.kv.Pair attributes = 2 [(gogoproto.nullable)=false, (gogoproto.jsontag)="attributes,omitempty"]; repeated tendermint.libs.kv.Pair attributes = 2
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "attributes,omitempty"];
} }
//---------------------------------------- //----------------------------------------
@ -254,63 +257,62 @@ message Event {
message Header { message Header {
// basic block info // basic block info
Version version = 1 [(gogoproto.nullable)=false]; Version version = 1 [(gogoproto.nullable) = false];
string chain_id = 2 [(gogoproto.customname)="ChainID"]; string chain_id = 2 [(gogoproto.customname) = "ChainID"];
int64 height = 3; int64 height = 3;
google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// prev block info // prev block info
BlockID last_block_id = 5 [(gogoproto.nullable)=false]; BlockID last_block_id = 5 [(gogoproto.nullable) = false];
// hashes of block data // hashes of block data
bytes last_commit_hash = 6; // commit from validators from the last block bytes last_commit_hash = 6; // commit from validators from the last block
bytes data_hash = 7; // transactions bytes data_hash = 7; // transactions
// hashes from the app output from the prev block // hashes from the app output from the prev block
bytes validators_hash = 8; // validators for the current block bytes validators_hash = 8; // validators for the current block
bytes next_validators_hash = 9; // validators for the next block bytes next_validators_hash = 9; // validators for the next block
bytes consensus_hash = 10; // consensus params for current block bytes consensus_hash = 10; // consensus params for current block
bytes app_hash = 11; // state after txs from the previous block bytes app_hash = 11; // state after txs from the previous block
bytes last_results_hash = 12;// root hash of all results from the txs from the previous block bytes last_results_hash = 12; // root hash of all results from the txs from the previous block
// consensus info // consensus info
bytes evidence_hash = 13; // evidence included in the block bytes evidence_hash = 13; // evidence included in the block
bytes proposer_address = 14; // original proposer of the block bytes proposer_address = 14; // original proposer of the block
} }
message Version { message Version {
uint64 Block = 1; uint64 Block = 1;
uint64 App = 2; uint64 App = 2;
} }
message BlockID { message BlockID {
bytes hash = 1; bytes hash = 1;
PartSetHeader parts_header = 2 [(gogoproto.nullable)=false]; PartSetHeader parts_header = 2 [(gogoproto.nullable) = false];
} }
message PartSetHeader { message PartSetHeader {
int32 total = 1; int32 total = 1;
bytes hash = 2; bytes hash = 2;
} }
// Validator // Validator
message Validator { message Validator {
bytes address = 1; bytes address = 1;
//PubKey pub_key = 2 [(gogoproto.nullable)=false]; // PubKey pub_key = 2 [(gogoproto.nullable)=false];
int64 power = 3; int64 power = 3;
} }
// ValidatorUpdate // ValidatorUpdate
message ValidatorUpdate { message ValidatorUpdate {
PubKey pub_key = 1 [(gogoproto.nullable)=false]; PubKey pub_key = 1 [(gogoproto.nullable) = false];
int64 power = 2; int64 power = 2;
} }
// VoteInfo // VoteInfo
message VoteInfo { message VoteInfo {
Validator validator = 1 [(gogoproto.nullable)=false]; Validator validator = 1 [(gogoproto.nullable) = false];
bool signed_last_block = 2; bool signed_last_block = 2;
} }
message PubKey { message PubKey {
@ -319,18 +321,18 @@ message PubKey {
} }
message Evidence { message Evidence {
string type = 1; string type = 1;
Validator validator = 2 [(gogoproto.nullable)=false]; Validator validator = 2 [(gogoproto.nullable) = false];
int64 height = 3; int64 height = 3;
google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
int64 total_voting_power = 5; int64 total_voting_power = 5;
} }
//---------------------------------------- //----------------------------------------
// Service Definition // Service Definition
service ABCIApplication { service ABCIApplication {
rpc Echo(RequestEcho) returns (ResponseEcho) ; rpc Echo(RequestEcho) returns (ResponseEcho);
rpc Flush(RequestFlush) returns (ResponseFlush); rpc Flush(RequestFlush) returns (ResponseFlush);
rpc Info(RequestInfo) returns (ResponseInfo); rpc Info(RequestInfo) returns (ResponseInfo);
rpc SetOption(RequestSetOption) returns (ResponseSetOption); rpc SetOption(RequestSetOption) returns (ResponseSetOption);

View File

@ -1,17 +1,17 @@
syntax = "proto3"; syntax = "proto3";
package tendermint.crypto.merkle; package tendermint.crypto.merkle;
option go_package = "github.com/tendermint/tendermint/crypto/merkle"; option go_package = "github.com/tendermint/tendermint/crypto/merkle";
// For more information on gogo.proto, see: // For more information on gogo.proto, see:
// https://github.com/gogo/protobuf/blob/master/extensions.md // https://github.com/gogo/protobuf/blob/master/extensions.md
import "third_party/proto/gogoproto/gogo.proto"; import "third_party/proto/gogoproto/gogo.proto";
option (gogoproto.marshaler_all) = true; option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true; option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true; option (gogoproto.sizer_all) = true;
option (gogoproto.populate_all) = true; option (gogoproto.populate_all) = true;
option (gogoproto.equal_all) = true; option (gogoproto.equal_all) = true;
//---------------------------------------- //----------------------------------------
// Message types // Message types
@ -21,11 +21,11 @@ option (gogoproto.equal_all) = true;
// for example neighbouring node hash // for example neighbouring node hash
message ProofOp { message ProofOp {
string type = 1; string type = 1;
bytes key = 2; bytes key = 2;
bytes data = 3; bytes data = 3;
} }
// Proof is Merkle proof defined by the list of ProofOps // Proof is Merkle proof defined by the list of ProofOps
message Proof { message Proof {
repeated ProofOp ops = 1 [(gogoproto.nullable)=false]; repeated ProofOp ops = 1 [(gogoproto.nullable) = false];
} }

View File

@ -1,29 +1,29 @@
syntax = "proto3"; syntax = "proto3";
package tendermint.libs.kv; package tendermint.libs.kv;
option go_package = "github.com/tendermint/tendermint/libs/kv"; option go_package = "github.com/tendermint/tendermint/libs/kv";
import "third_party/proto/gogoproto/gogo.proto"; import "third_party/proto/gogoproto/gogo.proto";
option (gogoproto.marshaler_all) = true; option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true; option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true; option (gogoproto.sizer_all) = true;
option (gogoproto.goproto_registration) = true; option (gogoproto.goproto_registration) = true;
// Generate tests // Generate tests
option (gogoproto.populate_all) = true; option (gogoproto.populate_all) = true;
option (gogoproto.equal_all) = true; option (gogoproto.equal_all) = true;
option (gogoproto.testgen_all) = true; option (gogoproto.testgen_all) = true;
//---------------------------------------- //----------------------------------------
// Abstract types // Abstract types
// Define these here for compatibility but use tmlibs/common.KVPair. // Define these here for compatibility but use tmlibs/kv.Pair.
message Pair { message Pair {
bytes key = 1; bytes key = 1;
bytes value = 2; bytes value = 2;
} }
// Define these here for compatibility but use tmlibs/common.KI64Pair. // Define these here for compatibility but use tmlibs/kv.KI64Pair.
message KI64Pair { message KI64Pair {
bytes key = 1; bytes key = 1;
int64 value = 2; int64 value = 2;
} }