Skip to content

pool cap sweep: post each uncapped pool once, then only count it - #358

Closed
rbcp18 wants to merge 1 commit into
developfrom
claude/optimistic-planck-q9ee3d
Closed

rbcp18 wants to merge 1 commit into
developfrom
claude/optimistic-planck-q9ee3d

Conversation

@rbcp18

@rbcp18 rbcp18 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Why

The nightly pool cap sweep posts the same ~40 uncapped pools on the same six chains to Slack every run. Most of them belong to other owners, and the list never changes, so after the first night the post is mostly noise.

What changes

In the AUDIT_NETWORKS sweep in packages/contracts/scripts/deploy-chain.sh:

  • Remembers what it posted. Posted pools are kept in $AUDIT_STATE_DIR/pool-cap-audit-seen.txt, one <network> <pool> line each. AUDIT_STATE_DIR should point at a Railway volume on the scheduled service.
  • New pools are posted once. A pool is named in Slack the first run it shows up uncapped, whoever owns it: address, pair, amount available and owner. After that it only counts toward a one-line total, e.g. Total: 38 uncapped pool(s) across 6 chain(s).
  • The seen file tracks the current state. It is rewritten every run with the pools that are uncapped now, so a pool that gets capped and later uncapped counts as new again. A chain the run could not read keeps its previous lines.
  • Unreadable chains are always posted, as one line with the reason.
  • Quiet nights post nothing. With no new pools and no unreadable chains, the sweep prints nothing new since the last post; Slack skipped (...).
  • The first run with a state file only records a baseline and posts the totals, so the channel doesn't get the whole list again.
  • Without AUDIT_STATE_DIR, every uncapped pool is treated as new each run, in the shorter format.
  • Exit codes are unchanged.

Testing

I ran the sweep block locally with a stub yarn that returns canned audit output and a stub curl that captures the Slack payload:

Run Expected Result
First run with a state dir baseline and totals only ✓
Same pools again nothing posted ✓
Same pools, one chain unreadable "no new uncapped pools" plus a could-not-audit line ✓
One new pool added that pool posted, with the total ✓
Same again nothing posted ✓
Chain unreadable its earlier seen entries are kept ✓
No AUDIT_STATE_DIR every pool posted as new ✓

bash -n passes.

Rollout

After merge, bump CONTRACTS_REF in worker-agents/chain-deployer/Dockerfile. The pool-cap-audit service already has a volume at /data and AUDIT_STATE_DIR=/data set.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TEE2vGbGJPRMNNsZdNTZps


Generated by Claude Code

Every nightly sweep posted the same forty-odd uncapped pools on the same six
chains, most of them owned by someone else, so the post was long and said
nothing new after the first night.

The sweep now remembers which uncapped pools it has posted, in a file under
AUDIT_STATE_DIR (a Railway volume on the scheduled service). A pool is named
in Slack the first run it is seen uncapped, whoever owns it; after that it
is only counted in a one-line total. The file is rewritten each run to the
pools uncapped now, so a pool that is capped and later uncapped is new
again, and a chain the run could not read keeps its previous entries.

A chain that could not be read is still always posted, as one line with
its reason. Nothing new and nothing unreadable means no post at all. The
first run with a state file records a baseline and posts the totals only.
Unset AUDIT_STATE_DIR treats every pool as new. Exit codes are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TEE2vGbGJPRMNNsZdNTZps

rbcp18 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Closing without merging. Deciding what gets posted to Slack is internal ops work, not protocol code, so it's moving to the scheduled job's own repo. The audit-pool-caps task stays here, unchanged, and the new job calls it with --json true.


Generated by Claude Code

@rbcp18 rbcp18 closed this Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants