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

feat(bens): add zns-ink #1222

Merged
merged 3 commits into from
Jan 31, 2025
Merged

feat(bens): add zns-ink #1222

merged 3 commits into from
Jan 31, 2025

Conversation

sevenzing
Copy link
Contributor

@sevenzing sevenzing commented Jan 30, 2025

Summary by CodeRabbit

  • New Features

    • Added support for ZNS (ZNS Connect Domains) protocol.
    • Integrated new network configuration for ZNS with ID 57073.
    • Configured subgraph for ZNS ink-mainnet network.
  • Configuration Updates

    • Updated production configuration to include ZNS protocol.
    • Added network and subgraph details for ZNS ink-mainnet.
  • Enhancements

    • Improved address resolution process with new techniques.
    • Simplified access to protocol information in the resolution logic.
    • Enhanced D3 connection resolution by incorporating address resolution techniques.

Copy link
Contributor

coderabbitai bot commented Jan 30, 2025

Walkthrough

The pull request introduces configuration updates for the ZNS (Zns) protocol across multiple files in the blockscout-ens project. Specifically, the changes involve adding support for the "zns-ink" protocol with network ID 57073. The modifications span three configuration files: prod.json, config.json, and networks.json. These updates include defining the protocol's metadata, subgraph configuration, and registry details for the ink-mainnet network. Additionally, the resolution functions in the codebase have been updated to incorporate a new parameter, address_resolve_technique, enhancing how domain names are resolved based on specified techniques. The changes enable the integration of the ZNS Connect Domains naming system, providing a structured approach to recognize and handle this new protocol within the existing infrastructure.

Possibly related PRs

  • bens(config): add ape chain to configs #1188: The changes in prod.json for the addition of the "d3-connect-ape" protocol are related to the main PR's addition of the "zns-ink" protocol, as both involve updating the configuration for new protocols within the same project.
  • feat(bens): add indexing reverse records to d3-connect  #1220: The modifications to prod.json regarding the "d3-connect-shib" protocol and its address resolution technique are relevant to the main PR's updates to the "zns-ink" protocol, as both PRs involve changes to protocol configurations and address resolution techniques.

Poem

🐰 A Rabbit's Ode to ZNS Domains

In configs deep, a new path unfurls,
ZNS ink protocol gently swirls.
Network 57073 now takes flight,
With domains dancing in blockchain's light 🌐
A protocol born, configuration neat! 🚀


📜 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 d6f44b1 and 1fa294d.

📒 Files selected for processing (1)
  • blockscout-ens/bens-server/config/prod.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Unit, doc and integration tests
🔇 Additional comments (3)
blockscout-ens/bens-server/config/prod.json (3)

170-170: LGTM! Protocol configuration for network 57073.

The addition of "zns-ink" protocol alongside "ens" for network 57073 follows the established pattern of multi-protocol support seen in other networks.


395-398: LGTM! Description update for ZNS protocols.

The description has been updated to maintain consistency across all ZNS protocols.


400-414: Verify ZNS contracts on ink-mainnet network.

The protocol configuration looks good and follows the established pattern of other ZNS protocols. However, we should verify the contract addresses on the ink-mainnet network.

✅ Verification successful

ZNS contract successfully verified on ink-mainnet

The ZNSRegistry contract (0xFb2Cd41a8aeC89EFBb19575C6c48d872cE97A0A5) is properly deployed, verified, and actively used on ink-mainnet with over 32k holders. The configuration in prod.json correctly references this contract.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify ZNS contract addresses on ink-mainnet network

# Search for contract addresses in the repository
echo "Searching for ZNS contract addresses in the codebase..."
rg -A 5 "ZNSRegistry|ZNSResolver" --type yaml --type json

# Search for contract deployment transactions
echo "Searching for contract deployment transactions..."
curl -s "https://explorer.inkonchain.com/api/v2/smart-contracts?filter=created" | jq '.items[] | select(.name | contains("ZNS"))'

Length of output: 5949


Script:

#!/bin/bash
# Try alternative API endpoint to verify the contract
echo "Attempting to verify contract existence..."
curl -s "https://explorer.inkonchain.com/api/v2/addresses/0xFb2Cd41a8aeC89EFBb19575C6c48d872cE97A0A5"

# Search for any additional contract references
echo -e "\nSearching for additional contract references..."
rg -i "0xFb2Cd41a8aeC89EFBb19575C6c48d872cE97A0A5" --type json --type yaml

Length of output: 1478


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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bc6a29f and ff3c8f7.

📒 Files selected for processing (3)
  • blockscout-ens/bens-server/config/prod.json (2 hunks)
  • blockscout-ens/graph-node/deployer/config.json (1 hunks)
  • blockscout-ens/graph-node/subgraphs/zns-subgraph/networks.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Unit, doc and integration tests
🔇 Additional comments (3)
blockscout-ens/graph-node/subgraphs/zns-subgraph/networks.json (1)

14-18: Verify the registry contract address and start block.

The registry configuration looks structurally correct. However, please ensure:

  1. The registry contract address is the official deployed address
  2. The start block (334900) captures all historical events
blockscout-ens/graph-node/deployer/config.json (1)

78-81: LGTM!

The configuration correctly reuses the ZNS subgraph and properly references the ink-mainnet network.

blockscout-ens/bens-server/config/prod.json (1)

170-170: LGTM!

The network configuration correctly includes both ENS and ZNS-ink protocols.

blockscout-ens/bens-server/config/prod.json Outdated Show resolved Hide resolved
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

🧹 Nitpick comments (1)
blockscout-ens/bens-logic/src/subgraph/offchain/d3/offchain.rs (1)

92-109: Consider adding error handling for reverse resolution.

The reverse resolution logic is well-structured, but it might benefit from additional error handling. Currently, if reverse resolution fails, the error is propagated up the call stack, which might be too aggressive.

Consider wrapping the reverse resolution in a match or map_err to handle specific error cases:

         AddressResolveTechnique::Addr2Name => {
-            let reverse_resolve_result =
-                alloy_ccip_read::d3::reverse_resolve_d3_name(reader, addr, resolver_address, "")
-                    .await?;
+            match alloy_ccip_read::d3::reverse_resolve_d3_name(reader, addr, resolver_address, "")
+                .await
+            {
+                Ok(reverse_resolve_result) => DomainName::new(
+                    &reverse_resolve_result.name.value,
+                    name.deployed_protocol
+                        .protocol
+                        .info
+                        .protocol_specific
+                        .empty_label_hash(),
+                )
+                .map(|name| name.name)
+                .ok(),
+                Err(err) => {
+                    tracing::warn!(
+                        error = err.to_string(),
+                        "failed to reverse resolve d3 name"
+                    );
+                    None
+                }
+            }
-            DomainName::new(
-                &reverse_resolve_result.name.value,
-                name.deployed_protocol
-                    .protocol
-                    .info
-                    .protocol_specific
-                    .empty_label_hash(),
-            )
-            .map(|name| name.name)
-            .ok()
         }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ff3c8f7 and d6f44b1.

📒 Files selected for processing (2)
  • blockscout-ens/bens-logic/src/subgraph/offchain/d3/offchain.rs (5 hunks)
  • blockscout-ens/bens-logic/src/subgraph/offchain/resolve.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Linting
  • GitHub Check: Unit, doc and integration tests
🔇 Additional comments (3)
blockscout-ens/bens-logic/src/subgraph/offchain/resolve.rs (1)

66-71: LGTM! Code readability improved.

The introduction of the info variable and passing address_resolve_technique to d3::maybe_offchain_resolution improves code readability and maintainability. The changes align well with the broader context of adding support for the "zns-ink" protocol.

blockscout-ens/bens-logic/src/subgraph/offchain/d3/offchain.rs (2)

23-23: LGTM! Function signatures consistently updated.

The new parameter address_resolve_technique is consistently added across all related functions with the correct type specification.

Also applies to: 46-46, 86-86


67-74: LGTM! Clean and readable function call.

The function call is well-formatted with one argument per line, improving readability.

@sevenzing sevenzing merged commit 67dadd9 into main Jan 31, 2025
6 checks passed
@sevenzing sevenzing deleted the ll/zns-ink branch January 31, 2025 09:04
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