Skip to content

Commit

Permalink
Adapt code to renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-mena authored and greg-szabo committed Nov 26, 2024
1 parent 71db7a7 commit d8b2ec9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
22 changes: 11 additions & 11 deletions consensus/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1564,11 +1564,11 @@ func TestExtendVoteCalledWhenEnabled(t *testing.T) {
addr := pv.Address()
if testCase.enabled {
m.AssertCalled(t, "VerifyVoteExtension", context.TODO(), &abci.RequestVerifyVoteExtension{
Hash: blockID.Hash,
ValidatorAddress: addr,
Height: height,
VoteExtension: []byte("extension"),
NrpVoteExtension: []byte("non_replay_protected_extension"),
Hash: blockID.Hash,
ValidatorAddress: addr,
Height: height,
VoteExtension: []byte("extension"),
NonRpVoteExtension: []byte("non_replay_protected_extension"),
})
} else {
m.AssertNotCalled(t, "VerifyVoteExtension", mock.Anything, mock.Anything)
Expand Down Expand Up @@ -1639,11 +1639,11 @@ func TestVerifyVoteExtensionNotCalledOnAbsentPrecommit(t *testing.T) {
addr = pv.Address()

m.AssertNotCalled(t, "VerifyVoteExtension", context.TODO(), &abci.RequestVerifyVoteExtension{
Hash: blockID.Hash,
ValidatorAddress: addr,
Height: height,
VoteExtension: []byte("extension"),
NrpVoteExtension: []byte("non_replay_protected_extension"),
Hash: blockID.Hash,
ValidatorAddress: addr,
Height: height,
VoteExtension: []byte("extension"),
NonRpVoteExtension: []byte("non_replay_protected_extension"),
})
}

Expand Down Expand Up @@ -1738,7 +1738,7 @@ func TestPrepareProposalReceivesVoteExtensions(t *testing.T) {
for i := range vss {
vote := &rpp.LocalLastCommit.Votes[i]
require.Equal(t, vote.VoteExtension, voteExtensions[i])
require.Equal(t, vote.NrpVoteExtension, nonRpVoteExtensions[i])
require.Equal(t, vote.NonRpVoteExtension, nonRpVoteExtensions[i])

require.NotZero(t, len(vote.ExtensionSignature))
cve := cmtproto.CanonicalVoteExtension{
Expand Down
22 changes: 11 additions & 11 deletions state/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,11 @@ func (blockExec *BlockExecutor) ExtendVote(

func (blockExec *BlockExecutor) VerifyVoteExtension(ctx context.Context, vote *types.Vote) error {
req := abci.RequestVerifyVoteExtension{
Hash: vote.BlockID.Hash,
ValidatorAddress: vote.ValidatorAddress,
Height: vote.Height,
VoteExtension: vote.Extension,
NrpVoteExtension: vote.NonRpExtension,
Hash: vote.BlockID.Hash,
ValidatorAddress: vote.ValidatorAddress,
Height: vote.Height,
VoteExtension: vote.Extension,
NonRpVoteExtension: vote.NonRpExtension,
}

resp, err := blockExec.proxyApp.VerifyVoteExtension(ctx, &req)
Expand Down Expand Up @@ -552,12 +552,12 @@ func BuildExtendedCommitInfo(ec *types.ExtendedCommit, valSet *types.ValidatorSe
}

votes[i] = abci.ExtendedVoteInfo{
Validator: types.TM2PB.Validator(val),
BlockIdFlag: cmtproto.BlockIDFlag(ecs.BlockIDFlag),
VoteExtension: ecs.Extension,
ExtensionSignature: ecs.ExtensionSignature,
NrpVoteExtension: ecs.NonRpExtension,
NrpExtensionSignature: ecs.NonRpExtensionSignature,
Validator: types.TM2PB.Validator(val),
BlockIdFlag: cmtproto.BlockIDFlag(ecs.BlockIDFlag),
VoteExtension: ecs.Extension,
ExtensionSignature: ecs.ExtensionSignature,
NonRpVoteExtension: ecs.NonRpExtension,
NonRpExtensionSignature: ecs.NonRpExtensionSignature,
}
}

Expand Down
10 changes: 5 additions & 5 deletions test/e2e/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ func (app *Application) VerifyVoteExtension(_ context.Context, req *abci.Request
panic(fmt.Errorf("received call to VerifyVoteExtension at height %d, when vote extensions are disabled", appHeight))
}
// We don't allow vote extensions to be optional
if len(req.VoteExtension) == 0 || len(req.NrpVoteExtension) == 0 {
if len(req.VoteExtension) == 0 || len(req.NonRpVoteExtension) == 0 {
app.logger.Error("received empty vote extension")
return &abci.ResponseVerifyVoteExtension{
Status: abci.ResponseVerifyVoteExtension_REJECT,
Expand All @@ -528,9 +528,9 @@ func (app *Application) VerifyVoteExtension(_ context.Context, req *abci.Request
}, nil
}

num_nrp, err := parseVoteExtension(req.NrpVoteExtension)
num_nrp, err := parseVoteExtension(req.NonRpVoteExtension)
if err != nil {
app.logger.Error("failed to parse nrp vote extension", "vote_extension", req.NrpVoteExtension, "err", err)
app.logger.Error("failed to parse nrp vote extension", "vote_extension", req.NonRpVoteExtension, "err", err)
return &abci.ResponseVerifyVoteExtension{
Status: abci.ResponseVerifyVoteExtension_REJECT,
}, nil
Expand All @@ -542,7 +542,7 @@ func (app *Application) VerifyVoteExtension(_ context.Context, req *abci.Request

app.logger.Info("verified vote extension value", "height", req.Height,
"vote_extension", req.VoteExtension, "num_ve", num_ve,
"nrp_vote_extension", req.NrpVoteExtension, "num_nrp_ve", num_nrp)
"nrp_vote_extension", req.NonRpVoteExtension, "num_nrp_ve", num_nrp)
return &abci.ResponseVerifyVoteExtension{
Status: abci.ResponseVerifyVoteExtension_ACCEPT,
}, nil
Expand Down Expand Up @@ -730,7 +730,7 @@ func (app *Application) verifyAndSum(
if !pubKey.VerifySignature(extSignBytes, vote.ExtensionSignature) {
return 0, errors.New("received vote with invalid signature")
}
if !pubKey.VerifySignature(vote.NrpVoteExtension, vote.NrpExtensionSignature) {
if !pubKey.VerifySignature(vote.NonRpVoteExtension, vote.NonRpExtensionSignature) {
return 0, errors.New("received vote with invalid signature of nrp vote extension")
}

Expand Down

0 comments on commit d8b2ec9

Please sign in to comment.