Skip to content

chore: strip explanatory comments from contract source#81

Merged
0xdevcollins merged 2 commits into
testnetfrom
fix/-strip-comments
Jul 17, 2026
Merged

chore: strip explanatory comments from contract source#81
0xdevcollins merged 2 commits into
testnetfrom
fix/-strip-comments

Conversation

@0xdevcollins

@0xdevcollins 0xdevcollins commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

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

  • New Features
    • Added no-fee escrow deposits for exact token amounts.
    • Added support for managing supported tokens, event managers, applicants, and winners.
  • Validation
    • Strengthened event creation checks for release configuration, deadlines, token support, title length, and budget limits.
  • Tests
    • Expanded integration coverage for balances, profiles, event records, fee overrides, milestone replay protection, and manager authorization.
  • Documentation
    • Streamlined inline documentation and formatting across event and profile contracts and their tests.

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>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@0xdevcollins, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 48067250-ab7a-474a-b81d-9152e8a2e63c

📥 Commits

Reviewing files that changed from the base of the PR and between 5cf0759 and b1c3f47.

📒 Files selected for processing (1)
  • contracts/events/src/tests/contributions.rs
📝 Walkthrough

Walkthrough

This 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.

Changes

Events contract

Layer / File(s) Summary
Validation and lifecycle flow
contracts/events/src/{admin,bounty,crowdfunding,escrow,event_ops,idempotency}.rs
Adds deposit_no_fee, tightens crowdfunding creation validation, and reorganizes event creation, manager authorization, cancellation, winner selection, and idempotency code.
Contracts and integration coverage
contracts/events/src/{errors,events,lib,profile_client,types}.rs, contracts/events/src/storage.rs, contracts/events/src/tests/*
Preserves existing contracts while adding explicit balance, profile, fee, replay, winner, and manager assertions; removes explanatory comments and documentation.

Profile contract

Layer / File(s) Summary
Test entry and behavior
contracts/profile/src/tests/*
Adds the test module entry declarations and retains earnings, bootstrap, reputation, and admin test behavior while trimming comments and adjusting assertion placement.
Source contracts and types
contracts/profile/src/{admin,bootstrap,earnings,errors,events,idempotency,lib,reputation,storage,types}.rs
Removes module and inline documentation while preserving profile APIs, storage, lifecycle logic, errors, events, and data types.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Poem

A rabbit reviewed the contracts with care,
Brushed dusty comments from everywhere.
Escrow hopped softly, validations grew,
Tests checked balances and profiles anew.
“Less fluff, more signals!” the rabbit cried—
Then bounded home with code by its side.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing explanatory comments from contract source.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/-strip-comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@0xdevcollins
0xdevcollins merged commit 862cb7d into testnet Jul 17, 2026
3 of 4 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Unconditionally transition to Completed for Single releases.

For a ReleaseKind::Single event, the first call to select_winners records winners with milestone: None. This triggers an Error::WinnersAlreadySelected rejection on any subsequent calls, meaning select_winners can only be called once.

If there is dust due to integer division truncation (or if a manager submits a partial list of winners), total_owed will be slightly less than escrow_at_select. Consequently, event.remaining_escrow == 0 evaluates to false, leaving the event permanently stuck in EventStatus::Active with trapped funds.

Unconditionally transition to EventStatus::Completed here. (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

📥 Commits

Reviewing files that changed from the base of the PR and between e1f1793 and 5cf0759.

📒 Files selected for processing (43)
  • contracts/events/src/admin.rs
  • contracts/events/src/bounty.rs
  • contracts/events/src/crowdfunding.rs
  • contracts/events/src/errors.rs
  • contracts/events/src/escrow.rs
  • contracts/events/src/event_ops.rs
  • contracts/events/src/events.rs
  • contracts/events/src/grant.rs
  • contracts/events/src/hackathon.rs
  • contracts/events/src/idempotency.rs
  • contracts/events/src/lib.rs
  • contracts/events/src/profile_client.rs
  • contracts/events/src/storage.rs
  • contracts/events/src/tests/admin.rs
  • contracts/events/src/tests/bounty_pillar.rs
  • contracts/events/src/tests/cancel_refund.rs
  • contracts/events/src/tests/common.rs
  • contracts/events/src/tests/contributions.rs
  • contracts/events/src/tests/cross_contract.rs
  • contracts/events/src/tests/crowdfunding.rs
  • contracts/events/src/tests/escrow_fee_math.rs
  • contracts/events/src/tests/grant_pillar.rs
  • contracts/events/src/tests/hackathon_pillar.rs
  • contracts/events/src/tests/mod.rs
  • contracts/events/src/tests/token_whitelist.rs
  • contracts/events/src/token_whitelist.rs
  • contracts/events/src/types.rs
  • contracts/profile/src/admin.rs
  • contracts/profile/src/bootstrap.rs
  • contracts/profile/src/earnings.rs
  • contracts/profile/src/errors.rs
  • contracts/profile/src/events.rs
  • contracts/profile/src/idempotency.rs
  • contracts/profile/src/lib.rs
  • contracts/profile/src/reputation.rs
  • contracts/profile/src/storage.rs
  • contracts/profile/src/tests/admin.rs
  • contracts/profile/src/tests/bootstrap.rs
  • contracts/profile/src/tests/common.rs
  • contracts/profile/src/tests/earnings.rs
  • contracts/profile/src/tests/mod.rs
  • contracts/profile/src/tests/reputation.rs
  • contracts/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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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

Shadow-MMN pushed a commit to Shadow-MMN/boundless-contract that referenced this pull request Jul 17, 2026
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
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.

1 participant