Skip to content

fix: allow a zero slippage tolerance when collecting payments#1236

Open
MoonBoi9001 wants to merge 1 commit into
main-dipsfrom
mb9/allow-zero-dips-collection-slippage
Open

fix: allow a zero slippage tolerance when collecting payments#1236
MoonBoi9001 wants to merge 1 commit into
main-dipsfrom
mb9/allow-zero-dips-collection-slippage

Conversation

@MoonBoi9001

Copy link
Copy Markdown
Member

TL;DR

A payment-collection setting that bounds how much the indexer will accept losing versus the expected amount could not be set to zero, even though zero — accept no loss at all — is a valid, strict choice. This change makes the setting accept zero while still capping it at 100.

Motivation

When an indexer collects a payment for indexing work, the payer's on-chain agreement caps can make the amount actually collectable come in below what the indexer expected to earn. A setting bounds the indexer's stop-loss: the largest share of the expected amount it will accept losing before it aborts the collection.

Today that setting's validation rejects a value of zero, so an operator who wants a strict zero-tolerance policy — collect the full expected amount or nothing — cannot configure it and the agent refuses to start. The command-line help already advertises the range as 0 to 100, so the rejection also contradicts the documented range. This change lets the setting accept zero while keeping the cap at 100.

Summary

  • Let the collection-slippage setting accept 0 (no loss tolerated), keeping the 0-100 range.
  • Fix the validator, which paired a "greater than zero" rule with a dead "zero or more" rule.
  • Add a test asserting a zero value now parses.

The collection-slippage setting is the indexer's stop-loss when collecting a payment: the
most it will accept losing versus the expected amount. Its validator rejected 0, blocking a
valid zero-tolerance policy; accept 0 (still capped at 100) so that setting can be used.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this to 🗃️ Inbox in Indexer Jun 16, 2026
@MoonBoi9001 MoonBoi9001 requested a review from Maikol June 16, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🗃️ Inbox

Development

Successfully merging this pull request may close these issues.

1 participant