Co-authored-by: Erik Grinaker <erik@interchain.berlin>pull/7804/head
@ -0,0 +1,23 @@ | |||
# Protocol Buffers | |||
This sections defines the types and messages shared across implementations. The definition of the data structures are located in the [core/data_structures](../spec/core/data_structures.md) for the core data types and ABCI definitions are located in the [ABCI](../spec/abci/README.md) section. | |||
## Process of Updates | |||
The `.proto` files within this section are core to the protocol and updates must be treated as such. | |||
### Steps | |||
1. Make an issue with the proposed change. | |||
- Within in the issue members from both the Tendermint-go and Tendermint-rs team will leave comments. If there is not consensus on the change an [RFC](../rfc/README.md) may be requested. | |||
1a. Submission of an RFC as a pull request should be made to facilitate further discussion. | |||
1b. Merge the RFC. | |||
2. Make the necessary changes to the `.proto` file(s), [core data structures](../spec/core/data_structures.md) and/or [ABCI protocol](../spec/abci/apps.md). | |||
3. Open issues within Tendermint-go and Tendermint-rs repos. This is used to notify the teams that a change occurred in the spec. | |||
1. Tag the issue with a spec version label. This will notify the team the changed has been made on master but has not entered a release. | |||
### Versioning | |||
The spec repo aims to be versioned. Once it has been versioned, updates to the protobuf files will live on master. After a certain amount of time, decided on by Tendermint-go and Tendermint-rs team leads, a release will be made on the spec repo. The spec may contain minor releases as well, depending on the implementation these changes may lead to a breaking change. If so, the implementation team should open an issue within the spec repo requiring a major release of the spec. | |||
If the steps above were followed each implementation should have issues tagged with a spec change label. Once all issues have been completed the team should signify their readiness for release. |
@ -0,0 +1,392 @@ | |||
syntax = "proto3"; | |||
package tendermint.abci; | |||
option go_package = "github.com/tendermint/tendermint/abci/types"; | |||
// For more information on gogo.proto, see: | |||
// https://github.com/gogo/protobuf/blob/master/extensions.md | |||
import "tendermint/crypto/proof.proto"; | |||
import "tendermint/types/types.proto"; | |||
import "tendermint/crypto/keys.proto"; | |||
import "tendermint/types/params.proto"; | |||
import "google/protobuf/timestamp.proto"; | |||
import "gogoproto/gogo.proto"; | |||
// This file is copied from http://github.com/tendermint/abci | |||
// NOTE: When using custom types, mind the warnings. | |||
// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues | |||
//---------------------------------------- | |||
// Request types | |||
message Request { | |||
oneof value { | |||
RequestEcho echo = 1; | |||
RequestFlush flush = 2; | |||
RequestInfo info = 3; | |||
RequestInitChain init_chain = 4; | |||
RequestQuery query = 5; | |||
RequestBeginBlock begin_block = 6; | |||
RequestCheckTx check_tx = 7; | |||
RequestDeliverTx deliver_tx = 8; | |||
RequestEndBlock end_block = 9; | |||
RequestCommit commit = 10; | |||
RequestListSnapshots list_snapshots = 11; | |||
RequestOfferSnapshot offer_snapshot = 12; | |||
RequestLoadSnapshotChunk load_snapshot_chunk = 13; | |||
RequestApplySnapshotChunk apply_snapshot_chunk = 14; | |||
} | |||
} | |||
message RequestEcho { | |||
string message = 1; | |||
} | |||
message RequestFlush {} | |||
message RequestInfo { | |||
string version = 1; | |||
uint64 block_version = 2; | |||
uint64 p2p_version = 3; | |||
string abci_version = 4; | |||
} | |||
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; | |||
int64 initial_height = 6; | |||
} | |||
message RequestQuery { | |||
bytes data = 1; | |||
string path = 2; | |||
int64 height = 3; | |||
bool prove = 4; | |||
} | |||
message RequestBeginBlock { | |||
bytes hash = 1; | |||
tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; | |||
LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; | |||
repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; | |||
} | |||
enum CheckTxType { | |||
NEW = 0 [(gogoproto.enumvalue_customname) = "New"]; | |||
RECHECK = 1 [(gogoproto.enumvalue_customname) = "Recheck"]; | |||
} | |||
message RequestCheckTx { | |||
bytes tx = 1; | |||
CheckTxType type = 2; | |||
} | |||
message RequestDeliverTx { | |||
bytes tx = 1; | |||
} | |||
message RequestEndBlock { | |||
int64 height = 1; | |||
} | |||
message RequestCommit {} | |||
// lists available snapshots | |||
message RequestListSnapshots { | |||
} | |||
// offers a snapshot to the application | |||
message RequestOfferSnapshot { | |||
Snapshot snapshot = 1; // snapshot offered by peers | |||
bytes app_hash = 2; // light client-verified app hash for snapshot height | |||
} | |||
// loads a snapshot chunk | |||
message RequestLoadSnapshotChunk { | |||
uint64 height = 1; | |||
uint32 format = 2; | |||
uint32 chunk = 3; | |||
} | |||
// Applies a snapshot chunk | |||
message RequestApplySnapshotChunk { | |||
uint32 index = 1; | |||
bytes chunk = 2; | |||
string sender = 3; | |||
} | |||
//---------------------------------------- | |||
// Response types | |||
message Response { | |||
oneof value { | |||
ResponseException exception = 1; | |||
ResponseEcho echo = 2; | |||
ResponseFlush flush = 3; | |||
ResponseInfo info = 4; | |||
ResponseInitChain init_chain = 5; | |||
ResponseQuery query = 6; | |||
ResponseBeginBlock begin_block = 7; | |||
ResponseCheckTx check_tx = 8; | |||
ResponseDeliverTx deliver_tx = 9; | |||
ResponseEndBlock end_block = 10; | |||
ResponseCommit commit = 11; | |||
ResponseListSnapshots list_snapshots = 12; | |||
ResponseOfferSnapshot offer_snapshot = 13; | |||
ResponseLoadSnapshotChunk load_snapshot_chunk = 14; | |||
ResponseApplySnapshotChunk apply_snapshot_chunk = 15; | |||
} | |||
} | |||
// nondeterministic | |||
message ResponseException { | |||
string error = 1; | |||
} | |||
message ResponseEcho { | |||
string message = 1; | |||
} | |||
message ResponseFlush {} | |||
message ResponseInfo { | |||
string data = 1; | |||
// this is the software version of the application. TODO: remove? | |||
string version = 2; | |||
uint64 app_version = 3; | |||
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; | |||
} | |||
message ResponseQuery { | |||
uint32 code = 1; | |||
// bytes data = 2; // use "value" instead. | |||
string log = 3; // nondeterministic | |||
string info = 4; // nondeterministic | |||
int64 index = 5; | |||
bytes key = 6; | |||
bytes value = 7; | |||
tendermint.crypto.ProofOps proof_ops = 8; | |||
int64 height = 9; | |||
string codespace = 10; | |||
} | |||
message ResponseBeginBlock { | |||
repeated Event events = 1 | |||
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; | |||
} | |||
message ResponseCheckTx { | |||
uint32 code = 1; | |||
bytes data = 2; | |||
string log = 3; // nondeterministic | |||
string info = 4; // nondeterministic | |||
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"]; | |||
string codespace = 8; | |||
} | |||
message ResponseDeliverTx { | |||
uint32 code = 1; | |||
bytes data = 2; | |||
string log = 3; // nondeterministic | |||
string info = 4; // nondeterministic | |||
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"]; | |||
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"]; | |||
} | |||
message ResponseCommit { | |||
// reserve 1 | |||
bytes data = 2; | |||
int64 retain_height = 3; | |||
} | |||
message ResponseListSnapshots { | |||
repeated Snapshot snapshots = 1; | |||
} | |||
message ResponseOfferSnapshot { | |||
Result result = 1; | |||
enum Result { | |||
UNKNOWN = 0; // Unknown result, abort all snapshot restoration | |||
ACCEPT = 1; // Snapshot accepted, apply chunks | |||
ABORT = 2; // Abort all snapshot restoration | |||
REJECT = 3; // Reject this specific snapshot, try others | |||
REJECT_FORMAT = 4; // Reject all snapshots of this format, try others | |||
REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others | |||
} | |||
} | |||
message ResponseLoadSnapshotChunk { | |||
bytes chunk = 1; | |||
} | |||
message ResponseApplySnapshotChunk { | |||
Result result = 1; | |||
repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply | |||
repeated string reject_senders = 3; // Chunk senders to reject and ban | |||
enum Result { | |||
UNKNOWN = 0; // Unknown result, abort all snapshot restoration | |||
ACCEPT = 1; // Chunk successfully accepted | |||
ABORT = 2; // Abort all snapshot restoration | |||
RETRY = 3; // Retry chunk (combine with refetch and reject) | |||
RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) | |||
REJECT_SNAPSHOT = 5; // Reject this snapshot, try others | |||
} | |||
} | |||
//---------------------------------------- | |||
// 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]; | |||
} | |||
// Event allows application developers to attach additional information to | |||
// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. | |||
// Later, transactions may be queried using these events. | |||
message Event { | |||
string type = 1; | |||
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 | |||
} | |||
// TxResult contains results of executing the transaction. | |||
// | |||
// One usage is indexing transaction results. | |||
message TxResult { | |||
int64 height = 1; | |||
uint32 index = 2; | |||
bytes tx = 3; | |||
ResponseDeliverTx result = 4 [(gogoproto.nullable) = false]; | |||
} | |||
//---------------------------------------- | |||
// Blockchain Types | |||
// Validator | |||
message Validator { | |||
bytes address = 1; // The first 20 bytes of SHA256(public key) | |||
// PubKey pub_key = 2 [(gogoproto.nullable)=false]; | |||
int64 power = 3; // The voting power | |||
} | |||
// ValidatorUpdate | |||
message ValidatorUpdate { | |||
tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; | |||
int64 power = 2; | |||
} | |||
// VoteInfo | |||
message VoteInfo { | |||
Validator validator = 1 [(gogoproto.nullable) = false]; | |||
bool signed_last_block = 2; | |||
} | |||
enum EvidenceType { | |||
UNKNOWN = 0; | |||
DUPLICATE_VOTE = 1; | |||
LIGHT_CLIENT_ATTACK = 2; | |||
} | |||
message Evidence { | |||
EvidenceType type = 1; | |||
// The offending validator | |||
Validator validator = 2 [(gogoproto.nullable) = false]; | |||
// The height when the offense occurred | |||
int64 height = 3; | |||
// The corresponding time where the offense occurred | |||
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 | |||
int64 total_voting_power = 5; | |||
} | |||
//---------------------------------------- | |||
// State Sync Types | |||
message Snapshot { | |||
uint64 height = 1; // The height at which the snapshot was taken | |||
uint32 format = 2; // The application-specific snapshot format | |||
uint32 chunks = 3; // Number of chunks in the snapshot | |||
bytes hash = 4; // Arbitrary snapshot hash, equal only if identical | |||
bytes metadata = 5; // Arbitrary application metadata | |||
} | |||
//---------------------------------------- | |||
// Service Definition | |||
service ABCIApplication { | |||
rpc Echo(RequestEcho) returns (ResponseEcho); | |||
rpc Flush(RequestFlush) returns (ResponseFlush); | |||
rpc Info(RequestInfo) returns (ResponseInfo); | |||
rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx); | |||
rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); | |||
rpc Query(RequestQuery) returns (ResponseQuery); | |||
rpc Commit(RequestCommit) returns (ResponseCommit); | |||
rpc InitChain(RequestInitChain) returns (ResponseInitChain); | |||
rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock); | |||
rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); | |||
rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); | |||
rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); | |||
rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk); | |||
rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk); | |||
} |
@ -0,0 +1,41 @@ | |||
syntax = "proto3"; | |||
package tendermint.blockchain; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/blockchain"; | |||
import "tendermint/types/block.proto"; | |||
// BlockRequest requests a block for a specific height | |||
message BlockRequest { | |||
int64 height = 1; | |||
} | |||
// NoBlockResponse informs the node that the peer does not have block at the requested height | |||
message NoBlockResponse { | |||
int64 height = 1; | |||
} | |||
// BlockResponse returns block to the requested | |||
message BlockResponse { | |||
tendermint.types.Block block = 1; | |||
} | |||
// StatusRequest requests the status of a peer. | |||
message StatusRequest { | |||
} | |||
// StatusResponse is a peer response to inform their status. | |||
message StatusResponse { | |||
int64 height = 1; | |||
int64 base = 2; | |||
} | |||
message Message { | |||
oneof sum { | |||
BlockRequest block_request = 1; | |||
NoBlockResponse no_block_response = 2; | |||
BlockResponse block_response = 3; | |||
StatusRequest status_request = 4; | |||
StatusResponse status_response = 5; | |||
} | |||
} |
@ -0,0 +1,92 @@ | |||
syntax = "proto3"; | |||
package tendermint.consensus; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/consensus"; | |||
import "gogoproto/gogo.proto"; | |||
import "tendermint/types/types.proto"; | |||
import "tendermint/libs/bits/types.proto"; | |||
// NewRoundStep is sent for every step taken in the ConsensusState. | |||
// For every height/round/step transition | |||
message NewRoundStep { | |||
int64 height = 1; | |||
int32 round = 2; | |||
uint32 step = 3; | |||
int64 seconds_since_start_time = 4; | |||
int32 last_commit_round = 5; | |||
} | |||
// NewValidBlock is sent when a validator observes a valid block B in some round r, | |||
//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 { | |||
int64 height = 1; | |||
int32 round = 2; | |||
tendermint.types.PartSetHeader block_part_set_header = 3 [(gogoproto.nullable) = false]; | |||
tendermint.libs.bits.BitArray block_parts = 4; | |||
bool is_commit = 5; | |||
} | |||
// Proposal is sent when a new block is proposed. | |||
message Proposal { | |||
tendermint.types.Proposal proposal = 1 [(gogoproto.nullable) = false]; | |||
} | |||
// ProposalPOL is sent when a previous proposal is re-proposed. | |||
message ProposalPOL { | |||
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 { | |||
int64 height = 1; | |||
int32 round = 2; | |||
tendermint.types.Part part = 3 [(gogoproto.nullable) = false]; | |||
} | |||
// Vote is sent when voting for a proposal (or lack thereof). | |||
message Vote { | |||
tendermint.types.Vote vote = 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; | |||
} | |||
// VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. | |||
message VoteSetMaj23 { | |||
int64 height = 1; | |||
int32 round = 2; | |||
tendermint.types.SignedMsgType type = 3; | |||
tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; | |||
} | |||
// VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. | |||
message VoteSetBits { | |||
int64 height = 1; | |||
int32 round = 2; | |||
tendermint.types.SignedMsgType type = 3; | |||
tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; | |||
tendermint.libs.bits.BitArray votes = 5 [(gogoproto.nullable) = false]; | |||
} | |||
message Message { | |||
oneof sum { | |||
NewRoundStep new_round_step = 1; | |||
NewValidBlock new_valid_block = 2; | |||
Proposal proposal = 3; | |||
ProposalPOL proposal_pol = 4; | |||
BlockPart block_part = 5; | |||
Vote vote = 6; | |||
HasVote has_vote = 7; | |||
VoteSetMaj23 vote_set_maj23 = 8; | |||
VoteSetBits vote_set_bits = 9; | |||
} | |||
} |
@ -0,0 +1,16 @@ | |||
syntax = "proto3"; | |||
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; | |||
} | |||
message Message { | |||
oneof sum { | |||
Txs txs = 1; | |||
} | |||
} |
@ -0,0 +1,31 @@ | |||
syntax = "proto3"; | |||
package tendermint.p2p; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/p2p"; | |||
import "gogoproto/gogo.proto"; | |||
import "tendermint/crypto/keys.proto"; | |||
message PacketPing {} | |||
message PacketPong {} | |||
message PacketMsg { | |||
int32 channel_id = 1 [(gogoproto.customname) = "ChannelID"]; | |||
bool eof = 2 [(gogoproto.customname) = "EOF"]; | |||
bytes data = 3; | |||
} | |||
message Packet { | |||
oneof sum { | |||
PacketPing packet_ping = 1; | |||
PacketPong packet_pong = 2; | |||
PacketMsg packet_msg = 3; | |||
} | |||
} | |||
// AuthSigMessage is used while upgrading an insecure connection. | |||
message AuthSigMessage { | |||
tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; | |||
bytes sig = 2; | |||
} |
@ -0,0 +1,20 @@ | |||
syntax = "proto3"; | |||
package tendermint.p2p; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/p2p"; | |||
import "tendermint/p2p/types.proto"; | |||
import "gogoproto/gogo.proto"; | |||
message PexRequest {} | |||
message PexResponse { | |||
repeated NetAddress addresses = 1 [(gogoproto.nullable) = false]; | |||
} | |||
message PexMessage { | |||
oneof sum { | |||
PexRequest pex_request = 1; | |||
PexResponse pex_response = 2; | |||
} | |||
} |
@ -0,0 +1,35 @@ | |||
syntax = "proto3"; | |||
package tendermint.p2p; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/p2p"; | |||
import "gogoproto/gogo.proto"; | |||
message NetAddress { | |||
string id = 1 [(gogoproto.customname) = "ID"]; | |||
string ip = 2 [(gogoproto.customname) = "IP"]; | |||
uint32 port = 3; | |||
} | |||
message ProtocolVersion { | |||
uint64 p2p = 1 [(gogoproto.customname) = "P2P"]; | |||
uint64 block = 2; | |||
uint64 app = 3; | |||
} | |||
// NodeInfo is the information exchanged between two peers when conducting the handshake. | |||
message NodeInfo { | |||
ProtocolVersion protocol_version = 1 [(gogoproto.nullable) = false]; | |||
string node_id = 2 [(gogoproto.customname) = "NodeID"]; | |||
string listen_addr = 3; | |||
string network = 4; | |||
string version = 5; | |||
bytes channels = 6; | |||
string moniker = 7; | |||
NodeInfoOther other = 8 [(gogoproto.nullable) = false]; | |||
} | |||
message NodeInfoOther { | |||
string tx_index = 1; | |||
string rpc_address = 2 [(gogoproto.customname) = "RPCAddress"]; | |||
} |
@ -0,0 +1,37 @@ | |||
syntax = "proto3"; | |||
package tendermint.statesync; | |||
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; | |||
} | |||
} | |||
message SnapshotsRequest {} | |||
message SnapshotsResponse { | |||
uint64 height = 1; | |||
uint32 format = 2; | |||
uint32 chunks = 3; | |||
bytes hash = 4; | |||
bytes metadata = 5; | |||
} | |||
message ChunkRequest { | |||
uint64 height = 1; | |||
uint32 format = 2; | |||
uint32 index = 3; | |||
} | |||
message ChunkResponse { | |||
uint64 height = 1; | |||
uint32 format = 2; | |||
uint32 index = 3; | |||
bytes chunk = 4; | |||
bool missing = 5; | |||
} |
@ -0,0 +1,15 @@ | |||
syntax = "proto3"; | |||
package tendermint.types; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; | |||
import "gogoproto/gogo.proto"; | |||
import "tendermint/types/types.proto"; | |||
import "tendermint/types/evidence.proto"; | |||
message Block { | |||
Header header = 1 [(gogoproto.nullable) = false]; | |||
Data data = 2 [(gogoproto.nullable) = false]; | |||
tendermint.types.EvidenceList evidence = 3 [(gogoproto.nullable) = false]; | |||
Commit last_commit = 4; | |||
} |
@ -0,0 +1,38 @@ | |||
syntax = "proto3"; | |||
package tendermint.types; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; | |||
import "gogoproto/gogo.proto"; | |||
import "google/protobuf/timestamp.proto"; | |||
import "tendermint/types/types.proto"; | |||
import "tendermint/types/validator.proto"; | |||
message Evidence { | |||
oneof sum { | |||
DuplicateVoteEvidence duplicate_vote_evidence = 1; | |||
LightClientAttackEvidence light_client_attack_evidence = 2; | |||
} | |||
} | |||
// DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. | |||
message DuplicateVoteEvidence { | |||
tendermint.types.Vote vote_a = 1; | |||
tendermint.types.Vote vote_b = 2; | |||
int64 total_voting_power = 3; | |||
int64 validator_power = 4; | |||
google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; | |||
} | |||
// LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. | |||
message LightClientAttackEvidence { | |||
tendermint.types.LightBlock conflicting_block = 1; | |||
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]; | |||
} | |||
message EvidenceList { | |||
repeated Evidence evidence = 1 [(gogoproto.nullable) = false]; | |||
} |
@ -0,0 +1,77 @@ | |||
syntax = "proto3"; | |||
package tendermint.types; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; | |||
import "gogoproto/gogo.proto"; | |||
import "google/protobuf/duration.proto"; | |||
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 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 | |||
int64 max_gas = 2; | |||
// This parameter is unused. | |||
int64 time_iota_ms = 3; | |||
} | |||
// EvidenceParams determine how we handle evidence of malfeasance. | |||
message EvidenceParams { | |||
// Max age of evidence, in blocks. | |||
// | |||
// The basic formula for calculating this is: MaxAgeDuration / {average block | |||
// time}. | |||
int64 max_age_num_blocks = 1; | |||
// Max age of evidence, in time. | |||
// | |||
// It should correspond with an app's "unbonding period" or other similar | |||
// mechanism for handling [Nothing-At-Stake | |||
// attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). | |||
google.protobuf.Duration max_age_duration = 2 | |||
[(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; | |||
// This sets the maximum size of total evidence in bytes that can be committed in a single block. | |||
// and should fall comfortably under the max block bytes. | |||
// Default is 1048576 or 1MB | |||
int64 max_bytes = 3; | |||
} | |||
// 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; | |||
} | |||
// HashedParams is a subset of ConsensusParams. | |||
// | |||
// It is hashed into the Header.ConsensusHash. | |||
message HashedParams { | |||
int64 block_max_bytes = 1; | |||
int64 block_max_gas = 2; | |||
} |
@ -0,0 +1,157 @@ | |||
syntax = "proto3"; | |||
package tendermint.types; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; | |||
import "gogoproto/gogo.proto"; | |||
import "google/protobuf/timestamp.proto"; | |||
import "tendermint/crypto/proof.proto"; | |||
import "tendermint/version/types.proto"; | |||
import "tendermint/types/validator.proto"; | |||
// BlockIdFlag indicates which BlcokID the signature is for | |||
enum BlockIDFlag { | |||
option (gogoproto.goproto_enum_stringer) = true; | |||
option (gogoproto.goproto_enum_prefix) = false; | |||
BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"]; | |||
BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"]; | |||
BLOCK_ID_FLAG_COMMIT = 2 [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"]; | |||
BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"]; | |||
} | |||
// SignedMsgType is a type of signed message in the consensus. | |||
enum SignedMsgType { | |||
option (gogoproto.goproto_enum_stringer) = true; | |||
option (gogoproto.goproto_enum_prefix) = false; | |||
SIGNED_MSG_TYPE_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "UnknownType"]; | |||
// Votes | |||
SIGNED_MSG_TYPE_PREVOTE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"]; | |||
SIGNED_MSG_TYPE_PRECOMMIT = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"]; | |||
// Proposals | |||
SIGNED_MSG_TYPE_PROPOSAL = 32 [(gogoproto.enumvalue_customname) = "ProposalType"]; | |||
} | |||
// PartsetHeader | |||
message PartSetHeader { | |||
uint32 total = 1; | |||
bytes hash = 2; | |||
} | |||
message Part { | |||
uint32 index = 1; | |||
bytes bytes = 2; | |||
tendermint.crypto.Proof proof = 3 [(gogoproto.nullable) = false]; | |||
} | |||
// BlockID | |||
message BlockID { | |||
bytes hash = 1; | |||
PartSetHeader part_set_header = 2 [(gogoproto.nullable) = false]; | |||
} | |||
// -------------------------------- | |||
// Header defines the structure of a Tendermint block header. | |||
message Header { | |||
// basic block info | |||
tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false]; | |||
string chain_id = 2 [(gogoproto.customname) = "ChainID"]; | |||
int64 height = 3; | |||
google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; | |||
// prev block info | |||
BlockID last_block_id = 5 [(gogoproto.nullable) = false]; | |||
// hashes of block data | |||
bytes last_commit_hash = 6; // commit from validators from the last block | |||
bytes data_hash = 7; // transactions | |||
// hashes from the app output from the prev block | |||
bytes validators_hash = 8; // validators for the current block | |||
bytes next_validators_hash = 9; // validators for the next block | |||
bytes consensus_hash = 10; // consensus params for current 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 | |||
// consensus info | |||
bytes evidence_hash = 13; // evidence included in the block | |||
bytes proposer_address = 14; // original proposer of the block | |||
} | |||
// Data contains the set of transactions included in the block | |||
message Data { | |||
// Txs that will be applied by state @ block.Height+1. | |||
// NOTE: not all txs here are valid. We're just agreeing on the order first. | |||
// This means that block.AppHash does not include these txs. | |||
repeated bytes txs = 1; | |||
} | |||
// Vote represents a prevote, precommit, or commit vote from validators for | |||
// consensus. | |||
message Vote { | |||
SignedMsgType type = 1; | |||
int64 height = 2; | |||
int32 round = 3; | |||
BlockID block_id = 4 | |||
[(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. | |||
google.protobuf.Timestamp timestamp = 5 | |||
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; | |||
bytes validator_address = 6; | |||
int32 validator_index = 7; | |||
bytes signature = 8; | |||
} | |||
// Commit contains the evidence that a block was committed by a set of validators. | |||
message Commit { | |||
int64 height = 1; | |||
int32 round = 2; | |||
BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; | |||
repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; | |||
} | |||
// CommitSig is a part of the Vote included in a Commit. | |||
message CommitSig { | |||
BlockIDFlag block_id_flag = 1; | |||
bytes validator_address = 2; | |||
google.protobuf.Timestamp timestamp = 3 | |||
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; | |||
bytes signature = 4; | |||
} | |||
message Proposal { | |||
SignedMsgType type = 1; | |||
int64 height = 2; | |||
int32 round = 3; | |||
int32 pol_round = 4; | |||
BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; | |||
google.protobuf.Timestamp timestamp = 6 | |||
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; | |||
bytes signature = 7; | |||
} | |||
message SignedHeader { | |||
Header header = 1; | |||
Commit commit = 2; | |||
} | |||
message LightBlock { | |||
SignedHeader signed_header = 1; | |||
tendermint.types.ValidatorSet validator_set = 2; | |||
} | |||
message BlockMeta { | |||
BlockID block_id = 1 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; | |||
int64 block_size = 2; | |||
Header header = 3 [(gogoproto.nullable) = false]; | |||
int64 num_txs = 4; | |||
} | |||
// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. | |||
message TxProof { | |||
bytes root_hash = 1; | |||
bytes data = 2; | |||
tendermint.crypto.Proof proof = 3; | |||
} |
@ -0,0 +1,26 @@ | |||
syntax = "proto3"; | |||
package tendermint.types; | |||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; | |||
import "gogoproto/gogo.proto"; | |||
import "tendermint/crypto/keys.proto"; | |||
message ValidatorSet { | |||
repeated Validator validators = 1; | |||
Validator proposer = 2; | |||
int64 total_voting_power = 3; | |||
} | |||
message Validator { | |||
bytes address = 1; | |||
tendermint.crypto.PublicKey pub_key = 2 [(gogoproto.nullable) = false]; | |||
int64 voting_power = 3; | |||
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; | |||
} |