Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add networkId logic to superfluid subgraphs #1896

Merged
merged 3 commits into from
Dec 26, 2024

Conversation

CarlosQ96
Copy link
Collaborator

@CarlosQ96 CarlosQ96 commented Dec 24, 2024

Summary by CodeRabbit

  • New Features
    • Introduced a new GraphQL query for retrieving eligible projects for recurring donations.
  • Enhancements
    • Updated several methods to include a networkId parameter for improved network context handling.
    • Enhanced flow retrieval processes to specify network IDs in various service functions.
    • Improved handling of subgraph URLs based on network IDs for better data fetching.
  • Bug Fixes
    • Adjusted account balance validation to include network ID for accurate balance checks.

Copy link
Collaborator

@kkatusic kkatusic left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

Walkthrough

The pull request introduces network-specific enhancements to the SuperFluid adapter and related services. The primary modification involves adding a networkId parameter to various methods across multiple files, enabling more flexible and context-aware interactions with SuperFluid's subgraph. The changes span the SuperFluid adapter, interface, mock adapter, and several services, ensuring consistent network-specific data retrieval for recurring donations and flow-related operations.

Changes

File Change Summary
src/adapters/superFluid/superFluidAdapter.ts - Added subgraphUrlMap for network-specific subgraph URLs
- Introduced getSubgraphUrl function
- Updated methods to include networkId parameter
src/adapters/superFluid/superFluidAdapterInterface.ts - Modified method signatures to include networkId in accountBalance and getFlowByTxHash
src/adapters/superFluid/superFluidMockAdapter.ts - Updated getFlowByReceiverSenderFlowRate and getFlowByTxHash to accept networkId
src/services/chains/evm/draftRecurringDonationService.ts - Added networkId to getFlowParams object
src/services/cronJobs/checkUserSuperTokenBalancesQueue.ts - Modified validateDonorSuperTokenBalance to pass networkId
src/services/recurringDonationService.ts - Updated updateRecurringDonationStatusWithNetwork to include networkId in SuperFluid adapter calls
test/graphqlQueries.ts - Added recurringDonationEligibleProjectsQuery with optional networkId parameter

Possibly related PRs

Poem

🐰 In the realm of networks wide and bright,
Our adapter now shines with network might!
With IDs dancing, URLs so clear,
SuperFluid flows without a fear 🌊
A rabbit's code, both smart and light! 🚀

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 Nitpick comments (6)
src/adapters/superFluid/superFluidAdapter.ts (4)

7-14: Mismatch in naming constants vs. actual chain references
The constants mention "Polygon" while the URLs point to Optimism. This can be confusing for future maintainers.

Consider renaming them to something like superFluidGraphqlOptimismUrl and superFluidGraphqlOptimismStagingUrl for clarity.


23-30: Consider externalizing subgraph URLs
Storing these URLs in code is fine for now, but if additional networks or environments are added, you might consider loading them from configuration to ensure easy maintenance.


186-186: Validate typed responses
While the approach to fetch accountTokenSnapshots is correct, the method still returns untyped data (any). Consider defining an interface for typed responses to catch potential runtime issues.

Also applies to: 188-188


233-233: Unify repeated flow query logic
getFlowByReceiverSenderFlowRate and getFlowByTxHash share similar code for constructing subgraph queries. Consider extracting common logic to maintain consistency and avoid duplication.

Also applies to: 236-236, 237-237

src/adapters/superFluid/superFluidMockAdapter.ts (1)

98-98: Safe to ignore networkId
Returning a random string in the mock is acceptable. Ensure whenever your tests rely on networkId, you update the mock accordingly.

test/graphqlQueries.ts (1)

2075-2092: Query looks good, but consider adding pagination or filter arguments to the query definition
The $networkId, $page, and $limit parameters are declared but not used within the query body. If you plan to implement pagination or additional filtering later, make sure to pass these parameters into recurringDonationEligibleProjects or remove them to avoid confusion.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 82dfc17 and a90bf7e.

📒 Files selected for processing (7)
  • src/adapters/superFluid/superFluidAdapter.ts (4 hunks)
  • src/adapters/superFluid/superFluidAdapterInterface.ts (1 hunks)
  • src/adapters/superFluid/superFluidMockAdapter.ts (2 hunks)
  • src/services/chains/evm/draftRecurringDonationService.ts (1 hunks)
  • src/services/cronJobs/checkUserSuperTokenBalancesQueue.ts (1 hunks)
  • src/services/recurringDonationService.ts (1 hunks)
  • test/graphqlQueries.ts (1 hunks)
🔇 Additional comments (6)
src/adapters/superFluid/superFluidAdapter.ts (2)

16-21: Network-specific mapping looks solid
This map is comprehensive for the listed chains. Remember to add an entry or fallback whenever a new network is introduced.


207-207: Consistent usage of subgraph URLs
Including networkId to retrieve the correct subgraph URL is a good approach.

Also applies to: 210-210

src/adapters/superFluid/superFluidMockAdapter.ts (1)

88-88: Mock ignores new parameter
Including networkId in _params is fine for a mock. Just remain aware that if future logic depends on networkId, the mock will need to reflect that.

src/services/cronJobs/checkUserSuperTokenBalancesQueue.ts (1)

111-111: Good use of networkId for accountBalance
Passing the correct networkId ensures subgraph calls go to the right endpoint. The updated signature is properly used here.

src/services/chains/evm/draftRecurringDonationService.ts (1)

50-50: Consistent inclusion of networkId
Including networkId in getFlowParams aligns with the newly updated adapter methods, ensuring the correct subgraph is queried. Nicely done!

src/services/recurringDonationService.ts (1)

396-396: Validate networkId before calling getFlowByTxHash
While passing networkId is correct for ensuring the subgraph is queried for the right network, consider verifying that recurringDonation.networkId is valid and not null/undefined to prevent unexpected behavior or errors when awaiting the external call.

@@ -20,12 +20,13 @@ export interface SuperFluidAdapterInterface {
currency: string;
recurringDonationTxHash: string;
}): Promise<any>;
accountBalance(accountId: string): Promise<any>;
accountBalance(accountId: string, networkId: number): Promise<any>;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Interface missing networkId in one of the method definitions
The getFlowByReceiverSenderFlowRate method in the adapter now accepts networkId, but the interface doesn't match. This can lead to inconsistent usage.

Apply this diff to keep the interface in sync:

 export interface SuperFluidAdapterInterface {
   ...
   getFlowByReceiverSenderFlowRate(params: {
     receiver: string;
     sender: string;
     flowRate: string;
     timestamp_gt: number;
+    networkId: number;
   }): Promise<FlowUpdatedEvent | undefined>;
 }

Also applies to: 29-29

@kkatusic
Copy link
Collaborator

@CarlosQ96 it fails somewhere :(

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: 3

🔭 Outside diff range comments (1)
src/adapters/superFluid/superFluidAdapter.ts (1)

Based on the analysis of the error handling patterns in the codebase, particularly in the superFluidAdapter.ts file and other network request handlers, I can provide the final response:

Inconsistent error handling in network requests needs attention

The error handling across network requests shows inconsistencies that need to be addressed:

  • accountBalance() method swallows the error and returns undefined
  • getFlowByTxHash() and getFlowByReceiverSenderFlowRate() rethrow the error after logging
  • No validation of response data before accessing nested properties (e.g., response.data.data.account?.accountTokenSnapshots)

Recommendations:

  • Add proper error handling with specific error types for different failure scenarios
  • Validate response data before accessing nested properties
  • Be consistent with error propagation - either handle errors at this layer or propagate them
  • Consider adding retry logic for transient network failures
🔗 Analysis chain

Line range hint 186-258: Verify error handling across network requests

Given the user comment "it fails somewhere :(", we should verify the error handling across all network requests.

Run the following script to analyze error handling patterns:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check error handling patterns in network requests

# Look for axios error handling patterns
rg -A 5 "catch \(e\)" --type ts

# Look for potential network-related error handling
ast-grep --pattern 'try {
  $$$
  await axios.$$$
  $$$
} catch (e) {
  $$$
}'

Length of output: 71181

🧰 Tools
🪛 GitHub Check: test

[failure] 242-242:
'networkId' is assigned a value but never used

🪛 eslint

[error] 242-242: 'networkId' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)

🧹 Nitpick comments (1)
src/adapters/superFluid/superFluidAdapter.ts (1)

24-30: Consider graceful fallback for getSubgraphUrl

The current implementation throws an error if no URL is found. Consider adding a fallback mechanism or default URL for better resilience.

Example implementation:

 const getSubgraphUrl = (networkId: number) => {
   const url = subgraphUrlMap[networkId];
   if (!url) {
-    throw new Error(`No subgraph URL found for network ID: ${networkId}`);
+    logger.warn(`No specific subgraph URL found for network ID: ${networkId}, using default`);
+    return superFluidGraphqlOptimismUrl; // or another suitable default
   }
   return url;
 };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a90bf7e and 8935b46.

📒 Files selected for processing (2)
  • src/adapters/superFluid/superFluidAdapter.ts (4 hunks)
  • src/adapters/superFluid/superFluidAdapterInterface.ts (1 hunks)
🧰 Additional context used
🪛 GitHub Check: test
src/adapters/superFluid/superFluidAdapter.ts

[failure] 211-211:
'networkId' is assigned a value but never used


[failure] 242-242:
'networkId' is assigned a value but never used

🪛 eslint
src/adapters/superFluid/superFluidAdapter.ts

[error] 211-211: 'networkId' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)


[error] 242-242: 'networkId' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)

🔇 Additional comments (5)
src/adapters/superFluid/superFluidAdapterInterface.ts (3)

23-23: LGTM: accountBalance signature updated correctly

The networkId parameter has been properly added to the accountBalance method signature.


29-29: LGTM: getFlowByTxHash signature updated correctly

The networkId parameter has been properly added to the getFlowByTxHash method parameters.


36-36: LGTM: getFlowByReceiverSenderFlowRate signature updated correctly

The networkId parameter has been properly added to the getFlowByReceiverSenderFlowRate method parameters.

src/adapters/superFluid/superFluidAdapter.ts (2)

16-21: Verify BASE_SEPOLIA configuration

BASE_MAINNET and BASE_SEPOLIA are using the same URL. This might be incorrect as typically testnet and mainnet use different subgraph endpoints.

Please verify if this is intentional or if BASE_SEPOLIA should use a different URL.


186-188: LGTM: accountBalance implementation

The networkId parameter is properly used to get the correct subgraph URL.

Comment on lines +9 to +14
const superFluidGraphqlPolygonUrl =
'https://subgraph-endpoints.superfluid.dev/optimism-mainnet/protocol-v1';
const superFluidGraphqlStagingUrl =
const superFluidGraphqlPolygonStagingUrl =
'https://optimism-sepolia.subgraph.x.superfluid.dev';
const superFluidGraphBaseUrl =
'https://subgraph-endpoints.superfluid.dev/base-mainnet/protocol-v1';
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix misleading constant names

The constant names suggest Polygon network but they're actually for Optimism network. This could lead to confusion and maintenance issues.

Apply this diff to fix the naming:

-const superFluidGraphqlPolygonUrl =
+const superFluidGraphqlOptimismUrl =
   'https://subgraph-endpoints.superfluid.dev/optimism-mainnet/protocol-v1';
-const superFluidGraphqlPolygonStagingUrl =
+const superFluidGraphqlOptimismSepoliaUrl =
   'https://optimism-sepolia.subgraph.x.superfluid.dev';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const superFluidGraphqlPolygonUrl =
'https://subgraph-endpoints.superfluid.dev/optimism-mainnet/protocol-v1';
const superFluidGraphqlStagingUrl =
const superFluidGraphqlPolygonStagingUrl =
'https://optimism-sepolia.subgraph.x.superfluid.dev';
const superFluidGraphBaseUrl =
'https://subgraph-endpoints.superfluid.dev/base-mainnet/protocol-v1';
const superFluidGraphqlOptimismUrl =
'https://subgraph-endpoints.superfluid.dev/optimism-mainnet/protocol-v1';
const superFluidGraphqlOptimismSepoliaUrl =
'https://optimism-sepolia.subgraph.x.superfluid.dev';
const superFluidGraphBaseUrl =
'https://subgraph-endpoints.superfluid.dev/base-mainnet/protocol-v1';

Comment on lines 210 to 216
const subgraphUrl = getSubgraphUrl(params.networkId);
const { networkId, ...whereParams } = params;

const response = await axios.post(subgraphUrl, {
query: getFlowsQuery,
variables: {
where: params,
where: whereParams,
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix unused networkId variable

The destructured networkId variable is not used. The linter correctly flagged this issue.

Apply this diff to fix the issue:

-      const { networkId, ...whereParams } = params;
+      const { networkId: _, ...whereParams } = params;

This change explicitly indicates that we're intentionally not using the networkId after destructuring.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const subgraphUrl = getSubgraphUrl(params.networkId);
const { networkId, ...whereParams } = params;
const response = await axios.post(subgraphUrl, {
query: getFlowsQuery,
variables: {
where: params,
where: whereParams,
const subgraphUrl = getSubgraphUrl(params.networkId);
const { networkId: _, ...whereParams } = params;
const response = await axios.post(subgraphUrl, {
query: getFlowsQuery,
variables: {
where: whereParams,
🧰 Tools
🪛 GitHub Check: test

[failure] 211-211:
'networkId' is assigned a value but never used

🪛 eslint

[error] 211-211: 'networkId' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)

Comment on lines 238 to 247
const subgraphUrl = getSubgraphUrl(params.networkId);

logger.debug('getFlowByReceiverSenderFlowRate has been called', params);

const { networkId, ...whereParams } = params;

const response = await axios.post(subgraphUrl, {
query: getFlowsQuery,
variables: {
where: params,
where: whereParams,
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix unused networkId variable and improve logging

Similar to the previous issue, the networkId variable is unused. Also, the debug log could be more informative.

Apply this diff to fix these issues:

       const subgraphUrl = getSubgraphUrl(params.networkId);
 
-      logger.debug('getFlowByReceiverSenderFlowRate has been called', params);
+      logger.debug('getFlowByReceiverSenderFlowRate called with params:', {
+        ...params,
+        subgraphUrl
+      });
 
-      const { networkId, ...whereParams } = params;
+      const { networkId: _, ...whereParams } = params;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const subgraphUrl = getSubgraphUrl(params.networkId);
logger.debug('getFlowByReceiverSenderFlowRate has been called', params);
const { networkId, ...whereParams } = params;
const response = await axios.post(subgraphUrl, {
query: getFlowsQuery,
variables: {
where: params,
where: whereParams,
const subgraphUrl = getSubgraphUrl(params.networkId);
logger.debug('getFlowByReceiverSenderFlowRate called with params:', {
...params,
subgraphUrl
});
const { networkId: _, ...whereParams } = params;
const response = await axios.post(subgraphUrl, {
query: getFlowsQuery,
variables: {
where: whereParams,
🧰 Tools
🪛 GitHub Check: test

[failure] 242-242:
'networkId' is assigned a value but never used

🪛 eslint

[error] 242-242: 'networkId' is assigned a value but never used.

(@typescript-eslint/no-unused-vars)

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: 0

♻️ Duplicate comments (1)
src/adapters/superFluid/superFluidAdapter.ts (1)

9-14: ⚠️ Potential issue

Fix misleading constant names

The constant names suggest Polygon network but they're actually for Optimism network. This could lead to confusion and maintenance issues.

Apply this diff to fix the naming:

-const superFluidGraphqlPolygonUrl =
+const superFluidGraphqlOptimismUrl =
   'https://subgraph-endpoints.superfluid.dev/optimism-mainnet/protocol-v1';
-const superFluidGraphqlPolygonStagingUrl =
+const superFluidGraphqlOptimismSepoliaUrl =
   'https://optimism-sepolia.subgraph.x.superfluid.dev';
🧹 Nitpick comments (3)
src/adapters/superFluid/superFluidAdapter.ts (3)

186-188: Enhance error logging

Consider including networkId in error logs and properly typing the error for better debugging.

Apply this diff:

   async accountBalance(accountId: string, networkId: number) {
     try {
       const subgraphUrl = getSubgraphUrl(networkId);
       const response = await axios.post(subgraphUrl, {
         query: accountQuery,
         variables: {
           id: accountId?.toLowerCase(),
         },
       });
 
       return response.data.data.account?.accountTokenSnapshots;
     } catch (e) {
-      logger.error('superFluidAdaptor.accountBalance error', e);
+      logger.error('superFluidAdaptor.accountBalance error', {
+        error: e instanceof Error ? e.message : String(e),
+        accountId,
+        networkId,
+      });
     }
   }

211-216: Simplify parameter handling and improve error logging

The parameter handling can be simplified using destructuring, and error logging can be enhanced.

Apply this diff:

-      const whereParams = {
-        receiver: params.receiver,
-        sender: params.sender,
-        flowRate: params.flowRate,
-        transactionHash: params.transactionHash,
-      };
+      const { networkId, ...whereParams } = params;

Also enhance error logging:

     } catch (e) {
-      logger.error('getFlowByReceiverSenderFlowRate error', e);
+      logger.error('getFlowByTxHash error', {
+        error: e instanceof Error ? e.message : String(e),
+        params,
+      });
       throw e;
     }

247-252: Enhance parameter handling and logging

Similar to getFlowByTxHash, parameter handling can be simplified and logging can be improved.

Apply this diff:

-      logger.debug('getFlowByReceiverSenderFlowRate has been called', params);
+      logger.debug('getFlowByReceiverSenderFlowRate called', {
+        params,
+        subgraphUrl,
+      });

-      const whereParams = {
-        receiver: params.receiver,
-        sender: params.sender,
-        flowRate: params.flowRate,
-        timestamp_gt: params.timestamp_gt,
-      };
+      const { networkId, ...whereParams } = params;

Also enhance error logging:

     } catch (e) {
-      logger.error('getFlowByReceiverSenderFlowRate error', e);
+      logger.error('getFlowByReceiverSenderFlowRate error', {
+        error: e instanceof Error ? e.message : String(e),
+        params,
+      });
       throw e;
     }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8935b46 and 0b71248.

📒 Files selected for processing (1)
  • src/adapters/superFluid/superFluidAdapter.ts (4 hunks)
🔇 Additional comments (2)
src/adapters/superFluid/superFluidAdapter.ts (2)

23-30: LGTM! Well-implemented helper function

The function properly handles network ID validation with clear error messaging.


16-21: Verify network ID handling across the codebase

Given the comment "it fails somewhere", let's verify that all calls to these methods provide the correct network ID.

Run this script to check network ID usage:

✅ Verification successful

Let me gather more information about the network ID usage in these specific files and the parameters being passed.


Network ID handling is properly implemented and consistent

Based on the verification results, all SuperFluid adapter methods correctly handle network IDs:

  1. The interface (superFluidAdapterInterface.ts) properly defines networkId as a required parameter for all methods
  2. The implementation (superFluidAdapter.ts) correctly uses networkId to get the appropriate subgraph URL
  3. All service calls properly pass the networkId:
    • checkUserSuperTokenBalancesQueue.ts passes recurringDonation.networkId
    • draftRecurringDonationService.ts includes networkId in getFlowParams
    • recurringDonationService.ts passes networkId in all adapter calls

The "it fails somewhere" comment appears unrelated to network ID handling as the implementation is consistent and complete across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if networkId is consistently passed to SuperFluid adapter methods

# Find all instances where SuperFluid adapter methods are called
echo "Checking SuperFluid adapter method calls..."
rg -A 2 "superFluidAdapter\.(accountBalance|getFlowByTxHash|getFlowByReceiverSenderFlowRate)" 

# Find potential places where networkId might be undefined
echo "Checking for potential undefined networkId..."
ast-grep --pattern 'superFluidAdapter.$_($$$ networkId: $_? $$$)'

Length of output: 1285


Script:

#!/bin/bash
# Check the implementation of these methods and their parameters
echo "Checking superFluidAdapter implementation and parameters..."
rg -A 10 "getFlowByTxHash|accountBalance|getFlowByReceiverSenderFlowRate" src/adapters/superFluid/

# Check the context of the calls to verify networkId passing
echo "Checking context of superFluidAdapter calls..."
rg -B 5 -A 5 "superFluidAdapter\." src/services/recurringDonationService.ts src/services/cronJobs/checkUserSuperTokenBalancesQueue.ts src/services/chains/evm/draftRecurringDonationService.ts

# Check the getFlowParams construction
echo "Checking getFlowParams construction..."
rg "getFlowParams" src/services/chains/evm/draftRecurringDonationService.ts -B 5 -A 2

Length of output: 13206

@CarlosQ96 CarlosQ96 merged commit ff91c4d into staging Dec 26, 2024
5 checks passed
@CarlosQ96 CarlosQ96 deleted the hotfix_add_network_logic_to_superfluid branch December 26, 2024 17:46
CarlosQ96 added a commit that referenced this pull request Dec 26, 2024
* add networkId logic to superfluid subgraphs

* remove networkId from api call to superfluid

* fix eslint
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