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++: Sync implementation and spec for vote extensions #8141

Merged
merged 95 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
8fbe537
Refactor so building and linting works
thanethomson Mar 16, 2022
116bbf0
Fix typo
thanethomson Mar 17, 2022
ce54bf3
Better describe method given vote extensions
thanethomson Mar 17, 2022
da4fedc
Fix types tests
thanethomson Mar 17, 2022
c978c29
Move CanonicalVoteExtension to canonical types proto defs
thanethomson Mar 17, 2022
306d568
Regenerate protos including latest PBTS synchrony params update
thanethomson Mar 17, 2022
aac3df4
Inject vote extensions into proposal
thanethomson Mar 19, 2022
71d3695
Thread vote extensions through code and fix tests
thanethomson Mar 20, 2022
19e07c9
Remove extraneous empty value initialization
thanethomson Mar 20, 2022
9431db9
Fix lint
thanethomson Mar 20, 2022
ab50582
Fix missing VerifyVoteExtension request data
thanethomson Mar 20, 2022
25a7312
Explicitly ensure length > 0 to sign vote extension
thanethomson Mar 20, 2022
e0ca454
Explicitly ensure length > 0 to sign vote extension
thanethomson Mar 20, 2022
65f1902
Remove extraneous comment
thanethomson Mar 20, 2022
4b62616
Update privval/file.go
thanethomson Mar 21, 2022
0527731
Update types/vote_test.go
thanethomson Mar 21, 2022
dfe8243
Format
thanethomson Mar 21, 2022
040cb56
Merge latest changes from master and resolve conflicts
thanethomson Mar 24, 2022
f3188e5
Fix ABCI proto generation scripts for Linux
thanethomson Mar 24, 2022
9951b7a
Sync intermediate and goal protos
thanethomson Mar 24, 2022
806e348
Update internal/consensus/common_test.go
thanethomson Mar 25, 2022
617f47f
Use dummy value with clearer meaning
thanethomson Mar 24, 2022
cbe8560
Rewrite loop for clarity
thanethomson Mar 24, 2022
01b6a4f
Panic on ABCI++ method call failure
thanethomson Mar 28, 2022
fab3cd0
Add strong correctness guarantees when constructing extended commit i…
thanethomson Mar 28, 2022
620c323
Add strong guarantee in extendedCommitInfo that the number of votes c…
thanethomson Mar 28, 2022
f618fc2
Make extendedCommitInfo function more robust
thanethomson Mar 29, 2022
d9b2859
Merge latest changes from master
thanethomson Mar 29, 2022
a03504d
Remove extraneous validator address assignment
thanethomson Mar 29, 2022
730b245
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Mar 29, 2022
3fabdee
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Mar 29, 2022
27c920c
Sign over canonical vote extension
thanethomson Mar 29, 2022
4ddc46e
Validate vote extension signature against canonical vote extension
thanethomson Mar 29, 2022
3be1b6a
Update privval tests for more meaningful dummy value
thanethomson Mar 29, 2022
f3d8529
Add vote extension capability to E2E test app
thanethomson Mar 29, 2022
7d1f928
Disable lint for weak RNG usage for test app
thanethomson Mar 29, 2022
685487a
Use parseVoteExtension instead of custom parsing in PrepareProposal
thanethomson Mar 30, 2022
a8505f0
Only include extension if we have received txs
thanethomson Mar 30, 2022
b8e0e0b
Require app_hash from app to match that from last block
thanethomson Mar 30, 2022
c9921eb
Add contrived (possibly flaky) test to check that vote extensions cod…
thanethomson Mar 31, 2022
b06d274
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Mar 31, 2022
989c9b6
Merge latest changes from master and resolve conflicts
thanethomson Mar 31, 2022
b958ca2
Remove workaround for problem now solved by #8229
thanethomson Mar 31, 2022
431c85b
add tests for vote extension cases
williambanfield Mar 31, 2022
a682cc8
Fix spelling mistake to appease linter
thanethomson Apr 1, 2022
16b67fd
Merge latest changes from master and fix conflicts
thanethomson Apr 5, 2022
eedb750
Collapse redundant if statement
thanethomson Apr 5, 2022
1488a90
Formatting
thanethomson Apr 5, 2022
8938553
Always expect an extension signature, regardless of whether an extens…
thanethomson Apr 5, 2022
9b12360
Votes constructed from commits cannot include extensions or signatures
thanethomson Apr 5, 2022
28cd854
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 5, 2022
a371c86
Pass through vote extension in test helpers
thanethomson Apr 5, 2022
f697844
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 6, 2022
3a158ce
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 6, 2022
a3f0123
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 7, 2022
2bc6c4c
Temporarily disable vote extension signature requirement
thanethomson Apr 7, 2022
e7e8061
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 7, 2022
63c32c4
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 8, 2022
2ccd305
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 11, 2022
c1c8ca9
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 11, 2022
26f049a
Expand on vote equality test errors for clarity
thanethomson Apr 11, 2022
af6d500
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 11, 2022
3124ac5
Expand on vote matching error messages in testing
thanethomson Apr 12, 2022
e7523c4
Allow for selective subscription by vote type
thanethomson Apr 12, 2022
5502162
Merge from master and fix conflicts
thanethomson Apr 12, 2022
8bb7983
Read lock consensus state mutex in test helper to avoid data race
thanethomson Apr 12, 2022
5884ce5
Revert BlockIDFlag parameter in node test
thanethomson Apr 12, 2022
50fc899
Perform additional check in ProcessProposal for special txs generated…
thanethomson Apr 12, 2022
b054c42
e2e: check that our added tx does not cause all txs to exceed req.Max…
thanethomson Apr 12, 2022
35aa879
Only set vote extension signatures when signing is successful
thanethomson Apr 12, 2022
532a0f9
Remove channel capacity constraint in test helper to avoid missing me…
thanethomson Apr 13, 2022
c420dd4
Add TODO to always require extension signatures in vote validation
thanethomson Apr 13, 2022
298a6b2
e2e: reject vote extensions if the request height does not match what…
thanethomson Apr 13, 2022
8104cf5
types: remove extraneous call to voteWithoutExtension in test
thanethomson Apr 13, 2022
b3b74df
Remove unnecessary address parameter from CanonicalVoteExtension
thanethomson Apr 13, 2022
43f4f5c
privval: change test vote type to precommit since we use an extension
thanethomson Apr 13, 2022
d2d8748
Merge latest changes from master
thanethomson Apr 13, 2022
8b104e4
privval: update signing logic to cater for vote extensions
thanethomson Apr 13, 2022
a07ae24
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 13, 2022
68245d7
proto: update field descriptions for vote message
thanethomson Apr 13, 2022
77ac2b3
proto: update field description for vote extension sig in vote message
thanethomson Apr 13, 2022
c89890b
proto/types: use fixed-length 64-bit integers for rounds in Canonical…
thanethomson Apr 14, 2022
cb97056
consensus: fix flaky TestPrepareProposalReceivesVoteExtensions
thanethomson Apr 14, 2022
faec1d3
consensus: remove previously added test helper functionality
thanethomson Apr 14, 2022
61899b2
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 14, 2022
e4dd691
e2e: add error logs when we get an unexpected height in ExtendVote or…
thanethomson Apr 14, 2022
ed7daa9
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 14, 2022
1512b23
node_test: get validator addresses from privvals
thanethomson Apr 16, 2022
ec30866
privval/file_test: optimize filepv creation in tests
thanethomson Apr 16, 2022
a25fbe0
privval: add test to check that vote extensions are always signed
thanethomson Apr 16, 2022
916d475
Add a script to check documentation for ToC entries. (#8356)
Apr 15, 2022
a840495
build(deps): Bump async from 2.6.3 to 2.6.4 in /docs (#8357)
dependabot[bot] Apr 16, 2022
ea464c7
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 16, 2022
bc4a40d
privval/file_test: reset vote ext sig before signing
thanethomson Apr 16, 2022
abdb000
Merge branch 'master' into thane/7655-vote-extensions
thanethomson Apr 19, 2022
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
34 changes: 0 additions & 34 deletions abci/example/kvstore/persistent_kvstore.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package kvstore

import (
"bytes"

dbm "github.com/tendermint/tm-db"

"github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
cryptoproto "github.com/tendermint/tendermint/proto/tendermint/crypto"
ptypes "github.com/tendermint/tendermint/proto/tendermint/types"
)

const (
Expand Down Expand Up @@ -45,34 +42,3 @@ func (app *PersistentKVStoreApplication) OfferSnapshot(req types.RequestOfferSna
func (app *PersistentKVStoreApplication) ApplySnapshotChunk(req types.RequestApplySnapshotChunk) types.ResponseApplySnapshotChunk {
return types.ResponseApplySnapshotChunk{Result: types.ResponseApplySnapshotChunk_ABORT}
}

func (app *PersistentKVStoreApplication) ExtendVote(req types.RequestExtendVote) types.ResponseExtendVote {
return types.ResponseExtendVote{VoteExtension: ConstructVoteExtension(req.Vote.ValidatorAddress)}
}

func (app *PersistentKVStoreApplication) VerifyVoteExtension(req types.RequestVerifyVoteExtension) types.ResponseVerifyVoteExtension {
return types.RespondVerifyVoteExtension(app.verifyExtension(req.Vote.ValidatorAddress, req.Vote.VoteExtension))
}
thanethomson marked this conversation as resolved.
Show resolved Hide resolved

// -----------------------------

func ConstructVoteExtension(valAddr []byte) *ptypes.VoteExtension {
return &ptypes.VoteExtension{
AppDataToSign: valAddr,
AppDataSelfAuthenticating: valAddr,
}
}

func (app *PersistentKVStoreApplication) verifyExtension(valAddr []byte, ext *ptypes.VoteExtension) bool {
if ext == nil {
return false
}
canonical := ConstructVoteExtension(valAddr)
if !bytes.Equal(canonical.AppDataToSign, ext.AppDataToSign) {
return false
}
if !bytes.Equal(canonical.AppDataSelfAuthenticating, ext.AppDataSelfAuthenticating) {
return false
}
return true
}
2 changes: 1 addition & 1 deletion abci/types/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (BaseApplication) ExtendVote(req RequestExtendVote) ResponseExtendVote {

func (BaseApplication) VerifyVoteExtension(req RequestVerifyVoteExtension) ResponseVerifyVoteExtension {
return ResponseVerifyVoteExtension{
Result: ResponseVerifyVoteExtension_ACCEPT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd probably be a good idea to merge with master at this point, to get #8158

Accept: true,
}
}

Expand Down
36 changes: 0 additions & 36 deletions abci/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"encoding/json"

"github.com/gogo/protobuf/jsonpb"

types "github.com/tendermint/tendermint/proto/tendermint/types"
)

const (
Expand Down Expand Up @@ -53,21 +51,6 @@ func (r ResponseQuery) IsErr() bool {
return r.Code != CodeTypeOK
}

// IsUnknown returns true if Code is Unknown
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider keeping these (in some form), after merging

func (r ResponseVerifyVoteExtension) IsUnknown() bool {
return r.Result == ResponseVerifyVoteExtension_UNKNOWN
}

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

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

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

Expand Down Expand Up @@ -149,25 +132,6 @@ var _ jsonRoundTripper = (*EventAttribute)(nil)
// -----------------------------------------------
// construct Result data

func RespondExtendVote(appDataToSign, appDataSelfAuthenticating []byte) ResponseExtendVote {
return ResponseExtendVote{
VoteExtension: &types.VoteExtension{
AppDataToSign: appDataToSign,
AppDataSelfAuthenticating: appDataSelfAuthenticating,
},
}
}

func RespondVerifyVoteExtension(ok bool) ResponseVerifyVoteExtension {
result := ResponseVerifyVoteExtension_REJECT
if ok {
result = ResponseVerifyVoteExtension_ACCEPT
}
return ResponseVerifyVoteExtension{
Result: result,
}
}

// deterministicExecTxResult constructs a copy of response that omits
// non-deterministic fields. The input response is not modified.
func deterministicExecTxResult(response *ExecTxResult) *ExecTxResult {
Expand Down
Loading