From 8f9cd23016ea66431545047b868b5b276121fa74 Mon Sep 17 00:00:00 2001 From: Marko Date: Fri, 16 Jul 2021 14:45:02 +0000 Subject: [PATCH] update proto files for release (#318) --- proto/abci/types.proto | 86 ++++++++++++------------------------ proto/blockchain/types.proto | 8 ++-- proto/consensus/types.proto | 20 ++++----- proto/crypto/keys.proto | 18 ++++++++ proto/crypto/proof.proto | 41 +++++++++++++++++ proto/mempool/types.proto | 2 - proto/statesync/types.proto | 14 +++--- proto/types/evidence.proto | 2 +- proto/types/params.proto | 19 +++----- proto/types/types.proto | 8 ++-- proto/types/validator.proto | 1 - proto/version/types.proto | 16 +++++++ 12 files changed, 137 insertions(+), 98 deletions(-) create mode 100644 proto/crypto/keys.proto create mode 100644 proto/crypto/proof.proto create mode 100644 proto/version/types.proto diff --git a/proto/abci/types.proto b/proto/abci/types.proto index fa1c2e355..bf088e8b1 100644 --- a/proto/abci/types.proto +++ b/proto/abci/types.proto @@ -52,19 +52,18 @@ message RequestInfo { } message RequestInitChain { - google.protobuf.Timestamp time = 1 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - string chain_id = 2; - ConsensusParams consensus_params = 3; - repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; - bytes app_state_bytes = 5; - uint64 initial_height = 6; + google.protobuf.Timestamp time = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string chain_id = 2; + tendermint.types.ConsensusParams consensus_params = 3; + repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; + bytes app_state_bytes = 5; + int64 initial_height = 6; } message RequestQuery { bytes data = 1; string path = 2; - uint64 height = 3; + int64 height = 3; bool prove = 4; } @@ -90,14 +89,13 @@ message RequestDeliverTx { } message RequestEndBlock { - uint64 height = 1; + int64 height = 1; } message RequestCommit {} // lists available snapshots -message RequestListSnapshots { -} +message RequestListSnapshots {} // offers a snapshot to the application message RequestOfferSnapshot { @@ -160,14 +158,14 @@ message ResponseInfo { string version = 2; uint64 app_version = 3; - uint64 last_block_height = 4; - bytes last_block_app_hash = 5; + int64 last_block_height = 4; + bytes last_block_app_hash = 5; } message ResponseInitChain { - ConsensusParams consensus_params = 1; - repeated ValidatorUpdate validators = 2 [(gogoproto.nullable) = false]; - bytes app_hash = 3; + tendermint.types.ConsensusParams consensus_params = 1; + repeated ValidatorUpdate validators = 2 [(gogoproto.nullable) = false]; + bytes app_hash = 3; } message ResponseQuery { @@ -179,13 +177,12 @@ message ResponseQuery { bytes key = 6; bytes value = 7; tendermint.crypto.ProofOps proof_ops = 8; - uint64 height = 9; + int64 height = 9; string codespace = 10; } 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 { @@ -209,22 +206,20 @@ message ResponseDeliverTx { int64 gas_wanted = 5 [json_name = "gas_wanted"]; int64 gas_used = 6 [json_name = "gas_used"]; repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; // nondeterministic string codespace = 8; } message ResponseEndBlock { - repeated ValidatorUpdate validator_updates = 1 - [(gogoproto.nullable) = false]; - ConsensusParams consensus_param_updates = 2; - repeated Event events = 3 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable) = false]; + tendermint.types.ConsensusParams consensus_param_updates = 2; + repeated Event events = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; } message ResponseCommit { // reserve 1 - bytes data = 2; - uint64 retain_height = 3; + bytes data = 2; + int64 retain_height = 3; } message ResponseListSnapshots { @@ -266,23 +261,6 @@ message ResponseApplySnapshotChunk { //---------------------------------------- // Misc. -// ConsensusParams contains all consensus-relevant parameters -// that can be adjusted by the abci app -message ConsensusParams { - BlockParams block = 1; - tendermint.types.EvidenceParams evidence = 2; - tendermint.types.ValidatorParams validator = 3; - tendermint.types.VersionParams version = 4; -} - -// BlockParams contains limits on the block size. -message BlockParams { - // Note: must be greater than 0 - int64 max_bytes = 1; - // Note: must be greater or equal to -1 - int64 max_gas = 2; -} - message LastCommitInfo { int32 round = 1; repeated VoteInfo votes = 2 [(gogoproto.nullable) = false]; @@ -293,24 +271,21 @@ message LastCommitInfo { // Later, transactions may be queried using these events. message Event { string type = 1; - repeated EventAttribute attributes = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "attributes,omitempty" - ]; + repeated EventAttribute attributes = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "attributes,omitempty"]; } // EventAttribute is a single key-value pair, associated with an event. message EventAttribute { - bytes key = 1; - bytes value = 2; - bool index = 3; // nondeterministic + string key = 1; + string value = 2; + bool index = 3; // nondeterministic } // TxResult contains results of executing the transaction. // // One usage is indexing transaction results. message TxResult { - uint64 height = 1; + int64 height = 1; uint32 index = 2; bytes tx = 3; ResponseDeliverTx result = 4 [(gogoproto.nullable) = false]; @@ -349,12 +324,9 @@ message Evidence { // The offending validator Validator validator = 2 [(gogoproto.nullable) = false]; // The height when the offense occurred - uint64 height = 3; + int64 height = 3; // The corresponding time where the offense occurred - google.protobuf.Timestamp time = 4 [ - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; + google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // Total voting power of the validator set in case the ABCI application does // not store historical validators. // https://github.com/tendermint/tendermint/issues/4581 diff --git a/proto/blockchain/types.proto b/proto/blockchain/types.proto index 5da642887..f5c143cf5 100644 --- a/proto/blockchain/types.proto +++ b/proto/blockchain/types.proto @@ -7,12 +7,12 @@ import "tendermint/types/block.proto"; // BlockRequest requests a block for a specific height message BlockRequest { - uint64 height = 1; + int64 height = 1; } // NoBlockResponse informs the node that the peer does not have block at the requested height message NoBlockResponse { - uint64 height = 1; + int64 height = 1; } // BlockResponse returns block to the requested @@ -26,8 +26,8 @@ message StatusRequest { // StatusResponse is a peer response to inform their status. message StatusResponse { - uint64 height = 1; - uint64 base = 2; + int64 height = 1; + int64 base = 2; } message Message { diff --git a/proto/consensus/types.proto b/proto/consensus/types.proto index 92f70e393..6e1f41371 100644 --- a/proto/consensus/types.proto +++ b/proto/consensus/types.proto @@ -10,7 +10,7 @@ import "tendermint/libs/bits/types.proto"; // NewRoundStep is sent for every step taken in the ConsensusState. // For every height/round/step transition message NewRoundStep { - uint64 height = 1; + int64 height = 1; int32 round = 2; uint32 step = 3; int64 seconds_since_start_time = 4; @@ -21,7 +21,7 @@ message NewRoundStep { //i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. // In case the block is also committed, then IsCommit flag is set to true. message NewValidBlock { - uint64 height = 1; + int64 height = 1; int32 round = 2; tendermint.types.PartSetHeader block_part_set_header = 3 [(gogoproto.nullable) = false]; tendermint.libs.bits.BitArray block_parts = 4; @@ -35,14 +35,14 @@ message Proposal { // ProposalPOL is sent when a previous proposal is re-proposed. message ProposalPOL { - uint64 height = 1; + int64 height = 1; int32 proposal_pol_round = 2; tendermint.libs.bits.BitArray proposal_pol = 3 [(gogoproto.nullable) = false]; } // BlockPart is sent when gossipping a piece of the proposed block. message BlockPart { - uint64 height = 1; + int64 height = 1; int32 round = 2; tendermint.types.Part part = 3 [(gogoproto.nullable) = false]; } @@ -52,9 +52,9 @@ message Vote { tendermint.types.Vote vote = 1; } -// ReceivedVote is sent to indicate that a particular vote has been received. -message ReceivedVote { - uint64 height = 1; +// HasVote is sent to indicate that a particular vote has been received. +message HasVote { + int64 height = 1; int32 round = 2; tendermint.types.SignedMsgType type = 3; int32 index = 4; @@ -62,7 +62,7 @@ message ReceivedVote { // VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. message VoteSetMaj23 { - uint64 height = 1; + int64 height = 1; int32 round = 2; tendermint.types.SignedMsgType type = 3; tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; @@ -70,7 +70,7 @@ message VoteSetMaj23 { // VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. message VoteSetBits { - uint64 height = 1; + int64 height = 1; int32 round = 2; tendermint.types.SignedMsgType type = 3; tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; @@ -85,7 +85,7 @@ message Message { ProposalPOL proposal_pol = 4; BlockPart block_part = 5; Vote vote = 6; - ReceivedVote received_vote = 7; + HasVote has_vote = 7; VoteSetMaj23 vote_set_maj23 = 8; VoteSetBits vote_set_bits = 9; } diff --git a/proto/crypto/keys.proto b/proto/crypto/keys.proto new file mode 100644 index 000000000..d66f9fc0c --- /dev/null +++ b/proto/crypto/keys.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package tendermint.crypto; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/crypto"; + +import "gogoproto/gogo.proto"; + +// PublicKey defines the keys available for use with Tendermint Validators +message PublicKey { + option (gogoproto.compare) = true; + option (gogoproto.equal) = true; + + oneof sum { + bytes ed25519 = 1; + bytes secp256k1 = 2; + bytes sr25519 = 3; + } +} diff --git a/proto/crypto/proof.proto b/proto/crypto/proof.proto new file mode 100644 index 000000000..975df7685 --- /dev/null +++ b/proto/crypto/proof.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package tendermint.crypto; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/crypto"; + +import "gogoproto/gogo.proto"; + +message Proof { + int64 total = 1; + int64 index = 2; + bytes leaf_hash = 3; + repeated bytes aunts = 4; +} + +message ValueOp { + // Encoded in ProofOp.Key. + bytes key = 1; + + // To encode in ProofOp.Data + Proof proof = 2; +} + +message DominoOp { + string key = 1; + string input = 2; + string output = 3; +} + +// ProofOp defines an operation used for calculating Merkle root +// The data could be arbitrary format, providing nessecary data +// for example neighbouring node hash +message ProofOp { + string type = 1; + bytes key = 2; + bytes data = 3; +} + +// ProofOps is Merkle proof defined by the list of ProofOps +message ProofOps { + repeated ProofOp ops = 1 [(gogoproto.nullable) = false]; +} diff --git a/proto/mempool/types.proto b/proto/mempool/types.proto index eaa7b4d67..b55d9717b 100644 --- a/proto/mempool/types.proto +++ b/proto/mempool/types.proto @@ -3,8 +3,6 @@ package tendermint.mempool; option go_package = "github.com/tendermint/tendermint/proto/tendermint/mempool"; -// Txs list of transactions. -// Note because they are sent over the wire does not mean they are valid transactions message Txs { repeated bytes txs = 1; } diff --git a/proto/statesync/types.proto b/proto/statesync/types.proto index f187c4bf2..23995f2f4 100644 --- a/proto/statesync/types.proto +++ b/proto/statesync/types.proto @@ -7,12 +7,12 @@ option go_package = "github.com/tendermint/tendermint/proto/tendermint/statesync message Message { oneof sum { - SnapshotsRequest snapshots_request = 1; - SnapshotsResponse snapshots_response = 2; - ChunkRequest chunk_request = 3; - ChunkResponse chunk_response = 4; - LightBlockRequest light_block_request = 5; - LightBlockResponse light_block_response = 6; + SnapshotsRequest snapshots_request = 1; + SnapshotsResponse snapshots_response = 2; + ChunkRequest chunk_request = 3; + ChunkResponse chunk_response = 4; + LightBlockRequest light_block_request = 5; + LightBlockResponse light_block_response = 6; } } @@ -45,5 +45,5 @@ message LightBlockRequest { } message LightBlockResponse { - LightBlock light_block = 1; + tendermint.types.LightBlock light_block = 1; } diff --git a/proto/types/evidence.proto b/proto/types/evidence.proto index 800591e32..451b8dca3 100644 --- a/proto/types/evidence.proto +++ b/proto/types/evidence.proto @@ -27,7 +27,7 @@ message DuplicateVoteEvidence { // LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. message LightClientAttackEvidence { tendermint.types.LightBlock conflicting_block = 1; - uint64 common_height = 2; + int64 common_height = 2; repeated tendermint.types.Validator byzantine_validators = 3; int64 total_voting_power = 4; google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; diff --git a/proto/types/params.proto b/proto/types/params.proto index 8f2cb1497..cc926b64e 100644 --- a/proto/types/params.proto +++ b/proto/types/params.proto @@ -11,15 +11,16 @@ option (gogoproto.equal_all) = true; // ConsensusParams contains consensus critical parameters that determine the // validity of blocks. message ConsensusParams { - BlockParams block = 1 [(gogoproto.nullable) = false]; - EvidenceParams evidence = 2 [(gogoproto.nullable) = false]; - ValidatorParams validator = 3 [(gogoproto.nullable) = false]; - VersionParams version = 4 [(gogoproto.nullable) = false]; + BlockParams block = 1; + EvidenceParams evidence = 2; + ValidatorParams validator = 3; + VersionParams version = 4; } // BlockParams contains limits on the block size. message BlockParams { // Max block size, in bytes. + // Note: must be greater than 0 int64 max_bytes = 1; // Max gas per block. // Note: must be greater or equal to -1 @@ -51,17 +52,11 @@ message EvidenceParams { // ValidatorParams restrict the public key types validators can use. // NOTE: uses ABCI pubkey naming, not Amino names. message ValidatorParams { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; - repeated string pub_key_types = 1; } // VersionParams contains the ABCI application version. message VersionParams { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; - uint64 app_version = 1; } @@ -69,6 +64,6 @@ message VersionParams { // // It is hashed into the Header.ConsensusHash. message HashedParams { - uint64 block_max_bytes = 1; - uint64 block_max_gas = 2; + int64 block_max_bytes = 1; + int64 block_max_gas = 2; } diff --git a/proto/types/types.proto b/proto/types/types.proto index 9322bf9d6..8d4f00972 100644 --- a/proto/types/types.proto +++ b/proto/types/types.proto @@ -59,7 +59,7 @@ message Header { // basic block info tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false]; string chain_id = 2 [(gogoproto.customname) = "ChainID"]; - uint64 height = 3; + int64 height = 3; google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // prev block info @@ -93,7 +93,7 @@ message Data { // consensus. message Vote { SignedMsgType type = 1; - uint64 height = 2; + int64 height = 2; int32 round = 3; BlockID block_id = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. @@ -106,7 +106,7 @@ message Vote { // Commit contains the evidence that a block was committed by a set of validators. message Commit { - uint64 height = 1; + int64 height = 1; int32 round = 2; BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; @@ -123,7 +123,7 @@ message CommitSig { message Proposal { SignedMsgType type = 1; - uint64 height = 2; + int64 height = 2; int32 round = 3; int32 pol_round = 4; BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; diff --git a/proto/types/validator.proto b/proto/types/validator.proto index c33ae4d24..49860b96d 100644 --- a/proto/types/validator.proto +++ b/proto/types/validator.proto @@ -19,7 +19,6 @@ message Validator { int64 proposer_priority = 4; } -// Used to compute the validator hash within the ValidatorSetHash message SimpleValidator { tendermint.crypto.PublicKey pub_key = 1; int64 voting_power = 2; diff --git a/proto/version/types.proto b/proto/version/types.proto new file mode 100644 index 000000000..3c4e4cc53 --- /dev/null +++ b/proto/version/types.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package tendermint.version; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/version"; + +import "gogoproto/gogo.proto"; + +// Consensus captures the consensus rules for processing a block in the blockchain, +// including all blockchain data structures and the rules of the application's +// state transition machine. +message Consensus { + option (gogoproto.equal) = true; + + uint64 block = 1; + uint64 app = 2; +}