Files
tendermint/types/types.proto
T
Ismail Khoffi 793e1b540f This commit tries to give an idea what work would be needed to use
gogo/protobuf without deleting the actual go-types:

 - it uses custom types and adds the necessary methods to (our) Vote
 - the conversion between proto votes (VoteType) and our votes (Vote)
 is done manually
 - Note: there is some conversion between int <-> int64 which won't work
 reliably on 32 bit machines
 - there are some tests but I'm not confident they test for all the edge
 cases
 - my script to generate the proto files from go structs did not work
 reliably (had to write those messages manually)

Signed-off-by: Ismail Khoffi <Ismail.Khoffi@gmail.com>
2019-04-19 16:18:08 +02:00

41 lines
1.0 KiB
Protocol Buffer

syntax = "proto2";
package types;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
option (gogoproto.unmarshaler_all) = false;
option (gogoproto.marshaler_all) = false;
option (gogoproto.populate_all) = true;
option (gogoproto.testgen_all) = true;
message VoteCustomType {
required VoteType vote = 1 [(gogoproto.customtype) = "Vote"];
}
message VoteType {
required uint32 Type = 1;
required int64 Height = 2;
required int64 Round = 3;
required BlockIDType BlockID = 4;
required google.protobuf.Timestamp timestamp_field = 5;
required bytes ValidatorAddress = 6;
required int64 ValidatorIndex = 7;
optional bytes Signature = 8;
}
// TODO: try if it's worth using custom types here too instead?
// (probably not a good idea: more interface methods to implement
// and this messages do not travel the wire separately)
message PartSetHeaderType {
required sint64 total = 1;
required bytes hash = 2;
}
message BlockIDType {
optional bytes Hash = 1;
optional PartSetHeaderType PartSetHeader = 2;
}