Skip to content

Commit

Permalink
fix: don't accept evidence on non-validator hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Aug 12, 2024
1 parent fe41a12 commit 6ec2a50
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/evidence/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ func (r *Reactor) handleEvidenceMessage(ctx context.Context, envelope *p2p.Envel

switch msg := envelope.Message.(type) {
case *tmproto.Evidence:

// Only accept evidence if we are an active validator.
// On other hosts, signatures in evidence (if any) cannot be verified due to lack of validator public keys,
// and it creates risk of adding invalid evidence to the pool.
//
// TODO: We need to figure out how to handle evidence from non-validator nodes, to avoid scenarios where some
// evidence is lost.
if !r.evpool.state.Validators.HasPublicKeys {
// silently drop the message
logger.Debug("dropping evidence message as we are not a validator", "evidence", envelope.Message)
}

// Process the evidence received from a peer
// Evidence is sent and received one by one
ev, err := types.EvidenceFromProto(msg)
Expand Down

0 comments on commit 6ec2a50

Please sign in to comment.