Skip to content

Commit

Permalink
switch to the lazyledger-core proto files
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Jan 30, 2021
1 parent b88c49e commit 072f7a2
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 69 deletions.
97 changes: 47 additions & 50 deletions third_party/proto/tendermint/abci/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ message Request {
RequestEcho echo = 1;
RequestFlush flush = 2;
RequestInfo info = 3;
RequestSetOption set_option = 4;
RequestInitChain init_chain = 5;
RequestQuery query = 6;
RequestBeginBlock begin_block = 7;
RequestCheckTx check_tx = 8;
RequestDeliverTx deliver_tx = 9;
RequestEndBlock end_block = 10;
RequestCommit commit = 11;
RequestListSnapshots list_snapshots = 12;
RequestOfferSnapshot offer_snapshot = 13;
RequestLoadSnapshotChunk load_snapshot_chunk = 14;
RequestApplySnapshotChunk apply_snapshot_chunk = 15;
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;
RequestPreprocessTxs preprocess_txs = 15;
}
}

Expand All @@ -49,12 +49,7 @@ message RequestInfo {
string version = 1;
uint64 block_version = 2;
uint64 p2p_version = 3;
}

// nondeterministic
message RequestSetOption {
string key = 1;
string value = 2;
string abci_version = 4;
}

message RequestInitChain {
Expand Down Expand Up @@ -125,6 +120,10 @@ message RequestApplySnapshotChunk {
string sender = 3;
}

message RequestPreprocessTxs {
repeated bytes txs = 1;
}

//----------------------------------------
// Response types

Expand All @@ -134,18 +133,18 @@ message Response {
ResponseEcho echo = 2;
ResponseFlush flush = 3;
ResponseInfo info = 4;
ResponseSetOption set_option = 5;
ResponseInitChain init_chain = 6;
ResponseQuery query = 7;
ResponseBeginBlock begin_block = 8;
ResponseCheckTx check_tx = 9;
ResponseDeliverTx deliver_tx = 10;
ResponseEndBlock end_block = 11;
ResponseCommit commit = 12;
ResponseListSnapshots list_snapshots = 13;
ResponseOfferSnapshot offer_snapshot = 14;
ResponseLoadSnapshotChunk load_snapshot_chunk = 15;
ResponseApplySnapshotChunk apply_snapshot_chunk = 16;
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;
ResponsePreprocessTxs preprocess_txs = 16;
}
}

Expand All @@ -163,21 +162,14 @@ 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;
}

// nondeterministic
message ResponseSetOption {
uint32 code = 1;
// bytes data = 2;
string log = 3;
string info = 4;
}

message ResponseInitChain {
ConsensusParams consensus_params = 1;
repeated ValidatorUpdate validators = 2 [(gogoproto.nullable) = false];
Expand Down Expand Up @@ -276,6 +268,11 @@ message ResponseApplySnapshotChunk {
}
}

message ResponsePreprocessTxs {
repeated bytes txs = 1;
tendermint.types.Messages messages = 2;
}

//----------------------------------------
// Misc.

Expand Down Expand Up @@ -334,9 +331,9 @@ message TxResult {

// Validator
message Validator {
bytes address = 1; // The first 20 bytes of SHA256(public key)
bytes address = 1; // The first 20 bytes of SHA256(public key)
// PubKey pub_key = 2 [(gogoproto.nullable)=false];
int64 power = 3; // The voting power
int64 power = 3; // The voting power
}

// ValidatorUpdate
Expand All @@ -352,25 +349,25 @@ message VoteInfo {
}

enum EvidenceType {
UNKNOWN = 0;
DUPLICATE_VOTE = 1;
LIGHT_CLIENT_ATTACK = 2;
UNKNOWN = 0;
DUPLICATE_VOTE = 1;
LIGHT_CLIENT_ATTACK = 2;
}

message Evidence {
EvidenceType type = 1;
EvidenceType type = 1;
// The offending validator
Validator validator = 2 [(gogoproto.nullable) = false];
// The height when the offense occurred
int64 height = 3;
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 [
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/lazyledger/lazyledger-core/issues/4581
// https://github.com/tendermint/tendermint/issues/4581
int64 total_voting_power = 5;
}

Expand All @@ -392,7 +389,6 @@ service ABCIApplication {
rpc Echo(RequestEcho) returns (ResponseEcho);
rpc Flush(RequestFlush) returns (ResponseFlush);
rpc Info(RequestInfo) returns (ResponseInfo);
rpc SetOption(RequestSetOption) returns (ResponseSetOption);
rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
rpc Query(RequestQuery) returns (ResponseQuery);
Expand All @@ -404,4 +400,5 @@ service ABCIApplication {
rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot);
rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk);
rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk);
rpc PreprocessTxs(RequestPreprocessTxs) returns (ResponsePreprocessTxs);
}
3 changes: 2 additions & 1 deletion third_party/proto/tendermint/crypto/keys.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ message PublicKey {
option (gogoproto.equal) = true;

oneof sum {
bytes ed25519 = 1;
bytes ed25519 = 1;
bytes secp256k1 = 2;
}
}
9 changes: 4 additions & 5 deletions third_party/proto/tendermint/types/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ message EvidenceParams {
google.protobuf.Duration max_age_duration = 2
[(gogoproto.nullable) = false, (gogoproto.stdduration) = true];

// This sets the maximum number of evidence that can be committed in a single block.
// and should fall comfortably under the max block bytes when we consider the size of
// each evidence (See MaxEvidenceBytes). The maximum number is MaxEvidencePerBlock.
// Default is 50
uint32 max_num = 3;
// 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.
Expand Down
83 changes: 70 additions & 13 deletions third_party/proto/tendermint/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ option go_package = "github.com/lazyledger/lazyledger-core/proto/tendermint/type

import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "tendermint/libs/bits/types.proto";
import "tendermint/crypto/proof.proto";
import "tendermint/version/types.proto";
import "tendermint/types/validator.proto";
Expand All @@ -26,13 +25,13 @@ enum SignedMsgType {
option (gogoproto.goproto_enum_stringer) = true;
option (gogoproto.goproto_enum_prefix) = false;

SIGNED_MSG_TYPE_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "UnknownType"];
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"];
SIGNED_MSG_TYPE_PROPOSAL = 32 [(gogoproto.enumvalue_customname) = "ProposalType"];
}

// PartsetHeader
Expand Down Expand Up @@ -87,9 +86,69 @@ 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;
// Volatile
bytes hash = 2;
repeated bytes txs = 1;
IntermediateStateRoots intermediate_state_roots = 2 [(gogoproto.nullable) = false];
EvidenceList evidence = 3 [(gogoproto.nullable) = false];
Messages messages = 4 [(gogoproto.nullable) = false];
}

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];
}

message IntermediateStateRoots {
repeated bytes raw_roots_list = 1;
}

message Messages {
repeated Message messages_list = 1;
}

message Message {
bytes namespace_id = 1;
bytes data = 2;
}

// DataAvailabilityHeader contains the row and column roots of the erasure
// coded version of the data in Block.Data.
// Therefor the original Block.Data is arranged in a
// k × k matrix, which is then "extended" to a
// 2k × 2k matrix applying multiple times Reed-Solomon encoding.
// For details see Section 5.2: https://arxiv.org/abs/1809.09044
// or the LazyLedger specification:
// https://github.com/lazyledger/lazyledger-specs/blob/master/specs/data_structures.md#availabledataheader
// Note that currently we list row and column roots in separate fields
// (different from the spec).
message DataAvailabilityHeader {
// RowRoot_j = root((M_{j,1} || M_{j,2} || ... || M_{j,2k} ))
repeated bytes row_roots = 1;
// ColumnRoot_j = root((M_{1,j} || M_{2,j} || ... || M_{2k,j} ))
repeated bytes column_roots = 2;
}

// Vote represents a prevote, precommit, or commit vote from validators for
Expand All @@ -109,12 +168,10 @@ message Vote {

// 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];
bytes hash = 5;
tendermint.libs.bits.BitArray bit_array = 6;
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.
Expand Down Expand Up @@ -144,7 +201,7 @@ message SignedHeader {

message LightBlock {
SignedHeader signed_header = 1;
tendermint.types.ValidatorSet validator_set = 2;
tendermint.types.ValidatorSet validator_set = 2;
}

message BlockMeta {
Expand Down

0 comments on commit 072f7a2

Please sign in to comment.