Skip to content

Conversation

@rouzwelt
Copy link
Collaborator

@rouzwelt rouzwelt commented Dec 19, 2025

Motivation

Solution

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

Release Notes

  • New Features
    • Added skipSweep configuration option to specify token addresses that should be excluded from sweep and conversion operations. Tokens listed in skipSweep will be automatically skipped during fund sweeping and gas conversion workflows. Skipped tokens will be marked with a "skipped" status in operation reports instead of being processed.

✏️ Tip: You can customize this high-level summary in your review settings.

@rouzwelt rouzwelt self-assigned this Dec 19, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Walkthrough

The pull request adds a new skipSweep configuration option that allows specifying tokens to skip during sweep and conversion operations. The feature is introduced through configuration files, integrated into the AppOptions type system with address validation, and implemented as conditional skip logic in wallet sweep and conversion loops.

Changes

Cohort / File(s) Change Summary
Configuration fields
config.env.yaml, config.example.yaml
Added new skipSweep configuration field to specify tokens to skip during sweep operations. Env var references $SKIP_SWEEP, example YAML lists token addresses.
AppOptions type definition
src/cli/commands/sweep.ts, src/config/yaml.ts
Added public skipSweep field of type Set<string> to AppOptions. Integrated address validation via Validator.resolveAddressSet() in AppOptions.tryFrom() method.
Wallet sweep and convert logic
src/wallet/index.ts
Implemented skip checks in sweepWallet and convertHoldingsToGas loops: if token address exists in appOptions.skipSweep, mark status as "skipped" and bypass processing.
Test setup and validation
src/config/yaml.test.ts, src/wallet/index.test.ts
Added skipSweep initialization in YAML parsing tests with Set population expectations. Updated wallet state initializations to include appOptions.skipSweep: new Set().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify Validator.resolveAddressSet() correctly parses and validates token addresses from configuration
  • Confirm skip logic placement and conditions in both sweepWallet and convertHoldingsToGas loops are correct
  • Review test coverage to ensure skipSweep functionality is adequately tested across config parsing and wallet operations

Possibly related PRs

Suggested labels

enhancement, update, general update

Suggested reviewers

  • hardyjosh

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Skip token sweep' directly describes the main feature added: skipping specific tokens during the sweep process via the skipSweep field.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2025-12-19-skip-token-sweep

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)
src/wallet/index.ts (1)

321-357: Critical: Missing skip logic in sweepWallet for consistency.

The sweepWallet method transfers ERC20 tokens without checking the skipSweep set, while convertHoldingsToGas (lines 432-435) does implement the skip logic. Based on the PR description stating tokens should be skipped "during sweep and conversion operations," this appears to be an inconsistency.

Should sweepWallet also skip tokens that are in appOptions.skipSweep? If so, add similar logic here:

🔎 Proposed fix to add skip logic
 // sweep erc20 tokens from the wallet
 for (const [, tokenDetails] of this.state.watchedTokens) {
     report.setAttr(`details.transfers.${tokenDetails.symbol}.token`, tokenDetails.address);
+
+    if (this.state.appOptions.skipSweep.has(tokenDetails.address.toLowerCase())) {
+        report.setAttr(`details.transfers.${tokenDetails.symbol}.status`, "skipped");
+        continue;
+    }
+
     try {
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51b38ce and 6ed60c6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • config.env.yaml (1 hunks)
  • config.example.yaml (1 hunks)
  • src/cli/commands/sweep.ts (1 hunks)
  • src/config/yaml.test.ts (4 hunks)
  • src/config/yaml.ts (2 hunks)
  • src/wallet/index.test.ts (2 hunks)
  • src/wallet/index.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-10T00:57:36.977Z
Learnt from: rouzwelt
Repo: rainlanguage/rain.solver PR: 408
File: src/core/modes/index.ts:163-194
Timestamp: 2025-10-10T00:57:36.977Z
Learning: In the rain.solver repository's `src/core/modes/index.ts`, the `getEnabledTrades` function implements "opt-in per orderbook with default-all fallback" semantics: if an orderbook address is not present in any of the orderbookTradeTypes sets (router, intraOrderbook, interOrderbook), all trade types are enabled by default. If the orderbook appears in at least one set, only the trade types for which it is explicitly listed are enabled. This is intentional behavior to provide a sane default.

Applied to files:

  • src/cli/commands/sweep.ts
  • src/config/yaml.test.ts
🔇 Additional comments (8)
config.env.yaml (1)

34-34: LGTM! Configuration field added correctly.

The skipSweep field is properly placed and follows the existing pattern of using environment variables.

config.example.yaml (1)

109-112: LGTM! Example configuration is clear and well-documented.

The skipSweep configuration is properly documented with clear examples that follow the established pattern used throughout the configuration file.

src/cli/commands/sweep.ts (1)

122-122: Verify intentional behavior: sweep command always uses empty skipSweep.

The sweep command initializes skipSweep as an empty Set, meaning no tokens will be skipped during the sweep operation. This appears intentional since this is an explicit sweep command rather than automatic bounty processing, but please confirm:

  • Is it intentional that the sweep command doesn't respect a skipSweep configuration?
  • Should users be able to specify tokens to skip even in the explicit sweep command?
src/config/yaml.ts (2)

100-101: LGTM! Type definition is clear and accurate.

The skipSweep field is properly typed as Set<string> with clear documentation explaining its purpose for skipping bounty tokens during sweeping.


280-283: LGTM! Configuration resolution is implemented correctly.

The skipSweep field is resolved using Validator.resolveAddressSet, which provides:

  • Address validation
  • Deduplication via Set
  • Clear error messaging

This is consistent with how orderbookTradeTypes addresses are resolved elsewhere in the codebase.

src/config/yaml.test.ts (2)

42-44: LGTM! Test coverage for skipSweep configuration.

The test properly verifies that skipSweep is parsed from YAML into a Set of addresses, with appropriate test addresses following the established pattern.

Also applies to: 150-150


190-190: LGTM! Test verifies default behavior.

The test correctly verifies that when skipSweep is undefined in the input, it defaults to an empty Set, ensuring the field is always initialized.

Also applies to: 326-326

src/wallet/index.ts (1)

432-435: LGTM! Skip logic implemented correctly.

The convertHoldingsToGas method properly checks if a token address is in the skipSweep set before attempting conversion. The implementation:

  • Uses toLowerCase() for case-insensitive address comparison
  • Sets clear "skipped" status in the report
  • Continues to the next token without attempting conversion

@rouzwelt rouzwelt merged commit 3972032 into master Dec 20, 2025
10 of 13 checks passed
@github-actions
Copy link
Contributor

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 20, 2025

Tip

For best results, initiate chat on the files or code changes.

SIZE=M

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.

2 participants