Skip to content

Conversation

@rouzwelt
Copy link
Collaborator

@rouzwelt rouzwelt commented Nov 29, 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

  • Refactor
    • Router and provider event handlers now return explicit success flags to improve reliability of pool detection and lifecycle handling.
  • Chores
    • Removed a legacy liquidity provider from the active provider list.
    • Added a CI workflow that builds, lints, and enforces a clean git state on push.

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

@rouzwelt rouzwelt self-assigned this Nov 29, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 29, 2025

Walkthrough

Multiple router providers and the base liquidity provider were changed to return booleans from their event-processing methods; RainDataFetcher.updatePools now returns Promise and aggregates provider boolean results to indicate whether any new pools were created. NileV2Provider was removed from the providers list and a CI workflow was added.

Changes

Cohort / File(s) Summary
Base liquidity provider
packages/sushi/src/router/liquidity-providers/LiquidityProvider.ts
processLog(_log: Log) signature changed from void to boolean; default implementation now return false.
Uniswap V2 & V3 providers
packages/sushi/src/router/rain/UniswapV2Base.ts, packages/sushi/src/router/rain/UniswapV3Base.ts
processLog(log: Log) and handleFactoryEvents(log: Log) now return boolean. handleFactoryEvents returns this.nullPools.delete(...) on matched factory events and false otherwise; processLog captures/propagates that boolean while still invoking pool handlers.
Algebra & Velodrome providers
packages/sushi/src/router/rain/AlgebraV1Base.ts, packages/sushi/src/router/rain/VelodromeSlipstreamBase.ts
handleFactoryEvents(log: Log) signature changed to return boolean; factory-event paths return pool-deletion result, non-matching paths return false.
Rain data fetcher
packages/sushi/src/router/rain/RainDataFetcher.ts
updatePools(untilBlock?: bigint) now returns Promise<boolean>; function fetches untilBlock when needed, returns false on early-exits/no-results, and aggregates provider processLog booleans into isNewPoolCreated return value.
Data-fetcher providers list
packages/sushi/src/router/data-fetcher.ts
Removed NileV2Provider import and commented out its instantiation in the providers array.
CI workflow
.github/workflows/git-clean.yml
Adds "Git is clean" workflow that builds, lints, and fails if the working tree has uncommitted changes; installs Nix, restores caches, and runs pnpm/turbo steps.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Check that all overrides of LiquidityProvider.processLog now return booleans and that callers handle the return value.
  • Verify RainDataFetcher.updatePools correctly aggregates provider results and that early-exit paths consistently return booleans.
  • Confirm removed NileV2Provider usage doesn't leave dangling references or broken provider ordering.

Possibly related PRs

  • indexer extension #32 — Modifies the same Rain provider and data-fetcher methods and likely overlaps with these signature/flow changes.

Suggested labels

new feature

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 'return pool creation result for process log' directly summarizes the main changes across all modified files—converting processLog and related methods from void to boolean-returning functions to track pool creation outcomes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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-11-29-return-pool-creation-result

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d598d7 and 2689ed1.

📒 Files selected for processing (1)
  • packages/sushi/src/router/rain/RainDataFetcher.ts (5 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/UniswapV3Base.ts:71-92
Timestamp: 2025-04-09T16:38:40.404Z
Learning: In packages/sushi/src/router/rain/UniswapV3Base.ts, the fetchPoolData method uses multicall where each pool returns its own response independently, and failures are handled at the individual pool level rather than affecting all pools at once.
📚 Learning: 2025-04-09T16:38:40.404Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/UniswapV3Base.ts:71-92
Timestamp: 2025-04-09T16:38:40.404Z
Learning: In packages/sushi/src/router/rain/UniswapV3Base.ts, the fetchPoolData method uses multicall where each pool returns its own response independently, and failures are handled at the individual pool level rather than affecting all pools at once.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-04-08T19:08:36.306Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/UniswapV3Base.ts:169-210
Timestamp: 2025-04-08T19:08:36.306Z
Learning: In packages/sushi/src/router/rain/UniswapV3Base.ts, the methods getIndexes and fetchPoolsForToken are separate methods with distinct responsibilities and not closely interlinked as might be assumed.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-04-08T21:48:34.425Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/UniswapV3Base.ts:93-117
Timestamp: 2025-04-08T21:48:34.425Z
Learning: In the SushiSwap router implementation, error handling for multicall failures in methods like `fetchPoolData` is simplified (logging and returning undefined) because it's handled downstream in the calling code.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-11-27T23:22:08.828Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 40
File: protocols/route-processor/test/DataFetcher.test.ts:242-271
Timestamp: 2025-11-27T23:22:08.828Z
Learning: In protocols/route-processor/test/DataFetcher.test.ts, the 60-second sleep delays between test branches are intentional and necessary due to rate limiting constraints on public RPCs. These sleeps should not be reduced or conditionally gated.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-04-09T16:44:17.669Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/RainDataFetcher.ts:317-339
Timestamp: 2025-04-09T16:44:17.669Z
Learning: The `processLog` method in router providers is synchronous and must process blockchain logs sequentially to maintain consistent state between events.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-04-09T15:38:12.307Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/UniswapV2Base.ts:127-144
Timestamp: 2025-04-09T15:38:12.307Z
Learning: In blockchain event processing systems, logs arrive in order, which explains the design choice to check log.blockNumber against pool.blockNumber and only process newer logs.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: datafetcher-test (CRONOS)
  • GitHub Check: datafetcher-test (ZETACHAIN)
  • GitHub Check: datafetcher-test (BASE)
  • GitHub Check: datafetcher-test (CORE)
  • GitHub Check: datafetcher-test (THUNDERCORE)
  • GitHub Check: datafetcher-test (OPTIMISM)
  • GitHub Check: datafetcher-test (KAVA)
  • GitHub Check: datafetcher-test (OKEX)
  • GitHub Check: datafetcher-test (CELO)
  • GitHub Check: datafetcher-test (HARMONY)
  • GitHub Check: datafetcher-test (TELOS)
  • GitHub Check: datafetcher-test (MOONRIVER)
  • GitHub Check: datafetcher-test (ARBITRUM)
  • GitHub Check: datafetcher-test (FANTOM)
  • GitHub Check: datafetcher-test (AVALANCHE)
  • GitHub Check: datafetcher-test (ARBITRUM_NOVA)
  • GitHub Check: datafetcher-test (ETHEREUM)
  • GitHub Check: datafetcher-test (POLYGON)
  • GitHub Check: router-test
  • GitHub Check: git-clean
🔇 Additional comments (4)
packages/sushi/src/router/rain/RainDataFetcher.ts (4)

282-283: LGTM: Documentation updated correctly.

The documentation accurately reflects that the method now returns a boolean indicating whether new pools were created.


286-286: LGTM: Signature change aligns with PR objective.

The return type change from Promise<void> to Promise<boolean> correctly implements the PR's goal to indicate pool creation results.


321-333: LGTM: Early returns are correct.

The early exit paths correctly return false when:

  • No existing pools to update (line 321)
  • No new blocks to process (line 322)
  • No pool addresses to monitor (line 333)

These scenarios all indicate no new pools were created.


418-418: LGTM: Return statement completes the implementation.

The method correctly returns the accumulated boolean, allowing callers to determine whether any new pools were created during the update.


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

Copy link

@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)
packages/sushi/src/router/data-fetcher.ts (1)

185-285: NileV2Provider is silently disabled here; consider explicit deprecation or cleanup.

Commenting out NileV2Provider in _setProviders (and dropping its import) means routes will no longer include Nile V2 pools, but any config or code that still references a LiquidityProviders.NileV2 enum value will now be effectively ignored with no obvious signal.

If Nile V2 is permanently deprecated, it would be cleaner to:

  • Remove NileV2Provider from the provider list entirely (rather than leaving it commented), and
  • Remove or clearly deprecate any corresponding enum entries / wiring (if they still exist), or
  • Add a short comment explaining why it’s disabled (e.g., “temporarily disabled due to broken subgraph / contracts”).

This makes the behavior change explicit and reduces confusion for future maintainers.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e119e70 and 2d598d7.

📒 Files selected for processing (3)
  • .github/workflows/git-clean.yml (1 hunks)
  • packages/sushi/src/router/data-fetcher.ts (1 hunks)
  • packages/sushi/src/router/rain/RainDataFetcher.ts (5 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-04-09T16:38:40.404Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/UniswapV3Base.ts:71-92
Timestamp: 2025-04-09T16:38:40.404Z
Learning: In packages/sushi/src/router/rain/UniswapV3Base.ts, the fetchPoolData method uses multicall where each pool returns its own response independently, and failures are handled at the individual pool level rather than affecting all pools at once.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-04-08T19:08:36.306Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/UniswapV3Base.ts:169-210
Timestamp: 2025-04-08T19:08:36.306Z
Learning: In packages/sushi/src/router/rain/UniswapV3Base.ts, the methods getIndexes and fetchPoolsForToken are separate methods with distinct responsibilities and not closely interlinked as might be assumed.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-04-08T21:48:34.425Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/UniswapV3Base.ts:93-117
Timestamp: 2025-04-08T21:48:34.425Z
Learning: In the SushiSwap router implementation, error handling for multicall failures in methods like `fetchPoolData` is simplified (logging and returning undefined) because it's handled downstream in the calling code.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-11-27T23:22:08.828Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 40
File: protocols/route-processor/test/DataFetcher.test.ts:242-271
Timestamp: 2025-11-27T23:22:08.828Z
Learning: In protocols/route-processor/test/DataFetcher.test.ts, the 60-second sleep delays between test branches are intentional and necessary due to rate limiting constraints on public RPCs. These sleeps should not be reduced or conditionally gated.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-04-09T15:38:12.307Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/UniswapV2Base.ts:127-144
Timestamp: 2025-04-09T15:38:12.307Z
Learning: In blockchain event processing systems, logs arrive in order, which explains the design choice to check log.blockNumber against pool.blockNumber and only process newer logs.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
📚 Learning: 2025-04-09T16:44:17.669Z
Learnt from: rouzwelt
Repo: rainlanguage/sushiswap PR: 32
File: packages/sushi/src/router/rain/RainDataFetcher.ts:317-339
Timestamp: 2025-04-09T16:44:17.669Z
Learning: The `processLog` method in router providers is synchronous and must process blockchain logs sequentially to maintain consistent state between events.

Applied to files:

  • packages/sushi/src/router/rain/RainDataFetcher.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: git-clean
  • GitHub Check: datafetcher-test (FLARE)
  • GitHub Check: datafetcher-test (BASE)
  • GitHub Check: datafetcher-test (FILECOIN)
  • GitHub Check: datafetcher-test (FUSE)
  • GitHub Check: datafetcher-test (OPTIMISM)
  • GitHub Check: datafetcher-test (BOBA_BNB)
  • GitHub Check: datafetcher-test (POLYGON_ZKEVM)
  • GitHub Check: datafetcher-test (METIS)
  • GitHub Check: datafetcher-test (KAVA)
  • GitHub Check: datafetcher-test (TELOS)
  • GitHub Check: datafetcher-test (CELO)
  • GitHub Check: datafetcher-test (ARBITRUM_NOVA)
  • GitHub Check: datafetcher-test (OKEX)
  • GitHub Check: datafetcher-test (ARBITRUM)
  • GitHub Check: datafetcher-test (AVALANCHE)
  • GitHub Check: datafetcher-test (HARMONY)
  • GitHub Check: datafetcher-test (BSC)
  • GitHub Check: datafetcher-test (FANTOM)
  • GitHub Check: router-test
🔇 Additional comments (3)
.github/workflows/git-clean.yml (1)

1-38: Clarify the workflow's purpose and verify build scope aligns with PR changes.

The workflow appears to run post-push and checks for uncommitted changes—a check that typically prevents code from being committed in the first place. This suggests the workflow may be misconfigured or its purpose is unclear.

Additionally, the build step (line 31) scopes to ./packages/sushi only, but the PR's summary indicates changes across multiple liquidity provider classes and data fetchers. Verify that this build scope is sufficient to exercise all the boolean return-type changes described in the PR.

Please clarify:

  1. Is this workflow intended as post-commit validation (in which case the git diff --exit-code check is redundant), or as a pre-commit guard (which would be better suited for a pre-commit hook or pull-request workflow)?
  2. Does the ./packages/sushi build scope fully cover the changes described in the PR (liquidity provider classes and RainDataFetcher updates)?
  3. Is the scoped build intentional, or should it build the entire workspace?
packages/sushi/src/router/rain/RainDataFetcher.ts (2)

321-333: LGTM!

The early return paths correctly return false for cases where no pool updates occur: uninitialized state, already synced, or empty pool list. These semantically represent "no new pool was created."


282-286: Based on my comprehensive verification, I can now provide the rewritten review comment:


Public API change: updatePools now returns Promise<boolean> indicating new pool creation.

The signature change and documentation update are correct. The method properly returns false in early exit cases and accumulates a flag tracking whether any logs indicated new pool creation. The sole internal caller at line 478 safely ignores the return value, maintaining backward compatibility—returning a value from a previously void-returning function does not break existing code that ignores it. Tests in RainDataFetcher.test.ts work without modification.

@rouzwelt rouzwelt merged commit 69b4ce0 into rain-fork Nov 29, 2025
32 of 36 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 1, 2025
4 tasks
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