Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abci: Vote Extension 2 #35

Open
wants to merge 31 commits into
base: mconcat/abci-vote-extension
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5d982c4
add extension signing
mconcat Jul 10, 2021
08c4f89
modify state execution in progress
mconcat Jul 9, 2021
306296a
add extension signing
mconcat Jul 10, 2021
dbb2c71
verify in progress
mconcat Jul 15, 2021
059eafa
Merge branch 'mconcat/abci-vote-extension-2' of mconcat.github.com:si…
mconcat Jul 15, 2021
d01e50a
modify CommitSig
mconcat Jul 15, 2021
2dcf9af
fix test
mconcat Jul 16, 2021
1bb0326
Merge branch 'mconcat/abci-vote-extension' into mconcat/abci-vote-ext…
mconcat Jul 20, 2021
fc5767d
Apply suggestions from code review
mconcat Jul 20, 2021
d52863d
fix test
mconcat Jul 21, 2021
539eac2
Merge branch 'mconcat/abci-vote-extension-2' of github.com:sikkatech/…
mconcat Jul 21, 2021
a9708f0
VoteExtensionSigned => VoteExtensionToSigned
mconcat Aug 2, 2021
90a3ee4
Merge branch 'mconcat/abci-vote-extension' into mconcat/abci-vote-ext…
mconcat Aug 5, 2021
185fe06
add example VoteExtension
mconcat Aug 9, 2021
0e30b6a
Merge branch 'mconcat/abci-vote-extension' into mconcat/abci-vote-ext…
mconcat Aug 11, 2021
ae4a96c
fix vote
mconcat Aug 13, 2021
86035a3
Merge branch 'mconcat/abci-vote-extension' into mconcat/abci-vote-ext…
mconcat Aug 13, 2021
68dd6c6
abci: Vote Extension 1 (#6646)
mconcat Aug 23, 2021
27bc51b
Merge branch 'mconcat/abci-vote-extension' into mconcat/abci-vote-ext…
mconcat Aug 24, 2021
2279c7b
add abcipp_kvstore.go
mconcat Aug 27, 2021
ba4f88f
add extension test
mconcat Aug 30, 2021
d53c4ec
fix test
mconcat Sep 1, 2021
920518e
fix test
mconcat Sep 1, 2021
c87d7ca
Merge branch 'abci++' of github.com:tendermint/tendermint into mconca…
mconcat Sep 1, 2021
1f6aa38
fix test
mconcat Sep 1, 2021
ccdb40b
fit lint
mconcat Sep 1, 2021
094adfa
uncomment test
mconcat Sep 1, 2021
6d3dc26
refactor test in progress
mconcat Sep 7, 2021
020e6f9
gofmt
mconcat Sep 16, 2021
fc796fa
apply review
mconcat Sep 16, 2021
85e1808
fix lint
mconcat Sep 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions abci/types/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ func (r ResponseQuery) IsErr() bool {
return r.Code != CodeTypeOK
}

// IsOK returns true if Code is OK
func (r ResponseVerifyVoteExtension) IsOK() bool {
return r.Code == CodeTypeOK
}

// IsErr returns true if Code is something other than OK.
func (r ResponseVerifyVoteExtension) IsErr() bool {
return r.Code != CodeTypeOK
}

//---------------------------------------------------------------------------
// override JSON marshaling so we emit defaults (ie. disable omitempty)

Expand Down
364 changes: 182 additions & 182 deletions abci/types/types.pb.go

Large diffs are not rendered by default.

34 changes: 30 additions & 4 deletions internal/consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,6 @@ func (cs *State) enterPrecommit(height int64, round int32) {
logger.Error("failed publishing event relock", "err", err)
}

// XXX: need to add vote extension here
cs.signAddVote(tmproto.PrecommitType, blockID.Hash, blockID.PartSetHeader)
return
}
Expand All @@ -1446,7 +1445,6 @@ func (cs *State) enterPrecommit(height int64, round int32) {
logger.Error("failed publishing event lock", "err", err)
}

// XXX: need to add vote extension here
cs.signAddVote(tmproto.PrecommitType, blockID.Hash, blockID.PartSetHeader)
return
}
Expand Down Expand Up @@ -1530,7 +1528,6 @@ func (cs *State) enterCommit(height int64, commitRound int32) {
cs.tryFinalizeCommit(height)
}()

// XXX: SelfAuthenticating AppData VoteExtension should be excluded here
blockID, ok := cs.Votes.Precommits(commitRound).TwoThirdsMajority()
if !ok {
panic("RunActionCommit() expects +2/3 precommits")
Expand Down Expand Up @@ -2042,6 +2039,13 @@ func (cs *State) addVote(vote *types.Vote, peerID types.NodeID) (added bool, err
return
}

// Verify VoteExtension if precommit
if vote.Type == tmproto.PrecommitType {
if err = cs.blockExec.VerifyVoteExtension(vote.VoteExtension); err != nil {
return
}
}

height := cs.Height
added, err = cs.Votes.AddVote(vote, peerID)
if !added {
Expand Down Expand Up @@ -2213,6 +2217,27 @@ func (cs *State) signVote(
timeout = time.Second
}

// If the signedMessage type is for precommit, add VoteExtension
switch msgType {
case tmproto.PrecommitType:
ext, err := cs.blockExec.ExtendVote(cs.Height, cs.Round)
if err != nil {
return nil, err
}
vote.VoteExtension = ext
default:
}
// If the signedMessage type is for precommit, add VoteExtension
switch msgType {
case tmproto.PrecommitType:
ext, err := cs.blockExec.ExtendVote(cs.Height, cs.Round)
if err != nil {
return nil, err
}
vote.VoteExtension = ext
default:
}

ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()

Expand Down Expand Up @@ -2247,7 +2272,8 @@ func (cs *State) voteTime() time.Time {
}

// sign the vote and publish on internalMsgQueue
func (cs *State) signAddVote(msgType tmproto.SignedMsgType, hash []byte, header types.PartSetHeader) *types.Vote {
func (cs *State) signAddVote(
msgType tmproto.SignedMsgType, hash []byte, header types.PartSetHeader) *types.Vote {
if cs.privValidator == nil { // the node does not have a key
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion proto/tendermint/abci/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ message RequestExtendVote {

// Verify the vote extension
message RequestVerifyVoteExtension {
tendermint.types.VoteExtension extension = 1 [(gogoproto.nullable) = false];
tendermint.types.VoteExtension vote_extension = 1 [(gogoproto.nullable) = false];
}

//----------------------------------------
Expand Down
Loading