@@ -193,6 +193,7 @@ func TestLightClientAttackEvidenceValidation(t *testing.T) {
193193 {"Height is equal to the divergent block" , func (ev * LightClientAttackEvidence ) {
194194 ev .CommonHeight = height
195195 }, false },
196+ {"Nil conflicting signed header" , func (ev * LightClientAttackEvidence ) { ev .ConflictingBlock .SignedHeader = nil }, true },
196197 {"Nil conflicting header" , func (ev * LightClientAttackEvidence ) { ev .ConflictingBlock .Header = nil }, true },
197198 {"Nil conflicting blocl" , func (ev * LightClientAttackEvidence ) { ev .ConflictingBlock = nil }, true },
198199 {"Nil validator set" , func (ev * LightClientAttackEvidence ) {
@@ -229,6 +230,26 @@ func TestLightClientAttackEvidenceValidation(t *testing.T) {
229230
230231}
231232
233+ func TestLightClientAttackEvidenceFromProtoNilConflictingSignedHeader (t * testing.T ) {
234+ height := int64 (5 )
235+ _ , valSet , _ := randVoteSet (height , 1 , cmtproto .PrecommitType , 10 , 1 , false )
236+ valsProto , err := valSet .ToProto ()
237+ require .NoError (t , err )
238+
239+ evidenceProto := & cmtproto.LightClientAttackEvidence {
240+ ConflictingBlock : & cmtproto.LightBlock {
241+ ValidatorSet : valsProto ,
242+ },
243+ CommonHeight : height - 1 ,
244+ TotalVotingPower : valSet .TotalVotingPower (),
245+ }
246+
247+ require .NotPanics (t , func () {
248+ _ , err = LightClientAttackEvidenceFromProto (evidenceProto )
249+ })
250+ require .ErrorContains (t , err , "conflicting block missing signed header" )
251+ }
252+
232253func TestMockEvidenceValidateBasic (t * testing.T ) {
233254 goodEvidence , err := NewMockDuplicateVoteEvidence (int64 (1 ), time .Now (), "mock-chain-id" )
234255 require .NoError (t , err )
0 commit comments