From b46f2fbbf9459a8e57bb41dc73c710898156e157 Mon Sep 17 00:00:00 2001 From: mattac21 Date: Wed, 8 Apr 2026 18:09:41 -0400 Subject: [PATCH] fix(types): add signed header validation to light client attack evidence (#5757) Adds additional validation for the light client evidence type. --- - [ ] Tests written/updated - [ ] Changelog entry added in `CHANGELOG.md` - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> (cherry picked from commit 336b47cf5d5ea5d44155efe6888c85dde2cd3938) --- types/evidence.go | 3 +++ types/evidence_test.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/types/evidence.go b/types/evidence.go index ef56a198884..1aecd6cb862 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -344,6 +344,9 @@ func (l *LightClientAttackEvidence) ValidateBasic() error { } // this check needs to be done before we can run validate basic + if l.ConflictingBlock.SignedHeader == nil { + return errors.New("conflicting block missing signed header") + } if l.ConflictingBlock.Header == nil { return errors.New("conflicting block missing header") } diff --git a/types/evidence_test.go b/types/evidence_test.go index 36a164a8498..ec21bf6848e 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -190,7 +190,8 @@ func TestLightClientAttackEvidenceValidation(t *testing.T) { ev.CommonHeight = height }, false}, {"Nil conflicting header", func(ev *LightClientAttackEvidence) { ev.ConflictingBlock.Header = nil }, true}, - {"Nil conflicting blocl", func(ev *LightClientAttackEvidence) { ev.ConflictingBlock = nil }, true}, + {"Nil conflicting block", func(ev *LightClientAttackEvidence) { ev.ConflictingBlock = nil }, true}, + {"Nil signed header", func(ev *LightClientAttackEvidence) { ev.ConflictingBlock.SignedHeader = nil }, true}, {"Nil validator set", func(ev *LightClientAttackEvidence) { ev.ConflictingBlock.ValidatorSet = &ValidatorSet{} }, true},