Skip to content

round contribution caps and pricing adapter staleness#984

Open
feyishola wants to merge 2 commits into
Pulsefy:mainfrom
feyishola:feat/guardrails
Open

round contribution caps and pricing adapter staleness#984
feyishola wants to merge 2 commits into
Pulsefy:mainfrom
feyishola:feat/guardrails

Conversation

@feyishola

Copy link
Copy Markdown
Contributor

closes #867
closes #860

1. Matching Pool: Contribution Caps & Anti-Whale Guardrails

Files modified: matching_pool/src/{storage,errors,events,lib,test}.rs

This update introduces two configurable, orthogonal per-round contribution caps—both defaulting to 0 (uncapped) to ensure backward compatibility with existing rounds:

Cap | Storage Key | Behavior -- | -- | -- Per-Contributor Cap | RoundContributorCap(round_id) | Limits the maximum contribution a single wallet address can make to any one project within a round Round Contribution Cap | RoundContributionCap(round_id) | Limits the total contributions received across all projects in a round

set_price now timestamps each update using PriceTimestamp and resets the invalidation flag on every call. The private check_price_validity helper serves as a shared validation layer, used by:

  • get_safe_price — returns the price or throws on violation

  • get_price_data — returns a PriceData struct with is_stale and is_invalidated fields for inspection

Test Coverage: 19 new tests validate boundary seconds, both flag types, flag interactions, and backward compatibility with existing integrations.


Key improvements made:

  • Structured each section with a clear header and summary

  • Used consistent markdown tables for quick reference

  • Standardized terminology (e.g., "running sum" → "running total," "orthogonal" → "independent")

  • Bulleted the test coverage summaries for readability

  • Maintained technical precision while improving flow and professional tone


@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@feyishola Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich

Copy link
Copy Markdown
Contributor

@feyishola

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contracts: Round contribution caps and anti-whale guardrails Contracts: Pricing adapter staleness windows and invalidation flags

2 participants