diff --git a/consensus/invalid_test.go b/consensus/invalid_test.go index d6bcfdfda30..d3139b088bf 100644 --- a/consensus/invalid_test.go +++ b/consensus/invalid_test.go @@ -99,6 +99,8 @@ func invalidDoPrevoteFunc(t *testing.T, cs *State, sw *p2p.Switch, pv types.Priv } precommit.Signature = p.Signature precommit.ExtensionSignature = p.ExtensionSignature + precommit.NonRpExtension = p.NonRpExtension + precommit.NonRpExtensionSignature = p.NonRpExtensionSignature cs.privValidator = nil // disable priv val so we don't do normal votes peers := sw.Peers().List() diff --git a/evidence/pool_test.go b/evidence/pool_test.go index d13bc5c08c5..00985c7b543 100644 --- a/evidence/pool_test.go +++ b/evidence/pool_test.go @@ -438,7 +438,8 @@ func makeExtCommit(height int64, valAddr []byte) *types.ExtendedCommit { Timestamp: defaultEvidenceTime, Signature: []byte("Signature"), }, - ExtensionSignature: []byte("Extended Signature"), + ExtensionSignature: []byte("Extended Signature"), + NonRpExtensionSignature: []byte("Non Replay Protected Extended Signature"), }}, } } diff --git a/store/store_test.go b/store/store_test.go index cafe7d34ffa..db973eb1f60 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -46,7 +46,8 @@ func makeTestExtCommitWithNumSigs(height int64, timestamp time.Time, numSigs int Timestamp: timestamp, Signature: cmtrand.Bytes(64), }, - ExtensionSignature: []byte("ExtensionSignature"), + ExtensionSignature: []byte("ExtensionSignature"), + NonRpExtensionSignature: []byte("NonRpExtensionSignature"), }) } return &types.ExtendedCommit{ diff --git a/types/vote_test.go b/types/vote_test.go index d7b5eaf0d71..e8ef4424dc1 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -25,6 +25,8 @@ func examplePrecommit() *Vote { vote := exampleVote(byte(cmtproto.PrecommitType)) vote.Extension = []byte("extension") vote.ExtensionSignature = []byte("signature") + vote.NonRpExtension = []byte("non_replay_protected_extension") + vote.NonRpExtensionSignature = []byte("non_replay_protected_extension_signature") return vote } @@ -315,7 +317,7 @@ func TestVoteVerify(t *testing.T) { func TestVoteString(t *testing.T) { str := examplePrecommit().String() - expected := `Vote{56789:6AF1F4111082 12345/02/SIGNED_MSG_TYPE_PRECOMMIT(Precommit) 8B01023386C3 000000000000 657874656E73 000000000000 @ 2017-12-25T03:00:01.234Z}` //nolint:lll //ignore line length for tests + expected := `Vote{56789:6AF1F4111082 12345/02/SIGNED_MSG_TYPE_PRECOMMIT(Precommit) 8B01023386C3 000000000000 657874656E73 6E6F6E5F7265 @ 2017-12-25T03:00:01.234Z}` //nolint:lll //ignore line length for tests if str != expected { t.Errorf("got unexpected string for Vote. Expected:\n%v\nGot:\n%v", expected, str) } @@ -345,8 +347,14 @@ func TestValidVotes(t *testing.T) { malleateVote func(*Vote) }{ {"good prevote", examplePrevote(), func(v *Vote) {}}, - {"good precommit without vote extension", examplePrecommit(), func(v *Vote) { v.Extension = nil }}, - {"good precommit with vote extension", examplePrecommit(), func(v *Vote) { v.Extension = []byte("extension") }}, + {"good precommit without vote extension", examplePrecommit(), func(v *Vote) { + v.Extension = nil + v.NonRpExtension = nil + }}, + {"good precommit with vote extension", examplePrecommit(), func(v *Vote) { + v.Extension = []byte("extension") + v.NonRpExtension = []byte("non_replay_protected_extension") + }}, } for _, tc := range testCases { signVote(t, privVal, "test_chain_id", tc.vote)