Old PrepareProposal and vote extension integration on feature/abci++ppp (#9117)

* abci: PrepareProposal-VoteExtension integration [2nd try] (#7821)

* PrepareProposal-VoteExtension integration (#6915)

* make proto-gen

* Fix protobuf crash in e2e nightly tests

* Update types/vote.go

Co-authored-by: M. J. Fromberger <fromberger@interchain.io>

* Addressed @creachadair's comments

Co-authored-by: mconcat <monoidconcat@gmail.com>
Co-authored-by: M. J. Fromberger <fromberger@interchain.io>

* Proto changes

* make proto-gen

* Fixed UTs

* bump

* lint

* lint2

* lint3

* lint4

* lint5

* lint6

* no_lint

Co-authored-by: mconcat <monoidconcat@gmail.com>
Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
This commit is contained in:
Sergio Mena
2022-08-03 13:29:15 +02:00
committed by GitHub
parent 61619ab072
commit 2164883501
42 changed files with 378 additions and 275 deletions

View File

@@ -509,7 +509,8 @@ func (h *Header) StringIndented(indent string) string {
indent, h.LastResultsHash,
indent, h.EvidenceHash,
indent, h.ProposerAddress,
indent, h.Hash())
indent, h.Hash(),
)
}
// ToProto converts Header to protobuf

View File

@@ -220,6 +220,22 @@ func (vote *Vote) ToProto() *tmproto.Vote {
}
}
func VotesToProto(votes []*Vote) []*tmproto.Vote {
if votes == nil {
return nil
}
res := make([]*tmproto.Vote, 0, len(votes))
for _, vote := range votes {
v := vote.ToProto()
// protobuf crashes when serializing "repeated" fields with nil elements
if v != nil {
res = append(res, v)
}
}
return res
}
// FromProto converts a proto generetad type to a handwritten type
// return type, nil if everything converts safely, otherwise nil, error
func VoteFromProto(pv *tmproto.Vote) (*Vote, error) {

View File

@@ -226,6 +226,10 @@ func (voteSet *VoteSet) getVote(valIndex int32, blockKey string) (vote *Vote, ok
return nil, false
}
func (voteSet *VoteSet) GetVotes() []*Vote {
return voteSet.votes
}
// Assumes signature is valid.
// If conflicting vote exists, returns it.
func (voteSet *VoteSet) addVerifiedVote(