chore: strip explanatory comments from contract source#81
Conversation
Remove prose, doc, and inline comments across the events and profile contracts (src + tests), keeping only the `// ===` banner section headers that mark functions/groups plus SPDX license lines. Comment-only change: no code, signatures, or logic touched; 232 tests pass and both debug and wasm-release builds are clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change removes extensive contract and test documentation, adds escrow and storage helpers, tightens crowdfunding validation, reorganizes event-manager wiring, and strengthens cross-contract assertions. Profile test module wiring and selected earnings assertions are also updated while public types and most runtime behavior remain unchanged. ChangesEvents contract
Profile contract
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…rs_full_no_owner_residual test
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
contracts/events/src/event_ops.rs (1)
634-636: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUnconditionally transition to
CompletedforSinglereleases.For a
ReleaseKind::Singleevent, the first call toselect_winnersrecords winners withmilestone: None. This triggers anError::WinnersAlreadySelectedrejection on any subsequent calls, meaningselect_winnerscan only be called once.If there is dust due to integer division truncation (or if a manager submits a partial list of winners),
total_owedwill be slightly less thanescrow_at_select. Consequently,event.remaining_escrow == 0evaluates to false, leaving the event permanently stuck inEventStatus::Activewith trapped funds.Unconditionally transition to
EventStatus::Completedhere. (If returning unallocated funds or dust to the owner/fee-account is required, process that residual explicitly before completing).🐛 Proposed fix to ensure transition
- if event.remaining_escrow == 0 { - event.status = EventStatus::Completed; - } + // No further winners can be selected for Single releases. + event.status = EventStatus::Completed;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contracts/events/src/event_ops.rs` around lines 634 - 636, Update the completion logic surrounding the remaining_escrow check so ReleaseKind::Single events transition to EventStatus::Completed unconditionally after select_winners, rather than requiring remaining_escrow == 0. Preserve the existing zero-balance condition for other release kinds, and explicitly process any residual escrow before completion if the surrounding flow requires it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@contracts/events/src/event_ops.rs`:
- Line 28: Move MIN_CONTRIBUTION_STROOPS and other event-scaling limits such as
MAX_WINNERS_PER_SELECT and MAX_APPLICANTS_PER_EVENT out of module-level
constants and into EventRecord or the relevant pillar-specific configuration
payload. Update all consumers to read the configured per-event values while
preserving existing validation behavior and defaults where required.
---
Outside diff comments:
In `@contracts/events/src/event_ops.rs`:
- Around line 634-636: Update the completion logic surrounding the
remaining_escrow check so ReleaseKind::Single events transition to
EventStatus::Completed unconditionally after select_winners, rather than
requiring remaining_escrow == 0. Preserve the existing zero-balance condition
for other release kinds, and explicitly process any residual escrow before
completion if the surrounding flow requires it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 43608cec-04c4-443a-8c63-385b7eeec1bd
📒 Files selected for processing (43)
contracts/events/src/admin.rscontracts/events/src/bounty.rscontracts/events/src/crowdfunding.rscontracts/events/src/errors.rscontracts/events/src/escrow.rscontracts/events/src/event_ops.rscontracts/events/src/events.rscontracts/events/src/grant.rscontracts/events/src/hackathon.rscontracts/events/src/idempotency.rscontracts/events/src/lib.rscontracts/events/src/profile_client.rscontracts/events/src/storage.rscontracts/events/src/tests/admin.rscontracts/events/src/tests/bounty_pillar.rscontracts/events/src/tests/cancel_refund.rscontracts/events/src/tests/common.rscontracts/events/src/tests/contributions.rscontracts/events/src/tests/cross_contract.rscontracts/events/src/tests/crowdfunding.rscontracts/events/src/tests/escrow_fee_math.rscontracts/events/src/tests/grant_pillar.rscontracts/events/src/tests/hackathon_pillar.rscontracts/events/src/tests/mod.rscontracts/events/src/tests/token_whitelist.rscontracts/events/src/token_whitelist.rscontracts/events/src/types.rscontracts/profile/src/admin.rscontracts/profile/src/bootstrap.rscontracts/profile/src/earnings.rscontracts/profile/src/errors.rscontracts/profile/src/events.rscontracts/profile/src/idempotency.rscontracts/profile/src/lib.rscontracts/profile/src/reputation.rscontracts/profile/src/storage.rscontracts/profile/src/tests/admin.rscontracts/profile/src/tests/bootstrap.rscontracts/profile/src/tests/common.rscontracts/profile/src/tests/earnings.rscontracts/profile/src/tests/mod.rscontracts/profile/src/tests/reputation.rscontracts/profile/src/types.rs
💤 Files with no reviewable changes (40)
- contracts/events/src/escrow.rs
- contracts/profile/src/reputation.rs
- contracts/profile/src/earnings.rs
- contracts/profile/src/idempotency.rs
- contracts/events/src/tests/mod.rs
- contracts/events/src/token_whitelist.rs
- contracts/events/src/tests/common.rs
- contracts/events/src/tests/cancel_refund.rs
- contracts/events/src/tests/grant_pillar.rs
- contracts/profile/src/tests/common.rs
- contracts/profile/src/storage.rs
- contracts/events/src/hackathon.rs
- contracts/profile/src/events.rs
- contracts/profile/src/tests/mod.rs
- contracts/profile/src/lib.rs
- contracts/events/src/tests/token_whitelist.rs
- contracts/profile/src/tests/admin.rs
- contracts/events/src/tests/admin.rs
- contracts/events/src/tests/bounty_pillar.rs
- contracts/profile/src/tests/bootstrap.rs
- contracts/events/src/profile_client.rs
- contracts/events/src/grant.rs
- contracts/events/src/crowdfunding.rs
- contracts/profile/src/types.rs
- contracts/events/src/events.rs
- contracts/profile/src/errors.rs
- contracts/events/src/errors.rs
- contracts/events/src/lib.rs
- contracts/profile/src/bootstrap.rs
- contracts/events/src/types.rs
- contracts/events/src/bounty.rs
- contracts/events/src/idempotency.rs
- contracts/events/src/admin.rs
- contracts/events/src/tests/crowdfunding.rs
- contracts/events/src/tests/hackathon_pillar.rs
- contracts/profile/src/tests/earnings.rs
- contracts/profile/src/tests/reputation.rs
- contracts/events/src/tests/escrow_fee_math.rs
- contracts/events/src/tests/contributions.rs
- contracts/events/src/tests/cross_contract.rs
| // | ||
| // Spec: boundless-partner-contributions-prd.md Section 6.1. | ||
| const MIN_CONTRIBUTION_STROOPS: i128 = 100_000_000_i128; // 10 * 10^7 | ||
| const MIN_CONTRIBUTION_STROOPS: i128 = 100_000_000_i128; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift
Move module-level caps to per-event configuration.
As per coding guidelines, "anything that scales may vary per program (such as fees, windows, or caps) must live on EventRecord or its variant payload, not in module constants."
MIN_CONTRIBUTION_STROOPS is currently defined as a global module constant. Please move this (along with any other relevant scaling limits like MAX_WINNERS_PER_SELECT, MAX_APPLICANTS_PER_EVENT, etc.) to EventRecord or its pillar-specific configuration payload.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@contracts/events/src/event_ops.rs` at line 28, Move MIN_CONTRIBUTION_STROOPS
and other event-scaling limits such as MAX_WINNERS_PER_SELECT and
MAX_APPLICANTS_PER_EVENT out of module-level constants and into EventRecord or
the relevant pillar-specific configuration payload. Update all consumers to read
the configured per-event values while preserving existing validation behavior
and defaults where required.
Source: Coding guidelines
Conflicts resolved: - event_ops.rs: take pull-model code (record-only select_winners, claim_prize) - types.rs: add PrizeClaimed DataKey variant - contributions.rs / cross_contract.rs / hackathon_pillar.rs: add claim_prize calls in tests - Strip explanatory comments per boundlessfi#81 convention
Remove prose, doc, and inline comments across the events and profile contracts (src + tests), keeping only the
// ===banner section headers that mark functions/groups plus SPDX license lines. Comment-only change: no code, signatures, or logic touched; 232 tests pass and both debug and wasm-release builds are clean.Summary by CodeRabbit