From df37e7ecb6bc70d9d066e2b6ef4335979cfecb8b Mon Sep 17 00:00:00 2001 From: William Banfield Date: Mon, 11 Apr 2022 12:12:10 -0400 Subject: [PATCH] add misbehavior to intermediate --- proto/tendermint/abci/types.proto | 47 ++++++++----------- .../tendermint/abci/types.proto.intermediate | 22 ++++----- proto/tendermint/privval/service.proto | 2 +- proto/tendermint/types/types.proto | 23 ++++++++- 4 files changed, 53 insertions(+), 41 deletions(-) diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 0f01ef0c5..1900e5cda 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -3,8 +3,6 @@ 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"; @@ -12,9 +10,14 @@ 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 +// This file is a temporary workaround to enable development during the ABCI++ +// project. This file should be deleted and any references to it removed when +// the ongoing work on ABCI++ is completed. +// +// For the duration of ABCI++, this file should be able to build the `abci/types/types.pb.go` +// file. Any changes that update that file must come as a result of a change in +// this .proto file. +// For more information, see https://github.com/tendermint/tendermint/issues/8066 //---------------------------------------- // Request types @@ -78,6 +81,7 @@ message RequestBeginBlock { CommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; repeated Misbehavior byzantine_validators = 4 [(gogoproto.nullable) = false]; } +} enum CheckTxType { NEW = 0 [(gogoproto.enumvalue_customname) = "New"]; @@ -150,16 +154,12 @@ message RequestProcessProposal { // Extends a vote with application-side injection message RequestExtendVote { - bytes hash = 1; - int64 height = 2; + types.Vote vote = 1; } // Verify the vote extension message RequestVerifyVoteExtension { - bytes hash = 1; - bytes validator_address = 2; - int64 height = 3; - bytes vote_extension = 4; + types.Vote vote = 1; } message RequestFinalizeBlock { @@ -349,7 +349,7 @@ message ResponseProcessProposal { } message ResponseExtendVote { - bytes vote_extension = 1; + tendermint.types.VoteExtension vote_extension = 1; } message ResponseVerifyVoteExtension { @@ -366,7 +366,7 @@ message ResponseFinalizeBlock { repeated Event events = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; repeated ExecTxResult tx_results = 2; - repeated ValidatorUpdate validator_updates = 3; + repeated ValidatorUpdate validator_updates = 3 [(gogoproto.nullable) = false]; tendermint.types.ConsensusParams consensus_param_updates = 4; bytes app_hash = 5; int64 retain_height = 6; @@ -419,10 +419,10 @@ message ExecTxResult { // // One usage is indexing transaction results. message TxResult { - int64 height = 1; - uint32 index = 2; - bytes tx = 3; - ResponseDeliverTx result = 4 [(gogoproto.nullable) = false]; + int64 height = 1; + uint32 index = 2; + bytes tx = 3; + ExecTxResult result = 4 [(gogoproto.nullable) = false]; } message TxRecord { @@ -458,25 +458,16 @@ message ValidatorUpdate { message VoteInfo { Validator validator = 1 [(gogoproto.nullable) = false]; bool signed_last_block = 2; + reserved 3; // Placeholder for tendermint_signed_extension in v0.37 + reserved 4; // Placeholder for app_signed_extension in v0.37 } -// ExtendedVoteInfo message ExtendedVoteInfo { Validator validator = 1 [(gogoproto.nullable) = false]; bool signed_last_block = 2; bytes vote_extension = 3; } -// CanonicalVoteExtension -// TODO: move this to core Tendermint data structures -message CanonicalVoteExtension { - bytes extension = 1; - int64 height = 2; - int32 round = 3; - string chain_id = 4; - bytes address = 5; -} - enum MisbehaviorType { UNKNOWN = 0; DUPLICATE_VOTE = 1; diff --git a/proto/tendermint/abci/types.proto.intermediate b/proto/tendermint/abci/types.proto.intermediate index 9404eb1f4..7f71795c0 100644 --- a/proto/tendermint/abci/types.proto.intermediate +++ b/proto/tendermint/abci/types.proto.intermediate @@ -77,7 +77,7 @@ message RequestBeginBlock { bytes hash = 1; tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; CommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; - repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; + repeated Misbehavior byzantine_validators = 4 [(gogoproto.nullable) = false]; } enum CheckTxType { @@ -130,16 +130,16 @@ message RequestPrepareProposal { // sent to the app for possible modifications. repeated bytes txs = 2; ExtendedCommitInfo local_last_commit = 3 [(gogoproto.nullable) = false]; - repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; + repeated Misbehavior byzantine_validators = 4 [(gogoproto.nullable) = false]; int64 height = 5; google.protobuf.Timestamp time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; bytes next_validators_hash = 7; } message RequestProcessProposal { - repeated bytes txs = 1; - CommitInfo proposed_last_commit = 2 [(gogoproto.nullable) = false]; - repeated Evidence byzantine_validators = 3 [(gogoproto.nullable) = false]; + repeated bytes txs = 1; + CommitInfo proposed_last_commit = 2 [(gogoproto.nullable) = false]; + repeated Misbehavior byzantine_validators = 3 [(gogoproto.nullable) = false]; // hash is the merkle root hash of the fields of the proposed block. bytes hash = 4; int64 height = 5; @@ -160,9 +160,9 @@ message RequestVerifyVoteExtension { } message RequestFinalizeBlock { - repeated bytes txs = 1; - CommitInfo decided_last_commit = 2 [(gogoproto.nullable) = false]; - repeated Evidence byzantine_validators = 3 [(gogoproto.nullable) = false]; + repeated bytes txs = 1; + CommitInfo decided_last_commit = 2 [(gogoproto.nullable) = false]; + repeated Misbehavior byzantine_validators = 3 [(gogoproto.nullable) = false]; // hash is the merkle root hash of the fields of the proposed block. bytes hash = 4; int64 height = 5; @@ -465,14 +465,14 @@ message ExtendedVoteInfo { bytes vote_extension = 3; } -enum EvidenceType { +enum MisbehaviorType { UNKNOWN = 0; DUPLICATE_VOTE = 1; LIGHT_CLIENT_ATTACK = 2; } -message Evidence { - EvidenceType type = 1; +message Misbehavior { + MisbehaviorType type = 1; // The offending validator Validator validator = 2 [(gogoproto.nullable) = false]; // The height when the offense occurred diff --git a/proto/tendermint/privval/service.proto b/proto/tendermint/privval/service.proto index 63e9afca7..2c699e1cd 100644 --- a/proto/tendermint/privval/service.proto +++ b/proto/tendermint/privval/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package tendermint.privval; -option go_package = "github.com/tendermint/tendermint/proto/tendermint/privval"; +option go_package = "github.com/tendermint/tendermint/proto/tendermint/privval"; import "tendermint/privval/types.proto"; diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index bc2c53196..3855af3d9 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -9,7 +9,14 @@ import "tendermint/crypto/proof.proto"; import "tendermint/version/types.proto"; import "tendermint/types/validator.proto"; -// BlockIdFlag indicates which BlcokID the signature is for +// This file is a temporary workaround to enable development during the ABCI++ +// project. This file should be deleted and any references to it removed when +// the ongoing work on ABCI++ is completed. +// +// This file supports building of the `tendermint.abci` proto package. +// For more information, see https://github.com/tendermint/tendermint/issues/8066 + +// BlockIdFlag indicates which BlockID the signature is for enum BlockIDFlag { option (gogoproto.goproto_enum_stringer) = true; option (gogoproto.goproto_enum_prefix) = false; @@ -113,6 +120,19 @@ message Vote { bytes validator_address = 6; int32 validator_index = 7; bytes signature = 8; + VoteExtension vote_extension = 9; +} + +// VoteExtension is app-defined additional information to the validator votes. +message VoteExtension { + bytes app_data_to_sign = 1; + bytes app_data_self_authenticating = 2; +} + +// VoteExtensionToSign is a subset of VoteExtension that is signed by the validators private key. +// VoteExtensionToSign is extracted from an existing VoteExtension. +message VoteExtensionToSign { + bytes app_data_to_sign = 1; } // Commit contains the evidence that a block was committed by a set of @@ -132,6 +152,7 @@ message CommitSig { google.protobuf.Timestamp timestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; bytes signature = 4; + VoteExtensionToSign vote_extension = 5; } message Proposal {