Skip to content

bug: gossip inserts in MessagePool::add() use TrustPolicy::Trusted instead of TrustPolicy::Untrusted #7076

@akaladarshi

Description

@akaladarshi

Summary

The MessagePool::add() method, which is used to insert messages received via gossip,
currently calls add_to_pool with TrustPolicy::Trusted. This bypasses the stricter
untrusted caps and gap rules that are intended for externally sourced traffic.

Details

File: src/message_pool/msgpool/msg_pool.rs

Messages received over gossipsub come from untrusted external peers. Using
TrustPolicy::Trusted for these inserts means:

  • The per-actor pending message limit of MAX_ACTOR_PENDING_MESSAGES (1000) applies
    instead of the tighter MAX_UNTRUSTED_ACTOR_PENDING_MESSAGES (10).
  • Gap/strictness rules intended for untrusted sources (StrictnessPolicy::Strict) may
    not be enforced correctly.

Suggested Fix

pub fn add(&self, msg: SignedMessage) -> Result<(), Error> {
    self.add_to_pool(msg, false, TrustPolicy::Untrusted)?;
    Ok(())
}

References

Note:

It's not actually a bug because TrustPolicy here merely tells us how many messages are allowed in the pending store nothing else, but opening this so we discuss changing things around because current naming creates confusion.

Metadata

Metadata

Assignees

Labels

Type: BugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions