Skip to content

Commit

Permalink
refactor!: Rename skip_sign_extension to skip_extension_signing (c…
Browse files Browse the repository at this point in the history
…ometbft#2522)

Follow-up and bikeshedding after cometbft#2519:

- Rename the added field to `skip_extension_signing` which reads better.
- Update the `tendermint.privval.SignVoteRequest` definition as per the
current practice.

---

#### PR checklist

- [ ] Tests written/updated
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
  • Loading branch information
mzabaluev authored Mar 6, 2024
1 parent 551fc9b commit ec21d4d
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 63 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- `[privval]` DO NOT require extension signature from privval if vote
extensions are disabled. Remote signers can skip signing the extension if
`skip_sign_extension` flag in `SignVoteRequest` is true.
`skip_extension_signing` flag in `SignVoteRequest` is true.
[\#2496](https://github.com/cometbft/cometbft/pull/2496)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[proto]` Add `skip_extension_signing` field to the `SignVoteRequest` message
in privval ([\#2522](https://github.com/cometbft/cometbft/pull/2522))
110 changes: 55 additions & 55 deletions api/cometbft/privval/v1/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion privval/signer_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (sc *SignerClient) GetPubKey() (crypto.PubKey, error) {

// SignVote requests a remote signer to sign a vote.
func (sc *SignerClient) SignVote(chainID string, vote *cmtproto.Vote, signExtension bool) error {
response, err := sc.endpoint.SendRequest(mustWrapMsg(&pvproto.SignVoteRequest{Vote: vote, ChainId: chainID, SkipSignExtension: !signExtension}))
response, err := sc.endpoint.SendRequest(mustWrapMsg(&pvproto.SignVoteRequest{Vote: vote, ChainId: chainID, SkipExtensionSigning: !signExtension}))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion privval/signer_requestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func DefaultValidationRequestHandler(

vote := r.SignVoteRequest.Vote

err = privVal.SignVote(chainID, vote, !r.SignVoteRequest.SkipSignExtension)
err = privVal.SignVote(chainID, vote, !r.SignVoteRequest.SkipExtensionSigning)
if err != nil {
res = mustWrapMsg(&pvproto.SignedVoteResponse{
Vote: cmtproto.Vote{}, Error: &pvproto.RemoteSignerError{Code: 0, Description: err.Error()},
Expand Down
6 changes: 3 additions & 3 deletions proto/cometbft/privval/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ message PubKeyResponse {

// SignVoteRequest is a request to sign a vote
message SignVoteRequest {
cometbft.types.v1.Vote vote = 1;
string chain_id = 2;
bool skip_sign_extension = 3; // if true, the signer may skip signing the extension bytes.
cometbft.types.v1.Vote vote = 1;
string chain_id = 2;
bool skip_extension_signing = 3; // if true, the signer may skip signing the extension bytes.
}

// SignedVoteResponse is a response containing a signed vote or an error
Expand Down
5 changes: 3 additions & 2 deletions proto/tendermint/privval/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ message PubKeyResponse {

// SignVoteRequest is a request to sign a vote
message SignVoteRequest {
tendermint.types.Vote vote = 1;
string chain_id = 2;
tendermint.types.Vote vote = 1;
string chain_id = 2;
bool skip_extension_signing = 3; // if true, the signer may skip signing the extension bytes.
}

// SignedVoteResponse is a response containing a signed vote or an error
Expand Down

0 comments on commit ec21d4d

Please sign in to comment.