diff --git a/abci/example/kvstore/helpers.go b/abci/example/kvstore/helpers.go index 0e69fab9f..bb086dec0 100644 --- a/abci/example/kvstore/helpers.go +++ b/abci/example/kvstore/helpers.go @@ -7,12 +7,10 @@ import ( // RandVal creates one random validator, with a key derived // from the input value -func RandVal(i int) types.Validator { - addr := cmn.RandBytes(20) +func RandVal(i int) types.ValidatorUpdate { pubkey := cmn.RandBytes(32) power := cmn.RandUint16() + 1 - v := types.Ed25519Validator(pubkey, int64(power)) - v.Address = addr + v := types.Ed25519ValidatorUpdate(pubkey, int64(power)) return v } @@ -20,8 +18,8 @@ func RandVal(i int) types.Validator { // the application. Note that the keys are deterministically // derived from the index in the array, while the power is // random (Change this if not desired) -func RandVals(cnt int) []types.Validator { - res := make([]types.Validator, cnt) +func RandVals(cnt int) []types.ValidatorUpdate { + res := make([]types.ValidatorUpdate, cnt) for i := 0; i < cnt; i++ { res[i] = RandVal(i) } diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index 33e67aaad..a18fb8d3c 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -122,11 +122,11 @@ func TestValUpdates(t *testing.T) { vals1, vals2 := vals[:nInit], kvstore.Validators() valsEqual(t, vals1, vals2) - var v1, v2, v3 types.Validator + var v1, v2, v3 types.ValidatorUpdate // add some validators v1, v2 = vals[nInit], vals[nInit+1] - diff := []types.Validator{v1, v2} + diff := []types.ValidatorUpdate{v1, v2} tx1 := MakeValSetChangeTx(v1.PubKey, v1.Power) tx2 := MakeValSetChangeTx(v2.PubKey, v2.Power) @@ -140,7 +140,7 @@ func TestValUpdates(t *testing.T) { v1.Power = 0 v2.Power = 0 v3.Power = 0 - diff = []types.Validator{v1, v2, v3} + diff = []types.ValidatorUpdate{v1, v2, v3} tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power) tx2 = MakeValSetChangeTx(v2.PubKey, v2.Power) tx3 := MakeValSetChangeTx(v3.PubKey, v3.Power) @@ -158,18 +158,18 @@ func TestValUpdates(t *testing.T) { } else { v1.Power = 5 } - diff = []types.Validator{v1} + diff = []types.ValidatorUpdate{v1} tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power) makeApplyBlock(t, kvstore, 3, diff, tx1) - vals1 = append([]types.Validator{v1}, vals1[1:]...) + vals1 = append([]types.ValidatorUpdate{v1}, vals1[1:]...) vals2 = kvstore.Validators() valsEqual(t, vals1, vals2) } -func makeApplyBlock(t *testing.T, kvstore types.Application, heightInt int, diff []types.Validator, txs ...[]byte) { +func makeApplyBlock(t *testing.T, kvstore types.Application, heightInt int, diff []types.ValidatorUpdate, txs ...[]byte) { // make and apply block height := int64(heightInt) hash := []byte("foo") @@ -191,12 +191,12 @@ func makeApplyBlock(t *testing.T, kvstore types.Application, heightInt int, diff } // order doesn't matter -func valsEqual(t *testing.T, vals1, vals2 []types.Validator) { +func valsEqual(t *testing.T, vals1, vals2 []types.ValidatorUpdate) { if len(vals1) != len(vals2) { t.Fatalf("vals dont match in len. got %d, expected %d", len(vals2), len(vals1)) } - sort.Sort(types.Validators(vals1)) - sort.Sort(types.Validators(vals2)) + sort.Sort(types.ValidatorUpdates(vals1)) + sort.Sort(types.ValidatorUpdates(vals2)) for i, v1 := range vals1 { v2 := vals2[i] if !bytes.Equal(v1.PubKey.Data, v2.PubKey.Data) || diff --git a/abci/example/kvstore/persistent_kvstore.go b/abci/example/kvstore/persistent_kvstore.go index b8a2299a6..f969eebfe 100644 --- a/abci/example/kvstore/persistent_kvstore.go +++ b/abci/example/kvstore/persistent_kvstore.go @@ -25,7 +25,7 @@ type PersistentKVStoreApplication struct { app *KVStoreApplication // validator set - ValUpdates []types.Validator + ValUpdates []types.ValidatorUpdate logger log.Logger } @@ -101,7 +101,7 @@ func (app *PersistentKVStoreApplication) InitChain(req types.RequestInitChain) t // Track the block hash and header information func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock { // reset valset changes - app.ValUpdates = make([]types.Validator, 0) + app.ValUpdates = make([]types.ValidatorUpdate, 0) return types.ResponseBeginBlock{} } @@ -113,11 +113,11 @@ func (app *PersistentKVStoreApplication) EndBlock(req types.RequestEndBlock) typ //--------------------------------------------- // update validators -func (app *PersistentKVStoreApplication) Validators() (validators []types.Validator) { +func (app *PersistentKVStoreApplication) Validators() (validators []types.ValidatorUpdate) { itr := app.app.state.db.Iterator(nil, nil) for ; itr.Valid(); itr.Next() { if isValidatorTx(itr.Key()) { - validator := new(types.Validator) + validator := new(types.ValidatorUpdate) err := types.ReadMessage(bytes.NewBuffer(itr.Value()), validator) if err != nil { panic(err) @@ -167,11 +167,11 @@ func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.Respon } // update - return app.updateValidator(types.Ed25519Validator(pubkey, int64(power))) + return app.updateValidator(types.Ed25519ValidatorUpdate(pubkey, int64(power))) } // add, update, or remove a validator -func (app *PersistentKVStoreApplication) updateValidator(v types.Validator) types.ResponseDeliverTx { +func (app *PersistentKVStoreApplication) updateValidator(v types.ValidatorUpdate) types.ResponseDeliverTx { key := []byte("val:" + string(v.PubKey.Data)) if v.Power == 0 { // remove validator diff --git a/abci/tests/server/client.go b/abci/tests/server/client.go index f67297cd7..5daa1e6af 100644 --- a/abci/tests/server/client.go +++ b/abci/tests/server/client.go @@ -12,11 +12,11 @@ import ( func InitChain(client abcicli.Client) error { total := 10 - vals := make([]types.Validator, total) + vals := make([]types.ValidatorUpdate, total) for i := 0; i < total; i++ { pubkey := cmn.RandBytes(33) power := cmn.RandInt() - vals[i] = types.Ed25519Validator(pubkey, int64(power)) + vals[i] = types.Ed25519ValidatorUpdate(pubkey, int64(power)) } _, err := client.InitChainSync(types.RequestInitChain{ Validators: vals, diff --git a/abci/types/pubkey.go b/abci/types/pubkey.go index e5cd5fbf3..46cd8c5e8 100644 --- a/abci/types/pubkey.go +++ b/abci/types/pubkey.go @@ -4,8 +4,8 @@ const ( PubKeyEd25519 = "ed25519" ) -func Ed25519Validator(pubkey []byte, power int64) Validator { - return Validator{ +func Ed25519ValidatorUpdate(pubkey []byte, power int64) ValidatorUpdate { + return ValidatorUpdate{ // Address: PubKey: PubKey{ Type: PubKeyEd25519, diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index a609d677b..773754c70 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -42,7 +42,8 @@ BlockID PartSetHeader Validator - SigningValidator + ValidatorUpdate + VoteInfo PubKey Evidence */ @@ -551,11 +552,11 @@ func (m *RequestSetOption) GetValue() string { } type RequestInitChain struct { - Time time.Time `protobuf:"bytes,1,opt,name=time,stdtime" json:"time"` - ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - ConsensusParams *ConsensusParams `protobuf:"bytes,3,opt,name=consensus_params,json=consensusParams" json:"consensus_params,omitempty"` - Validators []Validator `protobuf:"bytes,4,rep,name=validators" json:"validators"` - AppStateBytes []byte `protobuf:"bytes,5,opt,name=app_state_bytes,json=appStateBytes,proto3" json:"app_state_bytes,omitempty"` + Time time.Time `protobuf:"bytes,1,opt,name=time,stdtime" json:"time"` + ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ConsensusParams *ConsensusParams `protobuf:"bytes,3,opt,name=consensus_params,json=consensusParams" json:"consensus_params,omitempty"` + Validators []ValidatorUpdate `protobuf:"bytes,4,rep,name=validators" json:"validators"` + AppStateBytes []byte `protobuf:"bytes,5,opt,name=app_state_bytes,json=appStateBytes,proto3" json:"app_state_bytes,omitempty"` } func (m *RequestInitChain) Reset() { *m = RequestInitChain{} } @@ -584,7 +585,7 @@ func (m *RequestInitChain) GetConsensusParams() *ConsensusParams { return nil } -func (m *RequestInitChain) GetValidators() []Validator { +func (m *RequestInitChain) GetValidators() []ValidatorUpdate { if m != nil { return m.Validators } @@ -1285,8 +1286,8 @@ func (m *ResponseSetOption) GetInfo() string { } type ResponseInitChain struct { - ConsensusParams *ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams" json:"consensus_params,omitempty"` - Validators []Validator `protobuf:"bytes,2,rep,name=validators" json:"validators"` + ConsensusParams *ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams" json:"consensus_params,omitempty"` + Validators []ValidatorUpdate `protobuf:"bytes,2,rep,name=validators" json:"validators"` } func (m *ResponseInitChain) Reset() { *m = ResponseInitChain{} } @@ -1301,7 +1302,7 @@ func (m *ResponseInitChain) GetConsensusParams() *ConsensusParams { return nil } -func (m *ResponseInitChain) GetValidators() []Validator { +func (m *ResponseInitChain) GetValidators() []ValidatorUpdate { if m != nil { return m.Validators } @@ -1526,9 +1527,9 @@ func (m *ResponseDeliverTx) GetTags() []common.KVPair { } type ResponseEndBlock struct { - ValidatorUpdates []Validator `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates" json:"validator_updates"` - ConsensusParamUpdates *ConsensusParams `protobuf:"bytes,2,opt,name=consensus_param_updates,json=consensusParamUpdates" json:"consensus_param_updates,omitempty"` - Tags []common.KVPair `protobuf:"bytes,3,rep,name=tags" json:"tags,omitempty"` + ValidatorUpdates []ValidatorUpdate `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates" json:"validator_updates"` + ConsensusParamUpdates *ConsensusParams `protobuf:"bytes,2,opt,name=consensus_param_updates,json=consensusParamUpdates" json:"consensus_param_updates,omitempty"` + Tags []common.KVPair `protobuf:"bytes,3,rep,name=tags" json:"tags,omitempty"` } func (m *ResponseEndBlock) Reset() { *m = ResponseEndBlock{} } @@ -1536,7 +1537,7 @@ func (m *ResponseEndBlock) String() string { return proto.CompactText func (*ResponseEndBlock) ProtoMessage() {} func (*ResponseEndBlock) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{23} } -func (m *ResponseEndBlock) GetValidatorUpdates() []Validator { +func (m *ResponseEndBlock) GetValidatorUpdates() []ValidatorUpdate { if m != nil { return m.ValidatorUpdates } @@ -1686,8 +1687,7 @@ func (m *BlockGossip) GetBlockPartSizeBytes() int32 { } type LastCommitInfo struct { - CommitRound int32 `protobuf:"varint,1,opt,name=commit_round,json=commitRound,proto3" json:"commit_round,omitempty"` - Validators []SigningValidator `protobuf:"bytes,2,rep,name=validators" json:"validators"` + CommitVotes []VoteInfo `protobuf:"bytes,1,rep,name=commit_votes,json=commitVotes" json:"commit_votes"` } func (m *LastCommitInfo) Reset() { *m = LastCommitInfo{} } @@ -1695,16 +1695,9 @@ func (m *LastCommitInfo) String() string { return proto.CompactTextSt func (*LastCommitInfo) ProtoMessage() {} func (*LastCommitInfo) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{29} } -func (m *LastCommitInfo) GetCommitRound() int32 { +func (m *LastCommitInfo) GetCommitVotes() []VoteInfo { if m != nil { - return m.CommitRound - } - return 0 -} - -func (m *LastCommitInfo) GetValidators() []SigningValidator { - if m != nil { - return m.Validators + return m.CommitVotes } return nil } @@ -1893,7 +1886,6 @@ func (m *PartSetHeader) GetHash() []byte { // Validator type Validator struct { Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - PubKey PubKey `protobuf:"bytes,2,opt,name=pub_key,json=pubKey" json:"pub_key"` Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` } @@ -1909,45 +1901,71 @@ func (m *Validator) GetAddress() []byte { return nil } -func (m *Validator) GetPubKey() PubKey { +func (m *Validator) GetPower() int64 { + if m != nil { + return m.Power + } + return 0 +} + +// ValidatorUpdate +type ValidatorUpdate struct { + PubKey PubKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey" json:"pub_key"` + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` +} + +func (m *ValidatorUpdate) Reset() { *m = ValidatorUpdate{} } +func (m *ValidatorUpdate) String() string { return proto.CompactTextString(m) } +func (*ValidatorUpdate) ProtoMessage() {} +func (*ValidatorUpdate) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{34} } + +func (m *ValidatorUpdate) GetPubKey() PubKey { if m != nil { return m.PubKey } return PubKey{} } -func (m *Validator) GetPower() int64 { +func (m *ValidatorUpdate) GetPower() int64 { if m != nil { return m.Power } return 0 } -// Validator with an extra bool -type SigningValidator struct { +// VoteInfo +type VoteInfo struct { Validator Validator `protobuf:"bytes,1,opt,name=validator" json:"validator"` SignedLastBlock bool `protobuf:"varint,2,opt,name=signed_last_block,json=signedLastBlock,proto3" json:"signed_last_block,omitempty"` + CommitRound int64 `protobuf:"varint,3,opt,name=commit_round,json=commitRound,proto3" json:"commit_round,omitempty"` } -func (m *SigningValidator) Reset() { *m = SigningValidator{} } -func (m *SigningValidator) String() string { return proto.CompactTextString(m) } -func (*SigningValidator) ProtoMessage() {} -func (*SigningValidator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{34} } +func (m *VoteInfo) Reset() { *m = VoteInfo{} } +func (m *VoteInfo) String() string { return proto.CompactTextString(m) } +func (*VoteInfo) ProtoMessage() {} +func (*VoteInfo) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{35} } -func (m *SigningValidator) GetValidator() Validator { +func (m *VoteInfo) GetValidator() Validator { if m != nil { return m.Validator } return Validator{} } -func (m *SigningValidator) GetSignedLastBlock() bool { +func (m *VoteInfo) GetSignedLastBlock() bool { if m != nil { return m.SignedLastBlock } return false } +func (m *VoteInfo) GetCommitRound() int64 { + if m != nil { + return m.CommitRound + } + return 0 +} + type PubKey struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` @@ -1956,7 +1974,7 @@ type PubKey struct { func (m *PubKey) Reset() { *m = PubKey{} } func (m *PubKey) String() string { return proto.CompactTextString(m) } func (*PubKey) ProtoMessage() {} -func (*PubKey) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{35} } +func (*PubKey) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{36} } func (m *PubKey) GetType() string { if m != nil { @@ -1983,7 +2001,7 @@ type Evidence struct { func (m *Evidence) Reset() { *m = Evidence{} } func (m *Evidence) String() string { return proto.CompactTextString(m) } func (*Evidence) ProtoMessage() {} -func (*Evidence) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{36} } +func (*Evidence) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{37} } func (m *Evidence) GetType() string { if m != nil { @@ -2089,8 +2107,10 @@ func init() { golang_proto.RegisterType((*PartSetHeader)(nil), "types.PartSetHeader") proto.RegisterType((*Validator)(nil), "types.Validator") golang_proto.RegisterType((*Validator)(nil), "types.Validator") - proto.RegisterType((*SigningValidator)(nil), "types.SigningValidator") - golang_proto.RegisterType((*SigningValidator)(nil), "types.SigningValidator") + proto.RegisterType((*ValidatorUpdate)(nil), "types.ValidatorUpdate") + golang_proto.RegisterType((*ValidatorUpdate)(nil), "types.ValidatorUpdate") + proto.RegisterType((*VoteInfo)(nil), "types.VoteInfo") + golang_proto.RegisterType((*VoteInfo)(nil), "types.VoteInfo") proto.RegisterType((*PubKey)(nil), "types.PubKey") golang_proto.RegisterType((*PubKey)(nil), "types.PubKey") proto.RegisterType((*Evidence)(nil), "types.Evidence") @@ -3535,14 +3555,11 @@ func (this *LastCommitInfo) Equal(that interface{}) bool { } else if this == nil { return false } - if this.CommitRound != that1.CommitRound { + if len(this.CommitVotes) != len(that1.CommitVotes) { return false } - if len(this.Validators) != len(that1.Validators) { - return false - } - for i := range this.Validators { - if !this.Validators[i].Equal(&that1.Validators[i]) { + for i := range this.CommitVotes { + if !this.CommitVotes[i].Equal(&that1.CommitVotes[i]) { return false } } @@ -3690,6 +3707,30 @@ func (this *Validator) Equal(that interface{}) bool { if !bytes.Equal(this.Address, that1.Address) { return false } + if this.Power != that1.Power { + return false + } + return true +} +func (this *ValidatorUpdate) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ValidatorUpdate) + if !ok { + that2, ok := that.(ValidatorUpdate) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } if !this.PubKey.Equal(&that1.PubKey) { return false } @@ -3698,14 +3739,14 @@ func (this *Validator) Equal(that interface{}) bool { } return true } -func (this *SigningValidator) Equal(that interface{}) bool { +func (this *VoteInfo) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*SigningValidator) + that1, ok := that.(*VoteInfo) if !ok { - that2, ok := that.(SigningValidator) + that2, ok := that.(VoteInfo) if ok { that1 = &that2 } else { @@ -3723,6 +3764,9 @@ func (this *SigningValidator) Equal(that interface{}) bool { if this.SignedLastBlock != that1.SignedLastBlock { return false } + if this.CommitRound != that1.CommitRound { + return false + } return true } func (this *PubKey) Equal(that interface{}) bool { @@ -5532,14 +5576,9 @@ func (m *LastCommitInfo) MarshalTo(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.CommitRound != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.CommitRound)) - } - if len(m.Validators) > 0 { - for _, msg := range m.Validators { - dAtA[i] = 0x12 + if len(m.CommitVotes) > 0 { + for _, msg := range m.CommitVotes { + dAtA[i] = 0xa i++ i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) n, err := msg.MarshalTo(dAtA[i:]) @@ -5743,7 +5782,30 @@ func (m *Validator) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) i += copy(dAtA[i:], m.Address) } - dAtA[i] = 0x12 + if m.Power != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintTypes(dAtA, i, uint64(m.Power)) + } + return i, nil +} + +func (m *ValidatorUpdate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorUpdate) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa i++ i = encodeVarintTypes(dAtA, i, uint64(m.PubKey.Size())) n38, err := m.PubKey.MarshalTo(dAtA[i:]) @@ -5752,14 +5814,14 @@ func (m *Validator) MarshalTo(dAtA []byte) (int, error) { } i += n38 if m.Power != 0 { - dAtA[i] = 0x18 + dAtA[i] = 0x10 i++ i = encodeVarintTypes(dAtA, i, uint64(m.Power)) } return i, nil } -func (m *SigningValidator) Marshal() (dAtA []byte, err error) { +func (m *VoteInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) @@ -5769,7 +5831,7 @@ func (m *SigningValidator) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SigningValidator) MarshalTo(dAtA []byte) (int, error) { +func (m *VoteInfo) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int @@ -5792,6 +5854,11 @@ func (m *SigningValidator) MarshalTo(dAtA []byte) (int, error) { } i++ } + if m.CommitRound != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintTypes(dAtA, i, uint64(m.CommitRound)) + } return i, nil } @@ -6013,9 +6080,9 @@ func NewPopulatedRequestInitChain(r randyTypes, easy bool) *RequestInitChain { } if r.Intn(10) != 0 { v2 := r.Intn(5) - this.Validators = make([]Validator, v2) + this.Validators = make([]ValidatorUpdate, v2) for i := 0; i < v2; i++ { - v3 := NewPopulatedValidator(r, easy) + v3 := NewPopulatedValidatorUpdate(r, easy) this.Validators[i] = *v3 } } @@ -6265,9 +6332,9 @@ func NewPopulatedResponseInitChain(r randyTypes, easy bool) *ResponseInitChain { } if r.Intn(10) != 0 { v14 := r.Intn(5) - this.Validators = make([]Validator, v14) + this.Validators = make([]ValidatorUpdate, v14) for i := 0; i < v14; i++ { - v15 := NewPopulatedValidator(r, easy) + v15 := NewPopulatedValidatorUpdate(r, easy) this.Validators[i] = *v15 } } @@ -6390,9 +6457,9 @@ func NewPopulatedResponseEndBlock(r randyTypes, easy bool) *ResponseEndBlock { this := &ResponseEndBlock{} if r.Intn(10) != 0 { v27 := r.Intn(5) - this.ValidatorUpdates = make([]Validator, v27) + this.ValidatorUpdates = make([]ValidatorUpdate, v27) for i := 0; i < v27; i++ { - v28 := NewPopulatedValidator(r, easy) + v28 := NewPopulatedValidatorUpdate(r, easy) this.ValidatorUpdates[i] = *v28 } } @@ -6487,16 +6554,12 @@ func NewPopulatedBlockGossip(r randyTypes, easy bool) *BlockGossip { func NewPopulatedLastCommitInfo(r randyTypes, easy bool) *LastCommitInfo { this := &LastCommitInfo{} - this.CommitRound = int32(r.Int31()) - if r.Intn(2) == 0 { - this.CommitRound *= -1 - } if r.Intn(10) != 0 { v32 := r.Intn(5) - this.Validators = make([]SigningValidator, v32) + this.CommitVotes = make([]VoteInfo, v32) for i := 0; i < v32; i++ { - v33 := NewPopulatedSigningValidator(r, easy) - this.Validators[i] = *v33 + v33 := NewPopulatedVoteInfo(r, easy) + this.CommitVotes[i] = *v33 } } if !easy && r.Intn(10) != 0 { @@ -6610,6 +6673,17 @@ func NewPopulatedValidator(r randyTypes, easy bool) *Validator { for i := 0; i < v48; i++ { this.Address[i] = byte(r.Intn(256)) } + this.Power = int64(r.Int63()) + if r.Intn(2) == 0 { + this.Power *= -1 + } + if !easy && r.Intn(10) != 0 { + } + return this +} + +func NewPopulatedValidatorUpdate(r randyTypes, easy bool) *ValidatorUpdate { + this := &ValidatorUpdate{} v49 := NewPopulatedPubKey(r, easy) this.PubKey = *v49 this.Power = int64(r.Int63()) @@ -6621,11 +6695,15 @@ func NewPopulatedValidator(r randyTypes, easy bool) *Validator { return this } -func NewPopulatedSigningValidator(r randyTypes, easy bool) *SigningValidator { - this := &SigningValidator{} +func NewPopulatedVoteInfo(r randyTypes, easy bool) *VoteInfo { + this := &VoteInfo{} v50 := NewPopulatedValidator(r, easy) this.Validator = *v50 this.SignedLastBlock = bool(bool(r.Intn(2) == 0)) + this.CommitRound = int64(r.Int63()) + if r.Intn(2) == 0 { + this.CommitRound *= -1 + } if !easy && r.Intn(10) != 0 { } return this @@ -7384,11 +7462,8 @@ func (m *BlockGossip) Size() (n int) { func (m *LastCommitInfo) Size() (n int) { var l int _ = l - if m.CommitRound != 0 { - n += 1 + sovTypes(uint64(m.CommitRound)) - } - if len(m.Validators) > 0 { - for _, e := range m.Validators { + if len(m.CommitVotes) > 0 { + for _, e := range m.CommitVotes { l = e.Size() n += 1 + l + sovTypes(uint64(l)) } @@ -7487,6 +7562,15 @@ func (m *Validator) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + if m.Power != 0 { + n += 1 + sovTypes(uint64(m.Power)) + } + return n +} + +func (m *ValidatorUpdate) Size() (n int) { + var l int + _ = l l = m.PubKey.Size() n += 1 + l + sovTypes(uint64(l)) if m.Power != 0 { @@ -7495,7 +7579,7 @@ func (m *Validator) Size() (n int) { return n } -func (m *SigningValidator) Size() (n int) { +func (m *VoteInfo) Size() (n int) { var l int _ = l l = m.Validator.Size() @@ -7503,6 +7587,9 @@ func (m *SigningValidator) Size() (n int) { if m.SignedLastBlock { n += 2 } + if m.CommitRound != 0 { + n += 1 + sovTypes(uint64(m.CommitRound)) + } return n } @@ -8418,7 +8505,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Validators = append(m.Validators, Validator{}) + m.Validators = append(m.Validators, ValidatorUpdate{}) if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -10092,7 +10179,7 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Validators = append(m.Validators, Validator{}) + m.Validators = append(m.Validators, ValidatorUpdate{}) if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -10966,7 +11053,7 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorUpdates = append(m.ValidatorUpdates, Validator{}) + m.ValidatorUpdates = append(m.ValidatorUpdates, ValidatorUpdate{}) if err := m.ValidatorUpdates[len(m.ValidatorUpdates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -11580,27 +11667,8 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CommitRound", wireType) - } - m.CommitRound = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CommitRound |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CommitVotes", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -11624,8 +11692,8 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Validators = append(m.Validators, SigningValidator{}) - if err := m.Validators[len(m.Validators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.CommitVotes = append(m.CommitVotes, VoteInfo{}) + if err := m.CommitVotes[len(m.CommitVotes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -12396,7 +12464,76 @@ func (m *Validator) Unmarshal(dAtA []byte) error { m.Address = []byte{} } iNdEx = postIndex - case 2: + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) + } + m.Power = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Power |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) } @@ -12426,7 +12563,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) } @@ -12466,7 +12603,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } return nil } -func (m *SigningValidator) Unmarshal(dAtA []byte) error { +func (m *VoteInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -12489,10 +12626,10 @@ func (m *SigningValidator) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: SigningValidator: wiretype end group for non-group") + return fmt.Errorf("proto: VoteInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: SigningValidator: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: VoteInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -12545,6 +12682,25 @@ func (m *SigningValidator) Unmarshal(dAtA []byte) error { } } m.SignedLastBlock = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CommitRound", wireType) + } + m.CommitRound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CommitRound |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -12962,137 +13118,138 @@ func init() { proto.RegisterFile("abci/types/types.proto", fileDescriptorTypes) func init() { golang_proto.RegisterFile("abci/types/types.proto", fileDescriptorTypes) } var fileDescriptorTypes = []byte{ - // 2109 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xdf, 0x6f, 0x23, 0x49, - 0xf1, 0xcf, 0x38, 0x8e, 0xed, 0x29, 0x3b, 0xb6, 0xb7, 0x37, 0x9b, 0x78, 0x7d, 0xdf, 0x6f, 0xb2, - 0x0c, 0xb0, 0x97, 0x70, 0xb9, 0xe4, 0xc8, 0xb1, 0xa7, 0xec, 0x1d, 0x77, 0x22, 0xce, 0x2e, 0x97, - 0xe8, 0x0e, 0x08, 0xb3, 0x7b, 0x8b, 0x84, 0x90, 0x46, 0x6d, 0x4f, 0x67, 0x3c, 0x5a, 0x7b, 0x66, - 0x6e, 0xa6, 0x9d, 0x73, 0xf6, 0x4f, 0x40, 0x27, 0xc4, 0x1b, 0xcf, 0xbc, 0xf1, 0x0f, 0x20, 0xf1, - 0xc8, 0x13, 0xba, 0x47, 0x84, 0x40, 0xbc, 0x2d, 0x90, 0x13, 0x2f, 0xfc, 0x05, 0x3c, 0xa2, 0xae, - 0xee, 0xf9, 0x99, 0xf1, 0x6a, 0x6f, 0x79, 0xe3, 0xc5, 0x9e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, 0xe3, 0xf3, 0x15, 0x68, 0x98, 0x2c, 0x0a, 0x84, 0x1b, 0x91, 0x43, 0xd0, 0xd9, - 0x7c, 0xc4, 0x64, 0x0a, 0xd5, 0x0a, 0x09, 0x4a, 0xf2, 0x3c, 0x8c, 0xe9, 0x22, 0x94, 0x13, 0x66, - 0xb2, 0x93, 0x4b, 0xff, 0x37, 0x8b, 0x42, 0xd9, 0xfc, 0xbf, 0x9b, 0xcf, 0xff, 0x6b, 0x05, 0xde, - 0x02, 0x00, 0xec, 0xe4, 0x00, 0xa0, 0xb8, 0x70, 0x0e, 0x01, 0xee, 0x97, 0x20, 0x40, 0xf1, 0xf8, - 0x0b, 0x20, 0xe0, 0x7e, 0x09, 0x04, 0xf4, 0xae, 0xed, 0x55, 0x8a, 0x01, 0xbb, 0x79, 0x0c, 0x28, - 0xaa, 0x53, 0x00, 0x81, 0xef, 0x96, 0x81, 0xc0, 0xed, 0x82, 0xcc, 0x42, 0x14, 0x78, 0xfb, 0x1a, - 0x0a, 0xac, 0x17, 0x44, 0x4b, 0x60, 0xe0, 0x7e, 0x2e, 0x3f, 0x43, 0xa9, 0x6e, 0xe5, 0x09, 0x9a, - 0xbc, 0x73, 0x1d, 0x41, 0x36, 0x8a, 0x57, 0x5b, 0x06, 0x21, 0xfb, 0x05, 0x08, 0xb9, 0x55, 0x3c, - 0x65, 0x01, 0x43, 0x52, 0x24, 0xd8, 0x11, 0x71, 0x5f, 0xf0, 0x34, 0x91, 0x23, 0x58, 0x18, 0xfa, - 0xa1, 0x4a, 0xd5, 0x72, 0x60, 0x6c, 0x8b, 0x4c, 0x94, 0xfa, 0xd7, 0x0b, 0x50, 0x03, 0x9d, 0x3e, - 0xe3, 0x5d, 0xc6, 0xaf, 0xb4, 0x54, 0x16, 0x23, 0x3a, 0x9b, 0xc5, 0x74, 0x95, 0xc5, 0x32, 0x60, - 0x52, 0xc9, 0x81, 0x09, 0xf9, 0x16, 0xdc, 0xc0, 0x34, 0x82, 0x76, 0x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 0x00, 0x00, + // 2126 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x5f, 0x73, 0x1b, 0x49, + 0x11, 0xf7, 0xca, 0xb2, 0xa4, 0x6d, 0xc9, 0x92, 0x33, 0xf9, 0xa7, 0xe8, 0xc0, 0x09, 0x0b, 0xe4, + 0x6c, 0xce, 0x67, 0x1f, 0x3e, 0x42, 0x39, 0x97, 0xe3, 0x0a, 0x2b, 0x09, 0x67, 0x73, 0x07, 0x98, + 0x4d, 0x62, 0xaa, 0x28, 0xaa, 0xb6, 0x46, 0xda, 0xb1, 0xb4, 0x15, 0x69, 0x77, 0x6f, 0x67, 0xe4, + 0x93, 0xf3, 0x19, 0xae, 0x8a, 0x7b, 0xa0, 0x8a, 0x67, 0xde, 0xf8, 0x02, 0x54, 0xf1, 0xc8, 0x13, + 0x75, 0x8f, 0x14, 0x05, 0xc5, 0x5b, 0x00, 0x53, 0x3c, 0xc0, 0x27, 0xe0, 0x91, 0x9a, 0x9e, 0xd9, + 0xbf, 0x5e, 0xa5, 0x92, 0xf0, 0xc6, 0x8b, 0xb4, 0x33, 0xdd, 0x3d, 0x33, 0xdd, 0xd3, 0xdd, 0xbf, + 0xee, 0x81, 0x6b, 0x74, 0x30, 0xf4, 0x76, 0xc4, 0x59, 0xc8, 0xb8, 0xfa, 0xdd, 0x0e, 0xa3, 0x40, + 0x04, 0x64, 0x05, 0x07, 0xbd, 0xb7, 0x47, 0x9e, 0x18, 0xcf, 0x06, 0xdb, 0xc3, 0x60, 0xba, 0x33, + 0x0a, 0x46, 0xc1, 0x0e, 0x52, 0x07, 0xb3, 0x13, 0x1c, 0xe1, 0x00, 0xbf, 0x94, 0x54, 0xef, 0xe6, + 0x28, 0x08, 0x46, 0x13, 0x96, 0x72, 0x09, 0x6f, 0xca, 0xb8, 0xa0, 0xd3, 0x50, 0x33, 0xec, 0x65, + 0xd6, 0x13,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, 0x47, 0x92, 0x3d, 0xa8, 0xc7, 0xf5, 0x6c, 0xf9, 0x7b, 0x65, 0x6f, 0x41, 0xeb, 0x2a, + 0xcd, 0xa3, 0x7a, 0x82, 0xb2, 0x47, 0xd5, 0x5e, 0x69, 0x7f, 0x4d, 0xee, 0x40, 0x4d, 0x17, 0x28, + 0xa5, 0x6f, 0x96, 0xbd, 0xf2, 0x06, 0x54, 0x2a, 0x99, 0x76, 0x45, 0x8b, 0x1e, 0x7e, 0x7b, 0x0b, + 0x1f, 0x02, 0xc8, 0x3e, 0x40, 0xa6, 0x0f, 0x58, 0xf8, 0xa2, 0xdb, 0x5b, 0xdc, 0xe0, 0x93, 0x7b, + 0xd0, 0x48, 0x1f, 0x6d, 0xca, 0xdf, 0x68, 0x7b, 0x8b, 0x7a, 0xee, 0xfe, 0x97, 0xfe, 0xf3, 0xf7, + 0x75, 0xe3, 0xd7, 0xe7, 0xeb, 0xc6, 0x6f, 0xcf, 0xd7, 0x8d, 0x2f, 0xce, 0xd7, 0x8d, 0x3f, 0x9c, + 0xaf, 0x1b, 0x7f, 0x3b, 0x5f, 0x37, 0x7e, 0xf7, 0x8f, 0x75, 0x63, 0x50, 0x43, 0xf7, 0x7f, 0xf7, + 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x30, 0x52, 0xb5, 0x7b, 0x56, 0x18, 0x00, 0x00, } diff --git a/abci/types/types.proto b/abci/types/types.proto index fcec88884..a2eb65eb7 100644 --- a/abci/types/types.proto +++ b/abci/types/types.proto @@ -60,7 +60,7 @@ message RequestInitChain { google.protobuf.Timestamp time = 1 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; string chain_id = 2; ConsensusParams consensus_params = 3; - repeated Validator validators = 4 [(gogoproto.nullable)=false]; + repeated ValidatorUpdate validators = 4 [(gogoproto.nullable)=false]; bytes app_state_bytes = 5; } @@ -143,7 +143,7 @@ message ResponseSetOption { message ResponseInitChain { ConsensusParams consensus_params = 1; - repeated Validator validators = 2 [(gogoproto.nullable)=false]; + repeated ValidatorUpdate validators = 2 [(gogoproto.nullable)=false]; } message ResponseQuery { @@ -183,7 +183,7 @@ message ResponseDeliverTx { } message ResponseEndBlock { - repeated Validator validator_updates = 1 [(gogoproto.nullable)=false]; + repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable)=false]; ConsensusParams consensus_param_updates = 2; repeated common.KVPair tags = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"]; } @@ -225,8 +225,7 @@ message BlockGossip { } message LastCommitInfo { - int32 commit_round = 1; - repeated SigningValidator validators = 2 [(gogoproto.nullable)=false]; + repeated VoteInfo commit_votes = 1 [(gogoproto.nullable)=false]; } //---------------------------------------- @@ -272,14 +271,20 @@ message PartSetHeader { // Validator message Validator { bytes address = 1; - PubKey pub_key = 2 [(gogoproto.nullable)=false]; int64 power = 3; } -// Validator with an extra bool -message SigningValidator { +// ValidatorUpdate +message ValidatorUpdate { + PubKey pub_key = 1 [(gogoproto.nullable)=false]; + int64 power = 2; +} + +// VoteInfo +message VoteInfo { Validator validator = 1 [(gogoproto.nullable)=false]; bool signed_last_block = 2; + int64 commit_round = 3; } message PubKey { diff --git a/abci/types/typespb_test.go b/abci/types/typespb_test.go index cdff9c728..de094ed48 100644 --- a/abci/types/typespb_test.go +++ b/abci/types/typespb_test.go @@ -42,7 +42,8 @@ It has these top-level messages: BlockID PartSetHeader Validator - SigningValidator + ValidatorUpdate + VoteInfo PubKey Evidence */ @@ -1970,15 +1971,15 @@ func TestValidatorMarshalTo(t *testing.T) { } } -func TestSigningValidatorProto(t *testing.T) { +func TestValidatorUpdateProto(t *testing.T) { seed := time.Now().UnixNano() popr := rand.New(rand.NewSource(seed)) - p := NewPopulatedSigningValidator(popr, false) + p := NewPopulatedValidatorUpdate(popr, false) dAtA, err := proto.Marshal(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } - msg := &SigningValidator{} + msg := &ValidatorUpdate{} if err := proto.Unmarshal(dAtA, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } @@ -2001,10 +2002,10 @@ func TestSigningValidatorProto(t *testing.T) { } } -func TestSigningValidatorMarshalTo(t *testing.T) { +func TestValidatorUpdateMarshalTo(t *testing.T) { seed := time.Now().UnixNano() popr := rand.New(rand.NewSource(seed)) - p := NewPopulatedSigningValidator(popr, false) + p := NewPopulatedValidatorUpdate(popr, false) size := p.Size() dAtA := make([]byte, size) for i := range dAtA { @@ -2014,7 +2015,63 @@ func TestSigningValidatorMarshalTo(t *testing.T) { if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } - msg := &SigningValidator{} + msg := &ValidatorUpdate{} + if err := proto.Unmarshal(dAtA, msg); err != nil { + t.Fatalf("seed = %d, err = %v", seed, err) + } + for i := range dAtA { + dAtA[i] = byte(popr.Intn(256)) + } + if !p.Equal(msg) { + t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) + } +} + +func TestVoteInfoProto(t *testing.T) { + seed := time.Now().UnixNano() + popr := rand.New(rand.NewSource(seed)) + p := NewPopulatedVoteInfo(popr, false) + dAtA, err := proto.Marshal(p) + if err != nil { + t.Fatalf("seed = %d, err = %v", seed, err) + } + msg := &VoteInfo{} + if err := proto.Unmarshal(dAtA, msg); err != nil { + t.Fatalf("seed = %d, err = %v", seed, err) + } + littlefuzz := make([]byte, len(dAtA)) + copy(littlefuzz, dAtA) + for i := range dAtA { + dAtA[i] = byte(popr.Intn(256)) + } + if !p.Equal(msg) { + t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) + } + if len(littlefuzz) > 0 { + fuzzamount := 100 + for i := 0; i < fuzzamount; i++ { + littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) + littlefuzz = append(littlefuzz, byte(popr.Intn(256))) + } + // shouldn't panic + _ = proto.Unmarshal(littlefuzz, msg) + } +} + +func TestVoteInfoMarshalTo(t *testing.T) { + seed := time.Now().UnixNano() + popr := rand.New(rand.NewSource(seed)) + p := NewPopulatedVoteInfo(popr, false) + size := p.Size() + dAtA := make([]byte, size) + for i := range dAtA { + dAtA[i] = byte(popr.Intn(256)) + } + _, err := p.MarshalTo(dAtA) + if err != nil { + t.Fatalf("seed = %d, err = %v", seed, err) + } + msg := &VoteInfo{} if err := proto.Unmarshal(dAtA, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } @@ -2750,16 +2807,34 @@ func TestValidatorJSON(t *testing.T) { t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) } } -func TestSigningValidatorJSON(t *testing.T) { +func TestValidatorUpdateJSON(t *testing.T) { seed := time.Now().UnixNano() popr := rand.New(rand.NewSource(seed)) - p := NewPopulatedSigningValidator(popr, true) + p := NewPopulatedValidatorUpdate(popr, true) marshaler := jsonpb.Marshaler{} jsondata, err := marshaler.MarshalToString(p) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } - msg := &SigningValidator{} + msg := &ValidatorUpdate{} + err = jsonpb.UnmarshalString(jsondata, msg) + if err != nil { + t.Fatalf("seed = %d, err = %v", seed, err) + } + if !p.Equal(msg) { + t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) + } +} +func TestVoteInfoJSON(t *testing.T) { + seed := time.Now().UnixNano() + popr := rand.New(rand.NewSource(seed)) + p := NewPopulatedVoteInfo(popr, true) + marshaler := jsonpb.Marshaler{} + jsondata, err := marshaler.MarshalToString(p) + if err != nil { + t.Fatalf("seed = %d, err = %v", seed, err) + } + msg := &VoteInfo{} err = jsonpb.UnmarshalString(jsondata, msg) if err != nil { t.Fatalf("seed = %d, err = %v", seed, err) @@ -3756,12 +3831,12 @@ func TestValidatorProtoCompactText(t *testing.T) { } } -func TestSigningValidatorProtoText(t *testing.T) { +func TestValidatorUpdateProtoText(t *testing.T) { seed := time.Now().UnixNano() popr := rand.New(rand.NewSource(seed)) - p := NewPopulatedSigningValidator(popr, true) + p := NewPopulatedValidatorUpdate(popr, true) dAtA := proto.MarshalTextString(p) - msg := &SigningValidator{} + msg := &ValidatorUpdate{} if err := proto.UnmarshalText(dAtA, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } @@ -3770,12 +3845,40 @@ func TestSigningValidatorProtoText(t *testing.T) { } } -func TestSigningValidatorProtoCompactText(t *testing.T) { +func TestValidatorUpdateProtoCompactText(t *testing.T) { seed := time.Now().UnixNano() popr := rand.New(rand.NewSource(seed)) - p := NewPopulatedSigningValidator(popr, true) + p := NewPopulatedValidatorUpdate(popr, true) dAtA := proto.CompactTextString(p) - msg := &SigningValidator{} + msg := &ValidatorUpdate{} + if err := proto.UnmarshalText(dAtA, msg); err != nil { + t.Fatalf("seed = %d, err = %v", seed, err) + } + if !p.Equal(msg) { + t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) + } +} + +func TestVoteInfoProtoText(t *testing.T) { + seed := time.Now().UnixNano() + popr := rand.New(rand.NewSource(seed)) + p := NewPopulatedVoteInfo(popr, true) + dAtA := proto.MarshalTextString(p) + msg := &VoteInfo{} + if err := proto.UnmarshalText(dAtA, msg); err != nil { + t.Fatalf("seed = %d, err = %v", seed, err) + } + if !p.Equal(msg) { + t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) + } +} + +func TestVoteInfoProtoCompactText(t *testing.T) { + seed := time.Now().UnixNano() + popr := rand.New(rand.NewSource(seed)) + p := NewPopulatedVoteInfo(popr, true) + dAtA := proto.CompactTextString(p) + msg := &VoteInfo{} if err := proto.UnmarshalText(dAtA, msg); err != nil { t.Fatalf("seed = %d, err = %v", seed, err) } @@ -4588,10 +4691,32 @@ func TestValidatorSize(t *testing.T) { } } -func TestSigningValidatorSize(t *testing.T) { +func TestValidatorUpdateSize(t *testing.T) { + seed := time.Now().UnixNano() + popr := rand.New(rand.NewSource(seed)) + p := NewPopulatedValidatorUpdate(popr, true) + size2 := proto.Size(p) + dAtA, err := proto.Marshal(p) + if err != nil { + t.Fatalf("seed = %d, err = %v", seed, err) + } + size := p.Size() + if len(dAtA) != size { + t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) + } + if size2 != size { + t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) + } + size3 := proto.Size(p) + if size3 != size { + t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) + } +} + +func TestVoteInfoSize(t *testing.T) { seed := time.Now().UnixNano() popr := rand.New(rand.NewSource(seed)) - p := NewPopulatedSigningValidator(popr, true) + p := NewPopulatedVoteInfo(popr, true) size2 := proto.Size(p) dAtA, err := proto.Marshal(p) if err != nil { diff --git a/abci/types/util.go b/abci/types/util.go index 458024c58..3cde88232 100644 --- a/abci/types/util.go +++ b/abci/types/util.go @@ -2,58 +2,33 @@ package types import ( "bytes" - "encoding/json" "sort" - - cmn "github.com/tendermint/tendermint/libs/common" ) //------------------------------------------------------------------------------ -// Validators is a list of validators that implements the Sort interface -type Validators []Validator +// ValidatorUpdates is a list of validators that implements the Sort interface +type ValidatorUpdates []ValidatorUpdate -var _ sort.Interface = (Validators)(nil) +var _ sort.Interface = (ValidatorUpdates)(nil) -// All these methods for Validators: +// All these methods for ValidatorUpdates: // Len, Less and Swap -// are for Validators to implement sort.Interface +// are for ValidatorUpdates to implement sort.Interface // which will be used by the sort package. // See Issue https://github.com/tendermint/abci/issues/212 -func (v Validators) Len() int { +func (v ValidatorUpdates) Len() int { return len(v) } // XXX: doesn't distinguish same validator with different power -func (v Validators) Less(i, j int) bool { +func (v ValidatorUpdates) Less(i, j int) bool { return bytes.Compare(v[i].PubKey.Data, v[j].PubKey.Data) <= 0 } -func (v Validators) Swap(i, j int) { +func (v ValidatorUpdates) Swap(i, j int) { v1 := v[i] v[i] = v[j] v[j] = v1 } - -func ValidatorsString(vs Validators) string { - s := make([]validatorPretty, len(vs)) - for i, v := range vs { - s[i] = validatorPretty{ - Address: v.Address, - PubKey: v.PubKey.Data, - Power: v.Power, - } - } - b, err := json.Marshal(s) - if err != nil { - panic(err.Error()) - } - return string(b) -} - -type validatorPretty struct { - Address cmn.HexBytes `json:"address"` - PubKey []byte `json:"pub_key"` - Power int64 `json:"power"` -} diff --git a/consensus/common_test.go b/consensus/common_test.go index 818946184..dc055959b 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -354,7 +354,7 @@ func randConsensusNet(nValidators int, testName string, tickerFunc func() Timeou } ensureDir(path.Dir(thisConfig.Consensus.WalFile()), 0700) // dir for wal app := appFunc() - vals := types.TM2PB.Validators(state.Validators) + vals := types.TM2PB.ValidatorUpdates(state.Validators) app.InitChain(abci.RequestInitChain{Validators: vals}) css[i] = newConsensusStateWithConfig(thisConfig, state, privVals[i], app) @@ -386,7 +386,7 @@ func randConsensusNetWithPeers(nValidators, nPeers int, testName string, tickerF } app := appFunc() - vals := types.TM2PB.Validators(state.Validators) + vals := types.TM2PB.ValidatorUpdates(state.Validators) app.InitChain(abci.RequestInitChain{Validators: vals}) css[i] = newConsensusStateWithConfig(thisConfig, state, privVal, app) diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index 35502fb1c..4a6d4b9dc 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -118,7 +118,7 @@ func TestReactorWithEvidence(t *testing.T) { thisConfig := ResetConfig(fmt.Sprintf("%s_%d", testName, i)) ensureDir(path.Dir(thisConfig.Consensus.WalFile()), 0700) // dir for wal app := appFunc() - vals := types.TM2PB.Validators(state.Validators) + vals := types.TM2PB.ValidatorUpdates(state.Validators) app.InitChain(abci.RequestInitChain{Validators: vals}) pv := privVals[i] diff --git a/consensus/replay.go b/consensus/replay.go index cff8344be..c92654f2c 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -266,7 +266,7 @@ func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight // If appBlockHeight == 0 it means that we are at genesis and hence should send InitChain. if appBlockHeight == 0 { - nextVals := types.TM2PB.Validators(state.NextValidators) // state.Validators would work too. + nextVals := types.TM2PB.ValidatorUpdates(state.NextValidators) // state.Validators would work too. csParams := types.TM2PB.ConsensusParams(h.genDoc.ConsensusParams) req := abci.RequestInitChain{ Time: h.genDoc.GenesisTime, @@ -282,7 +282,7 @@ func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight // If the app returned validators or consensus params, update the state. if len(res.Validators) > 0 { - vals, err := types.PB2TM.Validators(res.Validators) + vals, err := types.PB2TM.ValidatorUpdates(res.Validators) if err != nil { return nil, err } diff --git a/consensus/replay_test.go b/consensus/replay_test.go index c74a1ae9d..8ea71d353 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -416,7 +416,7 @@ func buildAppStateFromChain(proxyApp proxy.AppConns, stateDB dbm.DB, } defer proxyApp.Stop() - validators := types.TM2PB.Validators(state.Validators) + validators := types.TM2PB.ValidatorUpdates(state.Validators) if _, err := proxyApp.Consensus().InitChainSync(abci.RequestInitChain{ Validators: validators, }); err != nil { @@ -453,7 +453,7 @@ func buildTMStateFromChain(config *cfg.Config, stateDB dbm.DB, state sm.State, c } defer proxyApp.Stop() - validators := types.TM2PB.Validators(state.Validators) + validators := types.TM2PB.ValidatorUpdates(state.Validators) if _, err := proxyApp.Consensus().InitChainSync(abci.RequestInitChain{ Validators: validators, }); err != nil { @@ -639,7 +639,7 @@ func (bs *mockBlockStore) LoadSeenCommit(height int64) *types.Commit { func TestInitChainUpdateValidators(t *testing.T) { val, _ := types.RandValidator(true, 10) vals := types.NewValidatorSet([]*types.Validator{val}) - app := &initChainApp{vals: types.TM2PB.Validators(vals)} + app := &initChainApp{vals: types.TM2PB.ValidatorUpdates(vals)} clientCreator := proxy.NewLocalClientCreator(app) config := ResetConfig("proxy_test_") @@ -666,7 +666,7 @@ func TestInitChainUpdateValidators(t *testing.T) { assert.Equal(t, newValAddr, expectValAddr) } -func newInitChainApp(vals []abci.Validator) *initChainApp { +func newInitChainApp(vals []abci.ValidatorUpdate) *initChainApp { return &initChainApp{ vals: vals, } @@ -675,7 +675,7 @@ func newInitChainApp(vals []abci.Validator) *initChainApp { // returns the vals on InitChain type initChainApp struct { abci.BaseApplication - vals []abci.Validator + vals []abci.ValidatorUpdate } func (ica *initChainApp) InitChain(req abci.RequestInitChain) abci.ResponseInitChain { diff --git a/state/execution.go b/state/execution.go index 7e7bc37a7..71b3ec1c1 100644 --- a/state/execution.go +++ b/state/execution.go @@ -184,15 +184,14 @@ func execBlockOnProxyApp(logger log.Logger, proxyAppConn proxy.AppConnConsensus, } proxyAppConn.SetResponseCallback(proxyCb) - signVals, byzVals := getBeginBlockValidatorInfo(block, lastValSet, stateDB) + voteInfos, byzVals := getBeginBlockValidatorInfo(block, lastValSet, stateDB) // Begin block. _, err := proxyAppConn.BeginBlockSync(abci.RequestBeginBlock{ Hash: block.Hash(), Header: types.TM2PB.Header(&block.Header), LastCommitInfo: abci.LastCommitInfo{ - CommitRound: int32(block.LastCommit.Round()), - Validators: signVals, + CommitVotes: voteInfos, }, ByzantineValidators: byzVals, }) @@ -218,15 +217,15 @@ func execBlockOnProxyApp(logger log.Logger, proxyAppConn proxy.AppConnConsensus, logger.Info("Executed block", "height", block.Height, "validTxs", validTxs, "invalidTxs", invalidTxs) - valUpdates := abciResponses.EndBlock.ValidatorUpdates - if len(valUpdates) > 0 { - logger.Info("Updates to validators", "updates", abci.ValidatorsString(valUpdates)) + if len(abciResponses.EndBlock.ValidatorUpdates) > 0 { + // TODO: cleanup the formatting + logger.Info("Updates to validators", "updates", abciResponses.EndBlock.ValidatorUpdates) } return abciResponses, nil } -func getBeginBlockValidatorInfo(block *types.Block, lastValSet *types.ValidatorSet, stateDB dbm.DB) ([]abci.SigningValidator, []abci.Evidence) { +func getBeginBlockValidatorInfo(block *types.Block, lastValSet *types.ValidatorSet, stateDB dbm.DB) ([]abci.VoteInfo, []abci.Evidence) { // Sanity check that commit length matches validator set size - // only applies after first block @@ -241,17 +240,22 @@ func getBeginBlockValidatorInfo(block *types.Block, lastValSet *types.ValidatorS } // determine which validators did not sign last block. - signVals := make([]abci.SigningValidator, len(lastValSet.Validators)) + voteInfos := make([]abci.VoteInfo, len(lastValSet.Validators)) for i, val := range lastValSet.Validators { var vote *types.Vote + var commitRound = -1 if i < len(block.LastCommit.Precommits) { vote = block.LastCommit.Precommits[i] + if vote != nil { + commitRound = vote.Round + } } - val := abci.SigningValidator{ - Validator: types.TM2PB.ValidatorWithoutPubKey(val), - SignedLastBlock: vote != nil, + voteInfo := abci.VoteInfo{ + Validator: types.TM2PB.Validator(val), + SignedLastBlock: vote != nil, // XXX: should we replace with commitRound == -1 ? + CommitRound: int64(commitRound), //XXX: why is round an int? } - signVals[i] = val + voteInfos[i] = voteInfo } byzVals := make([]abci.Evidence, len(block.Evidence.Evidence)) @@ -266,15 +270,15 @@ func getBeginBlockValidatorInfo(block *types.Block, lastValSet *types.ValidatorS byzVals[i] = types.TM2PB.Evidence(ev, valset, block.Time) } - return signVals, byzVals + return voteInfos, byzVals } // If more or equal than 1/3 of total voting power changed in one block, then // a light client could never prove the transition externally. See // ./lite/doc.go for details on how a light client tracks validators. -func updateValidators(currentSet *types.ValidatorSet, abciUpdates []abci.Validator) error { - updates, err := types.PB2TM.Validators(abciUpdates) +func updateValidators(currentSet *types.ValidatorSet, abciUpdates []abci.ValidatorUpdate) error { + updates, err := types.PB2TM.ValidatorUpdates(abciUpdates) if err != nil { return err } diff --git a/state/execution_test.go b/state/execution_test.go index 161b96f23..52baadf3f 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -86,7 +86,7 @@ func TestBeginBlockValidators(t *testing.T) { // -> app receives a list of validators with a bool indicating if they signed ctr := 0 - for i, v := range app.Validators { + for i, v := range app.CommitVotes { if ctr < len(tc.expectedAbsentValidators) && tc.expectedAbsentValidators[ctr] == i { @@ -160,7 +160,7 @@ func TestUpdateValidators(t *testing.T) { name string currentSet *types.ValidatorSet - abciUpdates []abci.Validator + abciUpdates []abci.ValidatorUpdate resultingSet *types.ValidatorSet shouldErr bool @@ -169,7 +169,7 @@ func TestUpdateValidators(t *testing.T) { "adding a validator is OK", types.NewValidatorSet([]*types.Validator{val1}), - []abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey2), Power: 20}}, + []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: 20}}, types.NewValidatorSet([]*types.Validator{val1, val2}), false, @@ -178,7 +178,7 @@ func TestUpdateValidators(t *testing.T) { "updating a validator is OK", types.NewValidatorSet([]*types.Validator{val1}), - []abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey1), Power: 20}}, + []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey1), Power: 20}}, types.NewValidatorSet([]*types.Validator{types.NewValidator(pubkey1, 20)}), false, @@ -187,7 +187,7 @@ func TestUpdateValidators(t *testing.T) { "removing a validator is OK", types.NewValidatorSet([]*types.Validator{val1, val2}), - []abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey2), Power: 0}}, + []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: 0}}, types.NewValidatorSet([]*types.Validator{val1}), false, @@ -197,7 +197,7 @@ func TestUpdateValidators(t *testing.T) { "removing a non-existing validator results in error", types.NewValidatorSet([]*types.Validator{val1}), - []abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey2), Power: 0}}, + []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: 0}}, types.NewValidatorSet([]*types.Validator{val1}), true, @@ -207,7 +207,7 @@ func TestUpdateValidators(t *testing.T) { "adding a validator with negative power results in error", types.NewValidatorSet([]*types.Validator{val1}), - []abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey2), Power: -100}}, + []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: -100}}, types.NewValidatorSet([]*types.Validator{val1}), true, @@ -335,7 +335,7 @@ func makeBlock(state State, height int64) *types.Block { type testApp struct { abci.BaseApplication - Validators []abci.SigningValidator + CommitVotes []abci.VoteInfo ByzantineValidators []abci.Evidence ValidatorUpdates []abci.Validator } @@ -347,7 +347,7 @@ func (app *testApp) Info(req abci.RequestInfo) (resInfo abci.ResponseInfo) { } func (app *testApp) BeginBlock(req abci.RequestBeginBlock) abci.ResponseBeginBlock { - app.Validators = req.LastCommitInfo.Validators + app.CommitVotes = req.LastCommitInfo.CommitVotes app.ByzantineValidators = req.ByzantineValidators return abci.ResponseBeginBlock{} } diff --git a/state/state_test.go b/state/state_test.go index 211d5fdc9..d8a8c0b82 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -78,8 +78,8 @@ func TestABCIResponsesSaveLoad1(t *testing.T) { abciResponses := NewABCIResponses(block) abciResponses.DeliverTx[0] = &abci.ResponseDeliverTx{Data: []byte("foo"), Tags: nil} abciResponses.DeliverTx[1] = &abci.ResponseDeliverTx{Data: []byte("bar"), Log: "ok", Tags: nil} - abciResponses.EndBlock = &abci.ResponseEndBlock{ValidatorUpdates: []abci.Validator{ - types.TM2PB.ValidatorFromPubKeyAndPower(ed25519.GenPrivKey().PubKey(), 10), + abciResponses.EndBlock = &abci.ResponseEndBlock{ValidatorUpdates: []abci.ValidatorUpdate{ + types.TM2PB.NewValidatorUpdate(ed25519.GenPrivKey().PubKey(), 10), }} saveABCIResponses(stateDB, block.Height, abciResponses) @@ -454,9 +454,9 @@ func makeHeaderPartsResponsesValPubKeyChange(state State, height int64, _, val := state.NextValidators.GetByIndex(0) if !bytes.Equal(pubkey.Bytes(), val.PubKey.Bytes()) { abciResponses.EndBlock = &abci.ResponseEndBlock{ - ValidatorUpdates: []abci.Validator{ - types.TM2PB.ValidatorFromPubKeyAndPower(val.PubKey, 0), - types.TM2PB.ValidatorFromPubKeyAndPower(pubkey, 10), + ValidatorUpdates: []abci.ValidatorUpdate{ + types.TM2PB.NewValidatorUpdate(val.PubKey, 0), + types.TM2PB.NewValidatorUpdate(pubkey, 10), }, } } @@ -476,8 +476,8 @@ func makeHeaderPartsResponsesValPowerChange(state State, height int64, _, val := state.NextValidators.GetByIndex(0) if val.VotingPower != power { abciResponses.EndBlock = &abci.ResponseEndBlock{ - ValidatorUpdates: []abci.Validator{ - types.TM2PB.ValidatorFromPubKeyAndPower(val.PubKey, power), + ValidatorUpdates: []abci.ValidatorUpdate{ + types.TM2PB.NewValidatorUpdate(val.PubKey, power), }, } } diff --git a/types/protobuf.go b/types/protobuf.go index 1681dd376..1363430b0 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "fmt" "reflect" "time" @@ -56,7 +55,7 @@ func (tm2pb) Header(header *Header) abci.Header { } } -func (tm2pb) ValidatorWithoutPubKey(val *Validator) abci.Validator { +func (tm2pb) Validator(val *Validator) abci.Validator { return abci.Validator{ Address: val.PubKey.Address(), Power: val.VotingPower, @@ -78,11 +77,10 @@ func (tm2pb) PartSetHeader(header PartSetHeader) abci.PartSetHeader { } // XXX: panics on unknown pubkey type -func (tm2pb) Validator(val *Validator) abci.Validator { - return abci.Validator{ - Address: val.PubKey.Address(), - PubKey: TM2PB.PubKey(val.PubKey), - Power: val.VotingPower, +func (tm2pb) ValidatorUpdate(val *Validator) abci.ValidatorUpdate { + return abci.ValidatorUpdate{ + PubKey: TM2PB.PubKey(val.PubKey), + Power: val.VotingPower, } } @@ -106,10 +104,10 @@ func (tm2pb) PubKey(pubKey crypto.PubKey) abci.PubKey { } // XXX: panics on nil or unknown pubkey type -func (tm2pb) Validators(vals *ValidatorSet) []abci.Validator { - validators := make([]abci.Validator, vals.Size()) +func (tm2pb) ValidatorUpdates(vals *ValidatorSet) []abci.ValidatorUpdate { + validators := make([]abci.ValidatorUpdate, vals.Size()) for i, val := range vals.Validators { - validators[i] = TM2PB.Validator(val) + validators[i] = TM2PB.ValidatorUpdate(val) } return validators } @@ -156,7 +154,7 @@ func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci. return abci.Evidence{ Type: evType, - Validator: TM2PB.ValidatorWithoutPubKey(val), + Validator: TM2PB.Validator(val), Height: ev.Height(), Time: evTime, TotalVotingPower: valSet.TotalVotingPower(), @@ -164,12 +162,11 @@ func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci. } // XXX: panics on nil or unknown pubkey type -func (tm2pb) ValidatorFromPubKeyAndPower(pubkey crypto.PubKey, power int64) abci.Validator { +func (tm2pb) NewValidatorUpdate(pubkey crypto.PubKey, power int64) abci.ValidatorUpdate { pubkeyABCI := TM2PB.PubKey(pubkey) - return abci.Validator{ - Address: pubkey.Address(), - PubKey: pubkeyABCI, - Power: power, + return abci.ValidatorUpdate{ + PubKey: pubkeyABCI, + Power: power, } } @@ -205,7 +202,7 @@ func (pb2tm) PubKey(pubKey abci.PubKey) (crypto.PubKey, error) { } } -func (pb2tm) Validators(vals []abci.Validator) ([]*Validator, error) { +func (pb2tm) ValidatorUpdates(vals []abci.ValidatorUpdate) ([]*Validator, error) { tmVals := make([]*Validator, len(vals)) for i, v := range vals { pub, err := PB2TM.PubKey(v.PubKey) @@ -214,17 +211,13 @@ func (pb2tm) Validators(vals []abci.Validator) ([]*Validator, error) { } // If the app provided an address too, it must match. // This is just a sanity check. - if len(v.Address) > 0 { + /*if len(v.Address) > 0 { if !bytes.Equal(pub.Address(), v.Address) { return nil, fmt.Errorf("Validator.Address (%X) does not match PubKey.Address (%X)", v.Address, pub.Address()) } - } - tmVals[i] = &Validator{ - Address: pub.Address(), - PubKey: pub, - VotingPower: v.Power, - } + }*/ + tmVals[i] = NewValidator(pub, v.Power) } return tmVals, nil } diff --git a/types/protobuf_test.go b/types/protobuf_test.go index caad5c8f9..22bed60fa 100644 --- a/types/protobuf_test.go +++ b/types/protobuf_test.go @@ -41,26 +41,26 @@ func TestABCIValidators(t *testing.T) { VotingPower: 10, } - abciVal := TM2PB.Validator(tmVal) - tmVals, err := PB2TM.Validators([]abci.Validator{abciVal}) + abciVal := TM2PB.ValidatorUpdate(tmVal) + tmVals, err := PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) assert.Nil(t, err) assert.Equal(t, tmValExpected, tmVals[0]) - abciVals := TM2PB.Validators(NewValidatorSet(tmVals)) - assert.Equal(t, []abci.Validator{abciVal}, abciVals) + abciVals := TM2PB.ValidatorUpdates(NewValidatorSet(tmVals)) + assert.Equal(t, []abci.ValidatorUpdate{abciVal}, abciVals) // val with address tmVal.Address = pkEd.Address() - abciVal = TM2PB.Validator(tmVal) - tmVals, err = PB2TM.Validators([]abci.Validator{abciVal}) + abciVal = TM2PB.ValidatorUpdate(tmVal) + tmVals, err = PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) assert.Nil(t, err) assert.Equal(t, tmValExpected, tmVals[0]) - // val with incorrect address - abciVal = TM2PB.Validator(tmVal) - abciVal.Address = []byte("incorrect!") - tmVals, err = PB2TM.Validators([]abci.Validator{abciVal}) + // val with incorrect pubkey daya + abciVal = TM2PB.ValidatorUpdate(tmVal) + abciVal.PubKey.Data = []byte("incorrect!") + tmVals, err = PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) assert.NotNil(t, err) assert.Nil(t, tmVals) } @@ -104,9 +104,6 @@ func TestABCIEvidence(t *testing.T) { ) assert.Equal(t, "duplicate/vote", abciEv.Type) - - // test we do not send pubkeys - assert.Empty(t, abciEv.Validator.PubKey) } type pubKeyEddie struct{} @@ -119,17 +116,17 @@ func (pubKeyEddie) Equals(crypto.PubKey) bool { return false } func TestABCIValidatorFromPubKeyAndPower(t *testing.T) { pubkey := ed25519.GenPrivKey().PubKey() - abciVal := TM2PB.ValidatorFromPubKeyAndPower(pubkey, 10) + abciVal := TM2PB.NewValidatorUpdate(pubkey, 10) assert.Equal(t, int64(10), abciVal.Power) - assert.Panics(t, func() { TM2PB.ValidatorFromPubKeyAndPower(nil, 10) }) - assert.Panics(t, func() { TM2PB.ValidatorFromPubKeyAndPower(pubKeyEddie{}, 10) }) + assert.Panics(t, func() { TM2PB.NewValidatorUpdate(nil, 10) }) + assert.Panics(t, func() { TM2PB.NewValidatorUpdate(pubKeyEddie{}, 10) }) } func TestABCIValidatorWithoutPubKey(t *testing.T) { pkEd := ed25519.GenPrivKey().PubKey() - abciVal := TM2PB.ValidatorWithoutPubKey(&Validator{ + abciVal := TM2PB.Validator(&Validator{ Address: pkEd.Address(), PubKey: pkEd, VotingPower: 10,