Use full vote in BeginBlock

This commit is contained in:
folex 2019-09-10 18:03:14 +03:00
parent 263500ba2f
commit 5a2b46caad
5 changed files with 272 additions and 46 deletions

View File

@ -5,7 +5,7 @@
<groupId>com.github.jtendermint</groupId> <groupId>com.github.jtendermint</groupId>
<artifactId>jabci</artifactId> <artifactId>jabci</artifactId>
<version>0.32.3</version> <version>0.32.3.1</version>
<name>com.github.jtendermint:jabci</name> <name>com.github.jtendermint:jabci</name>
<description>Java implementation for ABCI consensus protocol from tendermint.com and related tools</description> <description>Java implementation for ABCI consensus protocol from tendermint.com and related tools</description>

View File

@ -204,6 +204,11 @@ public final class Types {
static final static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_com_github_jtendermint_jabci_types_VoteInfo_fieldAccessorTable; internal_static_com_github_jtendermint_jabci_types_VoteInfo_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_com_github_jtendermint_jabci_types_Vote_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_com_github_jtendermint_jabci_types_Vote_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor static final com.google.protobuf.Descriptors.Descriptor
internal_static_com_github_jtendermint_jabci_types_PubKey_descriptor; internal_static_com_github_jtendermint_jabci_types_PubKey_descriptor;
static final static final
@ -359,48 +364,56 @@ public final class Types {
"alidator\022\017\n\007address\030\001 \001(\014\022\r\n\005power\030\003 \001(\003" + "alidator\022\017\n\007address\030\001 \001(\014\022\r\n\005power\030\003 \001(\003" +
"\"]\n\017ValidatorUpdate\022;\n\007pub_key\030\001 \001(\0132*.c" + "\"]\n\017ValidatorUpdate\022;\n\007pub_key\030\001 \001(\0132*.c" +
"om.github.jtendermint.jabci.types.PubKey" + "om.github.jtendermint.jabci.types.PubKey" +
"\022\r\n\005power\030\002 \001(\003\"g\n\010VoteInfo\022@\n\tvalidator" + "\022\r\n\005power\030\002 \001(\003\"\244\001\n\010VoteInfo\022@\n\tvalidato" +
"\030\001 \001(\0132-.com.github.jtendermint.jabci.ty" + "r\030\001 \001(\0132-.com.github.jtendermint.jabci.t" +
"pes.Validator\022\031\n\021signed_last_block\030\002 \001(\010" + "ypes.Validator\022\031\n\021signed_last_block\030\002 \001(" +
"\"$\n\006PubKey\022\014\n\004type\030\001 \001(\t\022\014\n\004data\030\002 \001(\014\"\260" + "\010\022;\n\tfull_vote\030\003 \001(\0132(.com.github.jtende" +
"\001\n\010Evidence\022\014\n\004type\030\001 \001(\t\022@\n\tvalidator\030\002" + "rmint.jabci.types.Vote\"\350\001\n\004Vote\022\014\n\004type\030" +
" \001(\0132-.com.github.jtendermint.jabci.type" + "\001 \001(\005\022\016\n\006height\030\002 \001(\003\022\r\n\005round\030\003 \001(\005\022=\n\010" +
"s.Validator\022\016\n\006height\030\003 \001(\003\022(\n\004time\030\004 \001(" + "block_id\030\004 \001(\0132+.com.github.jtendermint." +
"\0132\032.google.protobuf.Timestamp\022\032\n\022total_v" + "jabci.types.BlockID\022-\n\ttimestamp\030\005 \001(\0132\032" +
"oting_power\030\005 \001(\003*#\n\013CheckTxType\022\007\n\003New\020" + ".google.protobuf.Timestamp\022\031\n\021validator_" +
"\000\022\013\n\007Recheck\020\0012\212\n\n\017ABCIApplication\022i\n\004Ec" + "address\030\006 \001(\014\022\027\n\017validator_index\030\007 \001(\005\022\021" +
"ho\022/.com.github.jtendermint.jabci.types." + "\n\tsignature\030\010 \001(\014\"$\n\006PubKey\022\014\n\004type\030\001 \001(" +
"RequestEcho\0320.com.github.jtendermint.jab" + "\t\022\014\n\004data\030\002 \001(\014\"\260\001\n\010Evidence\022\014\n\004type\030\001 \001" +
"ci.types.ResponseEcho\022l\n\005Flush\0220.com.git" + "(\t\022@\n\tvalidator\030\002 \001(\0132-.com.github.jtend" +
"hub.jtendermint.jabci.types.RequestFlush" + "ermint.jabci.types.Validator\022\016\n\006height\030\003" +
"\0321.com.github.jtendermint.jabci.types.Re" + " \001(\003\022(\n\004time\030\004 \001(\0132\032.google.protobuf.Tim" +
"sponseFlush\022i\n\004Info\022/.com.github.jtender" + "estamp\022\032\n\022total_voting_power\030\005 \001(\003*#\n\013Ch" +
"mint.jabci.types.RequestInfo\0320.com.githu" + "eckTxType\022\007\n\003New\020\000\022\013\n\007Recheck\020\0012\212\n\n\017ABCI" +
"b.jtendermint.jabci.types.ResponseInfo\022x" + "Application\022i\n\004Echo\022/.com.github.jtender" +
"\n\tSetOption\0224.com.github.jtendermint.jab" + "mint.jabci.types.RequestEcho\0320.com.githu" +
"ci.types.RequestSetOption\0325.com.github.j" + "b.jtendermint.jabci.types.ResponseEcho\022l" +
"tendermint.jabci.types.ResponseSetOption" + "\n\005Flush\0220.com.github.jtendermint.jabci.t" +
"\022x\n\tDeliverTx\0224.com.github.jtendermint.j" + "ypes.RequestFlush\0321.com.github.jtendermi" +
"abci.types.RequestDeliverTx\0325.com.github" + "nt.jabci.types.ResponseFlush\022i\n\004Info\022/.c" +
".jtendermint.jabci.types.ResponseDeliver" + "om.github.jtendermint.jabci.types.Reques" +
"Tx\022r\n\007CheckTx\0222.com.github.jtendermint.j" + "tInfo\0320.com.github.jtendermint.jabci.typ" +
"abci.types.RequestCheckTx\0323.com.github.j" + "es.ResponseInfo\022x\n\tSetOption\0224.com.githu" +
"tendermint.jabci.types.ResponseCheckTx\022l" + "b.jtendermint.jabci.types.RequestSetOpti" +
"\n\005Query\0220.com.github.jtendermint.jabci.t" + "on\0325.com.github.jtendermint.jabci.types." +
"ypes.RequestQuery\0321.com.github.jtendermi" + "ResponseSetOption\022x\n\tDeliverTx\0224.com.git" +
"nt.jabci.types.ResponseQuery\022o\n\006Commit\0221" + "hub.jtendermint.jabci.types.RequestDeliv" +
".com.github.jtendermint.jabci.types.Requ" + "erTx\0325.com.github.jtendermint.jabci.type" +
"estCommit\0322.com.github.jtendermint.jabci" + "s.ResponseDeliverTx\022r\n\007CheckTx\0222.com.git" +
".types.ResponseCommit\022x\n\tInitChain\0224.com" + "hub.jtendermint.jabci.types.RequestCheck" +
".github.jtendermint.jabci.types.RequestI" + "Tx\0323.com.github.jtendermint.jabci.types." +
"nitChain\0325.com.github.jtendermint.jabci." + "ResponseCheckTx\022l\n\005Query\0220.com.github.jt" +
"types.ResponseInitChain\022{\n\nBeginBlock\0225." + "endermint.jabci.types.RequestQuery\0321.com" +
"com.github.jtendermint.jabci.types.Reque" + ".github.jtendermint.jabci.types.Response" +
"stBeginBlock\0326.com.github.jtendermint.ja" + "Query\022o\n\006Commit\0221.com.github.jtendermint" +
"bci.types.ResponseBeginBlock\022u\n\010EndBlock" + ".jabci.types.RequestCommit\0322.com.github." +
"\0223.com.github.jtendermint.jabci.types.Re" + "jtendermint.jabci.types.ResponseCommit\022x" +
"questEndBlock\0324.com.github.jtendermint.j" + "\n\tInitChain\0224.com.github.jtendermint.jab" +
"abci.types.ResponseEndBlockB\002P\001b\006proto3" "ci.types.RequestInitChain\0325.com.github.j" +
"tendermint.jabci.types.ResponseInitChain" +
"\022{\n\nBeginBlock\0225.com.github.jtendermint." +
"jabci.types.RequestBeginBlock\0326.com.gith" +
"ub.jtendermint.jabci.types.ResponseBegin" +
"Block\022u\n\010EndBlock\0223.com.github.jtendermi" +
"nt.jabci.types.RequestEndBlock\0324.com.git" +
"hub.jtendermint.jabci.types.ResponseEndB" +
"lockB\002P\001b\006proto3"
}; };
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@ -644,15 +657,21 @@ public final class Types {
internal_static_com_github_jtendermint_jabci_types_VoteInfo_fieldAccessorTable = new internal_static_com_github_jtendermint_jabci_types_VoteInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_com_github_jtendermint_jabci_types_VoteInfo_descriptor, internal_static_com_github_jtendermint_jabci_types_VoteInfo_descriptor,
new java.lang.String[] { "Validator", "SignedLastBlock", }); new java.lang.String[] { "Validator", "SignedLastBlock", "FullVote", });
internal_static_com_github_jtendermint_jabci_types_PubKey_descriptor = internal_static_com_github_jtendermint_jabci_types_Vote_descriptor =
getDescriptor().getMessageTypes().get(38); getDescriptor().getMessageTypes().get(38);
internal_static_com_github_jtendermint_jabci_types_Vote_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_com_github_jtendermint_jabci_types_Vote_descriptor,
new java.lang.String[] { "Type", "Height", "Round", "BlockId", "Timestamp", "ValidatorAddress", "ValidatorIndex", "Signature", });
internal_static_com_github_jtendermint_jabci_types_PubKey_descriptor =
getDescriptor().getMessageTypes().get(39);
internal_static_com_github_jtendermint_jabci_types_PubKey_fieldAccessorTable = new internal_static_com_github_jtendermint_jabci_types_PubKey_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_com_github_jtendermint_jabci_types_PubKey_descriptor, internal_static_com_github_jtendermint_jabci_types_PubKey_descriptor,
new java.lang.String[] { "Type", "Data", }); new java.lang.String[] { "Type", "Data", });
internal_static_com_github_jtendermint_jabci_types_Evidence_descriptor = internal_static_com_github_jtendermint_jabci_types_Evidence_descriptor =
getDescriptor().getMessageTypes().get(39); getDescriptor().getMessageTypes().get(40);
internal_static_com_github_jtendermint_jabci_types_Evidence_fieldAccessorTable = new internal_static_com_github_jtendermint_jabci_types_Evidence_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_com_github_jtendermint_jabci_types_Evidence_descriptor, internal_static_com_github_jtendermint_jabci_types_Evidence_descriptor,

View File

@ -64,6 +64,19 @@ private static final long serialVersionUID = 0L;
signedLastBlock_ = input.readBool(); signedLastBlock_ = input.readBool();
break; break;
} }
case 26: {
com.github.jtendermint.jabci.types.Vote.Builder subBuilder = null;
if (fullVote_ != null) {
subBuilder = fullVote_.toBuilder();
}
fullVote_ = input.readMessage(com.github.jtendermint.jabci.types.Vote.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(fullVote_);
fullVote_ = subBuilder.buildPartial();
}
break;
}
default: { default: {
if (!parseUnknownField( if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) { input, unknownFields, extensionRegistry, tag)) {
@ -126,6 +139,27 @@ private static final long serialVersionUID = 0L;
return signedLastBlock_; return signedLastBlock_;
} }
public static final int FULL_VOTE_FIELD_NUMBER = 3;
private com.github.jtendermint.jabci.types.Vote fullVote_;
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public boolean hasFullVote() {
return fullVote_ != null;
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public com.github.jtendermint.jabci.types.Vote getFullVote() {
return fullVote_ == null ? com.github.jtendermint.jabci.types.Vote.getDefaultInstance() : fullVote_;
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public com.github.jtendermint.jabci.types.VoteOrBuilder getFullVoteOrBuilder() {
return getFullVote();
}
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
@java.lang.Override @java.lang.Override
public final boolean isInitialized() { public final boolean isInitialized() {
@ -146,6 +180,9 @@ private static final long serialVersionUID = 0L;
if (signedLastBlock_ != false) { if (signedLastBlock_ != false) {
output.writeBool(2, signedLastBlock_); output.writeBool(2, signedLastBlock_);
} }
if (fullVote_ != null) {
output.writeMessage(3, getFullVote());
}
unknownFields.writeTo(output); unknownFields.writeTo(output);
} }
@ -163,6 +200,10 @@ private static final long serialVersionUID = 0L;
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBoolSize(2, signedLastBlock_); .computeBoolSize(2, signedLastBlock_);
} }
if (fullVote_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, getFullVote());
}
size += unknownFields.getSerializedSize(); size += unknownFields.getSerializedSize();
memoizedSize = size; memoizedSize = size;
return size; return size;
@ -185,6 +226,11 @@ private static final long serialVersionUID = 0L;
} }
if (getSignedLastBlock() if (getSignedLastBlock()
!= other.getSignedLastBlock()) return false; != other.getSignedLastBlock()) return false;
if (hasFullVote() != other.hasFullVote()) return false;
if (hasFullVote()) {
if (!getFullVote()
.equals(other.getFullVote())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false; if (!unknownFields.equals(other.unknownFields)) return false;
return true; return true;
} }
@ -203,6 +249,10 @@ private static final long serialVersionUID = 0L;
hash = (37 * hash) + SIGNED_LAST_BLOCK_FIELD_NUMBER; hash = (37 * hash) + SIGNED_LAST_BLOCK_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getSignedLastBlock()); getSignedLastBlock());
if (hasFullVote()) {
hash = (37 * hash) + FULL_VOTE_FIELD_NUMBER;
hash = (53 * hash) + getFullVote().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode(); hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash; memoizedHashCode = hash;
return hash; return hash;
@ -348,6 +398,12 @@ private static final long serialVersionUID = 0L;
} }
signedLastBlock_ = false; signedLastBlock_ = false;
if (fullVoteBuilder_ == null) {
fullVote_ = null;
} else {
fullVote_ = null;
fullVoteBuilder_ = null;
}
return this; return this;
} }
@ -380,6 +436,11 @@ private static final long serialVersionUID = 0L;
result.validator_ = validatorBuilder_.build(); result.validator_ = validatorBuilder_.build();
} }
result.signedLastBlock_ = signedLastBlock_; result.signedLastBlock_ = signedLastBlock_;
if (fullVoteBuilder_ == null) {
result.fullVote_ = fullVote_;
} else {
result.fullVote_ = fullVoteBuilder_.build();
}
onBuilt(); onBuilt();
return result; return result;
} }
@ -434,6 +495,9 @@ private static final long serialVersionUID = 0L;
if (other.getSignedLastBlock() != false) { if (other.getSignedLastBlock() != false) {
setSignedLastBlock(other.getSignedLastBlock()); setSignedLastBlock(other.getSignedLastBlock());
} }
if (other.hasFullVote()) {
mergeFullVote(other.getFullVote());
}
this.mergeUnknownFields(other.unknownFields); this.mergeUnknownFields(other.unknownFields);
onChanged(); onChanged();
return this; return this;
@ -605,6 +669,123 @@ private static final long serialVersionUID = 0L;
onChanged(); onChanged();
return this; return this;
} }
private com.github.jtendermint.jabci.types.Vote fullVote_;
private com.google.protobuf.SingleFieldBuilderV3<
com.github.jtendermint.jabci.types.Vote, com.github.jtendermint.jabci.types.Vote.Builder, com.github.jtendermint.jabci.types.VoteOrBuilder> fullVoteBuilder_;
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public boolean hasFullVote() {
return fullVoteBuilder_ != null || fullVote_ != null;
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public com.github.jtendermint.jabci.types.Vote getFullVote() {
if (fullVoteBuilder_ == null) {
return fullVote_ == null ? com.github.jtendermint.jabci.types.Vote.getDefaultInstance() : fullVote_;
} else {
return fullVoteBuilder_.getMessage();
}
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public Builder setFullVote(com.github.jtendermint.jabci.types.Vote value) {
if (fullVoteBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
fullVote_ = value;
onChanged();
} else {
fullVoteBuilder_.setMessage(value);
}
return this;
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public Builder setFullVote(
com.github.jtendermint.jabci.types.Vote.Builder builderForValue) {
if (fullVoteBuilder_ == null) {
fullVote_ = builderForValue.build();
onChanged();
} else {
fullVoteBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public Builder mergeFullVote(com.github.jtendermint.jabci.types.Vote value) {
if (fullVoteBuilder_ == null) {
if (fullVote_ != null) {
fullVote_ =
com.github.jtendermint.jabci.types.Vote.newBuilder(fullVote_).mergeFrom(value).buildPartial();
} else {
fullVote_ = value;
}
onChanged();
} else {
fullVoteBuilder_.mergeFrom(value);
}
return this;
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public Builder clearFullVote() {
if (fullVoteBuilder_ == null) {
fullVote_ = null;
onChanged();
} else {
fullVote_ = null;
fullVoteBuilder_ = null;
}
return this;
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public com.github.jtendermint.jabci.types.Vote.Builder getFullVoteBuilder() {
onChanged();
return getFullVoteFieldBuilder().getBuilder();
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
public com.github.jtendermint.jabci.types.VoteOrBuilder getFullVoteOrBuilder() {
if (fullVoteBuilder_ != null) {
return fullVoteBuilder_.getMessageOrBuilder();
} else {
return fullVote_ == null ?
com.github.jtendermint.jabci.types.Vote.getDefaultInstance() : fullVote_;
}
}
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.github.jtendermint.jabci.types.Vote, com.github.jtendermint.jabci.types.Vote.Builder, com.github.jtendermint.jabci.types.VoteOrBuilder>
getFullVoteFieldBuilder() {
if (fullVoteBuilder_ == null) {
fullVoteBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.github.jtendermint.jabci.types.Vote, com.github.jtendermint.jabci.types.Vote.Builder, com.github.jtendermint.jabci.types.VoteOrBuilder>(
getFullVote(),
getParentForChildren(),
isClean());
fullVote_ = null;
}
return fullVoteBuilder_;
}
@java.lang.Override @java.lang.Override
public final Builder setUnknownFields( public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) { final com.google.protobuf.UnknownFieldSet unknownFields) {

View File

@ -24,4 +24,17 @@ public interface VoteInfoOrBuilder extends
* <code>bool signed_last_block = 2;</code> * <code>bool signed_last_block = 2;</code>
*/ */
boolean getSignedLastBlock(); boolean getSignedLastBlock();
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
boolean hasFullVote();
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
com.github.jtendermint.jabci.types.Vote getFullVote();
/**
* <code>.com.github.jtendermint.jabci.types.Vote full_vote = 3;</code>
*/
com.github.jtendermint.jabci.types.VoteOrBuilder getFullVoteOrBuilder();
} }

View File

@ -301,6 +301,19 @@ message ValidatorUpdate {
message VoteInfo { message VoteInfo {
Validator validator = 1; Validator validator = 1;
bool signed_last_block = 2; bool signed_last_block = 2;
Vote full_vote = 3;
}
// Validator's vote for a block
message Vote {
int32 type = 1;
int64 height = 2;
int32 round = 3;
BlockID block_id = 4;
google.protobuf.Timestamp timestamp = 5;
bytes validator_address = 6;
int32 validator_index = 7;
bytes signature = 8;
} }
message PubKey { message PubKey {