Skip to content

Conversation

@leoslr
Copy link
Contributor

@leoslr leoslr commented Jan 23, 2025

Fixes #100

Description

Deployment of the payment subgraph for Sonic chain.
Also updates the payment subgraph on Sepolia to index events from ERC20TransferrableReceivable

Summary by CodeRabbit

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for the Sonic network
    • Introduced new contract configurations for various Ethereum proxies and fee proxies
    • Added a new entry "sonic" to the list of supported networks
  • Dependency Updates

    • Upgraded @requestnetwork/smart-contracts to version 0.45.1-next.0
  • Chores

    • Renamed internal variable singleRequestProxyFactoryArtifact to singleRequestForwarderFactoryArtifact
    • Updated deployment workflow to include the Sonic chain

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2025

Walkthrough

This pull request introduces several updates across multiple configuration files to support a new network called "Sonic". The changes include updating the networks list, modifying the manifest file with a renamed artifact, upgrading a smart contracts dependency, and adding a new subgraph configuration for the Sonic network. Additionally, a new Sepolia subgraph configuration is introduced with an ERC20 Transferrable Receivable contract. The modifications appear to be part of an infrastructure expansion to support new blockchain networks and contract interactions.

Changes

File Change Summary
cli/lib/manifest.ts Renamed singleRequestProxyFactoryArtifact to singleRequestForwarderFactoryArtifact
cli/networks.json Added "sonic" to the list of networks
package.json Updated @requestnetwork/smart-contracts from 0.38.1-next.2087 to 0.45.1-next.0
subgraph.sepolia.yaml Added new ERC20TransferrableReceivable_0_2_0 contract configuration
subgraph.sonic.yaml Created new subgraph configuration with multiple Ethereum data sources

Sequence Diagram

sequenceDiagram
    participant CLI as CLI
    participant Networks as Networks Config
    participant Subgraph as Subgraph Configuration
    participant Contracts as Smart Contracts

    CLI->>Networks: Add "sonic" network
    Networks-->>CLI: Network list updated
    
    CLI->>Contracts: Upgrade smart contracts dependency
    Contracts-->>CLI: Dependency updated

    CLI->>Subgraph: Configure Sonic network data sources
    Subgraph-->>CLI: Subgraph configuration complete

    Note over CLI, Subgraph: New network and contracts integrated
Loading

Assessment against linked issues

Objective Addressed Explanation
Add TransferableReceivable to Sepolia (100)
Detect TransferableReceivable payments on Sepolia (100)
Support for querying balances of TransferableReceivable requests (100) The implementation does not indicate that the querying mechanism for balances has been addressed.
Resolve "unsupported network" error for Sepolia (100)

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c01556c and 7c58f8b.

📒 Files selected for processing (1)
  • .github/workflows/deploy.yaml (1 hunks)
🔇 Additional comments (1)
.github/workflows/deploy.yaml (1)

30-30: LGTM! Verify the deployment configuration for Sonic chain.

The addition of "sonic" to the matrix follows the established pattern and maintains consistency with other chain deployments.

Let's verify the deployment configuration:

✅ Verification successful

✓ Sonic chain deployment configuration is properly set up

The configuration follows the established pattern used for other chains with all required components in place:

  • Listed in networks.json alongside other supported chains
  • Complete subgraph manifest with proper contract configurations
  • All necessary proxy contracts and event handlers defined
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Sonic chain configuration

# Check if the subgraph manifest exists for Sonic
if [ -f "subgraph.sonic.yaml" ]; then
    echo "✓ Found subgraph.sonic.yaml"
else
    echo "✗ Missing subgraph.sonic.yaml"
    exit 1
fi

# Check if Sonic is defined in networks configuration
if [ -f "cli/networks.json" ]; then
    echo "Networks configuration for Sonic:"
    cat cli/networks.json | jq '.sonic'
else
    echo "✗ Missing cli/networks.json"
    exit 1
fi

# Check for any Sonic-specific environment variables in GitHub Actions
gh api repos/RequestNetwork/payments-subgraph/environments/sonic/variables 2>/dev/null || echo "No custom variables set for Sonic environment"

Length of output: 619


Script:

#!/bin/bash
# Examine network configuration and subgraph manifest

echo "=== Networks Configuration Structure ==="
cat cli/networks.json | jq '.'

echo -e "\n=== Sonic Subgraph Manifest ==="
cat subgraph.sonic.yaml

echo -e "\n=== List All Subgraph Manifests ==="
fd "subgraph\..*\.yaml$"

Length of output: 5382


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

@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

🧹 Nitpick comments (2)
cli/networks.json (1)

21-22: Maintain alphabetical ordering of networks.

The "sonic" network should be inserted in alphabetical order to maintain consistency with the rest of the list.

   "sepolia",
   "tombchain",
   "xdai",
-  "zksyncera",
-  "sonic"
+  "sonic",
+  "zksyncera"
subgraph.sonic.yaml (1)

134-135: Fix YAML formatting issues.

There are two formatting issues at the end of the file:

  • Missing newline at end of file
  • Trailing whitespace on line 135
-  
+
🧰 Tools
🪛 yamllint (1.35.1)

[error] 135-135: no new line character at the end of file

(new-line-at-end-of-file)


[error] 135-135: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 541f68f and c01556c.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • cli/lib/manifest.ts (2 hunks)
  • cli/networks.json (1 hunks)
  • package.json (1 hunks)
  • subgraph.sepolia.yaml (1 hunks)
  • subgraph.sonic.yaml (1 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
subgraph.sonic.yaml

[error] 135-135: no new line character at the end of file

(new-line-at-end-of-file)


[error] 135-135: trailing spaces

(trailing-spaces)

🔇 Additional comments (7)
cli/lib/manifest.ts (1)

14-14: Verify the impact of artifact renaming.

The renaming from singleRequestProxyFactoryArtifact to singleRequestForwarderFactoryArtifact appears to be related to the smart contracts upgrade. Let's verify this change doesn't break existing deployments.

Also applies to: 28-28

✅ Verification successful

Artifact renaming is properly implemented and safe

The change is well-contained within manifest.ts and maintains backward compatibility by keeping the original SingleRequestProxyFactory key in the paymentNetworks object. No other references to either the old or new artifact names were found in deployment scripts or elsewhere in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the old artifact name is still used elsewhere in the codebase
# and verify the new artifact exists in the upgraded package

# Search for old artifact name
echo "Searching for old artifact name usage..."
rg "singleRequestProxyFactoryArtifact" -l

# Verify new artifact exists in node_modules
echo "Verifying new artifact in @requestnetwork/smart-contracts..."
find node_modules/@requestnetwork/smart-contracts -type f -exec grep -l "singleRequestForwarderFactoryArtifact" {} \;

Length of output: 464


Script:

#!/bin/bash
# Search for new artifact name in source files
echo "Searching for new artifact name usage..."
rg "singleRequestForwarderFactoryArtifact" -A 2 -B 2

# Look for deployment related files
echo -e "\nChecking deployment related files..."
fd -e ts -e js -e json "deploy|migration|config" --type f

Length of output: 968


Script:

#!/bin/bash
# Check deployment files for artifact references
echo "Checking deployment files for artifact references..."
rg -A 2 -B 2 "SingleRequestProxyFactory|singleRequestProxyFactoryArtifact|singleRequestForwarderFactoryArtifact" cli/commands/deploy.ts cli/lib/deploy.ts

Length of output: 270

package.json (1)

25-25: Review implications of major smart contracts upgrade.

The upgrade from 0.38.1-next.2087 to 0.45.1-next.0 is significant:

  • Major version bump (0.38 → 0.45) might include breaking changes
  • Switching from a later pre-release (-next.2087) to an earlier one (-next.0) could potentially reintroduce fixed issues
subgraph.sonic.yaml (2)

11-11: Verify start blocks for contract indexing.

Each contract has a specific start block configured. Please confirm these are the correct deployment blocks:

  • ERC20Proxy: 3974125
  • ERC20FeeProxy: 3974138
  • ERC20ConversionProxy: 3974151
  • EthProxy: 3974083
  • EthFeeProxy: 3974098
  • EthConversionProxy: 3974113

Also applies to: 32-32, 53-53, 76-76, 97-97, 118-118


9-9: Verify contract addresses on Sonic chain.

Please verify that these contract addresses are the correct deployments on the Sonic chain:

  • ERC20Proxy: 0xC8D3FE2A27bB69a85F6973081FdC41103E107595
  • ERC20FeeProxy: 0x399F5EE127ce7432E4921a61b8CF52b0af52cbfE
  • ERC20ConversionProxy: 0xe43fd55Da253628Ed7Cad5ab198664F5B3659DA9
  • EthProxy: 0x171Ee0881407d4c0C11eA1a2FB7D5b4cdED71e6e
  • EthFeeProxy: 0x4989F941D62bEEb3548Bf55d0D5291Ec335429f0
  • EthConversionProxy: 0x3E3B04e1bF170522a5c5DDE628C4d365c0342239

Also applies to: 30-30, 51-51, 74-74, 95-95, 116-116

subgraph.sepolia.yaml (3)

167-187: Verify the existence of required files.

The new data source references two files that need to be present in the repository:

  • ./abis/ERC20TransferrableReceivable-0.2.0.json
  • ./src/erc20TransferrableReceivable.ts
✅ Verification successful

Required files are present and correctly referenced

Both the ABI file and the mapping file exist at the specified paths in the repository, confirming that the data source configuration is complete and properly structured.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the required files exist in the repository

echo "Checking for ABI file..."
if [ -f "./abis/ERC20TransferrableReceivable-0.2.0.json" ]; then
    echo "✓ ABI file exists"
else
    echo "✗ Missing ABI file: ./abis/ERC20TransferrableReceivable-0.2.0.json"
fi

echo "Checking for mapping file..."
if [ -f "./src/erc20TransferrableReceivable.ts" ]; then
    echo "✓ Mapping file exists"
else
    echo "✗ Missing mapping file: ./src/erc20TransferrableReceivable.ts"
fi

Length of output: 334


167-187: Clarify the relationship with Sonic chain deployment.

The PR objectives mention deploying the payment subgraph for the Sonic chain, but this file configures a data source for the Sepolia network. Please clarify if this is:

  1. An unrelated change that's part of the same PR
  2. A prerequisite for the Sonic chain deployment
  3. A template that will be used for the Sonic configuration
✅ Verification successful

Sepolia and Sonic are separate network deployments

The Sepolia configuration is not a direct prerequisite or template for Sonic. Both are independent network deployments following this repository's standard multi-chain deployment structure, where each network maintains its own configuration with network-specific contract addresses and start blocks.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Look for Sonic-related configurations

echo "Searching for Sonic-related files..."
fd -t f "sonic" -i

echo "Searching for Sonic mentions in yaml files..."
rg -i "sonic" -g "*.yaml"

Length of output: 482


Script:

#!/bin/bash
# Compare Sepolia and Sonic configurations
echo "=== Comparing Sepolia and Sonic configurations ==="
diff subgraph.sepolia.yaml subgraph.sonic.yaml

echo -e "\n=== Checking for documentation ==="
# Check README and other common doc files
fd -e md -e txt -X cat {}

Length of output: 12737


167-187: Verify contract deployment on Sepolia.

The configuration references a contract at 0xB5E53C3d145Cbaa61C7028736A1fF0bC6817A4c5 starting from block 6194071 on Sepolia.

Copy link
Member

@MantisClone MantisClone left a comment

Choose a reason for hiding this comment

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

Should we attempt to add sonic to the deploy.yml workflow in Github Actions?

@leoslr leoslr merged commit 3c2a16b into main Jan 23, 2025
1 check passed
@leoslr leoslr deleted the feat/sonic branch January 23, 2025 14:05
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.

Add TransferableReceivable on Sepolia

3 participants