Skip to content

[good first issue] IntentPool: in-memory pool with expiry pruning and protocol/chain filters #6

@abhicris

Description

@abhicris

Context

Intent::is_expired(now) and UniswapXDecoder::fetch_open_intents both filter by deadline > now, but there is no structured monitor that keeps a live feed of open intents, prunes expired ones, and exposes metrics (count, cross-chain %, protocol breakdown). src/monitor/mod.rs is a stub. Filling it in with a simple in-memory intent pool and a tick-based pruner is a clean starter for someone who wants to learn the codebase.

Scope

  • Implement IntentPool in src/monitor/mod.rs:
    • pub struct IntentPool { intents: RwLock<HashMap<String, Intent>>, ... }.
    • pub fn add(&self, intent: Intent) — de-dupe by intent.id.
    • pub fn prune_expired(&self, now: u64) -> usize — returns number pruned.
    • pub fn len(&self), is_empty().
    • pub fn by_protocol(&self, protocol: &Protocol) -> Vec<Intent>.
    • pub fn by_dest_chain(&self, chain: Chain) -> Vec<Intent>.
  • Unit tests for every method — add 5+ synthetic intents, assert pruning + filters behave.
  • In src/main.rs (or whatever entry point exists), wire IntentPool into the solver loop so fetch_open_intents from all decoders feeds into a single pool.

Acceptance criteria

  • cargo test monitor green.
  • cargo clippy -- -D warnings clean.
  • IntentPool is Send + Sync and safe to share across solver tasks.
  • The public API has rustdoc.

Reference: src/intents/types.rs::Intent::is_expired for the expiry rule; PR #3 for the Across decoder pattern being wired into the same pool.

Estimated effort

S (3–5 hours)

kcolbchain / Abhishek Krishna

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions